]> git.proxmox.com Git - cargo.git/blob - vendor/openssl-sys/src/handwritten/bn.rs
New upstream version 0.63.1
[cargo.git] / vendor / openssl-sys / src / handwritten / bn.rs
1 use libc::*;
2 use *;
3
4 extern "C" {
5 pub fn BN_CTX_new() -> *mut BN_CTX;
6 #[cfg(ossl110)]
7 pub fn BN_CTX_secure_new() -> *mut BN_CTX;
8 pub fn BN_CTX_free(ctx: *mut BN_CTX);
9 pub fn BN_rand(r: *mut BIGNUM, bits: c_int, top: c_int, bottom: c_int) -> c_int;
10 pub fn BN_pseudo_rand(r: *mut BIGNUM, bits: c_int, top: c_int, bottom: c_int) -> c_int;
11 pub fn BN_rand_range(r: *mut BIGNUM, range: *const BIGNUM) -> c_int;
12 pub fn BN_pseudo_rand_range(r: *mut BIGNUM, range: *const BIGNUM) -> c_int;
13 pub fn BN_new() -> *mut BIGNUM;
14 #[cfg(ossl110)]
15 pub fn BN_secure_new() -> *mut BIGNUM;
16 #[cfg(ossl110)]
17 pub fn BN_set_flags(b: *mut BIGNUM, n: c_int);
18 #[cfg(ossl110)]
19 pub fn BN_get_flags(b: *const BIGNUM, n: c_int) -> c_int;
20 pub fn BN_num_bits(bn: *const BIGNUM) -> c_int;
21 pub fn BN_clear_free(bn: *mut BIGNUM);
22 pub fn BN_bin2bn(s: *const u8, size: c_int, ret: *mut BIGNUM) -> *mut BIGNUM;
23 pub fn BN_bn2bin(a: *const BIGNUM, to: *mut u8) -> c_int;
24 #[cfg(ossl110)]
25 pub fn BN_bn2binpad(a: *const BIGNUM, to: *mut u8, tolen: c_int) -> c_int;
26 pub fn BN_sub(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM) -> c_int;
27 pub fn BN_add(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM) -> c_int;
28 pub fn BN_mul(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, ctx: *mut BN_CTX) -> c_int;
29 pub fn BN_sqr(r: *mut BIGNUM, a: *const BIGNUM, ctx: *mut BN_CTX) -> c_int;
30 pub fn BN_set_negative(bn: *mut BIGNUM, n: c_int);
31 #[cfg(any(ossl110, libressl350))]
32 pub fn BN_is_negative(b: *const ::BIGNUM) -> c_int;
33
34 pub fn BN_div(
35 dv: *mut BIGNUM,
36 rem: *mut BIGNUM,
37 a: *const BIGNUM,
38 b: *const BIGNUM,
39 ctx: *mut BN_CTX,
40 ) -> c_int;
41 pub fn BN_nnmod(
42 rem: *mut BIGNUM,
43 a: *const BIGNUM,
44 m: *const BIGNUM,
45 ctx: *mut BN_CTX,
46 ) -> c_int;
47 pub fn BN_mod_add(
48 r: *mut BIGNUM,
49 a: *const BIGNUM,
50 b: *const BIGNUM,
51 m: *const BIGNUM,
52 ctx: *mut BN_CTX,
53 ) -> c_int;
54 pub fn BN_mod_sub(
55 r: *mut BIGNUM,
56 a: *const BIGNUM,
57 b: *const BIGNUM,
58 m: *const BIGNUM,
59 ctx: *mut BN_CTX,
60 ) -> c_int;
61 pub fn BN_mod_mul(
62 r: *mut BIGNUM,
63 a: *const BIGNUM,
64 b: *const BIGNUM,
65 m: *const BIGNUM,
66 ctx: *mut BN_CTX,
67 ) -> c_int;
68 pub fn BN_mod_sqr(
69 r: *mut BIGNUM,
70 a: *const BIGNUM,
71 m: *const BIGNUM,
72 ctx: *mut BN_CTX,
73 ) -> c_int;
74
75 pub fn BN_mod_word(r: *const BIGNUM, w: BN_ULONG) -> BN_ULONG;
76 pub fn BN_div_word(r: *mut BIGNUM, w: BN_ULONG) -> BN_ULONG;
77 pub fn BN_mul_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int;
78 pub fn BN_add_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int;
79 pub fn BN_sub_word(r: *mut BIGNUM, w: BN_ULONG) -> c_int;
80 pub fn BN_set_word(bn: *mut BIGNUM, n: BN_ULONG) -> c_int;
81
82 pub fn BN_cmp(a: *const BIGNUM, b: *const BIGNUM) -> c_int;
83 pub fn BN_free(bn: *mut BIGNUM);
84 pub fn BN_is_bit_set(a: *const BIGNUM, n: c_int) -> c_int;
85 pub fn BN_lshift(r: *mut BIGNUM, a: *const BIGNUM, n: c_int) -> c_int;
86 pub fn BN_lshift1(r: *mut BIGNUM, a: *const BIGNUM) -> c_int;
87 pub fn BN_exp(r: *mut BIGNUM, a: *const BIGNUM, p: *const BIGNUM, ctx: *mut BN_CTX) -> c_int;
88
89 pub fn BN_mod_exp(
90 r: *mut BIGNUM,
91 a: *const BIGNUM,
92 p: *const BIGNUM,
93 m: *const BIGNUM,
94 ctx: *mut BN_CTX,
95 ) -> c_int;
96
97 pub fn BN_mask_bits(a: *mut BIGNUM, n: c_int) -> c_int;
98 pub fn BN_rshift(r: *mut BIGNUM, a: *const BIGNUM, n: c_int) -> c_int;
99 pub fn BN_rshift1(r: *mut BIGNUM, a: *const BIGNUM) -> c_int;
100 pub fn BN_bn2hex(a: *const BIGNUM) -> *mut c_char;
101 pub fn BN_bn2dec(a: *const BIGNUM) -> *mut c_char;
102 pub fn BN_hex2bn(a: *mut *mut BIGNUM, s: *const c_char) -> c_int;
103 pub fn BN_dec2bn(a: *mut *mut BIGNUM, s: *const c_char) -> c_int;
104 pub fn BN_gcd(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM, ctx: *mut BN_CTX) -> c_int;
105 pub fn BN_mod_inverse(
106 r: *mut BIGNUM,
107 a: *const BIGNUM,
108 n: *const BIGNUM,
109 ctx: *mut BN_CTX,
110 ) -> *mut BIGNUM;
111 pub fn BN_clear(bn: *mut BIGNUM);
112 pub fn BN_dup(n: *const BIGNUM) -> *mut BIGNUM;
113 pub fn BN_ucmp(a: *const BIGNUM, b: *const BIGNUM) -> c_int;
114 pub fn BN_set_bit(a: *mut BIGNUM, n: c_int) -> c_int;
115 pub fn BN_clear_bit(a: *mut BIGNUM, n: c_int) -> c_int;
116
117 pub fn BN_generate_prime_ex(
118 r: *mut BIGNUM,
119 bits: c_int,
120 safe: c_int,
121 add: *const BIGNUM,
122 rem: *const BIGNUM,
123 cb: *mut BN_GENCB,
124 ) -> c_int;
125 pub fn BN_is_prime_ex(
126 p: *const BIGNUM,
127 checks: c_int,
128 ctx: *mut BN_CTX,
129 cb: *mut BN_GENCB,
130 ) -> c_int;
131 pub fn BN_is_prime_fasttest_ex(
132 p: *const BIGNUM,
133 checks: c_int,
134 ctx: *mut BN_CTX,
135 do_trial_division: c_int,
136 cb: *mut BN_GENCB,
137 ) -> c_int;
138 }
139
140 cfg_if! {
141 if #[cfg(any(ossl110, libressl350))] {
142 extern "C" {
143 pub fn BN_get_rfc2409_prime_768(bn: *mut BIGNUM) -> *mut BIGNUM;
144 pub fn BN_get_rfc2409_prime_1024(bn: *mut BIGNUM) -> *mut BIGNUM;
145 pub fn BN_get_rfc3526_prime_1536(bn: *mut BIGNUM) -> *mut BIGNUM;
146 pub fn BN_get_rfc3526_prime_2048(bn: *mut BIGNUM) -> *mut BIGNUM;
147 pub fn BN_get_rfc3526_prime_3072(bn: *mut BIGNUM) -> *mut BIGNUM;
148 pub fn BN_get_rfc3526_prime_4096(bn: *mut BIGNUM) -> *mut BIGNUM;
149 pub fn BN_get_rfc3526_prime_6144(bn: *mut BIGNUM) -> *mut BIGNUM;
150 pub fn BN_get_rfc3526_prime_8192(bn: *mut BIGNUM) -> *mut BIGNUM;
151 }
152 } else {
153 extern "C" {
154 pub fn get_rfc2409_prime_768(bn: *mut BIGNUM) -> *mut BIGNUM;
155 pub fn get_rfc2409_prime_1024(bn: *mut BIGNUM) -> *mut BIGNUM;
156 pub fn get_rfc3526_prime_1536(bn: *mut BIGNUM) -> *mut BIGNUM;
157 pub fn get_rfc3526_prime_2048(bn: *mut BIGNUM) -> *mut BIGNUM;
158 pub fn get_rfc3526_prime_3072(bn: *mut BIGNUM) -> *mut BIGNUM;
159 pub fn get_rfc3526_prime_4096(bn: *mut BIGNUM) -> *mut BIGNUM;
160 pub fn get_rfc3526_prime_6144(bn: *mut BIGNUM) -> *mut BIGNUM;
161 pub fn get_rfc3526_prime_8192(bn: *mut BIGNUM) -> *mut BIGNUM;
162 }
163 }
164 }