• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(any(ossl110, libressl340))]
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     #[cfg(any(ossl110, libressl350))]
BN_is_odd(b: *const BIGNUM) -> c_int36     pub fn BN_is_odd(b: *const BIGNUM) -> c_int;
37 
BN_div( dv: *mut BIGNUM, rem: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int38     pub fn BN_div(
39         dv: *mut BIGNUM,
40         rem: *mut BIGNUM,
41         a: *const BIGNUM,
42         b: *const BIGNUM,
43         ctx: *mut BN_CTX,
44     ) -> c_int;
BN_nnmod( rem: *mut BIGNUM, a: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int45     pub fn BN_nnmod(
46         rem: *mut BIGNUM,
47         a: *const BIGNUM,
48         m: *const BIGNUM,
49         ctx: *mut BN_CTX,
50     ) -> c_int;
BN_mod_add( r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int51     pub fn BN_mod_add(
52         r: *mut BIGNUM,
53         a: *const BIGNUM,
54         b: *const BIGNUM,
55         m: *const BIGNUM,
56         ctx: *mut BN_CTX,
57     ) -> c_int;
BN_mod_sub( r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int58     pub fn BN_mod_sub(
59         r: *mut BIGNUM,
60         a: *const BIGNUM,
61         b: *const BIGNUM,
62         m: *const BIGNUM,
63         ctx: *mut BN_CTX,
64     ) -> c_int;
BN_mod_mul( r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int65     pub fn BN_mod_mul(
66         r: *mut BIGNUM,
67         a: *const BIGNUM,
68         b: *const BIGNUM,
69         m: *const BIGNUM,
70         ctx: *mut BN_CTX,
71     ) -> c_int;
BN_mod_sqr( r: *mut BIGNUM, a: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int72     pub fn BN_mod_sqr(
73         r: *mut BIGNUM,
74         a: *const BIGNUM,
75         m: *const BIGNUM,
76         ctx: *mut BN_CTX,
77     ) -> c_int;
78     #[cfg(ossl110)]
BN_mod_sqrt( ret: *mut BIGNUM, a: *const BIGNUM, p: *const BIGNUM, ctx: *mut BN_CTX, ) -> *mut BIGNUM79     pub fn BN_mod_sqrt(
80         ret: *mut BIGNUM,
81         a: *const BIGNUM,
82         p: *const BIGNUM,
83         ctx: *mut BN_CTX,
84     ) -> *mut BIGNUM;
85 
BN_mod_word(r: *const BIGNUM, w: BN_ULONG) -> BN_ULONG86     pub fn BN_mod_word(r: *const BIGNUM, w: BN_ULONG) -> BN_ULONG;
BN_div_word(r: *mut BIGNUM, w: BN_ULONG) -> BN_ULONG87     pub fn BN_div_word(r: *mut BIGNUM, w: BN_ULONG) -> BN_ULONG;
BN_mul_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int88     pub fn BN_mul_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int;
BN_add_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int89     pub fn BN_add_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int;
BN_sub_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int90     pub fn BN_sub_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int;
BN_set_word(bn: *mut BIGNUM, n: BN_ULONG) -> c_int91     pub fn BN_set_word(bn: *mut BIGNUM, n: BN_ULONG) -> c_int;
92 
BN_cmp(a: *const BIGNUM, b: *const BIGNUM) -> c_int93     pub fn BN_cmp(a: *const BIGNUM, b: *const BIGNUM) -> c_int;
BN_free(bn: *mut BIGNUM)94     pub fn BN_free(bn: *mut BIGNUM);
BN_is_bit_set(a: *const BIGNUM, n: c_int) -> c_int95     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_int96     pub fn BN_lshift(r: *mut BIGNUM, a: *const BIGNUM, n: c_int) -> c_int;
BN_lshift1(r: *mut BIGNUM, a: *const BIGNUM) -> c_int97     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_int98     pub fn BN_exp(r: *mut BIGNUM, a: *const BIGNUM, p: *const BIGNUM, ctx: *mut BN_CTX) -> c_int;
99 
BN_mod_exp( r: *mut BIGNUM, a: *const BIGNUM, p: *const BIGNUM, m: *const BIGNUM, ctx: *mut BN_CTX, ) -> c_int100     pub fn BN_mod_exp(
101         r: *mut BIGNUM,
102         a: *const BIGNUM,
103         p: *const BIGNUM,
104         m: *const BIGNUM,
105         ctx: *mut BN_CTX,
106     ) -> c_int;
107 
BN_mask_bits(a: *mut BIGNUM, n: c_int) -> c_int108     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_int109     pub fn BN_rshift(r: *mut BIGNUM, a: *const BIGNUM, n: c_int) -> c_int;
BN_rshift1(r: *mut BIGNUM, a: *const BIGNUM) -> c_int110     pub fn BN_rshift1(r: *mut BIGNUM, a: *const BIGNUM) -> c_int;
BN_bn2hex(a: *const BIGNUM) -> *mut c_char111     pub fn BN_bn2hex(a: *const BIGNUM) -> *mut c_char;
BN_bn2dec(a: *const BIGNUM) -> *mut c_char112     pub fn BN_bn2dec(a: *const BIGNUM) -> *mut c_char;
BN_hex2bn(a: *mut *mut BIGNUM, s: *const c_char) -> c_int113     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_int114     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_int115     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 BIGNUM116     pub fn BN_mod_inverse(
117         r: *mut BIGNUM,
118         a: *const BIGNUM,
119         n: *const BIGNUM,
120         ctx: *mut BN_CTX,
121     ) -> *mut BIGNUM;
BN_clear(bn: *mut BIGNUM)122     pub fn BN_clear(bn: *mut BIGNUM);
BN_dup(n: *const BIGNUM) -> *mut BIGNUM123     pub fn BN_dup(n: *const BIGNUM) -> *mut BIGNUM;
BN_ucmp(a: *const BIGNUM, b: *const BIGNUM) -> c_int124     pub fn BN_ucmp(a: *const BIGNUM, b: *const BIGNUM) -> c_int;
BN_set_bit(a: *mut BIGNUM, n: c_int) -> c_int125     pub fn BN_set_bit(a: *mut BIGNUM, n: c_int) -> c_int;
BN_clear_bit(a: *mut BIGNUM, n: c_int) -> c_int126     pub fn BN_clear_bit(a: *mut BIGNUM, n: c_int) -> c_int;
127 
BN_generate_prime_ex( r: *mut BIGNUM, bits: c_int, safe: c_int, add: *const BIGNUM, rem: *const BIGNUM, cb: *mut BN_GENCB, ) -> c_int128     pub fn BN_generate_prime_ex(
129         r: *mut BIGNUM,
130         bits: c_int,
131         safe: c_int,
132         add: *const BIGNUM,
133         rem: *const BIGNUM,
134         cb: *mut BN_GENCB,
135     ) -> c_int;
136     #[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_int137     pub fn BN_is_prime_ex(
138         p: *const BIGNUM,
139         checks: c_int,
140         ctx: *mut BN_CTX,
141         cb: *mut BN_GENCB,
142     ) -> c_int;
143     #[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_int144     pub fn BN_is_prime_fasttest_ex(
145         p: *const BIGNUM,
146         checks: c_int,
147         ctx: *mut BN_CTX,
148         do_trial_division: c_int,
149         cb: *mut BN_GENCB,
150     ) -> c_int;
151 }
152 
153 cfg_if! {
154     if #[cfg(any(ossl110, libressl350))] {
155         extern "C" {
156             pub fn BN_get_rfc2409_prime_768(bn: *mut BIGNUM) -> *mut BIGNUM;
157             pub fn BN_get_rfc2409_prime_1024(bn: *mut BIGNUM) -> *mut BIGNUM;
158             pub fn BN_get_rfc3526_prime_1536(bn: *mut BIGNUM) -> *mut BIGNUM;
159             pub fn BN_get_rfc3526_prime_2048(bn: *mut BIGNUM) -> *mut BIGNUM;
160             pub fn BN_get_rfc3526_prime_3072(bn: *mut BIGNUM) -> *mut BIGNUM;
161             pub fn BN_get_rfc3526_prime_4096(bn: *mut BIGNUM) -> *mut BIGNUM;
162             pub fn BN_get_rfc3526_prime_6144(bn: *mut BIGNUM) -> *mut BIGNUM;
163             pub fn BN_get_rfc3526_prime_8192(bn: *mut BIGNUM) -> *mut BIGNUM;
164         }
165     } else {
166         extern "C" {
167             pub fn get_rfc2409_prime_768(bn: *mut BIGNUM) -> *mut BIGNUM;
168             pub fn get_rfc2409_prime_1024(bn: *mut BIGNUM) -> *mut BIGNUM;
169             pub fn get_rfc3526_prime_1536(bn: *mut BIGNUM) -> *mut BIGNUM;
170             pub fn get_rfc3526_prime_2048(bn: *mut BIGNUM) -> *mut BIGNUM;
171             pub fn get_rfc3526_prime_3072(bn: *mut BIGNUM) -> *mut BIGNUM;
172             pub fn get_rfc3526_prime_4096(bn: *mut BIGNUM) -> *mut BIGNUM;
173             pub fn get_rfc3526_prime_6144(bn: *mut BIGNUM) -> *mut BIGNUM;
174             pub fn get_rfc3526_prime_8192(bn: *mut BIGNUM) -> *mut BIGNUM;
175         }
176     }
177 }
178