ffi: make function types nullable
This commit is contained in:
parent
91eea119b3
commit
40c31342f2
|
@ -58,36 +58,37 @@ pub const SECP256K1_SER_COMPRESSED: c_uint = (1 << 1) | (1 << 8);
|
||||||
/// around the FFI functions to use it. And it's an unsafe type.
|
/// around the FFI functions to use it. And it's an unsafe type.
|
||||||
/// Nonces are generated deterministically by RFC6979 by
|
/// Nonces are generated deterministically by RFC6979 by
|
||||||
/// default; there should be no need to ever change this.
|
/// default; there should be no need to ever change this.
|
||||||
pub type NonceFn = unsafe extern "C" fn(nonce32: *mut c_uchar,
|
pub type NonceFn = Option<unsafe extern "C" fn(
|
||||||
msg32: *const c_uchar,
|
nonce32: *mut c_uchar,
|
||||||
key32: *const c_uchar,
|
msg32: *const c_uchar,
|
||||||
algo16: *const c_uchar,
|
key32: *const c_uchar,
|
||||||
data: *mut c_void,
|
algo16: *const c_uchar,
|
||||||
attempt: c_uint,
|
data: *mut c_void,
|
||||||
) -> c_int;
|
attempt: c_uint,
|
||||||
|
) -> c_int>;
|
||||||
|
|
||||||
/// Hash function to use to post-process an ECDH point to get
|
/// Hash function to use to post-process an ECDH point to get
|
||||||
/// a shared secret.
|
/// a shared secret.
|
||||||
pub type EcdhHashFn = unsafe extern "C" fn(
|
pub type EcdhHashFn = Option<unsafe extern "C" fn(
|
||||||
output: *mut c_uchar,
|
output: *mut c_uchar,
|
||||||
x: *const c_uchar,
|
x: *const c_uchar,
|
||||||
y: *const c_uchar,
|
y: *const c_uchar,
|
||||||
data: *mut c_void,
|
data: *mut c_void,
|
||||||
) -> c_int;
|
) -> c_int>;
|
||||||
|
|
||||||
/// Same as secp256k1_nonce function with the exception of accepting an
|
/// Same as secp256k1_nonce function with the exception of accepting an
|
||||||
/// additional pubkey argument and not requiring an attempt argument. The pubkey
|
/// additional pubkey argument and not requiring an attempt argument. The pubkey
|
||||||
/// argument can protect signature schemes with key-prefixed challenge hash
|
/// argument can protect signature schemes with key-prefixed challenge hash
|
||||||
/// inputs against reusing the nonce when signing with the wrong precomputed
|
/// inputs against reusing the nonce when signing with the wrong precomputed
|
||||||
/// pubkey.
|
/// pubkey.
|
||||||
pub type SchnorrNonceFn = unsafe extern "C" fn(
|
pub type SchnorrNonceFn = Option<unsafe extern "C" fn(
|
||||||
nonce32: *mut c_uchar,
|
nonce32: *mut c_uchar,
|
||||||
msg32: *const c_uchar,
|
msg32: *const c_uchar,
|
||||||
key32: *const c_uchar,
|
key32: *const c_uchar,
|
||||||
xonly_pk32: *const c_uchar,
|
xonly_pk32: *const c_uchar,
|
||||||
algo16: *const c_uchar,
|
algo16: *const c_uchar,
|
||||||
data: *mut c_void,
|
data: *mut c_void,
|
||||||
) -> c_int;
|
) -> c_int>;
|
||||||
|
|
||||||
/// A Secp256k1 context, containing various precomputed values and such
|
/// A Secp256k1 context, containing various precomputed values and such
|
||||||
/// needed to do elliptic curve computations. If you create one of these
|
/// needed to do elliptic curve computations. If you create one of these
|
||||||
|
|
|
@ -151,7 +151,7 @@ impl SharedSecret {
|
||||||
xy.as_mut_ptr(),
|
xy.as_mut_ptr(),
|
||||||
point.as_ptr(),
|
point.as_ptr(),
|
||||||
scalar.as_ptr(),
|
scalar.as_ptr(),
|
||||||
c_callback,
|
Some(c_callback),
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue