Skip to content

Commit

Permalink
external C function pointers are now Options
Browse files Browse the repository at this point in the history
  • Loading branch information
brimonk committed Apr 12, 2024
1 parent e3651f1 commit 1b85b33
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 56 deletions.
44 changes: 22 additions & 22 deletions openssl-sys/src/handwritten/rsa_meth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,126 +20,126 @@ extern "C" {

pub fn RSA_meth_set_pub_enc(
rsa: *mut RSA_METHOD,
pub_enc: extern "C" fn(
pub_enc: Option<extern "C" fn(
flen: c_int,
from: *const c_uchar,
to: *mut c_uchar,
rsa: *mut RSA,
padding: c_int,
) -> c_int,
) -> c_int>,
) -> c_int;

pub fn RSA_meth_set_pub_dec(
rsa: *mut RSA_METHOD,
pub_dec: extern "C" fn(
pub_dec: Option<extern "C" fn(
flen: c_int,
from: *const c_uchar,
to: *mut c_uchar,
rsa: *mut RSA,
padding: c_int,
) -> c_int,
) -> c_int>,
) -> c_int;

pub fn RSA_meth_set_priv_enc(
rsa: *mut RSA_METHOD,
priv_enc: extern "C" fn(
priv_enc: Option<extern "C" fn(
flen: c_int,
from: *const c_uchar,
to: *mut c_uchar,
rsa: *mut RSA,
padding: c_int,
) -> c_int,
) -> c_int>,
) -> c_int;
pub fn RSA_meth_set_priv_dec(
rsa: *mut RSA_METHOD,
priv_dec: extern "C" fn(
priv_dec: Option<extern "C" fn(
flen: c_int,
from: *const c_uchar,
to: *mut c_uchar,
rsa: *mut RSA,
padding: c_int,
) -> c_int,
) -> c_int>,
) -> c_int;

/// Notes from OpenSSL documentation: Can be null.
pub fn RSA_meth_set_mod_exp(
rsa: *mut RSA_METHOD,
mod_exp: extern "C" fn(
mod_exp: Option<extern "C" fn(
r0: *mut BIGNUM,
i: *const BIGNUM,
rsa: *mut RSA,
ctx: *mut BN_CTX,
) -> c_int,
) -> c_int>,
) -> c_int;

/// Notes from OpenSSL documentation: Can be null.
pub fn RSA_meth_set_bn_mod_exp(
rsa: *mut RSA_METHOD,
bn_mod_exp: extern "C" fn(
bn_mod_exp: Option<extern "C" fn(
r: *mut BIGNUM,
a: *const BIGNUM,
p: *const BIGNUM,
m: *const BIGNUM,
ctx: *mut BN_CTX,
m_ctx: *mut BN_MONT_CTX,
) -> c_int,
) -> c_int>,
) -> c_int;

/// Notes from OpenSSL documentation: Can be null.
pub fn RSA_meth_set_init(
rsa: *mut RSA_METHOD,
init: extern "C" fn(rsa: *mut RSA) -> c_int,
init: Option<extern "C" fn(rsa: *mut RSA) -> c_int>,
) -> c_int;

/// Notes from OpenSSL documentation: Can be null.
pub fn RSA_meth_set_finish(
rsa: *mut RSA_METHOD,
finish: extern "C" fn(rsa: *mut RSA) -> c_int,
finish: Option<extern "C" fn(rsa: *mut RSA) -> c_int>,
) -> c_int;

pub fn RSA_meth_set_sign(
rsa: *mut RSA_METHOD,
sign: extern "C" fn(
sign: Option<extern "C" fn(
_type: c_int,
m: *const c_uchar,
m_length: c_uint,
sigret: *mut c_uchar,
siglen: *mut c_uint,
rsa: *const RSA,
) -> c_int,
) -> c_int>,
) -> c_int;

pub fn RSA_meth_set_verify(
rsa: *mut RSA_METHOD,
verify: extern "C" fn(
verify: Option<extern "C" fn(
dtype: c_int,
m: *const c_uchar,
m_length: c_uint,
sigbuf: *const c_uchar,
siglen: c_uint,
rsa: *const RSA,
) -> c_int,
) -> c_int>,
) -> c_int;

pub fn RSA_meth_set_keygen(
rsa: *mut RSA_METHOD,
keygen: extern "C" fn(
keygen: Option<extern "C" fn(
rsa: *mut RSA,
bits: c_int,
e: *mut BIGNUM,
cb: *mut BN_GENCB,
) -> c_int,
) -> c_int>,
) -> c_int;

#[cfg(ossl111)]
pub fn RSA_meth_set_multi_prime_keygen(
meth: *mut RSA_METHOD,
keygen: extern "C" fn(
keygen: Option<extern "C" fn(
rsa: *mut RSA,
bits: c_int,
primes: c_int,
e: *mut BIGNUM,
cb: *mut BN_GENCB,
) -> c_int,
) -> c_int>,
) -> c_int;
}

0 comments on commit 1b85b33

Please sign in to comment.