File tree 4 files changed +13
-5
lines changed
4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -28,12 +28,16 @@ path = "src/lib.rs"
28
28
[features ]
29
29
unstable = []
30
30
default = [" std" ]
31
- fuzztarget = []
32
31
std = [" rand/std" ]
33
32
recovery = []
34
33
endomorphism = []
35
34
lowmemory = []
36
35
36
+ # Do not use this feature! HAZMAT. (meant for Bitcoin Core only)
37
+ dont_replace_c_symbols = []
38
+ # Do not use this feature! HAZMAT. (meant for Fuzzing only. this is *BROKEN CRYPTOGRAPHY*)
39
+ fuzztarget = []
40
+
37
41
[dev-dependencies ]
38
42
rand = " 0.6"
39
43
rand_core = " 0.4"
Original file line number Diff line number Diff line change @@ -51,14 +51,15 @@ fn main() {
51
51
. define ( "USE_NUM_NONE" , Some ( "1" ) )
52
52
. define ( "USE_FIELD_INV_BUILTIN" , Some ( "1" ) )
53
53
. define ( "USE_SCALAR_INV_BUILTIN" , Some ( "1" ) )
54
- . define ( "ENABLE_MODULE_ECDH" , Some ( "1" ) )
55
- . define ( "USE_EXTERNAL_DEFAULT_CALLBACKS" , Some ( "1" ) ) ;
54
+ . define ( "ENABLE_MODULE_ECDH" , Some ( "1" ) ) ;
56
55
57
56
if cfg ! ( feature = "lowmemory" ) {
58
57
base_config. define ( "ECMULT_WINDOW_SIZE" , Some ( "4" ) ) ; // A low-enough value to consume neglible memory
59
58
} else {
60
59
base_config. define ( "ECMULT_WINDOW_SIZE" , Some ( "15" ) ) ; // This is the default in the configure file (`auto`)
61
60
}
61
+ #[ cfg( not( feature = "dont_replace_c_symbols" ) ) ]
62
+ base_config. define ( "USE_EXTERNAL_DEFAULT_CALLBACKS" , Some ( "1" ) ) ;
62
63
#[ cfg( feature = "endomorphism" ) ]
63
64
base_config. define ( "USE_ENDOMORPHISM" , Some ( "1" ) ) ;
64
65
#[ cfg( feature = "recovery" ) ]
Original file line number Diff line number Diff line change @@ -256,7 +256,7 @@ extern "C" {
256
256
}
257
257
258
258
259
- #[ cfg( feature = "std" ) ]
259
+ #[ cfg( all ( feature = "std" , not ( feature = "dont_replace_c_symbols" ) ) ) ]
260
260
#[ no_mangle]
261
261
/// A reimplementation of the C function `secp256k1_context_create` in rust.
262
262
///
@@ -281,7 +281,7 @@ pub unsafe extern "C" fn secp256k1_context_create(flags: c_uint) -> *mut Context
281
281
secp256k1_context_preallocated_create ( ptr as * mut c_void , flags)
282
282
}
283
283
284
- #[ cfg( feature = "std" ) ]
284
+ #[ cfg( all ( feature = "std" , not ( feature = "dont_replace_c_symbols" ) ) ) ]
285
285
#[ no_mangle]
286
286
/// A reimplementation of the C function `secp256k1_context_destroy` in rust.
287
287
///
@@ -300,6 +300,7 @@ pub unsafe extern "C" fn secp256k1_context_destroy(ctx: *mut Context) {
300
300
}
301
301
302
302
303
+ #[ cfg( not( feature = "dont_replace_c_symbols" ) ) ]
303
304
#[ no_mangle]
304
305
/// **This function is an override for the C function, this is the an edited version of the original description:**
305
306
///
@@ -326,6 +327,7 @@ pub unsafe extern "C" fn secp256k1_default_illegal_callback_fn(message: *const c
326
327
panic ! ( "[libsecp256k1] illegal argument. {}" , msg) ;
327
328
}
328
329
330
+ #[ cfg( not( feature = "dont_replace_c_symbols" ) ) ]
329
331
#[ no_mangle]
330
332
/// **This function is an override for the C function, this is the an edited version of the original description:**
331
333
///
Original file line number Diff line number Diff line change @@ -723,6 +723,7 @@ mod tests {
723
723
724
724
725
725
#[ test]
726
+ #[ cfg( not( feature = "dont_replace_c_symbols" ) ) ]
726
727
fn test_manual_create_destroy ( ) {
727
728
let ctx_full = unsafe { ffi:: secp256k1_context_create ( AllPreallocated :: FLAGS ) } ;
728
729
let ctx_sign = unsafe { ffi:: secp256k1_context_create ( SignOnlyPreallocated :: FLAGS ) } ;
You can’t perform that action at this time.
0 commit comments