1use libc::*; 2use std::ptr; 3 4use super::super::*; 5 6pub const RSA_F4: c_long = 0x10001; 7 8cfg_if! { 9 if #[cfg(not(ossl300))] { 10 pub unsafe fn EVP_PKEY_CTX_set_rsa_padding(ctx: *mut EVP_PKEY_CTX, pad: c_int) -> c_int { 11 EVP_PKEY_CTX_ctrl( 12 ctx, 13 EVP_PKEY_RSA, 14 -1, 15 EVP_PKEY_CTRL_RSA_PADDING, 16 pad, 17 ptr::null_mut(), 18 ) 19 } 20 pub unsafe fn EVP_PKEY_CTX_get_rsa_padding(ctx: *mut EVP_PKEY_CTX, ppad: *mut c_int) -> c_int { 21 EVP_PKEY_CTX_ctrl( 22 ctx, 23 EVP_PKEY_RSA, 24 -1, 25 EVP_PKEY_CTRL_GET_RSA_PADDING, 26 0, 27 ppad as *mut c_void, 28 ) 29 } 30 31 pub unsafe fn EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx: *mut EVP_PKEY_CTX, len: c_int) -> c_int { 32 EVP_PKEY_CTX_ctrl( 33 ctx, 34 EVP_PKEY_RSA, 35 EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY, 36 EVP_PKEY_CTRL_RSA_PSS_SALTLEN, 37 len, 38 ptr::null_mut(), 39 ) 40 } 41 42 pub unsafe fn EVP_PKEY_CTX_set_rsa_mgf1_md(ctx: *mut EVP_PKEY_CTX, md: *mut EVP_MD) -> c_int { 43 EVP_PKEY_CTX_ctrl( 44 ctx, 45 EVP_PKEY_RSA, 46 EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, 47 EVP_PKEY_CTRL_RSA_MGF1_MD, 48 0, 49 md as *mut c_void, 50 ) 51 } 52 } 53} 54 55#[cfg(any(ossl102, libressl310))] 56pub unsafe fn EVP_PKEY_CTX_set_rsa_oaep_md(ctx: *mut EVP_PKEY_CTX, md: *mut EVP_MD) -> c_int { 57 EVP_PKEY_CTX_ctrl( 58 ctx, 59 EVP_PKEY_RSA, 60 EVP_PKEY_OP_TYPE_CRYPT, 61 EVP_PKEY_CTRL_RSA_OAEP_MD, 62 0, 63 md as *mut c_void, 64 ) 65} 66 67#[cfg(any(ossl102, libressl310))] 68pub unsafe fn EVP_PKEY_CTX_set0_rsa_oaep_label( 69 ctx: *mut EVP_PKEY_CTX, 70 label: *mut c_void, 71 len: c_int, 72) -> c_int { 73 EVP_PKEY_CTX_ctrl( 74 ctx, 75 EVP_PKEY_RSA, 76 EVP_PKEY_OP_TYPE_CRYPT, 77 EVP_PKEY_CTRL_RSA_OAEP_LABEL, 78 len, 79 label as *mut c_void, 80 ) 81} 82 83pub const EVP_PKEY_CTRL_RSA_PADDING: c_int = EVP_PKEY_ALG_CTRL + 1; 84pub const EVP_PKEY_CTRL_RSA_PSS_SALTLEN: c_int = EVP_PKEY_ALG_CTRL + 2; 85 86pub const EVP_PKEY_CTRL_RSA_MGF1_MD: c_int = EVP_PKEY_ALG_CTRL + 5; 87 88pub const EVP_PKEY_CTRL_GET_RSA_PADDING: c_int = EVP_PKEY_ALG_CTRL + 6; 89 90#[cfg(any(ossl102, libressl310))] 91pub const EVP_PKEY_CTRL_RSA_OAEP_MD: c_int = EVP_PKEY_ALG_CTRL + 9; 92#[cfg(any(ossl102, libressl310))] 93pub const EVP_PKEY_CTRL_RSA_OAEP_LABEL: c_int = EVP_PKEY_ALG_CTRL + 10; 94 95pub const RSA_PKCS1_PADDING: c_int = 1; 96#[cfg(not(ossl300))] 97pub const RSA_SSLV23_PADDING: c_int = 2; 98pub const RSA_NO_PADDING: c_int = 3; 99pub const RSA_PKCS1_OAEP_PADDING: c_int = 4; 100pub const RSA_X931_PADDING: c_int = 5; 101pub const RSA_PKCS1_PSS_PADDING: c_int = 6; 102