1 use super::super::*; 2 use libc::*; 3 4 extern "C" { BN_CTX_new() -> *mut BN_CTX5 pub fn BN_CTX_new() -> *mut BN_CTX; 6 #[cfg(ossl110)] BN_CTX_secure_new() -> *mut BN_CTX7 pub fn BN_CTX_secure_new() -> *mut BN_CTX; BN_CTX_free(ctx: *mut BN_CTX)8 pub fn BN_CTX_free(ctx: *mut BN_CTX); BN_rand(r: *mut BIGNUM, bits: c_int, top: c_int, bottom: c_int) -> c_int9 pub fn BN_rand(r: *mut BIGNUM, bits: c_int, top: c_int, bottom: c_int) -> c_int; 10 #[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))] BN_pseudo_rand(r: *mut BIGNUM, bits: c_int, top: c_int, bottom: c_int) -> c_int11 pub fn BN_pseudo_rand(r: *mut BIGNUM, bits: c_int, top: c_int, bottom: c_int) -> c_int; BN_rand_range(r: *mut BIGNUM, range: *const BIGNUM) -> c_int12 pub fn BN_rand_range(r: *mut BIGNUM, range: *const BIGNUM) -> c_int; 13 #[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))] BN_pseudo_rand_range(r: *mut BIGNUM, range: *const BIGNUM) -> c_int14 pub fn BN_pseudo_rand_range(r: *mut BIGNUM, range: *const BIGNUM) -> c_int; BN_new() -> *mut BIGNUM15 pub fn BN_new() -> *mut BIGNUM; 16 #[cfg(ossl110)] BN_secure_new() -> *mut BIGNUM17 pub fn BN_secure_new() -> *mut BIGNUM; 18 #[cfg(ossl110)] BN_set_flags(b: *mut BIGNUM, n: c_int)19 pub fn BN_set_flags(b: *mut BIGNUM, n: c_int); 20 #[cfg(ossl110)] BN_get_flags(b: *const BIGNUM, n: c_int) -> c_int21 pub fn BN_get_flags(b: *const BIGNUM, n: c_int) -> c_int; BN_num_bits(bn: *const BIGNUM) -> c_int22 pub fn BN_num_bits(bn: *const BIGNUM) -> c_int; BN_clear_free(bn: *mut BIGNUM)23 pub fn BN_clear_free(bn: *mut BIGNUM); BN_bin2bn(s: *const u8, size: c_int, ret: *mut BIGNUM) -> *mut BIGNUM24 pub fn BN_bin2bn(s: *const u8, size: c_int, ret: *mut BIGNUM) -> *mut BIGNUM; BN_bn2bin(a: *const BIGNUM, to: *mut u8) -> c_int25 pub fn BN_bn2bin(a: *const BIGNUM, to: *mut u8) -> c_int; 26 #[cfg(ossl110)] BN_bn2binpad(a: *const BIGNUM, to: *mut u8, tolen: c_int) -> c_int27 pub fn BN_bn2binpad(a: *const BIGNUM, to: *mut u8, tolen: c_int) -> c_int; BN_sub(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM) -> c_int28 pub fn BN_sub(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM) -> c_int; BN_add(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM) -> c_int29 pub fn BN_add(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM) -> c_int; BN_mul(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, ctx: *mut BN_CTX) -> c_int30 pub fn BN_mul(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, ctx: *mut BN_CTX) -> c_int; BN_sqr(r: *mut BIGNUM, a: *const BIGNUM, ctx: *mut BN_CTX) -> c_int31 pub fn BN_sqr(r: *mut BIGNUM, a: *const BIGNUM, ctx: *mut BN_CTX) -> c_int; BN_set_negative(bn: *mut BIGNUM, n: c_int)32 pub fn BN_set_negative(bn: *mut BIGNUM, n: c_int); 33 #[cfg(any(ossl110, libressl350))] BN_is_negative(b: *const BIGNUM) -> c_int34 pub fn BN_is_negative(b: *const BIGNUM) -> c_int; 35 BN_div( dv: *mut BIGNUM, rem: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int36 pub fn BN_div( 37 dv: *mut BIGNUM, 38 rem: *mut BIGNUM, 39 a: *const BIGNUM, 40 b: *const BIGNUM, 41 ctx: *mut BN_CTX, 42 ) -> c_int; BN_nnmod( rem: *mut BIGNUM, a: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int43 pub fn BN_nnmod( 44 rem: *mut BIGNUM, 45 a: *const BIGNUM, 46 m: *const BIGNUM, 47 ctx: *mut BN_CTX, 48 ) -> c_int; BN_mod_add( r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int49 pub fn BN_mod_add( 50 r: *mut BIGNUM, 51 a: *const BIGNUM, 52 b: *const BIGNUM, 53 m: *const BIGNUM, 54 ctx: *mut BN_CTX, 55 ) -> c_int; BN_mod_sub( r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int56 pub fn BN_mod_sub( 57 r: *mut BIGNUM, 58 a: *const BIGNUM, 59 b: *const BIGNUM, 60 m: *const BIGNUM, 61 ctx: *mut BN_CTX, 62 ) -> c_int; BN_mod_mul( r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int63 pub fn BN_mod_mul( 64 r: *mut BIGNUM, 65 a: *const BIGNUM, 66 b: *const BIGNUM, 67 m: *const BIGNUM, 68 ctx: *mut BN_CTX, 69 ) -> c_int; BN_mod_sqr( r: *mut BIGNUM, a: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int70 pub fn BN_mod_sqr( 71 r: *mut BIGNUM, 72 a: *const BIGNUM, 73 m: *const BIGNUM, 74 ctx: *mut BN_CTX, 75 ) -> c_int; 76 BN_mod_word(r: *const BIGNUM, w: BN_ULONG) -> BN_ULONG77 pub fn BN_mod_word(r: *const BIGNUM, w: BN_ULONG) -> BN_ULONG; BN_div_word(r: *mut BIGNUM, w: BN_ULONG) -> BN_ULONG78 pub fn BN_div_word(r: *mut BIGNUM, w: BN_ULONG) -> BN_ULONG; BN_mul_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int79 pub fn BN_mul_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int; BN_add_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int80 pub fn BN_add_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int; BN_sub_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int81 pub fn BN_sub_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int; BN_set_word(bn: *mut BIGNUM, n: BN_ULONG) -> c_int82 pub fn BN_set_word(bn: *mut BIGNUM, n: BN_ULONG) -> c_int; 83 BN_cmp(a: *const BIGNUM, b: *const BIGNUM) -> c_int84 pub fn BN_cmp(a: *const BIGNUM, b: *const BIGNUM) -> c_int; BN_free(bn: *mut BIGNUM)85 pub fn BN_free(bn: *mut BIGNUM); BN_is_bit_set(a: *const BIGNUM, n: c_int) -> c_int86 pub fn BN_is_bit_set(a: *const BIGNUM, n: c_int) -> c_int; BN_lshift(r: *mut BIGNUM, a: *const BIGNUM, n: c_int) -> c_int87 pub fn BN_lshift(r: *mut BIGNUM, a: *const BIGNUM, n: c_int) -> c_int; BN_lshift1(r: *mut BIGNUM, a: *const BIGNUM) -> c_int88 pub fn BN_lshift1(r: *mut BIGNUM, a: *const BIGNUM) -> c_int; BN_exp(r: *mut BIGNUM, a: *const BIGNUM, p: *const BIGNUM, ctx: *mut BN_CTX) -> c_int89 pub fn BN_exp(r: *mut BIGNUM, a: *const BIGNUM, p: *const BIGNUM, ctx: *mut BN_CTX) -> c_int; 90 BN_mod_exp( r: *mut BIGNUM, a: *const BIGNUM, p: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int91 pub fn BN_mod_exp( 92 r: *mut BIGNUM, 93 a: *const BIGNUM, 94 p: *const BIGNUM, 95 m: *const BIGNUM, 96 ctx: *mut BN_CTX, 97 ) -> c_int; 98 BN_mask_bits(a: *mut BIGNUM, n: c_int) -> c_int99 pub fn BN_mask_bits(a: *mut BIGNUM, n: c_int) -> c_int; BN_rshift(r: *mut BIGNUM, a: *const BIGNUM, n: c_int) -> c_int100 pub fn BN_rshift(r: *mut BIGNUM, a: *const BIGNUM, n: c_int) -> c_int; BN_rshift1(r: *mut BIGNUM, a: *const BIGNUM) -> c_int101 pub fn BN_rshift1(r: *mut BIGNUM, a: *const BIGNUM) -> c_int; BN_bn2hex(a: *const BIGNUM) -> *mut c_char102 pub fn BN_bn2hex(a: *const BIGNUM) -> *mut c_char; BN_bn2dec(a: *const BIGNUM) -> *mut c_char103 pub fn BN_bn2dec(a: *const BIGNUM) -> *mut c_char; BN_hex2bn(a: *mut *mut BIGNUM, s: *const c_char) -> c_int104 pub fn BN_hex2bn(a: *mut *mut BIGNUM, s: *const c_char) -> c_int; BN_dec2bn(a: *mut *mut BIGNUM, s: *const c_char) -> c_int105 pub fn BN_dec2bn(a: *mut *mut BIGNUM, s: *const c_char) -> c_int; BN_gcd(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, ctx: *mut BN_CTX) -> c_int106 pub fn BN_gcd(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, ctx: *mut BN_CTX) -> c_int; BN_mod_inverse( r: *mut BIGNUM, a: *const BIGNUM, n: *const BIGNUM, ctx: *mut BN_CTX, ) -> *mut BIGNUM107 pub fn BN_mod_inverse( 108 r: *mut BIGNUM, 109 a: *const BIGNUM, 110 n: *const BIGNUM, 111 ctx: *mut BN_CTX, 112 ) -> *mut BIGNUM; BN_clear(bn: *mut BIGNUM)113 pub fn BN_clear(bn: *mut BIGNUM); BN_dup(n: *const BIGNUM) -> *mut BIGNUM114 pub fn BN_dup(n: *const BIGNUM) -> *mut BIGNUM; BN_ucmp(a: *const BIGNUM, b: *const BIGNUM) -> c_int115 pub fn BN_ucmp(a: *const BIGNUM, b: *const BIGNUM) -> c_int; BN_set_bit(a: *mut BIGNUM, n: c_int) -> c_int116 pub fn BN_set_bit(a: *mut BIGNUM, n: c_int) -> c_int; BN_clear_bit(a: *mut BIGNUM, n: c_int) -> c_int117 pub fn BN_clear_bit(a: *mut BIGNUM, n: c_int) -> c_int; 118 BN_generate_prime_ex( r: *mut BIGNUM, bits: c_int, safe: c_int, add: *const BIGNUM, rem: *const BIGNUM, cb: *mut BN_GENCB, ) -> c_int119 pub fn BN_generate_prime_ex( 120 r: *mut BIGNUM, 121 bits: c_int, 122 safe: c_int, 123 add: *const BIGNUM, 124 rem: *const BIGNUM, 125 cb: *mut BN_GENCB, 126 ) -> c_int; 127 #[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))] BN_is_prime_ex( p: *const BIGNUM, checks: c_int, ctx: *mut BN_CTX, cb: *mut BN_GENCB, ) -> c_int128 pub fn BN_is_prime_ex( 129 p: *const BIGNUM, 130 checks: c_int, 131 ctx: *mut BN_CTX, 132 cb: *mut BN_GENCB, 133 ) -> c_int; 134 #[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))] BN_is_prime_fasttest_ex( p: *const BIGNUM, checks: c_int, ctx: *mut BN_CTX, do_trial_division: c_int, cb: *mut BN_GENCB, ) -> c_int135 pub fn BN_is_prime_fasttest_ex( 136 p: *const BIGNUM, 137 checks: c_int, 138 ctx: *mut BN_CTX, 139 do_trial_division: c_int, 140 cb: *mut BN_GENCB, 141 ) -> c_int; 142 } 143 144 cfg_if! { 145 if #[cfg(any(ossl110, libressl350))] { 146 extern "C" { 147 pub fn BN_get_rfc2409_prime_768(bn: *mut BIGNUM) -> *mut BIGNUM; 148 pub fn BN_get_rfc2409_prime_1024(bn: *mut BIGNUM) -> *mut BIGNUM; 149 pub fn BN_get_rfc3526_prime_1536(bn: *mut BIGNUM) -> *mut BIGNUM; 150 pub fn BN_get_rfc3526_prime_2048(bn: *mut BIGNUM) -> *mut BIGNUM; 151 pub fn BN_get_rfc3526_prime_3072(bn: *mut BIGNUM) -> *mut BIGNUM; 152 pub fn BN_get_rfc3526_prime_4096(bn: *mut BIGNUM) -> *mut BIGNUM; 153 pub fn BN_get_rfc3526_prime_6144(bn: *mut BIGNUM) -> *mut BIGNUM; 154 pub fn BN_get_rfc3526_prime_8192(bn: *mut BIGNUM) -> *mut BIGNUM; 155 } 156 } else { 157 extern "C" { 158 pub fn get_rfc2409_prime_768(bn: *mut BIGNUM) -> *mut BIGNUM; 159 pub fn get_rfc2409_prime_1024(bn: *mut BIGNUM) -> *mut BIGNUM; 160 pub fn get_rfc3526_prime_1536(bn: *mut BIGNUM) -> *mut BIGNUM; 161 pub fn get_rfc3526_prime_2048(bn: *mut BIGNUM) -> *mut BIGNUM; 162 pub fn get_rfc3526_prime_3072(bn: *mut BIGNUM) -> *mut BIGNUM; 163 pub fn get_rfc3526_prime_4096(bn: *mut BIGNUM) -> *mut BIGNUM; 164 pub fn get_rfc3526_prime_6144(bn: *mut BIGNUM) -> *mut BIGNUM; 165 pub fn get_rfc3526_prime_8192(bn: *mut BIGNUM) -> *mut BIGNUM; 166 } 167 } 168 } 169