Skip to content

Commit c016d0b

Browse files
committed
pkey_ctx/set_rsa_keygen_bits: fix ossl <=1.1
Use EVP_PKEY_CTX_set_rsa_keygen_bits macro via EVP_PKEY_CTX_ctrl
1 parent 83f4b31 commit c016d0b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

openssl-sys/src/rsa.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ pub const RSA_F4: c_long = 0x10001;
77

88
cfg_if! {
99
if #[cfg(not(ossl300))] {
10+
pub unsafe fn EVP_PKEY_CTX_set_rsa_keygen_bits(ctx: *mut EVP_PKEY_CTX, bits: c_int) -> c_int {
11+
EVP_PKEY_CTX_ctrl(
12+
ctx,
13+
EVP_PKEY_RSA,
14+
EVP_PKEY_OP_KEYGEN,
15+
EVP_PKEY_CTRL_RSA_KEYGEN_BITS,
16+
bits,
17+
ptr::null_mut(),
18+
)
19+
}
1020
pub unsafe fn EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx: *mut EVP_PKEY_CTX, pubexp: *mut BIGNUM) -> c_int {
1121
EVP_PKEY_CTX_ctrl(
1222
ctx,
@@ -92,6 +102,7 @@ pub unsafe fn EVP_PKEY_CTX_set0_rsa_oaep_label(
92102

93103
pub const EVP_PKEY_CTRL_RSA_PADDING: c_int = EVP_PKEY_ALG_CTRL + 1;
94104
pub const EVP_PKEY_CTRL_RSA_PSS_SALTLEN: c_int = EVP_PKEY_ALG_CTRL + 2;
105+
pub const EVP_PKEY_CTRL_RSA_KEYGEN_BITS: c_int = EVP_PKEY_ALG_CTRL + 3;
95106
pub const EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP: c_int = EVP_PKEY_ALG_CTRL + 4;
96107

97108
pub const EVP_PKEY_CTRL_RSA_MGF1_MD: c_int = EVP_PKEY_ALG_CTRL + 5;

0 commit comments

Comments
 (0)