• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(ossl110)] {
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 extern "C" {
EVP_DigestInit_ex(ctx: *mut EVP_MD_CTX, typ: *const EVP_MD, imple: *mut ENGINE) -> c_int69     pub fn EVP_DigestInit_ex(ctx: *mut EVP_MD_CTX, typ: *const EVP_MD, imple: *mut ENGINE)
70         -> c_int;
EVP_DigestUpdate(ctx: *mut EVP_MD_CTX, data: *const c_void, n: size_t) -> c_int71     pub fn EVP_DigestUpdate(ctx: *mut EVP_MD_CTX, data: *const c_void, n: size_t) -> c_int;
EVP_DigestFinal_ex(ctx: *mut EVP_MD_CTX, res: *mut u8, n: *mut u32) -> c_int72     pub fn EVP_DigestFinal_ex(ctx: *mut EVP_MD_CTX, res: *mut u8, n: *mut u32) -> c_int;
73     #[cfg(ossl300)]
EVP_Q_digest( libctx: *mut OSSL_LIB_CTX, name: *const c_char, propq: *const c_char, data: *const c_void, count: size_t, md: *mut c_uchar, size: *mut size_t, ) -> c_int74     pub fn EVP_Q_digest(
75         libctx: *mut OSSL_LIB_CTX,
76         name: *const c_char,
77         propq: *const c_char,
78         data: *const c_void,
79         count: size_t,
80         md: *mut c_uchar,
81         size: *mut size_t,
82     ) -> c_int;
EVP_DigestInit(ctx: *mut EVP_MD_CTX, typ: *const EVP_MD) -> c_int83     pub fn EVP_DigestInit(ctx: *mut EVP_MD_CTX, typ: *const EVP_MD) -> c_int;
EVP_DigestFinal(ctx: *mut EVP_MD_CTX, res: *mut u8, n: *mut u32) -> c_int84     pub fn EVP_DigestFinal(ctx: *mut EVP_MD_CTX, res: *mut u8, n: *mut u32) -> c_int;
85     #[cfg(ossl111)]
EVP_DigestFinalXOF(ctx: *mut EVP_MD_CTX, res: *mut u8, len: usize) -> c_int86     pub fn EVP_DigestFinalXOF(ctx: *mut EVP_MD_CTX, res: *mut u8, len: usize) -> c_int;
87 
88     #[cfg(ossl300)]
EVP_MD_fetch( ctx: *mut OSSL_LIB_CTX, algorithm: *const c_char, properties: *const c_char, ) -> *mut EVP_MD89     pub fn EVP_MD_fetch(
90         ctx: *mut OSSL_LIB_CTX,
91         algorithm: *const c_char,
92         properties: *const c_char,
93     ) -> *mut EVP_MD;
94 
95     #[cfg(ossl300)]
EVP_MD_free(md: *mut EVP_MD)96     pub fn EVP_MD_free(md: *mut EVP_MD);
97 
EVP_BytesToKey( typ: *const EVP_CIPHER, md: *const EVP_MD, salt: *const u8, data: *const u8, datalen: c_int, count: c_int, key: *mut u8, iv: *mut u8, ) -> c_int98     pub fn EVP_BytesToKey(
99         typ: *const EVP_CIPHER,
100         md: *const EVP_MD,
101         salt: *const u8,
102         data: *const u8,
103         datalen: c_int,
104         count: c_int,
105         key: *mut u8,
106         iv: *mut u8,
107     ) -> c_int;
108 
EVP_CipherInit( ctx: *mut EVP_CIPHER_CTX, evp: *const EVP_CIPHER, key: *const u8, iv: *const u8, mode: c_int, ) -> c_int109     pub fn EVP_CipherInit(
110         ctx: *mut EVP_CIPHER_CTX,
111         evp: *const EVP_CIPHER,
112         key: *const u8,
113         iv: *const u8,
114         mode: c_int,
115     ) -> c_int;
EVP_CipherInit_ex( ctx: *mut EVP_CIPHER_CTX, type_: *const EVP_CIPHER, impl_: *mut ENGINE, key: *const c_uchar, iv: *const c_uchar, enc: c_int, ) -> c_int116     pub fn EVP_CipherInit_ex(
117         ctx: *mut EVP_CIPHER_CTX,
118         type_: *const EVP_CIPHER,
119         impl_: *mut ENGINE,
120         key: *const c_uchar,
121         iv: *const c_uchar,
122         enc: c_int,
123     ) -> c_int;
EVP_CipherUpdate( ctx: *mut EVP_CIPHER_CTX, outbuf: *mut u8, outlen: *mut c_int, inbuf: *const u8, inlen: c_int, ) -> c_int124     pub fn EVP_CipherUpdate(
125         ctx: *mut EVP_CIPHER_CTX,
126         outbuf: *mut u8,
127         outlen: *mut c_int,
128         inbuf: *const u8,
129         inlen: c_int,
130     ) -> c_int;
EVP_CipherFinal(ctx: *mut EVP_CIPHER_CTX, res: *mut u8, len: *mut c_int) -> c_int131     pub fn EVP_CipherFinal(ctx: *mut EVP_CIPHER_CTX, res: *mut u8, len: *mut c_int) -> c_int;
132 
EVP_DigestSignInit( ctx: *mut EVP_MD_CTX, pctx: *mut *mut EVP_PKEY_CTX, type_: *const EVP_MD, e: *mut ENGINE, pkey: *mut EVP_PKEY, ) -> c_int133     pub fn EVP_DigestSignInit(
134         ctx: *mut EVP_MD_CTX,
135         pctx: *mut *mut EVP_PKEY_CTX,
136         type_: *const EVP_MD,
137         e: *mut ENGINE,
138         pkey: *mut EVP_PKEY,
139     ) -> c_int;
140 
141     #[cfg(ossl300)]
EVP_DigestSignUpdate(ctx: *mut EVP_MD_CTX, data: *const c_void, dsize: size_t) -> c_int142     pub fn EVP_DigestSignUpdate(ctx: *mut EVP_MD_CTX, data: *const c_void, dsize: size_t) -> c_int;
EVP_DigestSignFinal( ctx: *mut EVP_MD_CTX, sig: *mut c_uchar, siglen: *mut size_t, ) -> c_int143     pub fn EVP_DigestSignFinal(
144         ctx: *mut EVP_MD_CTX,
145         sig: *mut c_uchar,
146         siglen: *mut size_t,
147     ) -> c_int;
EVP_DigestVerifyInit( ctx: *mut EVP_MD_CTX, pctx: *mut *mut EVP_PKEY_CTX, type_: *const EVP_MD, e: *mut ENGINE, pkey: *mut EVP_PKEY, ) -> c_int148     pub fn EVP_DigestVerifyInit(
149         ctx: *mut EVP_MD_CTX,
150         pctx: *mut *mut EVP_PKEY_CTX,
151         type_: *const EVP_MD,
152         e: *mut ENGINE,
153         pkey: *mut EVP_PKEY,
154     ) -> c_int;
155     #[cfg(ossl300)]
EVP_DigestVerifyUpdate( ctx: *mut EVP_MD_CTX, data: *const c_void, dsize: size_t, ) -> c_int156     pub fn EVP_DigestVerifyUpdate(
157         ctx: *mut EVP_MD_CTX,
158         data: *const c_void,
159         dsize: size_t,
160     ) -> c_int;
EVP_SealInit( ctx: *mut EVP_CIPHER_CTX, type_: *const EVP_CIPHER, ek: *mut *mut c_uchar, ekl: *mut c_int, iv: *mut c_uchar, pubk: *mut *mut EVP_PKEY, npubk: c_int, ) -> c_int161     pub fn EVP_SealInit(
162         ctx: *mut EVP_CIPHER_CTX,
163         type_: *const EVP_CIPHER,
164         ek: *mut *mut c_uchar,
165         ekl: *mut c_int,
166         iv: *mut c_uchar,
167         pubk: *mut *mut EVP_PKEY,
168         npubk: c_int,
169     ) -> c_int;
EVP_SealFinal(ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int) -> c_int170     pub fn EVP_SealFinal(ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int) -> c_int;
EVP_EncryptInit_ex( ctx: *mut EVP_CIPHER_CTX, cipher: *const EVP_CIPHER, impl_: *mut ENGINE, key: *const c_uchar, iv: *const c_uchar, ) -> c_int171     pub fn EVP_EncryptInit_ex(
172         ctx: *mut EVP_CIPHER_CTX,
173         cipher: *const EVP_CIPHER,
174         impl_: *mut ENGINE,
175         key: *const c_uchar,
176         iv: *const c_uchar,
177     ) -> c_int;
EVP_EncryptUpdate( ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int, in_: *const u8, inl: c_int, ) -> c_int178     pub fn EVP_EncryptUpdate(
179         ctx: *mut EVP_CIPHER_CTX,
180         out: *mut c_uchar,
181         outl: *mut c_int,
182         in_: *const u8,
183         inl: c_int,
184     ) -> c_int;
EVP_EncryptFinal_ex( ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int, ) -> c_int185     pub fn EVP_EncryptFinal_ex(
186         ctx: *mut EVP_CIPHER_CTX,
187         out: *mut c_uchar,
188         outl: *mut c_int,
189     ) -> c_int;
EVP_OpenInit( ctx: *mut EVP_CIPHER_CTX, type_: *const EVP_CIPHER, ek: *const c_uchar, ekl: c_int, iv: *const c_uchar, priv_: *mut EVP_PKEY, ) -> c_int190     pub fn EVP_OpenInit(
191         ctx: *mut EVP_CIPHER_CTX,
192         type_: *const EVP_CIPHER,
193         ek: *const c_uchar,
194         ekl: c_int,
195         iv: *const c_uchar,
196         priv_: *mut EVP_PKEY,
197     ) -> c_int;
EVP_OpenFinal(ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int) -> c_int198     pub fn EVP_OpenFinal(ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int) -> c_int;
EVP_DecryptInit_ex( ctx: *mut EVP_CIPHER_CTX, cipher: *const EVP_CIPHER, impl_: *mut ENGINE, key: *const c_uchar, iv: *const c_uchar, ) -> c_int199     pub fn EVP_DecryptInit_ex(
200         ctx: *mut EVP_CIPHER_CTX,
201         cipher: *const EVP_CIPHER,
202         impl_: *mut ENGINE,
203         key: *const c_uchar,
204         iv: *const c_uchar,
205     ) -> c_int;
EVP_DecryptUpdate( ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int, in_: *const u8, inl: c_int, ) -> c_int206     pub fn EVP_DecryptUpdate(
207         ctx: *mut EVP_CIPHER_CTX,
208         out: *mut c_uchar,
209         outl: *mut c_int,
210         in_: *const u8,
211         inl: c_int,
212     ) -> c_int;
EVP_DecryptFinal_ex( ctx: *mut EVP_CIPHER_CTX, outm: *mut c_uchar, outl: *mut c_int, ) -> c_int213     pub fn EVP_DecryptFinal_ex(
214         ctx: *mut EVP_CIPHER_CTX,
215         outm: *mut c_uchar,
216         outl: *mut c_int,
217     ) -> c_int;
218 }
219 cfg_if! {
220     if #[cfg(ossl300)] {
221         extern "C" {
222             pub fn EVP_PKEY_get_size(pkey: *const EVP_PKEY) -> c_int;
223         }
224     } else {
225         const_ptr_api! {
226             extern "C" {
227                 pub fn EVP_PKEY_size(pkey: #[const_ptr_if(any(ossl111b, libressl280))] EVP_PKEY) -> c_int;
228             }
229         }
230     }
231 }
232 cfg_if! {
233     if #[cfg(any(ossl111, libressl370))] {
234         extern "C" {
235             pub fn EVP_DigestSign(
236                 ctx: *mut EVP_MD_CTX,
237                 sigret: *mut c_uchar,
238                 siglen: *mut size_t,
239                 tbs: *const c_uchar,
240                 tbslen: size_t
241             ) -> c_int;
242 
243             pub fn EVP_DigestVerify(
244                 ctx: *mut EVP_MD_CTX,
245                 sigret: *const c_uchar,
246                 siglen: size_t,
247                 tbs: *const c_uchar,
248                 tbslen: size_t
249             ) -> c_int;
250         }
251     }
252 }
253 const_ptr_api! {
254     extern "C" {
255         pub fn EVP_DigestVerifyFinal(
256             ctx: *mut EVP_MD_CTX,
257             sigret: #[const_ptr_if(any(ossl102, libressl280))] c_uchar,
258             siglen: size_t,
259         ) -> c_int;
260     }
261 }
262 
263 extern "C" {
EVP_CIPHER_CTX_new() -> *mut EVP_CIPHER_CTX264     pub fn EVP_CIPHER_CTX_new() -> *mut EVP_CIPHER_CTX;
EVP_CIPHER_CTX_free(ctx: *mut EVP_CIPHER_CTX)265     pub fn EVP_CIPHER_CTX_free(ctx: *mut EVP_CIPHER_CTX);
EVP_MD_CTX_copy_ex(dst: *mut EVP_MD_CTX, src: *const EVP_MD_CTX) -> c_int266     pub fn EVP_MD_CTX_copy_ex(dst: *mut EVP_MD_CTX, src: *const EVP_MD_CTX) -> c_int;
267     #[cfg(ossl111)]
EVP_MD_CTX_reset(ctx: *mut EVP_MD_CTX) -> c_int268     pub fn EVP_MD_CTX_reset(ctx: *mut EVP_MD_CTX) -> c_int;
EVP_CIPHER_CTX_set_key_length(ctx: *mut EVP_CIPHER_CTX, keylen: c_int) -> c_int269     pub fn EVP_CIPHER_CTX_set_key_length(ctx: *mut EVP_CIPHER_CTX, keylen: c_int) -> c_int;
EVP_CIPHER_CTX_set_padding(ctx: *mut EVP_CIPHER_CTX, padding: c_int) -> c_int270     pub fn EVP_CIPHER_CTX_set_padding(ctx: *mut EVP_CIPHER_CTX, padding: c_int) -> c_int;
EVP_CIPHER_CTX_ctrl( ctx: *mut EVP_CIPHER_CTX, type_: c_int, arg: c_int, ptr: *mut c_void, ) -> c_int271     pub fn EVP_CIPHER_CTX_ctrl(
272         ctx: *mut EVP_CIPHER_CTX,
273         type_: c_int,
274         arg: c_int,
275         ptr: *mut c_void,
276     ) -> c_int;
EVP_CIPHER_CTX_rand_key(ctx: *mut EVP_CIPHER_CTX, key: *mut c_uchar) -> c_int277     pub fn EVP_CIPHER_CTX_rand_key(ctx: *mut EVP_CIPHER_CTX, key: *mut c_uchar) -> c_int;
278 
EVP_md_null() -> *const EVP_MD279     pub fn EVP_md_null() -> *const EVP_MD;
EVP_md5() -> *const EVP_MD280     pub fn EVP_md5() -> *const EVP_MD;
EVP_sha1() -> *const EVP_MD281     pub fn EVP_sha1() -> *const EVP_MD;
EVP_sha224() -> *const EVP_MD282     pub fn EVP_sha224() -> *const EVP_MD;
EVP_sha256() -> *const EVP_MD283     pub fn EVP_sha256() -> *const EVP_MD;
EVP_sha384() -> *const EVP_MD284     pub fn EVP_sha384() -> *const EVP_MD;
EVP_sha512() -> *const EVP_MD285     pub fn EVP_sha512() -> *const EVP_MD;
286     #[cfg(ossl111)]
EVP_sha3_224() -> *const EVP_MD287     pub fn EVP_sha3_224() -> *const EVP_MD;
288     #[cfg(ossl111)]
EVP_sha3_256() -> *const EVP_MD289     pub fn EVP_sha3_256() -> *const EVP_MD;
290     #[cfg(ossl111)]
EVP_sha3_384() -> *const EVP_MD291     pub fn EVP_sha3_384() -> *const EVP_MD;
292     #[cfg(ossl111)]
EVP_sha3_512() -> *const EVP_MD293     pub fn EVP_sha3_512() -> *const EVP_MD;
294     #[cfg(ossl111)]
EVP_shake128() -> *const EVP_MD295     pub fn EVP_shake128() -> *const EVP_MD;
296     #[cfg(ossl111)]
EVP_shake256() -> *const EVP_MD297     pub fn EVP_shake256() -> *const EVP_MD;
EVP_ripemd160() -> *const EVP_MD298     pub fn EVP_ripemd160() -> *const EVP_MD;
299     #[cfg(all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM3")))]
EVP_sm3() -> *const EVP_MD300     pub fn EVP_sm3() -> *const EVP_MD;
EVP_des_ecb() -> *const EVP_CIPHER301     pub fn EVP_des_ecb() -> *const EVP_CIPHER;
EVP_des_ede3() -> *const EVP_CIPHER302     pub fn EVP_des_ede3() -> *const EVP_CIPHER;
EVP_des_ede3_cbc() -> *const EVP_CIPHER303     pub fn EVP_des_ede3_cbc() -> *const EVP_CIPHER;
EVP_des_ede3_cfb64() -> *const EVP_CIPHER304     pub fn EVP_des_ede3_cfb64() -> *const EVP_CIPHER;
EVP_des_cbc() -> *const EVP_CIPHER305     pub fn EVP_des_cbc() -> *const EVP_CIPHER;
EVP_rc4() -> *const EVP_CIPHER306     pub fn EVP_rc4() -> *const EVP_CIPHER;
EVP_bf_ecb() -> *const EVP_CIPHER307     pub fn EVP_bf_ecb() -> *const EVP_CIPHER;
EVP_bf_cbc() -> *const EVP_CIPHER308     pub fn EVP_bf_cbc() -> *const EVP_CIPHER;
EVP_bf_cfb64() -> *const EVP_CIPHER309     pub fn EVP_bf_cfb64() -> *const EVP_CIPHER;
EVP_bf_ofb() -> *const EVP_CIPHER310     pub fn EVP_bf_ofb() -> *const EVP_CIPHER;
EVP_aes_128_ecb() -> *const EVP_CIPHER311     pub fn EVP_aes_128_ecb() -> *const EVP_CIPHER;
EVP_aes_128_cbc() -> *const EVP_CIPHER312     pub fn EVP_aes_128_cbc() -> *const EVP_CIPHER;
EVP_aes_128_cfb1() -> *const EVP_CIPHER313     pub fn EVP_aes_128_cfb1() -> *const EVP_CIPHER;
EVP_aes_128_cfb8() -> *const EVP_CIPHER314     pub fn EVP_aes_128_cfb8() -> *const EVP_CIPHER;
EVP_aes_128_cfb128() -> *const EVP_CIPHER315     pub fn EVP_aes_128_cfb128() -> *const EVP_CIPHER;
EVP_aes_128_ctr() -> *const EVP_CIPHER316     pub fn EVP_aes_128_ctr() -> *const EVP_CIPHER;
EVP_aes_128_ccm() -> *const EVP_CIPHER317     pub fn EVP_aes_128_ccm() -> *const EVP_CIPHER;
EVP_aes_128_gcm() -> *const EVP_CIPHER318     pub fn EVP_aes_128_gcm() -> *const EVP_CIPHER;
EVP_aes_128_xts() -> *const EVP_CIPHER319     pub fn EVP_aes_128_xts() -> *const EVP_CIPHER;
EVP_aes_128_ofb() -> *const EVP_CIPHER320     pub fn EVP_aes_128_ofb() -> *const EVP_CIPHER;
321     #[cfg(ossl110)]
EVP_aes_128_ocb() -> *const EVP_CIPHER322     pub fn EVP_aes_128_ocb() -> *const EVP_CIPHER;
EVP_aes_192_ecb() -> *const EVP_CIPHER323     pub fn EVP_aes_192_ecb() -> *const EVP_CIPHER;
EVP_aes_192_cbc() -> *const EVP_CIPHER324     pub fn EVP_aes_192_cbc() -> *const EVP_CIPHER;
EVP_aes_192_cfb1() -> *const EVP_CIPHER325     pub fn EVP_aes_192_cfb1() -> *const EVP_CIPHER;
EVP_aes_192_cfb8() -> *const EVP_CIPHER326     pub fn EVP_aes_192_cfb8() -> *const EVP_CIPHER;
EVP_aes_192_cfb128() -> *const EVP_CIPHER327     pub fn EVP_aes_192_cfb128() -> *const EVP_CIPHER;
EVP_aes_192_ctr() -> *const EVP_CIPHER328     pub fn EVP_aes_192_ctr() -> *const EVP_CIPHER;
EVP_aes_192_ccm() -> *const EVP_CIPHER329     pub fn EVP_aes_192_ccm() -> *const EVP_CIPHER;
EVP_aes_192_gcm() -> *const EVP_CIPHER330     pub fn EVP_aes_192_gcm() -> *const EVP_CIPHER;
EVP_aes_192_ofb() -> *const EVP_CIPHER331     pub fn EVP_aes_192_ofb() -> *const EVP_CIPHER;
332     #[cfg(ossl110)]
EVP_aes_192_ocb() -> *const EVP_CIPHER333     pub fn EVP_aes_192_ocb() -> *const EVP_CIPHER;
EVP_aes_256_ecb() -> *const EVP_CIPHER334     pub fn EVP_aes_256_ecb() -> *const EVP_CIPHER;
EVP_aes_256_cbc() -> *const EVP_CIPHER335     pub fn EVP_aes_256_cbc() -> *const EVP_CIPHER;
EVP_aes_256_cfb1() -> *const EVP_CIPHER336     pub fn EVP_aes_256_cfb1() -> *const EVP_CIPHER;
EVP_aes_256_cfb8() -> *const EVP_CIPHER337     pub fn EVP_aes_256_cfb8() -> *const EVP_CIPHER;
EVP_aes_256_cfb128() -> *const EVP_CIPHER338     pub fn EVP_aes_256_cfb128() -> *const EVP_CIPHER;
EVP_aes_256_ctr() -> *const EVP_CIPHER339     pub fn EVP_aes_256_ctr() -> *const EVP_CIPHER;
EVP_aes_256_ccm() -> *const EVP_CIPHER340     pub fn EVP_aes_256_ccm() -> *const EVP_CIPHER;
EVP_aes_256_gcm() -> *const EVP_CIPHER341     pub fn EVP_aes_256_gcm() -> *const EVP_CIPHER;
EVP_aes_256_xts() -> *const EVP_CIPHER342     pub fn EVP_aes_256_xts() -> *const EVP_CIPHER;
EVP_aes_256_ofb() -> *const EVP_CIPHER343     pub fn EVP_aes_256_ofb() -> *const EVP_CIPHER;
344     #[cfg(ossl110)]
EVP_aes_256_ocb() -> *const EVP_CIPHER345     pub fn EVP_aes_256_ocb() -> *const EVP_CIPHER;
346     #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
EVP_chacha20() -> *const EVP_CIPHER347     pub fn EVP_chacha20() -> *const EVP_CIPHER;
348     #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
EVP_chacha20_poly1305() -> *const EVP_CIPHER349     pub fn EVP_chacha20_poly1305() -> *const EVP_CIPHER;
350     #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
EVP_seed_cbc() -> *const EVP_CIPHER351     pub fn EVP_seed_cbc() -> *const EVP_CIPHER;
352     #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
EVP_seed_cfb128() -> *const EVP_CIPHER353     pub fn EVP_seed_cfb128() -> *const EVP_CIPHER;
354     #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
EVP_seed_ecb() -> *const EVP_CIPHER355     pub fn EVP_seed_ecb() -> *const EVP_CIPHER;
356     #[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
EVP_seed_ofb() -> *const EVP_CIPHER357     pub fn EVP_seed_ofb() -> *const EVP_CIPHER;
358 
359     #[cfg(all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4")))]
EVP_sm4_ecb() -> *const EVP_CIPHER360     pub fn EVP_sm4_ecb() -> *const EVP_CIPHER;
361     #[cfg(all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4")))]
EVP_sm4_cbc() -> *const EVP_CIPHER362     pub fn EVP_sm4_cbc() -> *const EVP_CIPHER;
363     #[cfg(all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4")))]
EVP_sm4_cfb128() -> *const EVP_CIPHER364     pub fn EVP_sm4_cfb128() -> *const EVP_CIPHER;
365     #[cfg(all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4")))]
EVP_sm4_ofb() -> *const EVP_CIPHER366     pub fn EVP_sm4_ofb() -> *const EVP_CIPHER;
367     #[cfg(all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4")))]
EVP_sm4_ctr() -> *const EVP_CIPHER368     pub fn EVP_sm4_ctr() -> *const EVP_CIPHER;
369 
370     #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
EVP_camellia_128_cfb128() -> *const EVP_CIPHER371     pub fn EVP_camellia_128_cfb128() -> *const EVP_CIPHER;
372     #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
EVP_camellia_128_ecb() -> *const EVP_CIPHER373     pub fn EVP_camellia_128_ecb() -> *const EVP_CIPHER;
374     #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
EVP_camellia_192_cfb128() -> *const EVP_CIPHER375     pub fn EVP_camellia_192_cfb128() -> *const EVP_CIPHER;
376     #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
EVP_camellia_192_ecb() -> *const EVP_CIPHER377     pub fn EVP_camellia_192_ecb() -> *const EVP_CIPHER;
378     #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
EVP_camellia_256_cfb128() -> *const EVP_CIPHER379     pub fn EVP_camellia_256_cfb128() -> *const EVP_CIPHER;
380     #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
EVP_camellia_256_ecb() -> *const EVP_CIPHER381     pub fn EVP_camellia_256_ecb() -> *const EVP_CIPHER;
382 
383     #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
EVP_cast5_cfb64() -> *const EVP_CIPHER384     pub fn EVP_cast5_cfb64() -> *const EVP_CIPHER;
385     #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
EVP_cast5_ecb() -> *const EVP_CIPHER386     pub fn EVP_cast5_ecb() -> *const EVP_CIPHER;
387 
388     #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
EVP_idea_cfb64() -> *const EVP_CIPHER389     pub fn EVP_idea_cfb64() -> *const EVP_CIPHER;
390     #[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
EVP_idea_ecb() -> *const EVP_CIPHER391     pub fn EVP_idea_ecb() -> *const EVP_CIPHER;
392 
393     #[cfg(not(ossl110))]
OPENSSL_add_all_algorithms_noconf()394     pub fn OPENSSL_add_all_algorithms_noconf();
395 
EVP_get_digestbyname(name: *const c_char) -> *const EVP_MD396     pub fn EVP_get_digestbyname(name: *const c_char) -> *const EVP_MD;
EVP_get_cipherbyname(name: *const c_char) -> *const EVP_CIPHER397     pub fn EVP_get_cipherbyname(name: *const c_char) -> *const EVP_CIPHER;
398 }
399 
400 cfg_if! {
401     if #[cfg(ossl300)] {
402         extern "C" {
403             pub fn EVP_PKEY_get_id(pkey: *const EVP_PKEY) -> c_int;
404             pub fn EVP_PKEY_get_bits(key: *const EVP_PKEY) -> c_int;
405             pub fn EVP_PKEY_get_security_bits(key: *const EVP_PKEY) -> c_int;
406         }
407 
408         #[inline]
409         pub unsafe fn EVP_PKEY_id(pkey: *const EVP_PKEY) -> c_int {
410             EVP_PKEY_get_id(pkey)
411         }
412 
413         #[inline]
414         pub unsafe fn EVP_PKEY_bits(pkey: *const EVP_PKEY) -> c_int {
415             EVP_PKEY_get_bits(pkey)
416         }
417 
418         #[inline]
419         pub unsafe fn EVP_PKEY_security_bits(pkey: *const EVP_PKEY) -> c_int {
420             EVP_PKEY_get_security_bits(pkey)
421         }
422 
423     } else {
424         extern "C" {
425             pub fn EVP_PKEY_id(pkey: *const EVP_PKEY) -> c_int;
426         }
427         const_ptr_api! {
428             extern "C" {
429                 pub fn EVP_PKEY_bits(key: #[const_ptr_if(any(ossl110, libressl280))] EVP_PKEY) -> c_int;
430                 #[cfg(any(ossl110, libressl360))]
431                 pub fn EVP_PKEY_security_bits(pkey: #[const_ptr_if(any(ossl110, libressl280))] EVP_PKEY) -> c_int;
432             }
433         }
434     }
435 }
436 extern "C" {
EVP_PKEY_assign(pkey: *mut EVP_PKEY, typ: c_int, key: *mut c_void) -> c_int437     pub fn EVP_PKEY_assign(pkey: *mut EVP_PKEY, typ: c_int, key: *mut c_void) -> c_int;
438 
EVP_PKEY_set1_RSA(k: *mut EVP_PKEY, r: *mut RSA) -> c_int439     pub fn EVP_PKEY_set1_RSA(k: *mut EVP_PKEY, r: *mut RSA) -> c_int;
EVP_PKEY_get1_RSA(k: *mut EVP_PKEY) -> *mut RSA440     pub fn EVP_PKEY_get1_RSA(k: *mut EVP_PKEY) -> *mut RSA;
EVP_PKEY_get1_DSA(k: *mut EVP_PKEY) -> *mut DSA441     pub fn EVP_PKEY_get1_DSA(k: *mut EVP_PKEY) -> *mut DSA;
EVP_PKEY_get1_DH(k: *mut EVP_PKEY) -> *mut DH442     pub fn EVP_PKEY_get1_DH(k: *mut EVP_PKEY) -> *mut DH;
EVP_PKEY_get1_EC_KEY(k: *mut EVP_PKEY) -> *mut EC_KEY443     pub fn EVP_PKEY_get1_EC_KEY(k: *mut EVP_PKEY) -> *mut EC_KEY;
444 
EVP_PKEY_new() -> *mut EVP_PKEY445     pub fn EVP_PKEY_new() -> *mut EVP_PKEY;
EVP_PKEY_free(k: *mut EVP_PKEY)446     pub fn EVP_PKEY_free(k: *mut EVP_PKEY);
447     #[cfg(any(ossl110, libressl270))]
EVP_PKEY_up_ref(pkey: *mut EVP_PKEY) -> c_int448     pub fn EVP_PKEY_up_ref(pkey: *mut EVP_PKEY) -> c_int;
449 
d2i_AutoPrivateKey( a: *mut *mut EVP_PKEY, pp: *mut *const c_uchar, length: c_long, ) -> *mut EVP_PKEY450     pub fn d2i_AutoPrivateKey(
451         a: *mut *mut EVP_PKEY,
452         pp: *mut *const c_uchar,
453         length: c_long,
454     ) -> *mut EVP_PKEY;
455 
EVP_PKEY_cmp(a: *const EVP_PKEY, b: *const EVP_PKEY) -> c_int456     pub fn EVP_PKEY_cmp(a: *const EVP_PKEY, b: *const EVP_PKEY) -> c_int;
457 
EVP_PKEY_copy_parameters(to: *mut EVP_PKEY, from: *const EVP_PKEY) -> c_int458     pub fn EVP_PKEY_copy_parameters(to: *mut EVP_PKEY, from: *const EVP_PKEY) -> c_int;
459 
PKCS5_PBKDF2_HMAC_SHA1( pass: *const c_char, passlen: c_int, salt: *const u8, saltlen: c_int, iter: c_int, keylen: c_int, out: *mut u8, ) -> c_int460     pub fn PKCS5_PBKDF2_HMAC_SHA1(
461         pass: *const c_char,
462         passlen: c_int,
463         salt: *const u8,
464         saltlen: c_int,
465         iter: c_int,
466         keylen: c_int,
467         out: *mut u8,
468     ) -> c_int;
PKCS5_PBKDF2_HMAC( pass: *const c_char, passlen: c_int, salt: *const c_uchar, saltlen: c_int, iter: c_int, digest: *const EVP_MD, keylen: c_int, out: *mut u8, ) -> c_int469     pub fn PKCS5_PBKDF2_HMAC(
470         pass: *const c_char,
471         passlen: c_int,
472         salt: *const c_uchar,
473         saltlen: c_int,
474         iter: c_int,
475         digest: *const EVP_MD,
476         keylen: c_int,
477         out: *mut u8,
478     ) -> c_int;
479 
480     #[cfg(ossl110)]
EVP_PBE_scrypt( pass: *const c_char, passlen: size_t, salt: *const c_uchar, saltlen: size_t, N: u64, r: u64, p: u64, maxmem: u64, key: *mut c_uchar, keylen: size_t, ) -> c_int481     pub fn EVP_PBE_scrypt(
482         pass: *const c_char,
483         passlen: size_t,
484         salt: *const c_uchar,
485         saltlen: size_t,
486         N: u64,
487         r: u64,
488         p: u64,
489         maxmem: u64,
490         key: *mut c_uchar,
491         keylen: size_t,
492     ) -> c_int;
493 
EVP_PKEY_CTX_new(k: *mut EVP_PKEY, e: *mut ENGINE) -> *mut EVP_PKEY_CTX494     pub fn EVP_PKEY_CTX_new(k: *mut EVP_PKEY, e: *mut ENGINE) -> *mut EVP_PKEY_CTX;
EVP_PKEY_CTX_new_id(id: c_int, e: *mut ENGINE) -> *mut EVP_PKEY_CTX495     pub fn EVP_PKEY_CTX_new_id(id: c_int, e: *mut ENGINE) -> *mut EVP_PKEY_CTX;
EVP_PKEY_CTX_free(ctx: *mut EVP_PKEY_CTX)496     pub fn EVP_PKEY_CTX_free(ctx: *mut EVP_PKEY_CTX);
497 
EVP_PKEY_CTX_ctrl( ctx: *mut EVP_PKEY_CTX, keytype: c_int, optype: c_int, cmd: c_int, p1: c_int, p2: *mut c_void, ) -> c_int498     pub fn EVP_PKEY_CTX_ctrl(
499         ctx: *mut EVP_PKEY_CTX,
500         keytype: c_int,
501         optype: c_int,
502         cmd: c_int,
503         p1: c_int,
504         p2: *mut c_void,
505     ) -> c_int;
506 
EVP_PKEY_new_mac_key( type_: c_int, e: *mut ENGINE, key: *const c_uchar, keylen: c_int, ) -> *mut EVP_PKEY507     pub fn EVP_PKEY_new_mac_key(
508         type_: c_int,
509         e: *mut ENGINE,
510         key: *const c_uchar,
511         keylen: c_int,
512     ) -> *mut EVP_PKEY;
513 
EVP_PKEY_derive_init(ctx: *mut EVP_PKEY_CTX) -> c_int514     pub fn EVP_PKEY_derive_init(ctx: *mut EVP_PKEY_CTX) -> c_int;
EVP_PKEY_derive_set_peer(ctx: *mut EVP_PKEY_CTX, peer: *mut EVP_PKEY) -> c_int515     pub fn EVP_PKEY_derive_set_peer(ctx: *mut EVP_PKEY_CTX, peer: *mut EVP_PKEY) -> c_int;
EVP_PKEY_derive(ctx: *mut EVP_PKEY_CTX, key: *mut c_uchar, size: *mut size_t) -> c_int516     pub fn EVP_PKEY_derive(ctx: *mut EVP_PKEY_CTX, key: *mut c_uchar, size: *mut size_t) -> c_int;
517 
518     #[cfg(ossl300)]
EVP_PKEY_Q_keygen( libctx: *mut OSSL_LIB_CTX, propq: *const c_char, type_: *const c_char, ... ) -> *mut EVP_PKEY519     pub fn EVP_PKEY_Q_keygen(
520         libctx: *mut OSSL_LIB_CTX,
521         propq: *const c_char,
522         type_: *const c_char,
523         ...
524     ) -> *mut EVP_PKEY;
EVP_PKEY_keygen_init(ctx: *mut EVP_PKEY_CTX) -> c_int525     pub fn EVP_PKEY_keygen_init(ctx: *mut EVP_PKEY_CTX) -> c_int;
EVP_PKEY_keygen(ctx: *mut EVP_PKEY_CTX, key: *mut *mut EVP_PKEY) -> c_int526     pub fn EVP_PKEY_keygen(ctx: *mut EVP_PKEY_CTX, key: *mut *mut EVP_PKEY) -> c_int;
527 
EVP_PKEY_sign_init(ctx: *mut EVP_PKEY_CTX) -> c_int528     pub fn EVP_PKEY_sign_init(ctx: *mut EVP_PKEY_CTX) -> c_int;
EVP_PKEY_sign( ctx: *mut EVP_PKEY_CTX, sig: *mut c_uchar, siglen: *mut size_t, tbs: *const c_uchar, tbslen: size_t, ) -> c_int529     pub fn EVP_PKEY_sign(
530         ctx: *mut EVP_PKEY_CTX,
531         sig: *mut c_uchar,
532         siglen: *mut size_t,
533         tbs: *const c_uchar,
534         tbslen: size_t,
535     ) -> c_int;
EVP_PKEY_verify_init(ctx: *mut EVP_PKEY_CTX) -> c_int536     pub fn EVP_PKEY_verify_init(ctx: *mut EVP_PKEY_CTX) -> c_int;
EVP_PKEY_verify( ctx: *mut EVP_PKEY_CTX, sig: *const c_uchar, siglen: size_t, tbs: *const c_uchar, tbslen: size_t, ) -> c_int537     pub fn EVP_PKEY_verify(
538         ctx: *mut EVP_PKEY_CTX,
539         sig: *const c_uchar,
540         siglen: size_t,
541         tbs: *const c_uchar,
542         tbslen: size_t,
543     ) -> c_int;
EVP_PKEY_encrypt_init(ctx: *mut EVP_PKEY_CTX) -> c_int544     pub fn EVP_PKEY_encrypt_init(ctx: *mut EVP_PKEY_CTX) -> c_int;
EVP_PKEY_encrypt( ctx: *mut EVP_PKEY_CTX, pout: *mut c_uchar, poutlen: *mut size_t, pin: *const c_uchar, pinlen: size_t, ) -> c_int545     pub fn EVP_PKEY_encrypt(
546         ctx: *mut EVP_PKEY_CTX,
547         pout: *mut c_uchar,
548         poutlen: *mut size_t,
549         pin: *const c_uchar,
550         pinlen: size_t,
551     ) -> c_int;
EVP_PKEY_decrypt_init(ctx: *mut EVP_PKEY_CTX) -> c_int552     pub fn EVP_PKEY_decrypt_init(ctx: *mut EVP_PKEY_CTX) -> c_int;
EVP_PKEY_decrypt( ctx: *mut EVP_PKEY_CTX, pout: *mut c_uchar, poutlen: *mut size_t, pin: *const c_uchar, pinlen: size_t, ) -> c_int553     pub fn EVP_PKEY_decrypt(
554         ctx: *mut EVP_PKEY_CTX,
555         pout: *mut c_uchar,
556         poutlen: *mut size_t,
557         pin: *const c_uchar,
558         pinlen: size_t,
559     ) -> c_int;
560 }
561 
562 const_ptr_api! {
563     extern "C" {
564         pub fn EVP_PKCS82PKEY(p8: #[const_ptr_if(any(ossl110, libressl280))] PKCS8_PRIV_KEY_INFO) -> *mut EVP_PKEY;
565     }
566 }
567 
568 cfg_if! {
569     if #[cfg(any(ossl111, libressl370))] {
570         extern "C" {
571             pub fn EVP_PKEY_get_raw_public_key(
572                 pkey: *const EVP_PKEY,
573                 ppub: *mut c_uchar,
574                 len: *mut size_t,
575             ) -> c_int;
576             pub fn EVP_PKEY_new_raw_public_key(
577                 ttype: c_int,
578                 e: *mut ENGINE,
579                 key: *const c_uchar,
580                 keylen: size_t,
581             ) -> *mut EVP_PKEY;
582             pub fn EVP_PKEY_get_raw_private_key(
583                 pkey: *const EVP_PKEY,
584                 ppriv: *mut c_uchar,
585                 len: *mut size_t,
586             ) -> c_int;
587             pub fn EVP_PKEY_new_raw_private_key(
588                 ttype: c_int,
589                 e: *mut ENGINE,
590                 key: *const c_uchar,
591                 keylen: size_t,
592             ) -> *mut EVP_PKEY;
593         }
594     }
595 }
596 
597 extern "C" {
EVP_EncodeBlock(dst: *mut c_uchar, src: *const c_uchar, src_len: c_int) -> c_int598     pub fn EVP_EncodeBlock(dst: *mut c_uchar, src: *const c_uchar, src_len: c_int) -> c_int;
EVP_DecodeBlock(dst: *mut c_uchar, src: *const c_uchar, src_len: c_int) -> c_int599     pub fn EVP_DecodeBlock(dst: *mut c_uchar, src: *const c_uchar, src_len: c_int) -> c_int;
600 }
601