4 pub const EVP_MAX_MD_SIZE
: c_uint
= 64;
6 pub const PKCS5_SALT_LEN
: c_int
= 8;
7 pub const PKCS12_DEFAULT_ITER
: c_int
= 2048;
9 pub const EVP_PKEY_RSA
: c_int
= NID_rsaEncryption
;
10 pub const EVP_PKEY_DSA
: c_int
= NID_dsa
;
11 pub const EVP_PKEY_DH
: c_int
= NID_dhKeyAgreement
;
12 pub const EVP_PKEY_EC
: c_int
= NID_X9_62_id_ecPublicKey
;
14 pub const EVP_PKEY_SM2
: c_int
= NID_sm2
;
15 #[cfg(any(ossl111, libressl370))]
16 pub const EVP_PKEY_X25519
: c_int
= NID_X25519
;
17 #[cfg(any(ossl111, libressl370))]
18 pub const EVP_PKEY_ED25519
: c_int
= NID_ED25519
;
20 pub const EVP_PKEY_X448
: c_int
= NID_X448
;
22 pub const EVP_PKEY_ED448
: c_int
= NID_ED448
;
23 pub const EVP_PKEY_HMAC
: c_int
= NID_hmac
;
24 pub const EVP_PKEY_CMAC
: c_int
= NID_cmac
;
26 pub const EVP_PKEY_POLY1305
: c_int
= NID_poly1305
;
28 pub const EVP_PKEY_HKDF
: c_int
= NID_hkdf
;
31 pub const EVP_CIPHER_CTX_FLAG_WRAP_ALLOW
: c_int
= 0x1;
33 pub const EVP_CTRL_GCM_SET_IVLEN
: c_int
= 0x9;
34 pub const EVP_CTRL_GCM_GET_TAG
: c_int
= 0x10;
35 pub const EVP_CTRL_GCM_SET_TAG
: c_int
= 0x11;
37 pub unsafe fn EVP_get_digestbynid(type_
: c_int
) -> *const EVP_MD
{
38 EVP_get_digestbyname(OBJ_nid2sn(type_
))
44 pub unsafe fn EVP_MD_CTX_md(ctx
: *const EVP_MD_CTX
) -> *const EVP_MD
{
45 EVP_MD_CTX_get0_md(ctx
)
49 pub unsafe fn EVP_MD_CTX_get_size(ctx
: *const EVP_MD_CTX
) -> c_int
{
50 EVP_MD_get_size(EVP_MD_CTX_get0_md(ctx
))
54 pub unsafe fn EVP_MD_CTX_size(ctx
: *const EVP_MD_CTX
) -> c_int
{
55 EVP_MD_CTX_get_size(ctx
)
59 pub unsafe fn EVP_MD_block_size(md
: *const EVP_MD
) -> c_int
{
60 EVP_MD_get_block_size(md
)
64 pub unsafe fn EVP_MD_size(md
: *const EVP_MD
) -> c_int
{
69 pub unsafe fn EVP_MD_type(md
: *const EVP_MD
) -> c_int
{
74 pub unsafe fn EVP_CIPHER_key_length(cipher
: *const EVP_CIPHER
) -> c_int
{
75 EVP_CIPHER_get_key_length(cipher
)
79 pub unsafe fn EVP_CIPHER_block_size(cipher
: *const EVP_CIPHER
) -> c_int
{
80 EVP_CIPHER_get_block_size(cipher
)
84 pub unsafe fn EVP_CIPHER_iv_length(cipher
: *const EVP_CIPHER
) -> c_int
{
85 EVP_CIPHER_get_iv_length(cipher
)
89 pub unsafe fn EVP_CIPHER_nid(cipher
: *const EVP_CIPHER
) -> c_int
{
90 EVP_CIPHER_get_nid(cipher
)
94 pub unsafe fn EVP_CIPHER_CTX_block_size(ctx
: *const EVP_CIPHER_CTX
) -> c_int
{
95 EVP_CIPHER_CTX_get_block_size(ctx
)
99 pub unsafe fn EVP_CIPHER_CTX_key_length(ctx
: *const EVP_CIPHER_CTX
) -> c_int
{
100 EVP_CIPHER_CTX_get_key_length(ctx
)
104 pub unsafe fn EVP_CIPHER_CTX_iv_length(ctx
: *const EVP_CIPHER_CTX
) -> c_int
{
105 EVP_CIPHER_CTX_get_iv_length(ctx
)
109 pub unsafe fn EVP_CIPHER_CTX_num(ctx
: *const EVP_CIPHER_CTX
) -> c_int
{
110 EVP_CIPHER_CTX_get_num(ctx
)
113 pub unsafe fn EVP_MD_CTX_size(ctx
: *const EVP_MD_CTX
) -> c_int
{
114 EVP_MD_size(EVP_MD_CTX_md(ctx
))
120 pub unsafe fn EVP_DigestSignUpdate(
121 ctx
: *mut EVP_MD_CTX
,
125 EVP_DigestUpdate(ctx
, data
, dsize
)
129 pub unsafe fn EVP_DigestVerifyUpdate(
130 ctx
: *mut EVP_MD_CTX
,
134 EVP_DigestUpdate(ctx
, data
, dsize
)
138 pub unsafe fn EVP_PKEY_size(pkey
: *const EVP_PKEY
) -> c_int
{
139 EVP_PKEY_get_size(pkey
)
145 pub unsafe fn EVP_PKEY_id(pkey
: *const EVP_PKEY
) -> c_int
{
146 EVP_PKEY_get_id(pkey
)
150 pub unsafe fn EVP_PKEY_bits(pkey
: *const EVP_PKEY
) -> c_int
{
151 EVP_PKEY_get_bits(pkey
)
155 pub unsafe fn EVP_PKEY_security_bits(pkey
: *const EVP_PKEY
) -> c_int
{
156 EVP_PKEY_get_security_bits(pkey
)
161 pub const EVP_PKEY_OP_KEYGEN
: c_int
= 1 << 2;
164 pub const EVP_PKEY_OP_SIGN
: c_int
= 1 << 4;
165 pub const EVP_PKEY_OP_VERIFY
: c_int
= 1 << 5;
166 pub const EVP_PKEY_OP_VERIFYRECOVER
: c_int
= 1 << 6;
167 pub const EVP_PKEY_OP_SIGNCTX
: c_int
= 1 << 7;
168 pub const EVP_PKEY_OP_VERIFYCTX
: c_int
= 1 << 8;
169 pub const EVP_PKEY_OP_ENCRYPT
: c_int
= 1 << 9;
170 pub const EVP_PKEY_OP_DECRYPT
: c_int
= 1 << 10;
171 pub const EVP_PKEY_OP_DERIVE
: c_int
= 1 << 11;
173 pub const EVP_PKEY_OP_SIGN
: c_int
= 1 << 3;
174 pub const EVP_PKEY_OP_VERIFY
: c_int
= 1 << 4;
175 pub const EVP_PKEY_OP_VERIFYRECOVER
: c_int
= 1 << 5;
176 pub const EVP_PKEY_OP_SIGNCTX
: c_int
= 1 << 6;
177 pub const EVP_PKEY_OP_VERIFYCTX
: c_int
= 1 << 7;
178 pub const EVP_PKEY_OP_ENCRYPT
: c_int
= 1 << 8;
179 pub const EVP_PKEY_OP_DECRYPT
: c_int
= 1 << 9;
180 pub const EVP_PKEY_OP_DERIVE
: c_int
= 1 << 10;
184 pub const EVP_PKEY_OP_TYPE_SIG
: c_int
= EVP_PKEY_OP_SIGN
186 | EVP_PKEY_OP_VERIFYRECOVER
187 | EVP_PKEY_OP_SIGNCTX
188 | EVP_PKEY_OP_VERIFYCTX
;
190 pub const EVP_PKEY_OP_TYPE_CRYPT
: c_int
= EVP_PKEY_OP_ENCRYPT
| EVP_PKEY_OP_DECRYPT
;
192 pub const EVP_PKEY_CTRL_MD
: c_int
= 1;
194 pub const EVP_PKEY_CTRL_SET_MAC_KEY
: c_int
= 6;
196 pub const EVP_PKEY_CTRL_CIPHER
: c_int
= 12;
198 pub const EVP_PKEY_ALG_CTRL
: c_int
= 0x1000;
201 pub const EVP_PKEY_HKDEF_MODE_EXTRACT_AND_EXPAND
: c_int
= 0;
204 pub const EVP_PKEY_HKDEF_MODE_EXTRACT_ONLY
: c_int
= 1;
207 pub const EVP_PKEY_HKDEF_MODE_EXPAND_ONLY
: c_int
= 2;
210 pub const EVP_PKEY_CTRL_HKDF_MD
: c_int
= EVP_PKEY_ALG_CTRL
+ 3;
213 pub const EVP_PKEY_CTRL_HKDF_SALT
: c_int
= EVP_PKEY_ALG_CTRL
+ 4;
216 pub const EVP_PKEY_CTRL_HKDF_KEY
: c_int
= EVP_PKEY_ALG_CTRL
+ 5;
219 pub const EVP_PKEY_CTRL_HKDF_INFO
: c_int
= EVP_PKEY_ALG_CTRL
+ 6;
222 pub const EVP_PKEY_CTRL_HKDF_MODE
: c_int
= EVP_PKEY_ALG_CTRL
+ 7;
224 #[cfg(all(ossl111, not(ossl300)))]
225 pub unsafe fn EVP_PKEY_CTX_set_hkdf_mode(ctx
: *mut EVP_PKEY_CTX
, mode
: c_int
) -> c_int
{
230 EVP_PKEY_CTRL_HKDF_MODE
,
232 std
::ptr
::null_mut(),
236 #[cfg(all(ossl110, not(ossl300)))]
237 pub unsafe fn EVP_PKEY_CTX_set_hkdf_md(ctx
: *mut EVP_PKEY_CTX
, md
: *const EVP_MD
) -> c_int
{
242 EVP_PKEY_CTRL_HKDF_MD
,
248 #[cfg(all(ossl110, not(ossl300)))]
249 pub unsafe fn EVP_PKEY_CTX_set1_hkdf_salt(
250 ctx
: *mut EVP_PKEY_CTX
,
258 EVP_PKEY_CTRL_HKDF_SALT
,
264 #[cfg(all(ossl110, not(ossl300)))]
265 pub unsafe fn EVP_PKEY_CTX_set1_hkdf_key(
266 ctx
: *mut EVP_PKEY_CTX
,
274 EVP_PKEY_CTRL_HKDF_KEY
,
280 #[cfg(all(ossl110, not(ossl300)))]
281 pub unsafe fn EVP_PKEY_CTX_add1_hkdf_info(
282 ctx
: *mut EVP_PKEY_CTX
,
290 EVP_PKEY_CTRL_HKDF_INFO
,
296 #[cfg(all(not(ossl300), not(boringssl)))]
297 pub unsafe fn EVP_PKEY_CTX_set_signature_md(cxt
: *mut EVP_PKEY_CTX
, md
: *mut EVP_MD
) -> c_int
{
301 EVP_PKEY_OP_TYPE_SIG
,
308 pub unsafe fn EVP_PKEY_assign_RSA(pkey
: *mut EVP_PKEY
, rsa
: *mut RSA
) -> c_int
{
309 EVP_PKEY_assign(pkey
, EVP_PKEY_RSA
, rsa
as *mut c_void
)
312 pub unsafe fn EVP_PKEY_assign_DSA(pkey
: *mut EVP_PKEY
, dsa
: *mut DSA
) -> c_int
{
313 EVP_PKEY_assign(pkey
, EVP_PKEY_DSA
, dsa
as *mut c_void
)
316 pub unsafe fn EVP_PKEY_assign_DH(pkey
: *mut EVP_PKEY
, dh
: *mut DH
) -> c_int
{
317 EVP_PKEY_assign(pkey
, EVP_PKEY_DH
, dh
as *mut c_void
)
320 pub unsafe fn EVP_PKEY_assign_EC_KEY(pkey
: *mut EVP_PKEY
, ec_key
: *mut EC_KEY
) -> c_int
{
321 EVP_PKEY_assign(pkey
, EVP_PKEY_EC
, ec_key
as *mut c_void
)