Skip to content

Commit

Permalink
Merge pull request #89 from TheBlueMatt/master
Browse files Browse the repository at this point in the history
Sync fuzztarget combine with tweak_add since real functions do that
  • Loading branch information
TheBlueMatt authored Jan 9, 2019
2 parents fba7dfb + a74cbb6 commit dee10b9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ mod fuzz_dummy {
-> c_int {
assert!(!cx.is_null() && (*cx).0 as u32 & !(SECP256K1_START_NONE | SECP256K1_START_VERIFY | SECP256K1_START_SIGN) == 0);
if secp256k1_ec_seckey_verify(cx, sk) != 1 { return 0; }
ptr::copy(tweak, sk.offset(16), 16);
ptr::copy(tweak.offset(16), sk.offset(16), 16);
*sk.offset(24) = 0x7f; // Ensure sk remains valid no matter what tweak was
1
}
Expand All @@ -584,8 +584,8 @@ mod fuzz_dummy {
-> c_int {
assert!(!cx.is_null() && (*cx).0 as u32 & !(SECP256K1_START_NONE | SECP256K1_START_VERIFY | SECP256K1_START_SIGN) == 0);
if test_pk_validate(cx, pk) != 1 { return 0; }
ptr::copy(tweak, (*pk).0[16..32].as_mut_ptr(), 16);
ptr::copy(tweak, (*pk).0[16+32..64].as_mut_ptr(), 16);
ptr::copy(tweak.offset(16), (*pk).0[16..32].as_mut_ptr(), 16);
ptr::copy(tweak.offset(16), (*pk).0[16+32..64].as_mut_ptr(), 16);
(*pk).0[24] = 0x7f; // Ensure pk remains valid no matter what tweak was
(*pk).0[24+32] = 0x7f; // Ensure pk remains valid no matter what tweak was
1
Expand Down Expand Up @@ -629,8 +629,8 @@ mod fuzz_dummy {
(*out).0[(i*32/n) as usize..((i+1)*32/n) as usize].copy_from_slice(&(**ins.offset(i as isize)).0[(i*32/n) as usize..((i+1)*32/n) as usize]);
}
ptr::copy((*out).0[0..32].as_ptr(), (*out).0[32..64].as_mut_ptr(), 32);
(*out).0[24] = 0x0d; // pk should always be valid
(*out).0[24+32] = 0x0d; // pk should always be valid
(*out).0[24] = 0x7f; // pk should always be valid
(*out).0[24+32] = 0x7f; // pk should always be valid
test_pk_validate(cx, out)
}

Expand Down

0 comments on commit dee10b9

Please sign in to comment.