@@ -157,91 +157,91 @@ impl Default for SharedSecret {
157
157
#[ cfg( not( feature = "fuzztarget" ) ) ]
158
158
extern "C" {
159
159
/// Default ECDH hash function
160
- #[ link_name = "rustsecp256k1_v0_1_0_ecdh_hash_function_default" ]
160
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdh_hash_function_default" ) ]
161
161
pub static secp256k1_ecdh_hash_function_default: EcdhHashFn ;
162
162
163
- #[ link_name = "rustsecp256k1_v0_1_0_nonce_function_rfc6979" ]
163
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_nonce_function_rfc6979" ) ]
164
164
pub static secp256k1_nonce_function_rfc6979: NonceFn ;
165
165
166
- #[ link_name = "rustsecp256k1_v0_1_0_nonce_function_default" ]
166
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_nonce_function_default" ) ]
167
167
pub static secp256k1_nonce_function_default: NonceFn ;
168
168
169
- #[ link_name = "rustsecp256k1_v0_1_0_context_no_precomp" ]
169
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_context_no_precomp" ) ]
170
170
pub static secp256k1_context_no_precomp: * const Context ;
171
171
172
172
// Contexts
173
- #[ link_name = "rustsecp256k1_v0_1_0_context_preallocated_size" ]
173
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_context_preallocated_size" ) ]
174
174
pub fn secp256k1_context_preallocated_size ( flags : c_uint ) -> usize ;
175
175
176
- #[ link_name = "rustsecp256k1_v0_1_0_context_preallocated_create" ]
176
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_context_preallocated_create" ) ]
177
177
pub fn secp256k1_context_preallocated_create ( prealloc : * mut c_void , flags : c_uint ) -> * mut Context ;
178
178
179
- #[ link_name = "rustsecp256k1_v0_1_0_context_preallocated_destroy" ]
179
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_context_preallocated_destroy" ) ]
180
180
pub fn secp256k1_context_preallocated_destroy ( cx : * mut Context ) ;
181
181
182
- #[ link_name = "rustsecp256k1_v0_1_0_context_preallocated_clone_size" ]
182
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_context_preallocated_clone_size" ) ]
183
183
pub fn secp256k1_context_preallocated_clone_size ( cx : * const Context ) -> usize ;
184
184
185
- #[ link_name = "rustsecp256k1_v0_1_0_context_preallocated_clone" ]
185
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_context_preallocated_clone" ) ]
186
186
pub fn secp256k1_context_preallocated_clone ( cx : * const Context , prealloc : * mut c_void ) -> * mut Context ;
187
187
188
- #[ link_name = "rustsecp256k1_v0_1_0_context_randomize" ]
188
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_context_randomize" ) ]
189
189
pub fn secp256k1_context_randomize ( cx : * mut Context ,
190
190
seed32 : * const c_uchar )
191
191
-> c_int ;
192
192
193
193
// Pubkeys
194
- #[ link_name = "rustsecp256k1_v0_1_0_ec_pubkey_parse" ]
194
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ec_pubkey_parse" ) ]
195
195
pub fn secp256k1_ec_pubkey_parse ( cx : * const Context , pk : * mut PublicKey ,
196
196
input : * const c_uchar , in_len : usize )
197
197
-> c_int ;
198
198
199
- #[ link_name = "rustsecp256k1_v0_1_0_ec_pubkey_serialize" ]
199
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ec_pubkey_serialize" ) ]
200
200
pub fn secp256k1_ec_pubkey_serialize ( cx : * const Context , output : * mut c_uchar ,
201
201
out_len : * mut usize , pk : * const PublicKey ,
202
202
compressed : c_uint )
203
203
-> c_int ;
204
204
205
205
// Signatures
206
- #[ link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_der" ]
206
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_der" ) ]
207
207
pub fn secp256k1_ecdsa_signature_parse_der ( cx : * const Context , sig : * mut Signature ,
208
208
input : * const c_uchar , in_len : usize )
209
209
-> c_int ;
210
210
211
- #[ link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_compact" ]
211
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_compact" ) ]
212
212
pub fn secp256k1_ecdsa_signature_parse_compact ( cx : * const Context , sig : * mut Signature ,
213
213
input64 : * const c_uchar )
214
214
-> c_int ;
215
215
216
- #[ link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_der_lax" ]
216
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_parse_der_lax" ) ]
217
217
pub fn ecdsa_signature_parse_der_lax ( cx : * const Context , sig : * mut Signature ,
218
218
input : * const c_uchar , in_len : usize )
219
219
-> c_int ;
220
220
221
- #[ link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_serialize_der" ]
221
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_serialize_der" ) ]
222
222
pub fn secp256k1_ecdsa_signature_serialize_der ( cx : * const Context , output : * mut c_uchar ,
223
223
out_len : * mut usize , sig : * const Signature )
224
224
-> c_int ;
225
225
226
- #[ link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_serialize_compact" ]
226
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_serialize_compact" ) ]
227
227
pub fn secp256k1_ecdsa_signature_serialize_compact ( cx : * const Context , output64 : * mut c_uchar ,
228
228
sig : * const Signature )
229
229
-> c_int ;
230
230
231
- #[ link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_normalize" ]
231
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdsa_signature_normalize" ) ]
232
232
pub fn secp256k1_ecdsa_signature_normalize ( cx : * const Context , out_sig : * mut Signature ,
233
233
in_sig : * const Signature )
234
234
-> c_int ;
235
235
236
236
// ECDSA
237
- #[ link_name = "rustsecp256k1_v0_1_0_ecdsa_verify" ]
237
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdsa_verify" ) ]
238
238
pub fn secp256k1_ecdsa_verify ( cx : * const Context ,
239
239
sig : * const Signature ,
240
240
msg32 : * const c_uchar ,
241
241
pk : * const PublicKey )
242
242
-> c_int ;
243
243
244
- #[ link_name = "rustsecp256k1_v0_1_0_ecdsa_sign" ]
244
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdsa_sign" ) ]
245
245
pub fn secp256k1_ecdsa_sign ( cx : * const Context ,
246
246
sig : * mut Signature ,
247
247
msg32 : * const c_uchar ,
@@ -251,49 +251,49 @@ extern "C" {
251
251
-> c_int ;
252
252
253
253
// EC
254
- #[ link_name = "rustsecp256k1_v0_1_0_ec_seckey_verify" ]
254
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ec_seckey_verify" ) ]
255
255
pub fn secp256k1_ec_seckey_verify ( cx : * const Context ,
256
256
sk : * const c_uchar ) -> c_int ;
257
257
258
- #[ link_name = "rustsecp256k1_v0_1_0_ec_pubkey_create" ]
258
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ec_pubkey_create" ) ]
259
259
pub fn secp256k1_ec_pubkey_create ( cx : * const Context , pk : * mut PublicKey ,
260
260
sk : * const c_uchar ) -> c_int ;
261
261
262
262
//TODO secp256k1_ec_privkey_export
263
263
//TODO secp256k1_ec_privkey_import
264
264
265
- #[ link_name = "rustsecp256k1_v0_1_0_ec_privkey_tweak_add" ]
265
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ec_privkey_tweak_add" ) ]
266
266
pub fn secp256k1_ec_privkey_tweak_add ( cx : * const Context ,
267
267
sk : * mut c_uchar ,
268
268
tweak : * const c_uchar )
269
269
-> c_int ;
270
270
271
- #[ link_name = "rustsecp256k1_v0_1_0_ec_pubkey_tweak_add" ]
271
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ec_pubkey_tweak_add" ) ]
272
272
pub fn secp256k1_ec_pubkey_tweak_add ( cx : * const Context ,
273
273
pk : * mut PublicKey ,
274
274
tweak : * const c_uchar )
275
275
-> c_int ;
276
276
277
- #[ link_name = "rustsecp256k1_v0_1_0_ec_privkey_tweak_mul" ]
277
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ec_privkey_tweak_mul" ) ]
278
278
pub fn secp256k1_ec_privkey_tweak_mul ( cx : * const Context ,
279
279
sk : * mut c_uchar ,
280
280
tweak : * const c_uchar )
281
281
-> c_int ;
282
282
283
- #[ link_name = "rustsecp256k1_v0_1_0_ec_pubkey_tweak_mul" ]
283
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ec_pubkey_tweak_mul" ) ]
284
284
pub fn secp256k1_ec_pubkey_tweak_mul ( cx : * const Context ,
285
285
pk : * mut PublicKey ,
286
286
tweak : * const c_uchar )
287
287
-> c_int ;
288
288
289
- #[ link_name = "rustsecp256k1_v0_1_0_ec_pubkey_combine" ]
289
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ec_pubkey_combine" ) ]
290
290
pub fn secp256k1_ec_pubkey_combine ( cx : * const Context ,
291
291
out : * mut PublicKey ,
292
292
ins : * const * const PublicKey ,
293
293
n : c_int )
294
294
-> c_int ;
295
295
296
- #[ link_name = "rustsecp256k1_v0_1_0_ecdh" ]
296
+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdh" ) ]
297
297
pub fn secp256k1_ecdh (
298
298
cx : * const Context ,
299
299
output : * mut SharedSecret ,
@@ -305,8 +305,6 @@ extern "C" {
305
305
}
306
306
307
307
308
- #[ cfg( all( feature = "std" , not( feature = "dont_replace_c_symbols" ) ) ) ]
309
- #[ no_mangle]
310
308
/// A reimplementation of the C function `secp256k1_context_create` in rust.
311
309
///
312
310
/// This function allocates memory, the pointer should be deallocated using `secp256k1_context_destroy`
@@ -315,6 +313,8 @@ extern "C" {
315
313
/// This will create a secp256k1 raw context.
316
314
// Returns: a newly created context object.
317
315
// In: flags: which parts of the context to initialize.
316
+ #[ no_mangle]
317
+ #[ cfg( all( feature = "std" , not( feature = "external_symbols" ) ) ) ]
318
318
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_create ( flags : c_uint ) -> * mut Context {
319
319
use std:: mem;
320
320
assert ! ( mem:: align_of:: <usize >( ) >= mem:: align_of:: <u8 >( ) ) ;
@@ -331,19 +331,19 @@ pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_create(flags: c_uint) -> *
331
331
secp256k1_context_preallocated_create ( ptr as * mut c_void , flags)
332
332
}
333
333
334
- #[ cfg( all( feature = "std" , not( feature = "dont_replace_c_symbols " ) ) ) ]
334
+ #[ cfg( all( feature = "std" , not( feature = "external_symbols " ) ) ) ]
335
335
pub unsafe fn secp256k1_context_create ( flags : c_uint ) -> * mut Context {
336
336
rustsecp256k1_v0_1_0_context_create ( flags)
337
337
}
338
338
339
- #[ cfg( all( feature = "std" , not( feature = "dont_replace_c_symbols" ) ) ) ]
340
- #[ no_mangle]
341
339
/// A reimplementation of the C function `secp256k1_context_destroy` in rust.
342
340
///
343
341
/// This function destroys and deallcates the context created by `secp256k1_context_create`.
344
342
///
345
343
/// The pointer shouldn't be used after passing to this function, consider it as passing it to `free()`.
346
344
///
345
+ #[ no_mangle]
346
+ #[ cfg( all( feature = "std" , not( feature = "external_symbols" ) ) ) ]
347
347
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_destroy ( ctx : * mut Context ) {
348
348
secp256k1_context_preallocated_destroy ( ctx) ;
349
349
let ctx: * mut usize = ctx as * mut usize ;
@@ -354,14 +354,12 @@ pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_destroy(ctx: *mut Context)
354
354
let _ = Box :: from_raw ( slice as * mut [ usize ] ) ;
355
355
}
356
356
357
- #[ cfg( all( feature = "std" , not( feature = "dont_replace_c_symbols " ) ) ) ]
357
+ #[ cfg( all( feature = "std" , not( feature = "external_symbols " ) ) ) ]
358
358
pub unsafe fn secp256k1_context_destroy ( ctx : * mut Context ) {
359
359
rustsecp256k1_v0_1_0_context_destroy ( ctx)
360
360
}
361
361
362
362
363
- #[ cfg( not( feature = "dont_replace_c_symbols" ) ) ]
364
- #[ no_mangle]
365
363
/// **This function is an override for the C function, this is the an edited version of the original description:**
366
364
///
367
365
/// A callback function to be called when an illegal argument is passed to
@@ -380,15 +378,15 @@ pub unsafe fn secp256k1_context_destroy(ctx: *mut Context) {
380
378
///
381
379
/// See also secp256k1_default_error_callback_fn.
382
380
///
381
+ #[ no_mangle]
382
+ #[ cfg( not( feature = "external_symbols" ) ) ]
383
383
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_default_illegal_callback_fn ( message : * const c_char , _data : * mut c_void ) {
384
384
use core:: str;
385
385
let msg_slice = slice:: from_raw_parts ( message as * const u8 , strlen ( message) ) ;
386
386
let msg = str:: from_utf8_unchecked ( msg_slice) ;
387
387
panic ! ( "[libsecp256k1] illegal argument. {}" , msg) ;
388
388
}
389
389
390
- #[ cfg( not( feature = "dont_replace_c_symbols" ) ) ]
391
- #[ no_mangle]
392
390
/// **This function is an override for the C function, this is the an edited version of the original description:**
393
391
///
394
392
/// A callback function to be called when an internal consistency check
@@ -403,6 +401,8 @@ pub unsafe extern "C" fn rustsecp256k1_v0_1_0_default_illegal_callback_fn(messag
403
401
///
404
402
/// See also secp256k1_default_illegal_callback_fn.
405
403
///
404
+ #[ no_mangle]
405
+ #[ cfg( not( feature = "external_symbols" ) ) ]
406
406
pub unsafe extern "C" fn rustsecp256k1_v0_1_0_default_error_callback_fn ( message : * const c_char , _data : * mut c_void ) {
407
407
use core:: str;
408
408
let msg_slice = slice:: from_raw_parts ( message as * const u8 , strlen ( message) ) ;
0 commit comments