@@ -157,91 +157,91 @@ impl Default for SharedSecret {
157157#[ cfg( not( feature = "fuzztarget" ) ) ]
158158extern "C" {
159159 /// 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" ) ]
161161 pub static secp256k1_ecdh_hash_function_default: EcdhHashFn ;
162162
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" ) ]
164164 pub static secp256k1_nonce_function_rfc6979: NonceFn ;
165165
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" ) ]
167167 pub static secp256k1_nonce_function_default: NonceFn ;
168168
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" ) ]
170170 pub static secp256k1_context_no_precomp: * const Context ;
171171
172172 // 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" ) ]
174174 pub fn secp256k1_context_preallocated_size ( flags : c_uint ) -> usize ;
175175
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" ) ]
177177 pub fn secp256k1_context_preallocated_create ( prealloc : * mut c_void , flags : c_uint ) -> * mut Context ;
178178
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" ) ]
180180 pub fn secp256k1_context_preallocated_destroy ( cx : * mut Context ) ;
181181
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" ) ]
183183 pub fn secp256k1_context_preallocated_clone_size ( cx : * const Context ) -> usize ;
184184
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" ) ]
186186 pub fn secp256k1_context_preallocated_clone ( cx : * const Context , prealloc : * mut c_void ) -> * mut Context ;
187187
188- #[ link_name = "rustsecp256k1_v0_1_0_context_randomize" ]
188+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_context_randomize" ) ]
189189 pub fn secp256k1_context_randomize ( cx : * mut Context ,
190190 seed32 : * const c_uchar )
191191 -> c_int ;
192192
193193 // 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" ) ]
195195 pub fn secp256k1_ec_pubkey_parse ( cx : * const Context , pk : * mut PublicKey ,
196196 input : * const c_uchar , in_len : usize )
197197 -> c_int ;
198198
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" ) ]
200200 pub fn secp256k1_ec_pubkey_serialize ( cx : * const Context , output : * mut c_uchar ,
201201 out_len : * mut usize , pk : * const PublicKey ,
202202 compressed : c_uint )
203203 -> c_int ;
204204
205205 // 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" ) ]
207207 pub fn secp256k1_ecdsa_signature_parse_der ( cx : * const Context , sig : * mut Signature ,
208208 input : * const c_uchar , in_len : usize )
209209 -> c_int ;
210210
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" ) ]
212212 pub fn secp256k1_ecdsa_signature_parse_compact ( cx : * const Context , sig : * mut Signature ,
213213 input64 : * const c_uchar )
214214 -> c_int ;
215215
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" ) ]
217217 pub fn ecdsa_signature_parse_der_lax ( cx : * const Context , sig : * mut Signature ,
218218 input : * const c_uchar , in_len : usize )
219219 -> c_int ;
220220
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" ) ]
222222 pub fn secp256k1_ecdsa_signature_serialize_der ( cx : * const Context , output : * mut c_uchar ,
223223 out_len : * mut usize , sig : * const Signature )
224224 -> c_int ;
225225
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" ) ]
227227 pub fn secp256k1_ecdsa_signature_serialize_compact ( cx : * const Context , output64 : * mut c_uchar ,
228228 sig : * const Signature )
229229 -> c_int ;
230230
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" ) ]
232232 pub fn secp256k1_ecdsa_signature_normalize ( cx : * const Context , out_sig : * mut Signature ,
233233 in_sig : * const Signature )
234234 -> c_int ;
235235
236236 // 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" ) ]
238238 pub fn secp256k1_ecdsa_verify ( cx : * const Context ,
239239 sig : * const Signature ,
240240 msg32 : * const c_uchar ,
241241 pk : * const PublicKey )
242242 -> c_int ;
243243
244- #[ link_name = "rustsecp256k1_v0_1_0_ecdsa_sign" ]
244+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdsa_sign" ) ]
245245 pub fn secp256k1_ecdsa_sign ( cx : * const Context ,
246246 sig : * mut Signature ,
247247 msg32 : * const c_uchar ,
@@ -251,49 +251,49 @@ extern "C" {
251251 -> c_int ;
252252
253253 // 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" ) ]
255255 pub fn secp256k1_ec_seckey_verify ( cx : * const Context ,
256256 sk : * const c_uchar ) -> c_int ;
257257
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" ) ]
259259 pub fn secp256k1_ec_pubkey_create ( cx : * const Context , pk : * mut PublicKey ,
260260 sk : * const c_uchar ) -> c_int ;
261261
262262//TODO secp256k1_ec_privkey_export
263263//TODO secp256k1_ec_privkey_import
264264
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" ) ]
266266 pub fn secp256k1_ec_privkey_tweak_add ( cx : * const Context ,
267267 sk : * mut c_uchar ,
268268 tweak : * const c_uchar )
269269 -> c_int ;
270270
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" ) ]
272272 pub fn secp256k1_ec_pubkey_tweak_add ( cx : * const Context ,
273273 pk : * mut PublicKey ,
274274 tweak : * const c_uchar )
275275 -> c_int ;
276276
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" ) ]
278278 pub fn secp256k1_ec_privkey_tweak_mul ( cx : * const Context ,
279279 sk : * mut c_uchar ,
280280 tweak : * const c_uchar )
281281 -> c_int ;
282282
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" ) ]
284284 pub fn secp256k1_ec_pubkey_tweak_mul ( cx : * const Context ,
285285 pk : * mut PublicKey ,
286286 tweak : * const c_uchar )
287287 -> c_int ;
288288
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" ) ]
290290 pub fn secp256k1_ec_pubkey_combine ( cx : * const Context ,
291291 out : * mut PublicKey ,
292292 ins : * const * const PublicKey ,
293293 n : c_int )
294294 -> c_int ;
295295
296- #[ link_name = "rustsecp256k1_v0_1_0_ecdh" ]
296+ #[ cfg_attr ( not ( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_1_0_ecdh" ) ]
297297 pub fn secp256k1_ecdh (
298298 cx : * const Context ,
299299 output : * mut SharedSecret ,
@@ -305,8 +305,6 @@ extern "C" {
305305}
306306
307307
308- #[ cfg( all( feature = "std" , not( feature = "dont_replace_c_symbols" ) ) ) ]
309- #[ no_mangle]
310308/// A reimplementation of the C function `secp256k1_context_create` in rust.
311309///
312310/// This function allocates memory, the pointer should be deallocated using `secp256k1_context_destroy`
@@ -315,6 +313,8 @@ extern "C" {
315313/// This will create a secp256k1 raw context.
316314// Returns: a newly created context object.
317315// In: flags: which parts of the context to initialize.
316+ #[ no_mangle]
317+ #[ cfg( all( feature = "std" , not( feature = "external_symbols" ) ) ) ]
318318pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_create ( flags : c_uint ) -> * mut Context {
319319 use std:: mem;
320320 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) -> *
331331 secp256k1_context_preallocated_create ( ptr as * mut c_void , flags)
332332}
333333
334- #[ cfg( all( feature = "std" , not( feature = "dont_replace_c_symbols " ) ) ) ]
334+ #[ cfg( all( feature = "std" , not( feature = "external_symbols " ) ) ) ]
335335pub unsafe fn secp256k1_context_create ( flags : c_uint ) -> * mut Context {
336336 rustsecp256k1_v0_1_0_context_create ( flags)
337337}
338338
339- #[ cfg( all( feature = "std" , not( feature = "dont_replace_c_symbols" ) ) ) ]
340- #[ no_mangle]
341339/// A reimplementation of the C function `secp256k1_context_destroy` in rust.
342340///
343341/// This function destroys and deallcates the context created by `secp256k1_context_create`.
344342///
345343/// The pointer shouldn't be used after passing to this function, consider it as passing it to `free()`.
346344///
345+ #[ no_mangle]
346+ #[ cfg( all( feature = "std" , not( feature = "external_symbols" ) ) ) ]
347347pub unsafe extern "C" fn rustsecp256k1_v0_1_0_context_destroy ( ctx : * mut Context ) {
348348 secp256k1_context_preallocated_destroy ( ctx) ;
349349 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)
354354 let _ = Box :: from_raw ( slice as * mut [ usize ] ) ;
355355}
356356
357- #[ cfg( all( feature = "std" , not( feature = "dont_replace_c_symbols " ) ) ) ]
357+ #[ cfg( all( feature = "std" , not( feature = "external_symbols " ) ) ) ]
358358pub unsafe fn secp256k1_context_destroy ( ctx : * mut Context ) {
359359 rustsecp256k1_v0_1_0_context_destroy ( ctx)
360360}
361361
362362
363- #[ cfg( not( feature = "dont_replace_c_symbols" ) ) ]
364- #[ no_mangle]
365363/// **This function is an override for the C function, this is the an edited version of the original description:**
366364///
367365/// 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) {
380378///
381379/// See also secp256k1_default_error_callback_fn.
382380///
381+ #[ no_mangle]
382+ #[ cfg( not( feature = "external_symbols" ) ) ]
383383pub unsafe extern "C" fn rustsecp256k1_v0_1_0_default_illegal_callback_fn ( message : * const c_char , _data : * mut c_void ) {
384384 use core:: str;
385385 let msg_slice = slice:: from_raw_parts ( message as * const u8 , strlen ( message) ) ;
386386 let msg = str:: from_utf8_unchecked ( msg_slice) ;
387387 panic ! ( "[libsecp256k1] illegal argument. {}" , msg) ;
388388}
389389
390- #[ cfg( not( feature = "dont_replace_c_symbols" ) ) ]
391- #[ no_mangle]
392390/// **This function is an override for the C function, this is the an edited version of the original description:**
393391///
394392/// 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
403401///
404402/// See also secp256k1_default_illegal_callback_fn.
405403///
404+ #[ no_mangle]
405+ #[ cfg( not( feature = "external_symbols" ) ) ]
406406pub unsafe extern "C" fn rustsecp256k1_v0_1_0_default_error_callback_fn ( message : * const c_char , _data : * mut c_void ) {
407407 use core:: str;
408408 let msg_slice = slice:: from_raw_parts ( message as * const u8 , strlen ( message) ) ;
0 commit comments