1 use super::super::*; 2 use libc::*; 3 4 cfg_if! { 5 if #[cfg(ossl300)] { 6 extern "C" { 7 pub fn EVP_PKEY_CTX_set_rsa_padding(ctx: *mut EVP_PKEY_CTX, pad_mode: c_int) -> c_int; 8 pub fn EVP_PKEY_CTX_get_rsa_padding(ctx: *mut EVP_PKEY_CTX, pad_mode: *mut c_int) -> c_int; 9 10 pub fn EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx: *mut EVP_PKEY_CTX, len: c_int) -> c_int; 11 pub fn EVP_PKEY_CTX_set_rsa_mgf1_md(ctx: *mut EVP_PKEY_CTX, md: *const EVP_MD) -> c_int; 12 } 13 } 14 } 15 16 extern "C" { RSA_new() -> *mut RSA17 pub fn RSA_new() -> *mut RSA; RSA_size(k: *const RSA) -> c_int18 pub fn RSA_size(k: *const RSA) -> c_int; 19 20 #[cfg(any(ossl110, libressl273))] RSA_set0_key(r: *mut RSA, n: *mut BIGNUM, e: *mut BIGNUM, d: *mut BIGNUM) -> c_int21 pub fn RSA_set0_key(r: *mut RSA, n: *mut BIGNUM, e: *mut BIGNUM, d: *mut BIGNUM) -> c_int; 22 #[cfg(any(ossl110, libressl273))] RSA_set0_factors(r: *mut RSA, p: *mut BIGNUM, q: *mut BIGNUM) -> c_int23 pub fn RSA_set0_factors(r: *mut RSA, p: *mut BIGNUM, q: *mut BIGNUM) -> c_int; 24 #[cfg(any(ossl110, libressl273))] RSA_set0_crt_params( r: *mut RSA, dmp1: *mut BIGNUM, dmq1: *mut BIGNUM, iqmp: *mut BIGNUM, ) -> c_int25 pub fn RSA_set0_crt_params( 26 r: *mut RSA, 27 dmp1: *mut BIGNUM, 28 dmq1: *mut BIGNUM, 29 iqmp: *mut BIGNUM, 30 ) -> c_int; 31 #[cfg(any(ossl110, libressl273))] RSA_get0_key( r: *const RSA, n: *mut *const BIGNUM, e: *mut *const BIGNUM, d: *mut *const BIGNUM, )32 pub fn RSA_get0_key( 33 r: *const RSA, 34 n: *mut *const BIGNUM, 35 e: *mut *const BIGNUM, 36 d: *mut *const BIGNUM, 37 ); 38 #[cfg(any(ossl110, libressl273))] RSA_get0_factors(r: *const RSA, p: *mut *const BIGNUM, q: *mut *const BIGNUM)39 pub fn RSA_get0_factors(r: *const RSA, p: *mut *const BIGNUM, q: *mut *const BIGNUM); 40 #[cfg(any(ossl110, libressl273))] RSA_get0_crt_params( r: *const RSA, dmp1: *mut *const BIGNUM, dmq1: *mut *const BIGNUM, iqmp: *mut *const BIGNUM, )41 pub fn RSA_get0_crt_params( 42 r: *const RSA, 43 dmp1: *mut *const BIGNUM, 44 dmq1: *mut *const BIGNUM, 45 iqmp: *mut *const BIGNUM, 46 ); 47 48 #[cfg(not(ossl110))] RSA_generate_key( modsz: c_int, e: c_ulong, cb: Option<extern "C" fn(c_int, c_int, *mut c_void)>, cbarg: *mut c_void, ) -> *mut RSA49 pub fn RSA_generate_key( 50 modsz: c_int, 51 e: c_ulong, 52 cb: Option<extern "C" fn(c_int, c_int, *mut c_void)>, 53 cbarg: *mut c_void, 54 ) -> *mut RSA; 55 RSA_generate_key_ex( rsa: *mut RSA, bits: c_int, e: *mut BIGNUM, cb: *mut BN_GENCB, ) -> c_int56 pub fn RSA_generate_key_ex( 57 rsa: *mut RSA, 58 bits: c_int, 59 e: *mut BIGNUM, 60 cb: *mut BN_GENCB, 61 ) -> c_int; 62 RSA_public_encrypt( flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA, pad: c_int, ) -> c_int63 pub fn RSA_public_encrypt( 64 flen: c_int, 65 from: *const u8, 66 to: *mut u8, 67 k: *mut RSA, 68 pad: c_int, 69 ) -> c_int; RSA_private_encrypt( flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA, pad: c_int, ) -> c_int70 pub fn RSA_private_encrypt( 71 flen: c_int, 72 from: *const u8, 73 to: *mut u8, 74 k: *mut RSA, 75 pad: c_int, 76 ) -> c_int; RSA_public_decrypt( flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA, pad: c_int, ) -> c_int77 pub fn RSA_public_decrypt( 78 flen: c_int, 79 from: *const u8, 80 to: *mut u8, 81 k: *mut RSA, 82 pad: c_int, 83 ) -> c_int; RSA_private_decrypt( flen: c_int, from: *const u8, to: *mut u8, k: *mut RSA, pad: c_int, ) -> c_int84 pub fn RSA_private_decrypt( 85 flen: c_int, 86 from: *const u8, 87 to: *mut u8, 88 k: *mut RSA, 89 pad: c_int, 90 ) -> c_int; RSA_check_key(r: *const RSA) -> c_int91 pub fn RSA_check_key(r: *const RSA) -> c_int; RSA_free(rsa: *mut RSA)92 pub fn RSA_free(rsa: *mut RSA); RSA_up_ref(rsa: *mut RSA) -> c_int93 pub fn RSA_up_ref(rsa: *mut RSA) -> c_int; 94 i2d_RSAPublicKey(k: *const RSA, buf: *mut *mut u8) -> c_int95 pub fn i2d_RSAPublicKey(k: *const RSA, buf: *mut *mut u8) -> c_int; d2i_RSAPublicKey(k: *mut *mut RSA, buf: *mut *const u8, len: c_long) -> *mut RSA96 pub fn d2i_RSAPublicKey(k: *mut *mut RSA, buf: *mut *const u8, len: c_long) -> *mut RSA; i2d_RSAPrivateKey(k: *const RSA, buf: *mut *mut u8) -> c_int97 pub fn i2d_RSAPrivateKey(k: *const RSA, buf: *mut *mut u8) -> c_int; d2i_RSAPrivateKey(k: *mut *mut RSA, buf: *mut *const u8, len: c_long) -> *mut RSA98 pub fn d2i_RSAPrivateKey(k: *mut *mut RSA, buf: *mut *const u8, len: c_long) -> *mut RSA; 99 RSA_sign( t: c_int, m: *const u8, mlen: c_uint, sig: *mut u8, siglen: *mut c_uint, k: *mut RSA, ) -> c_int100 pub fn RSA_sign( 101 t: c_int, 102 m: *const u8, 103 mlen: c_uint, 104 sig: *mut u8, 105 siglen: *mut c_uint, 106 k: *mut RSA, 107 ) -> c_int; RSA_verify( t: c_int, m: *const u8, mlen: c_uint, sig: *const u8, siglen: c_uint, k: *mut RSA, ) -> c_int108 pub fn RSA_verify( 109 t: c_int, 110 m: *const u8, 111 mlen: c_uint, 112 sig: *const u8, 113 siglen: c_uint, 114 k: *mut RSA, 115 ) -> c_int; 116 RSA_padding_check_PKCS1_type_2( to: *mut c_uchar, tlen: c_int, f: *const c_uchar, fl: c_int, rsa_len: c_int, ) -> c_int117 pub fn RSA_padding_check_PKCS1_type_2( 118 to: *mut c_uchar, 119 tlen: c_int, 120 f: *const c_uchar, 121 fl: c_int, 122 rsa_len: c_int, 123 ) -> c_int; 124 } 125