1 | use super::super::*; |
2 | use libc::*; |
3 | |
4 | cfg_if! { |
5 | if #[cfg(ossl300)] { |
6 | extern "C" { |
7 | pub fn EVP_MD_get_block_size(md: *const EVP_MD) -> c_int; |
8 | pub fn EVP_MD_get_size(md: *const EVP_MD) -> c_int; |
9 | pub fn EVP_MD_get_type(md: *const EVP_MD) -> c_int; |
10 | |
11 | pub fn EVP_MD_CTX_get0_md(ctx: *const EVP_MD_CTX) -> *const EVP_MD; |
12 | |
13 | pub fn EVP_CIPHER_get_key_length(cipher: *const EVP_CIPHER) -> c_int; |
14 | pub fn EVP_CIPHER_get_block_size(cipher: *const EVP_CIPHER) -> c_int; |
15 | pub fn EVP_CIPHER_get_iv_length(cipher: *const EVP_CIPHER) -> c_int; |
16 | pub fn EVP_CIPHER_get_nid(cipher: *const EVP_CIPHER) -> c_int; |
17 | pub fn EVP_CIPHER_fetch( |
18 | ctx: *mut OSSL_LIB_CTX, |
19 | algorithm: *const c_char, |
20 | properties: *const c_char, |
21 | ) -> *mut EVP_CIPHER; |
22 | pub fn EVP_CIPHER_free(cipher: *mut EVP_CIPHER); |
23 | |
24 | pub fn EVP_CIPHER_CTX_get0_cipher(ctx: *const EVP_CIPHER_CTX) -> *const EVP_CIPHER; |
25 | pub fn EVP_CIPHER_CTX_get_block_size(ctx: *const EVP_CIPHER_CTX) -> c_int; |
26 | pub fn EVP_CIPHER_CTX_get_key_length(ctx: *const EVP_CIPHER_CTX) -> c_int; |
27 | pub fn EVP_CIPHER_CTX_get_iv_length(ctx: *const EVP_CIPHER_CTX) -> c_int; |
28 | pub fn EVP_CIPHER_CTX_get_tag_length(ctx: *const EVP_CIPHER_CTX) -> c_int; |
29 | pub fn EVP_CIPHER_CTX_get_num(ctx: *const EVP_CIPHER_CTX) -> c_int; |
30 | } |
31 | } else { |
32 | extern "C" { |
33 | pub fn EVP_MD_block_size(md: *const EVP_MD) -> c_int; |
34 | pub fn EVP_MD_size(md: *const EVP_MD) -> c_int; |
35 | pub fn EVP_MD_type(md: *const EVP_MD) -> c_int; |
36 | |
37 | pub fn EVP_MD_CTX_md(ctx: *const EVP_MD_CTX) -> *const EVP_MD; |
38 | |
39 | pub fn EVP_CIPHER_key_length(cipher: *const EVP_CIPHER) -> c_int; |
40 | pub fn EVP_CIPHER_block_size(cipher: *const EVP_CIPHER) -> c_int; |
41 | pub fn EVP_CIPHER_iv_length(cipher: *const EVP_CIPHER) -> c_int; |
42 | pub fn EVP_CIPHER_nid(cipher: *const EVP_CIPHER) -> c_int; |
43 | |
44 | pub fn EVP_CIPHER_CTX_cipher(ctx: *const EVP_CIPHER_CTX) -> *const EVP_CIPHER; |
45 | pub fn EVP_CIPHER_CTX_block_size(ctx: *const EVP_CIPHER_CTX) -> c_int; |
46 | pub fn EVP_CIPHER_CTX_key_length(ctx: *const EVP_CIPHER_CTX) -> c_int; |
47 | pub fn EVP_CIPHER_CTX_iv_length(ctx: *const EVP_CIPHER_CTX) -> c_int; |
48 | #[cfg (ossl110)] |
49 | pub fn EVP_CIPHER_CTX_num(ctx: *const EVP_CIPHER_CTX) -> c_int; |
50 | } |
51 | } |
52 | } |
53 | |
54 | cfg_if! { |
55 | if #[cfg(any(ossl110, libressl382))] { |
56 | extern "C" { |
57 | pub fn EVP_MD_CTX_new() -> *mut EVP_MD_CTX; |
58 | pub fn EVP_MD_CTX_free(ctx: *mut EVP_MD_CTX); |
59 | } |
60 | } else { |
61 | extern "C" { |
62 | pub fn EVP_MD_CTX_create() -> *mut EVP_MD_CTX; |
63 | pub fn EVP_MD_CTX_destroy(ctx: *mut EVP_MD_CTX); |
64 | } |
65 | } |
66 | } |
67 | |
68 | cfg_if! { |
69 | if #[cfg(ossl300)] { |
70 | extern "C" { |
71 | pub fn EVP_default_properties_is_fips_enabled(libctx: *mut OSSL_LIB_CTX) -> c_int; |
72 | pub fn EVP_default_properties_enable_fips(libctx: *mut OSSL_LIB_CTX, enable: c_int) -> c_int; |
73 | } |
74 | } |
75 | } |
76 | |
77 | extern "C" { |
78 | pub fn EVP_DigestInit_ex(ctx: *mut EVP_MD_CTX, typ: *const EVP_MD, imple: *mut ENGINE) |
79 | -> c_int; |
80 | pub fn EVP_DigestUpdate(ctx: *mut EVP_MD_CTX, data: *const c_void, n: size_t) -> c_int; |
81 | pub fn EVP_DigestFinal_ex(ctx: *mut EVP_MD_CTX, res: *mut u8, n: *mut u32) -> c_int; |
82 | #[cfg (ossl300)] |
83 | pub fn EVP_Q_digest( |
84 | libctx: *mut OSSL_LIB_CTX, |
85 | name: *const c_char, |
86 | propq: *const c_char, |
87 | data: *const c_void, |
88 | count: size_t, |
89 | md: *mut c_uchar, |
90 | size: *mut size_t, |
91 | ) -> c_int; |
92 | pub fn EVP_DigestInit(ctx: *mut EVP_MD_CTX, typ: *const EVP_MD) -> c_int; |
93 | pub fn EVP_DigestFinal(ctx: *mut EVP_MD_CTX, res: *mut u8, n: *mut u32) -> c_int; |
94 | #[cfg (ossl111)] |
95 | pub fn EVP_DigestFinalXOF(ctx: *mut EVP_MD_CTX, res: *mut u8, len: usize) -> c_int; |
96 | |
97 | #[cfg (ossl300)] |
98 | pub fn EVP_MD_fetch( |
99 | ctx: *mut OSSL_LIB_CTX, |
100 | algorithm: *const c_char, |
101 | properties: *const c_char, |
102 | ) -> *mut EVP_MD; |
103 | |
104 | #[cfg (ossl300)] |
105 | pub fn EVP_MD_free(md: *mut EVP_MD); |
106 | |
107 | pub fn EVP_BytesToKey( |
108 | typ: *const EVP_CIPHER, |
109 | md: *const EVP_MD, |
110 | salt: *const u8, |
111 | data: *const u8, |
112 | datalen: c_int, |
113 | count: c_int, |
114 | key: *mut u8, |
115 | iv: *mut u8, |
116 | ) -> c_int; |
117 | |
118 | pub fn EVP_CipherInit( |
119 | ctx: *mut EVP_CIPHER_CTX, |
120 | evp: *const EVP_CIPHER, |
121 | key: *const u8, |
122 | iv: *const u8, |
123 | mode: c_int, |
124 | ) -> c_int; |
125 | pub fn EVP_CipherInit_ex( |
126 | ctx: *mut EVP_CIPHER_CTX, |
127 | type_: *const EVP_CIPHER, |
128 | impl_: *mut ENGINE, |
129 | key: *const c_uchar, |
130 | iv: *const c_uchar, |
131 | enc: c_int, |
132 | ) -> c_int; |
133 | pub fn EVP_CipherUpdate( |
134 | ctx: *mut EVP_CIPHER_CTX, |
135 | outbuf: *mut u8, |
136 | outlen: *mut c_int, |
137 | inbuf: *const u8, |
138 | inlen: c_int, |
139 | ) -> c_int; |
140 | pub fn EVP_CipherFinal(ctx: *mut EVP_CIPHER_CTX, res: *mut u8, len: *mut c_int) -> c_int; |
141 | |
142 | pub fn EVP_DigestSignInit( |
143 | ctx: *mut EVP_MD_CTX, |
144 | pctx: *mut *mut EVP_PKEY_CTX, |
145 | type_: *const EVP_MD, |
146 | e: *mut ENGINE, |
147 | pkey: *mut EVP_PKEY, |
148 | ) -> c_int; |
149 | |
150 | #[cfg (ossl300)] |
151 | pub fn EVP_DigestSignUpdate(ctx: *mut EVP_MD_CTX, data: *const c_void, dsize: size_t) -> c_int; |
152 | pub fn EVP_DigestSignFinal( |
153 | ctx: *mut EVP_MD_CTX, |
154 | sig: *mut c_uchar, |
155 | siglen: *mut size_t, |
156 | ) -> c_int; |
157 | pub fn EVP_DigestVerifyInit( |
158 | ctx: *mut EVP_MD_CTX, |
159 | pctx: *mut *mut EVP_PKEY_CTX, |
160 | type_: *const EVP_MD, |
161 | e: *mut ENGINE, |
162 | pkey: *mut EVP_PKEY, |
163 | ) -> c_int; |
164 | #[cfg (ossl300)] |
165 | pub fn EVP_DigestVerifyUpdate( |
166 | ctx: *mut EVP_MD_CTX, |
167 | data: *const c_void, |
168 | dsize: size_t, |
169 | ) -> c_int; |
170 | pub fn EVP_SealInit( |
171 | ctx: *mut EVP_CIPHER_CTX, |
172 | type_: *const EVP_CIPHER, |
173 | ek: *mut *mut c_uchar, |
174 | ekl: *mut c_int, |
175 | iv: *mut c_uchar, |
176 | pubk: *mut *mut EVP_PKEY, |
177 | npubk: c_int, |
178 | ) -> c_int; |
179 | pub fn EVP_SealFinal(ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int) -> c_int; |
180 | pub fn EVP_EncryptInit_ex( |
181 | ctx: *mut EVP_CIPHER_CTX, |
182 | cipher: *const EVP_CIPHER, |
183 | impl_: *mut ENGINE, |
184 | key: *const c_uchar, |
185 | iv: *const c_uchar, |
186 | ) -> c_int; |
187 | pub fn EVP_EncryptUpdate( |
188 | ctx: *mut EVP_CIPHER_CTX, |
189 | out: *mut c_uchar, |
190 | outl: *mut c_int, |
191 | in_: *const u8, |
192 | inl: c_int, |
193 | ) -> c_int; |
194 | pub fn EVP_EncryptFinal_ex( |
195 | ctx: *mut EVP_CIPHER_CTX, |
196 | out: *mut c_uchar, |
197 | outl: *mut c_int, |
198 | ) -> c_int; |
199 | pub fn EVP_OpenInit( |
200 | ctx: *mut EVP_CIPHER_CTX, |
201 | type_: *const EVP_CIPHER, |
202 | ek: *const c_uchar, |
203 | ekl: c_int, |
204 | iv: *const c_uchar, |
205 | priv_: *mut EVP_PKEY, |
206 | ) -> c_int; |
207 | pub fn EVP_OpenFinal(ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int) -> c_int; |
208 | pub fn EVP_DecryptInit_ex( |
209 | ctx: *mut EVP_CIPHER_CTX, |
210 | cipher: *const EVP_CIPHER, |
211 | impl_: *mut ENGINE, |
212 | key: *const c_uchar, |
213 | iv: *const c_uchar, |
214 | ) -> c_int; |
215 | pub fn EVP_DecryptUpdate( |
216 | ctx: *mut EVP_CIPHER_CTX, |
217 | out: *mut c_uchar, |
218 | outl: *mut c_int, |
219 | in_: *const u8, |
220 | inl: c_int, |
221 | ) -> c_int; |
222 | pub fn EVP_DecryptFinal_ex( |
223 | ctx: *mut EVP_CIPHER_CTX, |
224 | outm: *mut c_uchar, |
225 | outl: *mut c_int, |
226 | ) -> c_int; |
227 | } |
228 | cfg_if! { |
229 | if #[cfg(ossl300)] { |
230 | extern "C" { |
231 | pub fn EVP_PKEY_get_size(pkey: *const EVP_PKEY) -> c_int; |
232 | } |
233 | } else { |
234 | const_ptr_api! { |
235 | extern "C" { |
236 | pub fn EVP_PKEY_size(pkey: #[const_ptr_if(any(ossl111b, libressl280))] EVP_PKEY) -> c_int; |
237 | } |
238 | } |
239 | } |
240 | } |
241 | cfg_if! { |
242 | if #[cfg(any(ossl111, libressl370))] { |
243 | extern "C" { |
244 | pub fn EVP_DigestSign( |
245 | ctx: *mut EVP_MD_CTX, |
246 | sigret: *mut c_uchar, |
247 | siglen: *mut size_t, |
248 | tbs: *const c_uchar, |
249 | tbslen: size_t |
250 | ) -> c_int; |
251 | |
252 | pub fn EVP_DigestVerify( |
253 | ctx: *mut EVP_MD_CTX, |
254 | sigret: *const c_uchar, |
255 | siglen: size_t, |
256 | tbs: *const c_uchar, |
257 | tbslen: size_t |
258 | ) -> c_int; |
259 | } |
260 | } |
261 | } |
262 | const_ptr_api! { |
263 | extern "C" { |
264 | pub fn EVP_DigestVerifyFinal( |
265 | ctx: *mut EVP_MD_CTX, |
266 | sigret: #[const_ptr_if(any(ossl102, libressl280))] c_uchar, |
267 | siglen: size_t, |
268 | ) -> c_int; |
269 | } |
270 | } |
271 | |
272 | extern "C" { |
273 | pub fn EVP_CIPHER_CTX_new() -> *mut EVP_CIPHER_CTX; |
274 | pub fn EVP_CIPHER_CTX_free(ctx: *mut EVP_CIPHER_CTX); |
275 | pub fn EVP_CIPHER_CTX_copy(dst: *mut EVP_CIPHER_CTX, src: *const EVP_CIPHER_CTX) -> c_int; |
276 | |
277 | pub fn EVP_MD_CTX_copy_ex(dst: *mut EVP_MD_CTX, src: *const EVP_MD_CTX) -> c_int; |
278 | #[cfg (ossl111)] |
279 | pub fn EVP_MD_CTX_reset(ctx: *mut EVP_MD_CTX) -> c_int; |
280 | pub fn EVP_CIPHER_CTX_set_key_length(ctx: *mut EVP_CIPHER_CTX, keylen: c_int) -> c_int; |
281 | pub fn EVP_CIPHER_CTX_set_padding(ctx: *mut EVP_CIPHER_CTX, padding: c_int) -> c_int; |
282 | pub fn EVP_CIPHER_CTX_ctrl( |
283 | ctx: *mut EVP_CIPHER_CTX, |
284 | type_: c_int, |
285 | arg: c_int, |
286 | ptr: *mut c_void, |
287 | ) -> c_int; |
288 | pub fn EVP_CIPHER_CTX_rand_key(ctx: *mut EVP_CIPHER_CTX, key: *mut c_uchar) -> c_int; |
289 | pub fn EVP_CIPHER_CTX_set_flags(ctx: *mut EVP_CIPHER_CTX, flags: c_int); |
290 | |
291 | pub fn EVP_md_null() -> *const EVP_MD; |
292 | pub fn EVP_md5() -> *const EVP_MD; |
293 | pub fn EVP_sha1() -> *const EVP_MD; |
294 | pub fn EVP_sha224() -> *const EVP_MD; |
295 | pub fn EVP_sha256() -> *const EVP_MD; |
296 | pub fn EVP_sha384() -> *const EVP_MD; |
297 | pub fn EVP_sha512() -> *const EVP_MD; |
298 | #[cfg (any(ossl111, libressl380))] |
299 | pub fn EVP_sha3_224() -> *const EVP_MD; |
300 | #[cfg (any(ossl111, libressl380))] |
301 | pub fn EVP_sha3_256() -> *const EVP_MD; |
302 | #[cfg (any(ossl111, libressl380))] |
303 | pub fn EVP_sha3_384() -> *const EVP_MD; |
304 | #[cfg (any(ossl111, libressl380))] |
305 | pub fn EVP_sha3_512() -> *const EVP_MD; |
306 | #[cfg (ossl111)] |
307 | pub fn EVP_shake128() -> *const EVP_MD; |
308 | #[cfg (ossl111)] |
309 | pub fn EVP_shake256() -> *const EVP_MD; |
310 | pub fn EVP_ripemd160() -> *const EVP_MD; |
311 | #[cfg (all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM3" )))] |
312 | pub fn EVP_sm3() -> *const EVP_MD; |
313 | pub fn EVP_des_ecb() -> *const EVP_CIPHER; |
314 | pub fn EVP_des_ede3() -> *const EVP_CIPHER; |
315 | pub fn EVP_des_ede3_cbc() -> *const EVP_CIPHER; |
316 | pub fn EVP_des_ede3_ecb() -> *const EVP_CIPHER; |
317 | pub fn EVP_des_ede3_cfb64() -> *const EVP_CIPHER; |
318 | pub fn EVP_des_ede3_cfb8() -> *const EVP_CIPHER; |
319 | pub fn EVP_des_ede3_ofb() -> *const EVP_CIPHER; |
320 | pub fn EVP_des_cbc() -> *const EVP_CIPHER; |
321 | #[cfg (not(osslconf = "OPENSSL_NO_RC4" ))] |
322 | pub fn EVP_rc4() -> *const EVP_CIPHER; |
323 | pub fn EVP_bf_ecb() -> *const EVP_CIPHER; |
324 | pub fn EVP_bf_cbc() -> *const EVP_CIPHER; |
325 | pub fn EVP_bf_cfb64() -> *const EVP_CIPHER; |
326 | pub fn EVP_bf_ofb() -> *const EVP_CIPHER; |
327 | pub fn EVP_aes_128_ecb() -> *const EVP_CIPHER; |
328 | pub fn EVP_aes_128_cbc() -> *const EVP_CIPHER; |
329 | pub fn EVP_aes_128_cfb1() -> *const EVP_CIPHER; |
330 | pub fn EVP_aes_128_cfb8() -> *const EVP_CIPHER; |
331 | pub fn EVP_aes_128_cfb128() -> *const EVP_CIPHER; |
332 | pub fn EVP_aes_128_ctr() -> *const EVP_CIPHER; |
333 | pub fn EVP_aes_128_ccm() -> *const EVP_CIPHER; |
334 | pub fn EVP_aes_128_gcm() -> *const EVP_CIPHER; |
335 | pub fn EVP_aes_128_xts() -> *const EVP_CIPHER; |
336 | pub fn EVP_aes_128_ofb() -> *const EVP_CIPHER; |
337 | #[cfg (ossl110)] |
338 | pub fn EVP_aes_128_ocb() -> *const EVP_CIPHER; |
339 | #[cfg (ossl102)] |
340 | pub fn EVP_aes_128_wrap() -> *const EVP_CIPHER; |
341 | #[cfg (ossl110)] |
342 | pub fn EVP_aes_128_wrap_pad() -> *const EVP_CIPHER; |
343 | pub fn EVP_aes_192_ecb() -> *const EVP_CIPHER; |
344 | pub fn EVP_aes_192_cbc() -> *const EVP_CIPHER; |
345 | pub fn EVP_aes_192_cfb1() -> *const EVP_CIPHER; |
346 | pub fn EVP_aes_192_cfb8() -> *const EVP_CIPHER; |
347 | pub fn EVP_aes_192_cfb128() -> *const EVP_CIPHER; |
348 | pub fn EVP_aes_192_ctr() -> *const EVP_CIPHER; |
349 | pub fn EVP_aes_192_ccm() -> *const EVP_CIPHER; |
350 | pub fn EVP_aes_192_gcm() -> *const EVP_CIPHER; |
351 | pub fn EVP_aes_192_ofb() -> *const EVP_CIPHER; |
352 | #[cfg (ossl110)] |
353 | pub fn EVP_aes_192_ocb() -> *const EVP_CIPHER; |
354 | #[cfg (ossl102)] |
355 | pub fn EVP_aes_192_wrap() -> *const EVP_CIPHER; |
356 | #[cfg (ossl110)] |
357 | pub fn EVP_aes_192_wrap_pad() -> *const EVP_CIPHER; |
358 | pub fn EVP_aes_256_ecb() -> *const EVP_CIPHER; |
359 | pub fn EVP_aes_256_cbc() -> *const EVP_CIPHER; |
360 | pub fn EVP_aes_256_cfb1() -> *const EVP_CIPHER; |
361 | pub fn EVP_aes_256_cfb8() -> *const EVP_CIPHER; |
362 | pub fn EVP_aes_256_cfb128() -> *const EVP_CIPHER; |
363 | pub fn EVP_aes_256_ctr() -> *const EVP_CIPHER; |
364 | pub fn EVP_aes_256_ccm() -> *const EVP_CIPHER; |
365 | pub fn EVP_aes_256_gcm() -> *const EVP_CIPHER; |
366 | pub fn EVP_aes_256_xts() -> *const EVP_CIPHER; |
367 | pub fn EVP_aes_256_ofb() -> *const EVP_CIPHER; |
368 | #[cfg (ossl110)] |
369 | pub fn EVP_aes_256_ocb() -> *const EVP_CIPHER; |
370 | #[cfg (ossl102)] |
371 | pub fn EVP_aes_256_wrap() -> *const EVP_CIPHER; |
372 | #[cfg (ossl110)] |
373 | pub fn EVP_aes_256_wrap_pad() -> *const EVP_CIPHER; |
374 | #[cfg (all(any(ossl110, libressl310), not(osslconf = "OPENSSL_NO_CHACHA" )))] |
375 | pub fn EVP_chacha20() -> *const EVP_CIPHER; |
376 | #[cfg (all(any(ossl110, libressl360), not(osslconf = "OPENSSL_NO_CHACHA" )))] |
377 | pub fn EVP_chacha20_poly1305() -> *const EVP_CIPHER; |
378 | #[cfg (not(osslconf = "OPENSSL_NO_SEED" ))] |
379 | pub fn EVP_seed_cbc() -> *const EVP_CIPHER; |
380 | #[cfg (not(osslconf = "OPENSSL_NO_SEED" ))] |
381 | pub fn EVP_seed_cfb128() -> *const EVP_CIPHER; |
382 | #[cfg (not(osslconf = "OPENSSL_NO_SEED" ))] |
383 | pub fn EVP_seed_ecb() -> *const EVP_CIPHER; |
384 | #[cfg (not(osslconf = "OPENSSL_NO_SEED" ))] |
385 | pub fn EVP_seed_ofb() -> *const EVP_CIPHER; |
386 | |
387 | #[cfg (all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4" )))] |
388 | pub fn EVP_sm4_ecb() -> *const EVP_CIPHER; |
389 | #[cfg (all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4" )))] |
390 | pub fn EVP_sm4_cbc() -> *const EVP_CIPHER; |
391 | #[cfg (all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4" )))] |
392 | pub fn EVP_sm4_cfb128() -> *const EVP_CIPHER; |
393 | #[cfg (all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4" )))] |
394 | pub fn EVP_sm4_ofb() -> *const EVP_CIPHER; |
395 | #[cfg (all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4" )))] |
396 | pub fn EVP_sm4_ctr() -> *const EVP_CIPHER; |
397 | |
398 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
399 | pub fn EVP_camellia_128_cfb128() -> *const EVP_CIPHER; |
400 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
401 | pub fn EVP_camellia_128_ecb() -> *const EVP_CIPHER; |
402 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
403 | pub fn EVP_camellia_128_cbc() -> *const EVP_CIPHER; |
404 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
405 | pub fn EVP_camellia_128_ofb() -> *const EVP_CIPHER; |
406 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
407 | pub fn EVP_camellia_192_cfb128() -> *const EVP_CIPHER; |
408 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
409 | pub fn EVP_camellia_192_ecb() -> *const EVP_CIPHER; |
410 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
411 | pub fn EVP_camellia_192_cbc() -> *const EVP_CIPHER; |
412 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
413 | pub fn EVP_camellia_192_ofb() -> *const EVP_CIPHER; |
414 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
415 | pub fn EVP_camellia_256_cfb128() -> *const EVP_CIPHER; |
416 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
417 | pub fn EVP_camellia_256_ecb() -> *const EVP_CIPHER; |
418 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
419 | pub fn EVP_camellia_256_cbc() -> *const EVP_CIPHER; |
420 | #[cfg (not(osslconf = "OPENSSL_NO_CAMELLIA" ))] |
421 | pub fn EVP_camellia_256_ofb() -> *const EVP_CIPHER; |
422 | |
423 | #[cfg (not(osslconf = "OPENSSL_NO_CAST" ))] |
424 | pub fn EVP_cast5_cfb64() -> *const EVP_CIPHER; |
425 | #[cfg (not(osslconf = "OPENSSL_NO_CAST" ))] |
426 | pub fn EVP_cast5_ecb() -> *const EVP_CIPHER; |
427 | #[cfg (not(osslconf = "OPENSSL_NO_CAST" ))] |
428 | pub fn EVP_cast5_cbc() -> *const EVP_CIPHER; |
429 | #[cfg (not(osslconf = "OPENSSL_NO_CAST" ))] |
430 | pub fn EVP_cast5_ofb() -> *const EVP_CIPHER; |
431 | |
432 | #[cfg (not(osslconf = "OPENSSL_NO_IDEA" ))] |
433 | pub fn EVP_idea_cfb64() -> *const EVP_CIPHER; |
434 | #[cfg (not(osslconf = "OPENSSL_NO_IDEA" ))] |
435 | pub fn EVP_idea_ecb() -> *const EVP_CIPHER; |
436 | #[cfg (not(osslconf = "OPENSSL_NO_IDEA" ))] |
437 | pub fn EVP_idea_cbc() -> *const EVP_CIPHER; |
438 | #[cfg (not(osslconf = "OPENSSL_NO_IDEA" ))] |
439 | pub fn EVP_idea_ofb() -> *const EVP_CIPHER; |
440 | |
441 | #[cfg (not(ossl110))] |
442 | pub fn OPENSSL_add_all_algorithms_noconf(); |
443 | |
444 | pub fn EVP_get_digestbyname(name: *const c_char) -> *const EVP_MD; |
445 | pub fn EVP_get_cipherbyname(name: *const c_char) -> *const EVP_CIPHER; |
446 | } |
447 | |
448 | cfg_if! { |
449 | if #[cfg(ossl300)] { |
450 | extern "C" { |
451 | pub fn EVP_PKEY_get_id(pkey: *const EVP_PKEY) -> c_int; |
452 | pub fn EVP_PKEY_get_bits(key: *const EVP_PKEY) -> c_int; |
453 | pub fn EVP_PKEY_get_security_bits(key: *const EVP_PKEY) -> c_int; |
454 | } |
455 | } else { |
456 | extern "C" { |
457 | pub fn EVP_PKEY_id(pkey: *const EVP_PKEY) -> c_int; |
458 | } |
459 | const_ptr_api! { |
460 | extern "C" { |
461 | pub fn EVP_PKEY_bits(key: #[const_ptr_if(any(ossl110, libressl280))] EVP_PKEY) -> c_int; |
462 | #[cfg (any(ossl110, libressl360))] |
463 | pub fn EVP_PKEY_security_bits(pkey: #[const_ptr_if(any(ossl110, libressl280))] EVP_PKEY) -> c_int; |
464 | } |
465 | } |
466 | } |
467 | } |
468 | extern "C" { |
469 | pub fn EVP_PKEY_assign(pkey: *mut EVP_PKEY, typ: c_int, key: *mut c_void) -> c_int; |
470 | |
471 | pub fn EVP_PKEY_set1_RSA(k: *mut EVP_PKEY, r: *mut RSA) -> c_int; |
472 | pub fn EVP_PKEY_get1_RSA(k: *mut EVP_PKEY) -> *mut RSA; |
473 | pub fn EVP_PKEY_get1_DSA(k: *mut EVP_PKEY) -> *mut DSA; |
474 | pub fn EVP_PKEY_get1_DH(k: *mut EVP_PKEY) -> *mut DH; |
475 | pub fn EVP_PKEY_get1_EC_KEY(k: *mut EVP_PKEY) -> *mut EC_KEY; |
476 | |
477 | pub fn EVP_PKEY_new() -> *mut EVP_PKEY; |
478 | pub fn EVP_PKEY_free(k: *mut EVP_PKEY); |
479 | #[cfg (any(ossl110, libressl270))] |
480 | pub fn EVP_PKEY_up_ref(pkey: *mut EVP_PKEY) -> c_int; |
481 | |
482 | pub fn d2i_AutoPrivateKey( |
483 | a: *mut *mut EVP_PKEY, |
484 | pp: *mut *const c_uchar, |
485 | length: c_long, |
486 | ) -> *mut EVP_PKEY; |
487 | |
488 | pub fn EVP_PKEY_cmp(a: *const EVP_PKEY, b: *const EVP_PKEY) -> c_int; |
489 | |
490 | pub fn EVP_PKEY_copy_parameters(to: *mut EVP_PKEY, from: *const EVP_PKEY) -> c_int; |
491 | |
492 | pub fn PKCS5_PBKDF2_HMAC_SHA1( |
493 | pass: *const c_char, |
494 | passlen: c_int, |
495 | salt: *const u8, |
496 | saltlen: c_int, |
497 | iter: c_int, |
498 | keylen: c_int, |
499 | out: *mut u8, |
500 | ) -> c_int; |
501 | pub fn PKCS5_PBKDF2_HMAC( |
502 | pass: *const c_char, |
503 | passlen: c_int, |
504 | salt: *const c_uchar, |
505 | saltlen: c_int, |
506 | iter: c_int, |
507 | digest: *const EVP_MD, |
508 | keylen: c_int, |
509 | out: *mut u8, |
510 | ) -> c_int; |
511 | |
512 | #[cfg (ossl110)] |
513 | pub fn EVP_PBE_scrypt( |
514 | pass: *const c_char, |
515 | passlen: size_t, |
516 | salt: *const c_uchar, |
517 | saltlen: size_t, |
518 | N: u64, |
519 | r: u64, |
520 | p: u64, |
521 | maxmem: u64, |
522 | key: *mut c_uchar, |
523 | keylen: size_t, |
524 | ) -> c_int; |
525 | |
526 | pub fn EVP_PKEY_CTX_new(k: *mut EVP_PKEY, e: *mut ENGINE) -> *mut EVP_PKEY_CTX; |
527 | pub fn EVP_PKEY_CTX_new_id(id: c_int, e: *mut ENGINE) -> *mut EVP_PKEY_CTX; |
528 | pub fn EVP_PKEY_CTX_free(ctx: *mut EVP_PKEY_CTX); |
529 | |
530 | pub fn EVP_PKEY_CTX_ctrl( |
531 | ctx: *mut EVP_PKEY_CTX, |
532 | keytype: c_int, |
533 | optype: c_int, |
534 | cmd: c_int, |
535 | p1: c_int, |
536 | p2: *mut c_void, |
537 | ) -> c_int; |
538 | |
539 | #[cfg (ossl300)] |
540 | pub fn EVP_PKEY_CTX_set_signature_md(ctx: *mut EVP_PKEY_CTX, md: *const EVP_MD) -> c_int; |
541 | |
542 | #[cfg (ossl300)] |
543 | pub fn EVP_PKEY_CTX_set_params(ctx: *mut EVP_PKEY_CTX, params: *const OSSL_PARAM) -> c_int; |
544 | |
545 | #[cfg (ossl300)] |
546 | pub fn EVP_PKEY_CTX_get_params(ctx: *mut EVP_PKEY_CTX, params: *mut OSSL_PARAM) -> c_int; |
547 | |
548 | pub fn EVP_PKEY_new_mac_key( |
549 | type_: c_int, |
550 | e: *mut ENGINE, |
551 | key: *const c_uchar, |
552 | keylen: c_int, |
553 | ) -> *mut EVP_PKEY; |
554 | |
555 | pub fn EVP_PKEY_derive_init(ctx: *mut EVP_PKEY_CTX) -> c_int; |
556 | pub fn EVP_PKEY_derive_set_peer(ctx: *mut EVP_PKEY_CTX, peer: *mut EVP_PKEY) -> c_int; |
557 | #[cfg (ossl300)] |
558 | pub fn EVP_PKEY_derive_set_peer_ex( |
559 | ctx: *mut EVP_PKEY_CTX, |
560 | peer: *mut EVP_PKEY, |
561 | validate_peer: c_int, |
562 | ) -> c_int; |
563 | pub fn EVP_PKEY_derive(ctx: *mut EVP_PKEY_CTX, key: *mut c_uchar, size: *mut size_t) -> c_int; |
564 | |
565 | #[cfg (ossl300)] |
566 | pub fn EVP_PKEY_Q_keygen( |
567 | libctx: *mut OSSL_LIB_CTX, |
568 | propq: *const c_char, |
569 | type_: *const c_char, |
570 | ... |
571 | ) -> *mut EVP_PKEY; |
572 | pub fn EVP_PKEY_keygen_init(ctx: *mut EVP_PKEY_CTX) -> c_int; |
573 | pub fn EVP_PKEY_keygen(ctx: *mut EVP_PKEY_CTX, key: *mut *mut EVP_PKEY) -> c_int; |
574 | |
575 | pub fn EVP_PKEY_sign_init(ctx: *mut EVP_PKEY_CTX) -> c_int; |
576 | pub fn EVP_PKEY_sign( |
577 | ctx: *mut EVP_PKEY_CTX, |
578 | sig: *mut c_uchar, |
579 | siglen: *mut size_t, |
580 | tbs: *const c_uchar, |
581 | tbslen: size_t, |
582 | ) -> c_int; |
583 | pub fn EVP_PKEY_verify_init(ctx: *mut EVP_PKEY_CTX) -> c_int; |
584 | pub fn EVP_PKEY_verify( |
585 | ctx: *mut EVP_PKEY_CTX, |
586 | sig: *const c_uchar, |
587 | siglen: size_t, |
588 | tbs: *const c_uchar, |
589 | tbslen: size_t, |
590 | ) -> c_int; |
591 | pub fn EVP_PKEY_encrypt_init(ctx: *mut EVP_PKEY_CTX) -> c_int; |
592 | pub fn EVP_PKEY_encrypt( |
593 | ctx: *mut EVP_PKEY_CTX, |
594 | pout: *mut c_uchar, |
595 | poutlen: *mut size_t, |
596 | pin: *const c_uchar, |
597 | pinlen: size_t, |
598 | ) -> c_int; |
599 | pub fn EVP_PKEY_decrypt_init(ctx: *mut EVP_PKEY_CTX) -> c_int; |
600 | pub fn EVP_PKEY_decrypt( |
601 | ctx: *mut EVP_PKEY_CTX, |
602 | pout: *mut c_uchar, |
603 | poutlen: *mut size_t, |
604 | pin: *const c_uchar, |
605 | pinlen: size_t, |
606 | ) -> c_int; |
607 | pub fn EVP_PKEY_verify_recover_init(ctx: *mut EVP_PKEY_CTX) -> c_int; |
608 | pub fn EVP_PKEY_verify_recover( |
609 | ctx: *mut EVP_PKEY_CTX, |
610 | rout: *mut c_uchar, |
611 | routlen: *mut size_t, |
612 | sig: *const c_uchar, |
613 | siglen: size_t, |
614 | ) -> c_int; |
615 | } |
616 | |
617 | const_ptr_api! { |
618 | extern "C" { |
619 | pub fn EVP_PKCS82PKEY(p8: #[const_ptr_if(any(ossl110, libressl280))] PKCS8_PRIV_KEY_INFO) -> *mut EVP_PKEY; |
620 | } |
621 | } |
622 | |
623 | cfg_if! { |
624 | if #[cfg(any(ossl111, libressl370))] { |
625 | extern "C" { |
626 | pub fn EVP_PKEY_get_raw_public_key( |
627 | pkey: *const EVP_PKEY, |
628 | ppub: *mut c_uchar, |
629 | len: *mut size_t, |
630 | ) -> c_int; |
631 | pub fn EVP_PKEY_new_raw_public_key( |
632 | ttype: c_int, |
633 | e: *mut ENGINE, |
634 | key: *const c_uchar, |
635 | keylen: size_t, |
636 | ) -> *mut EVP_PKEY; |
637 | pub fn EVP_PKEY_get_raw_private_key( |
638 | pkey: *const EVP_PKEY, |
639 | ppriv: *mut c_uchar, |
640 | len: *mut size_t, |
641 | ) -> c_int; |
642 | pub fn EVP_PKEY_new_raw_private_key( |
643 | ttype: c_int, |
644 | e: *mut ENGINE, |
645 | key: *const c_uchar, |
646 | keylen: size_t, |
647 | ) -> *mut EVP_PKEY; |
648 | } |
649 | } |
650 | } |
651 | |
652 | extern "C" { |
653 | pub fn EVP_EncodeBlock(dst: *mut c_uchar, src: *const c_uchar, src_len: c_int) -> c_int; |
654 | pub fn EVP_DecodeBlock(dst: *mut c_uchar, src: *const c_uchar, src_len: c_int) -> c_int; |
655 | } |
656 | |