File tree 6 files changed +20
-15
lines changed
6 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,6 @@ endomorphism = ["secp256k1-sys/endomorphism"]
26
26
lowmemory = [" secp256k1-sys/lowmemory" ]
27
27
global-context = [" std" , " rand-std" ]
28
28
29
- # Do not use this feature! HAZMAT. (meant for Fuzzing only. this is *BROKEN CRYPTOGRAPHY*)
30
- fuzztarget = [" secp256k1-sys/fuzztarget" ]
31
-
32
29
[dependencies ]
33
30
secp256k1-sys = { version = " 0.3.1" , default-features = false , path = " ./secp256k1-sys" }
34
31
bitcoin_hashes = { version = " 0.9" , optional = true }
Original file line number Diff line number Diff line change @@ -35,3 +35,12 @@ before_script:
35
35
cargo generate-lockfile --verbose && cargo update -p cc --precise "1.0.41" --verbose;
36
36
fi
37
37
` ` `
38
+
39
+ ## Fuzzing
40
+
41
+ If you want to fuzz this library, or any library which depends on it, you will
42
+ probably want to disable the actual cryptography, since fuzzers are unable to
43
+ forge signatures and therefore won't test many interesting codepaths. To instead
44
+ use a trivially-broken but fuzzer-accessible signature scheme, compile with
45
+ ` --cfg=rust_secp_fuzz` in your `RUSTFLAGS` variable.
46
+
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ if [ "$DO_FEATURE_MATRIX" = true ]; then
31
31
done
32
32
33
33
# Other combos
34
- cargo test --no-run --verbose --features= " fuzztarget "
35
- cargo test --no-run --verbose --features=" fuzztarget recovery"
34
+ RUSTFLAGS= ' --cfg=rust_secp_fuzz ' cargo test --no-run --verbose
35
+ RUSTFLAGS= ' --cfg=rust_secp_fuzz ' cargo test --no-run --verbose --features=" recovery"
36
36
cargo test --verbose --features=" rand rand-std"
37
37
cargo test --verbose --features=" rand serde"
38
38
Original file line number Diff line number Diff line change @@ -31,5 +31,3 @@ endomorphism = []
31
31
lowmemory = []
32
32
std = []
33
33
34
- # Do not use this feature! HAZMAT. (meant for Fuzzing only. this is *BROKEN CRYPTOGRAPHY*)
35
- fuzztarget = []
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ pub type SchnorrNonceFn = unsafe extern "C" fn(
93
93
#[ derive( Clone , Debug ) ]
94
94
#[ repr( C ) ] pub struct Context ( c_int ) ;
95
95
96
- #[ cfg( feature = "fuzztarget" ) ]
96
+ #[ cfg( rust_secp_fuzz ) ]
97
97
impl Context {
98
98
pub fn flags ( & self ) -> u32 {
99
99
self . 0 as u32
@@ -260,7 +260,7 @@ impl hash::Hash for KeyPair {
260
260
}
261
261
}
262
262
263
- #[ cfg( not( feature = "fuzztarget" ) ) ]
263
+ #[ cfg( not( rust_secp_fuzz ) ) ]
264
264
extern "C" {
265
265
/// Default ECDH hash function
266
266
#[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_3_1_ecdh_hash_function_default" ) ]
@@ -674,7 +674,7 @@ impl<T> CPtr for [T] {
674
674
675
675
676
676
677
- #[ cfg( feature = "fuzztarget" ) ]
677
+ #[ cfg( rust_secp_fuzz ) ]
678
678
mod fuzz_dummy {
679
679
extern crate std;
680
680
use self :: std:: { ptr, mem} ;
@@ -1156,7 +1156,8 @@ mod fuzz_dummy {
1156
1156
unimplemented ! ( ) ;
1157
1157
}
1158
1158
}
1159
- #[ cfg( feature = "fuzztarget" ) ]
1159
+
1160
+ #[ cfg( rust_secp_fuzz) ]
1160
1161
pub use self :: fuzz_dummy:: * ;
1161
1162
1162
1163
Original file line number Diff line number Diff line change 16
16
//! # FFI of the recovery module
17
17
18
18
use :: types:: * ;
19
- #[ cfg( not( feature = "fuzztarget" ) ) ]
19
+ #[ cfg( not( rust_secp_fuzz ) ) ]
20
20
use :: { Context , Signature , NonceFn , PublicKey } ;
21
21
22
22
/// Library-internal representation of a Secp256k1 signature + recovery ID
@@ -36,7 +36,7 @@ impl Default for RecoverableSignature {
36
36
}
37
37
}
38
38
39
- #[ cfg( not( feature = "fuzztarget" ) ) ]
39
+ #[ cfg( not( rust_secp_fuzz ) ) ]
40
40
extern "C" {
41
41
#[ cfg_attr( not( rust_secp_no_symbol_renaming) , link_name = "rustsecp256k1_v0_3_1_ecdsa_recoverable_signature_parse_compact" ) ]
42
42
pub fn secp256k1_ecdsa_recoverable_signature_parse_compact ( cx : * const Context , sig : * mut RecoverableSignature ,
@@ -70,7 +70,7 @@ extern "C" {
70
70
}
71
71
72
72
73
- #[ cfg( feature = "fuzztarget" ) ]
73
+ #[ cfg( rust_secp_fuzz ) ]
74
74
mod fuzz_dummy {
75
75
extern crate std;
76
76
use self :: std:: ptr;
@@ -126,6 +126,6 @@ mod fuzz_dummy {
126
126
unimplemented ! ( ) ;
127
127
}
128
128
}
129
- #[ cfg( feature = "fuzztarget" ) ]
129
+ #[ cfg( rust_secp_fuzz ) ]
130
130
pub use self :: fuzz_dummy:: * ;
131
131
You can’t perform that action at this time.
0 commit comments