@@ -736,6 +736,10 @@ impl<C: Signing> Secp256k1<C> {
736
736
}
737
737
738
738
entropy_p = extra_entropy. as_ptr ( ) as * const ffi:: types:: c_void ;
739
+
740
+ // When fuzzing, these checks will usually spinloop forever, so just short-circuit them.
741
+ #[ cfg( rust_secp_fuzz) ]
742
+ return Signature :: from ( ret) ;
739
743
}
740
744
}
741
745
}
@@ -1098,9 +1102,12 @@ mod tests {
1098
1102
if compact[ 0 ] < 0x80 {
1099
1103
assert_eq ! ( sig, low_r_sig) ;
1100
1104
} else {
1105
+ #[ cfg( not( rust_secp_fuzz) ) ] // mocked sig generation doesn't produce low-R sigs
1101
1106
assert_ne ! ( sig, low_r_sig) ;
1102
1107
}
1108
+ #[ cfg( not( rust_secp_fuzz) ) ] // mocked sig generation doesn't produce low-R sigs
1103
1109
assert ! ( super :: compact_sig_has_zero_first_bit( & low_r_sig. 0 ) ) ;
1110
+ #[ cfg( not( rust_secp_fuzz) ) ] // mocked sig generation doesn't produce low-R sigs
1104
1111
assert ! ( super :: der_length_check( & grind_r_sig. 0 , 70 ) ) ;
1105
1112
}
1106
1113
}
@@ -1195,6 +1202,7 @@ mod tests {
1195
1202
}
1196
1203
1197
1204
#[ test]
1205
+ #[ cfg( not( rust_secp_fuzz) ) ] // fuzz-sigs have fixed size/format
1198
1206
fn test_low_r ( ) {
1199
1207
let secp = Secp256k1 :: new ( ) ;
1200
1208
let msg = hex ! ( "887d04bb1cf1b1554f1b268dfe62d13064ca67ae45348d50d1392ce2d13418ac" ) ;
@@ -1209,6 +1217,7 @@ mod tests {
1209
1217
}
1210
1218
1211
1219
#[ test]
1220
+ #[ cfg( not( rust_secp_fuzz) ) ] // fuzz-sigs have fixed size/format
1212
1221
fn test_grind_r ( ) {
1213
1222
let secp = Secp256k1 :: new ( ) ;
1214
1223
let msg = hex ! ( "ef2d5b9a7c61865a95941d0f04285420560df7e9d76890ac1b8867b12ce43167" ) ;
0 commit comments