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