Skip to content

Commit 1742973

Browse files
committed
Add fuzztarget for negation
1 parent d45f709 commit 1742973

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

secp256k1-sys/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,20 @@ mod fuzz_dummy {
702702
//TODO secp256k1_ec_privkey_export
703703
//TODO secp256k1_ec_privkey_import
704704

705+
pub unsafe fn secp256k1_ec_privkey_negate(cx: *const Context,
706+
sk: *mut c_uchar) -> c_int {
707+
assert!(!cx.is_null() && (*cx).0 as u32 & !(SECP256K1_START_NONE | SECP256K1_START_VERIFY | SECP256K1_START_SIGN) == 0);
708+
if secp256k1_ec_seckey_verify(cx, sk) != 1 { return 0; }
709+
1
710+
}
711+
712+
pub unsafe fn secp256k1_ec_pubkey_negate(cx: *const Context,
713+
pk: *mut PublicKey) -> c_int {
714+
assert!(!cx.is_null() && (*cx).0 as u32 & !(SECP256K1_START_NONE | SECP256K1_START_VERIFY | SECP256K1_START_SIGN) == 0);
715+
if test_pk_validate(cx, pk) != 1 { return 0; }
716+
1
717+
}
718+
705719
/// Copies the first 16 bytes of tweak into the last 16 bytes of sk
706720
pub unsafe fn secp256k1_ec_privkey_tweak_add(cx: *const Context,
707721
sk: *mut c_uchar,

0 commit comments

Comments
 (0)