Skip to content

Commit ca8ea92

Browse files
committed
Fixed secp256k1_ecdh fuzztarget
1 parent f804282 commit ca8ea92

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

secp256k1-sys/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ mod fuzz_dummy {
440440
use self::std::{ptr, mem};
441441
use self::std::boxed::Box;
442442
use types::*;
443-
use ::{Signature, Context, NonceFn, EcdhHashFn, PublicKey, SharedSecret,
443+
use ::{Signature, Context, NonceFn, EcdhHashFn, PublicKey,
444444
SECP256K1_START_NONE, SECP256K1_START_VERIFY, SECP256K1_START_SIGN,
445445
SECP256K1_SER_COMPRESSED, SECP256K1_SER_UNCOMPRESSED};
446446

@@ -769,7 +769,7 @@ mod fuzz_dummy {
769769
/// Sets out to point[0..16]||scalar[0..16]
770770
pub unsafe fn secp256k1_ecdh(
771771
cx: *const Context,
772-
out: *mut SharedSecret,
772+
out: *mut c_uchar,
773773
point: *const PublicKey,
774774
scalar: *const c_uchar,
775775
_hashfp: EcdhHashFn,
@@ -782,13 +782,13 @@ mod fuzz_dummy {
782782
ptr::copy(scalar, scalar_prefix[..].as_mut_ptr(), 16);
783783

784784
if (*point).0[0..16] > scalar_prefix[0..16] {
785-
(*out).0[0..16].copy_from_slice(&(*point).0[0..16]);
786-
ptr::copy(scalar, (*out).0[16..32].as_mut_ptr(), 16);
785+
ptr::copy((*point).as_ptr(), out, 16);
786+
ptr::copy(scalar, out.offset(16), 16);
787787
} else {
788-
ptr::copy(scalar, (*out).0[0..16].as_mut_ptr(), 16);
789-
(*out).0[16..32].copy_from_slice(&(*point).0[0..16]);
788+
ptr::copy(scalar, out, 16);
789+
ptr::copy((*point).as_ptr(), out.offset(16), 16);
790790
}
791-
(*out).0[16] = 0x00; // result should always be a valid secret key
791+
(*out.offset(16)) = 0x00; // result should always be a valid secret key
792792
1
793793
}
794794
}

0 commit comments

Comments
 (0)