variant_ssl_sys/handwritten/
ec.rs1use super::super::*;
2use libc::*;
3
4#[cfg(ossl300)]
5extern "C" {
6 pub fn EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx: *mut EVP_PKEY_CTX, nid: c_int) -> c_int;
7}
8
9#[repr(C)]
10#[derive(Copy, Clone)]
11pub enum point_conversion_form_t {
12 POINT_CONVERSION_COMPRESSED = 2,
13 POINT_CONVERSION_UNCOMPRESSED = 4,
14 POINT_CONVERSION_HYBRID = 6,
15}
16
17#[cfg(not(any(libressl410, osslconf = "OPENSSL_NO_DEPRECATED_3_0")))]
18pub enum EC_METHOD {}
19pub enum EC_GROUP {}
20pub enum EC_POINT {}
21
22extern "C" {
23 #[cfg(not(any(libressl410, osslconf = "OPENSSL_NO_DEPRECATED_3_0")))]
24 pub fn EC_GROUP_new(meth: *const EC_METHOD) -> *mut EC_GROUP;
25
26 pub fn EC_GROUP_dup(group: *const EC_GROUP) -> *mut EC_GROUP;
27
28 pub fn EC_GROUP_free(group: *mut EC_GROUP);
29
30 pub fn EC_GROUP_get_order(
31 group: *const EC_GROUP,
32 order: *mut BIGNUM,
33 ctx: *mut BN_CTX,
34 ) -> c_int;
35
36 pub fn EC_GROUP_get_cofactor(
37 group: *const EC_GROUP,
38 cofactor: *mut BIGNUM,
39 ctx: *mut BN_CTX,
40 ) -> c_int;
41
42 pub fn EC_GROUP_get0_generator(group: *const EC_GROUP) -> *const EC_POINT;
43
44 pub fn EC_GROUP_set_generator(
45 group: *mut EC_GROUP,
46 generator: *const EC_POINT,
47 order: *const BIGNUM,
48 cofactor: *const BIGNUM,
49 ) -> c_int;
50
51 pub fn EC_GROUP_get_curve_name(group: *const EC_GROUP) -> c_int;
52
53 pub fn EC_GROUP_set_asn1_flag(key: *mut EC_GROUP, flag: c_int);
54
55 pub fn EC_GROUP_get_asn1_flag(group: *const EC_GROUP) -> c_int;
56
57 pub fn EC_GROUP_get_degree(group: *const EC_GROUP) -> c_int;
58
59 pub fn EC_GROUP_order_bits(group: *const EC_GROUP) -> c_int;
60
61 pub fn EC_GROUP_new_curve_GFp(
62 p: *const BIGNUM,
63 a: *const BIGNUM,
64 b: *const BIGNUM,
65 ctx: *mut BN_CTX,
66 ) -> *mut EC_GROUP;
67
68 #[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
69 pub fn EC_GROUP_new_curve_GF2m(
70 p: *const BIGNUM,
71 a: *const BIGNUM,
72 b: *const BIGNUM,
73 ctx: *mut BN_CTX,
74 ) -> *mut EC_GROUP;
75
76 pub fn EC_GROUP_new_by_curve_name(nid: c_int) -> *mut EC_GROUP;
77
78 pub fn EC_POINT_is_at_infinity(group: *const EC_GROUP, point: *const EC_POINT) -> c_int;
79
80 pub fn EC_POINT_is_on_curve(
81 group: *const EC_GROUP,
82 point: *const EC_POINT,
83 ctx: *mut BN_CTX,
84 ) -> c_int;
85
86 pub fn EC_POINT_new(group: *const EC_GROUP) -> *mut EC_POINT;
87
88 pub fn EC_POINT_free(point: *mut EC_POINT);
89
90 pub fn EC_POINT_dup(p: *const EC_POINT, group: *const EC_GROUP) -> *mut EC_POINT;
91
92 #[cfg(any(ossl111, libressl))]
93 pub fn EC_POINT_get_affine_coordinates(
94 group: *const EC_GROUP,
95 p: *const EC_POINT,
96 x: *mut BIGNUM,
97 y: *mut BIGNUM,
98 ctx: *mut BN_CTX,
99 ) -> c_int;
100
101 #[cfg(any(ossl111, libressl))]
102 pub fn EC_POINT_set_affine_coordinates(
103 group: *const EC_GROUP,
104 p: *mut EC_POINT,
105 x: *const BIGNUM,
106 y: *const BIGNUM,
107 ctx: *mut BN_CTX,
108 ) -> c_int;
109
110 pub fn EC_POINT_point2oct(
111 group: *const EC_GROUP,
112 p: *const EC_POINT,
113 form: point_conversion_form_t,
114 buf: *mut c_uchar,
115 len: size_t,
116 ctx: *mut BN_CTX,
117 ) -> size_t;
118
119 pub fn EC_POINT_oct2point(
120 group: *const EC_GROUP,
121 p: *mut EC_POINT,
122 buf: *const c_uchar,
123 len: size_t,
124 ctx: *mut BN_CTX,
125 ) -> c_int;
126
127 pub fn EC_POINT_point2hex(
128 group: *const EC_GROUP,
129 p: *const EC_POINT,
130 form: point_conversion_form_t,
131 ctx: *mut BN_CTX,
132 ) -> *mut c_char;
133
134 pub fn EC_POINT_hex2point(
135 group: *const EC_GROUP,
136 s: *const c_char,
137 p: *mut EC_POINT,
138 ctx: *mut BN_CTX,
139 ) -> *mut EC_POINT;
140
141 pub fn EC_POINT_add(
142 group: *const EC_GROUP,
143 r: *mut EC_POINT,
144 a: *const EC_POINT,
145 b: *const EC_POINT,
146 ctx: *mut BN_CTX,
147 ) -> c_int;
148
149 pub fn EC_POINT_invert(group: *const EC_GROUP, r: *mut EC_POINT, ctx: *mut BN_CTX) -> c_int;
150
151 pub fn EC_POINT_cmp(
152 group: *const EC_GROUP,
153 a: *const EC_POINT,
154 b: *const EC_POINT,
155 ctx: *mut BN_CTX,
156 ) -> c_int;
157
158 pub fn EC_POINT_mul(
159 group: *const EC_GROUP,
160 r: *mut EC_POINT,
161 n: *const BIGNUM,
162 q: *const EC_POINT,
163 m: *const BIGNUM,
164 ctx: *mut BN_CTX,
165 ) -> c_int;
166}
167
168#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
169extern "C" {
170 #[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
171 pub fn EC_GF2m_simple_method() -> *const EC_METHOD;
172
173 pub fn EC_GROUP_get_curve_GFp(
174 group: *const EC_GROUP,
175 p: *mut BIGNUM,
176 a: *mut BIGNUM,
177 b: *mut BIGNUM,
178 ctx: *mut BN_CTX,
179 ) -> c_int;
180
181 #[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
182 pub fn EC_GROUP_get_curve_GF2m(
183 group: *const EC_GROUP,
184 p: *mut BIGNUM,
185 a: *mut BIGNUM,
186 b: *mut BIGNUM,
187 ctx: *mut BN_CTX,
188 ) -> c_int;
189
190 pub fn EC_POINT_get_affine_coordinates_GFp(
191 group: *const EC_GROUP,
192 p: *const EC_POINT,
193 x: *mut BIGNUM,
194 y: *mut BIGNUM,
195 ctx: *mut BN_CTX,
196 ) -> c_int;
197
198 pub fn EC_POINT_set_affine_coordinates_GFp(
199 group: *const EC_GROUP,
200 p: *mut EC_POINT,
201 x: *const BIGNUM,
202 y: *const BIGNUM,
203 ctx: *mut BN_CTX,
204 ) -> c_int;
205
206 #[cfg(not(osslconf = "OPENSSL_NO_EC2M"))]
207 pub fn EC_POINT_get_affine_coordinates_GF2m(
208 group: *const EC_GROUP,
209 p: *const EC_POINT,
210 x: *mut BIGNUM,
211 y: *mut BIGNUM,
212 ctx: *mut BN_CTX,
213 ) -> c_int;
214
215 pub fn EC_KEY_new() -> *mut EC_KEY;
216
217 pub fn EC_KEY_new_by_curve_name(nid: c_int) -> *mut EC_KEY;
218
219 pub fn EC_KEY_free(key: *mut EC_KEY);
220
221 pub fn EC_KEY_dup(key: *const EC_KEY) -> *mut EC_KEY;
222
223 pub fn EC_KEY_up_ref(key: *mut EC_KEY) -> c_int;
224
225 pub fn EC_KEY_get0_group(key: *const EC_KEY) -> *const EC_GROUP;
226
227 pub fn EC_KEY_set_group(key: *mut EC_KEY, group: *const EC_GROUP) -> c_int;
228
229 pub fn EC_KEY_get0_private_key(key: *const EC_KEY) -> *const BIGNUM;
230
231 pub fn EC_KEY_set_private_key(key: *mut EC_KEY, key: *const BIGNUM) -> c_int;
232
233 pub fn EC_KEY_get0_public_key(key: *const EC_KEY) -> *const EC_POINT;
234
235 pub fn EC_KEY_set_public_key(key: *mut EC_KEY, key: *const EC_POINT) -> c_int;
236
237 pub fn EC_KEY_generate_key(key: *mut EC_KEY) -> c_int;
238
239 pub fn EC_KEY_check_key(key: *const EC_KEY) -> c_int;
240
241 pub fn EC_KEY_set_public_key_affine_coordinates(
242 key: *mut EC_KEY,
243 x: *mut BIGNUM,
244 y: *mut BIGNUM,
245 ) -> c_int;
246}
247
248pub enum ECDSA_SIG {}
249
250extern "C" {
251 pub fn ECDSA_SIG_new() -> *mut ECDSA_SIG;
252
253 pub fn ECDSA_SIG_free(sig: *mut ECDSA_SIG);
254
255 pub fn ECDSA_SIG_get0(sig: *const ECDSA_SIG, pr: *mut *const BIGNUM, ps: *mut *const BIGNUM);
256
257 pub fn ECDSA_SIG_set0(sig: *mut ECDSA_SIG, pr: *mut BIGNUM, ps: *mut BIGNUM) -> c_int;
258
259 pub fn d2i_ECDSA_SIG(
260 sig: *mut *mut ECDSA_SIG,
261 inp: *mut *const c_uchar,
262 length: c_long,
263 ) -> *mut ECDSA_SIG;
264
265 pub fn i2d_ECDSA_SIG(sig: *const ECDSA_SIG, out: *mut *mut c_uchar) -> c_int;
266}
267
268#[cfg(not(osslconf = "OPENSSL_NO_DEPRECATED_3_0"))]
269extern "C" {
270 pub fn ECDSA_do_sign(
271 dgst: *const c_uchar,
272 dgst_len: c_int,
273 eckey: *mut EC_KEY,
274 ) -> *mut ECDSA_SIG;
275
276 pub fn ECDSA_do_verify(
277 dgst: *const c_uchar,
278 dgst_len: c_int,
279 sig: *const ECDSA_SIG,
280 eckey: *mut EC_KEY,
281 ) -> c_int;
282}