]>
Commit | Line | Data |
---|---|---|
21dcbebc | 1 | /* |
4bed94f0 | 2 | * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. |
d02b48c6 | 3 | * |
48f4ad77 | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
21dcbebc RS |
5 | * this file except in compliance with the License. You can obtain a copy |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
d02b48c6 RE |
8 | */ |
9 | ||
ae4186b0 DMSP |
10 | #ifndef OPENSSL_EVP_H |
11 | # define OPENSSL_EVP_H | |
d86167ec DMSP |
12 | # pragma once |
13 | ||
14 | # include <openssl/macros.h> | |
15 | # if !OPENSSL_API_3 | |
16 | # define HEADER_ENVELOPE_H | |
17 | # endif | |
0f113f3e | 18 | |
567db2c1 RL |
19 | # include <stdarg.h> |
20 | ||
cde052f5 | 21 | # include <openssl/opensslconf.h> |
50cd4768 | 22 | # include <openssl/types.h> |
e74bd290 | 23 | # include <openssl/core.h> |
0f113f3e | 24 | # include <openssl/symhacks.h> |
a00ae6c4 | 25 | # include <openssl/bio.h> |
52df25cf | 26 | # include <openssl/evperr.h> |
d5e5e2ff | 27 | # include <openssl/params.h> |
d02b48c6 | 28 | |
0f113f3e MC |
29 | # define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */ |
30 | # define EVP_MAX_KEY_LENGTH 64 | |
31 | # define EVP_MAX_IV_LENGTH 16 | |
32 | # define EVP_MAX_BLOCK_LENGTH 32 | |
d02b48c6 | 33 | |
0f113f3e | 34 | # define PKCS5_SALT_LEN 8 |
b7d135b3 | 35 | /* Default PKCS#5 iteration count */ |
0f113f3e MC |
36 | # define PKCS5_DEFAULT_ITER 2048 |
37 | ||
38 | # include <openssl/objects.h> | |
39 | ||
40 | # define EVP_PK_RSA 0x0001 | |
41 | # define EVP_PK_DSA 0x0002 | |
42 | # define EVP_PK_DH 0x0004 | |
43 | # define EVP_PK_EC 0x0008 | |
44 | # define EVP_PKT_SIGN 0x0010 | |
45 | # define EVP_PKT_ENC 0x0020 | |
46 | # define EVP_PKT_EXCH 0x0040 | |
47 | # define EVP_PKS_RSA 0x0100 | |
48 | # define EVP_PKS_DSA 0x0200 | |
49 | # define EVP_PKS_EC 0x0400 | |
0f113f3e MC |
50 | |
51 | # define EVP_PKEY_NONE NID_undef | |
52 | # define EVP_PKEY_RSA NID_rsaEncryption | |
53 | # define EVP_PKEY_RSA2 NID_rsa | |
ffc6fad5 | 54 | # define EVP_PKEY_RSA_PSS NID_rsassaPss |
0f113f3e MC |
55 | # define EVP_PKEY_DSA NID_dsa |
56 | # define EVP_PKEY_DSA1 NID_dsa_2 | |
57 | # define EVP_PKEY_DSA2 NID_dsaWithSHA | |
58 | # define EVP_PKEY_DSA3 NID_dsaWithSHA1 | |
59 | # define EVP_PKEY_DSA4 NID_dsaWithSHA1_2 | |
60 | # define EVP_PKEY_DH NID_dhKeyAgreement | |
61 | # define EVP_PKEY_DHX NID_dhpublicnumber | |
62 | # define EVP_PKEY_EC NID_X9_62_id_ecPublicKey | |
3d328a44 | 63 | # define EVP_PKEY_SM2 NID_sm2 |
0f113f3e MC |
64 | # define EVP_PKEY_HMAC NID_hmac |
65 | # define EVP_PKEY_CMAC NID_cmac | |
cefa762e | 66 | # define EVP_PKEY_SCRYPT NID_id_scrypt |
1eff3485 | 67 | # define EVP_PKEY_TLS1_PRF NID_tls1_prf |
aacfb134 | 68 | # define EVP_PKEY_HKDF NID_hkdf |
52ad5b60 | 69 | # define EVP_PKEY_POLY1305 NID_poly1305 |
3f5616d7 | 70 | # define EVP_PKEY_SIPHASH NID_siphash |
d2916a5b DSH |
71 | # define EVP_PKEY_X25519 NID_X25519 |
72 | # define EVP_PKEY_ED25519 NID_ED25519 | |
f7869f1b MC |
73 | # define EVP_PKEY_X448 NID_X448 |
74 | # define EVP_PKEY_ED448 NID_ED448 | |
0f113f3e MC |
75 | |
76 | #ifdef __cplusplus | |
82271cee RL |
77 | extern "C" { |
78 | #endif | |
79 | ||
cb929645 RL |
80 | int EVP_set_default_properties(OPENSSL_CTX *libctx, const char *propq); |
81 | ||
0f113f3e MC |
82 | # define EVP_PKEY_MO_SIGN 0x0001 |
83 | # define EVP_PKEY_MO_VERIFY 0x0002 | |
84 | # define EVP_PKEY_MO_ENCRYPT 0x0004 | |
85 | # define EVP_PKEY_MO_DECRYPT 0x0008 | |
86 | ||
87 | # ifndef EVP_MD | |
2db6bf6f RL |
88 | EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); |
89 | EVP_MD *EVP_MD_meth_dup(const EVP_MD *md); | |
90 | void EVP_MD_meth_free(EVP_MD *md); | |
91 | ||
92 | int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize); | |
93 | int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize); | |
94 | int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize); | |
95 | int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags); | |
96 | int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx)); | |
97 | int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx, | |
98 | const void *data, | |
99 | size_t count)); | |
100 | int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx, | |
101 | unsigned char *md)); | |
102 | int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to, | |
103 | const EVP_MD_CTX *from)); | |
104 | int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx)); | |
105 | int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd, | |
106 | int p1, void *p2)); | |
107 | ||
108 | int EVP_MD_meth_get_input_blocksize(const EVP_MD *md); | |
109 | int EVP_MD_meth_get_result_size(const EVP_MD *md); | |
110 | int EVP_MD_meth_get_app_datasize(const EVP_MD *md); | |
111 | unsigned long EVP_MD_meth_get_flags(const EVP_MD *md); | |
112 | int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx); | |
113 | int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx, | |
114 | const void *data, | |
115 | size_t count); | |
116 | int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx, | |
117 | unsigned char *md); | |
118 | int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to, | |
119 | const EVP_MD_CTX *from); | |
120 | int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx); | |
121 | int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, | |
122 | int p1, void *p2); | |
0f113f3e | 123 | |
dbd87ffc | 124 | /* digest can only handle a single block */ |
0f113f3e | 125 | # define EVP_MD_FLAG_ONESHOT 0x0001 |
dbd87ffc | 126 | |
cd8d1456 AP |
127 | /* digest is extensible-output function, XOF */ |
128 | # define EVP_MD_FLAG_XOF 0x0002 | |
129 | ||
09659916 DSH |
130 | /* DigestAlgorithmIdentifier flags... */ |
131 | ||
0f113f3e | 132 | # define EVP_MD_FLAG_DIGALGID_MASK 0x0018 |
09659916 DSH |
133 | |
134 | /* NULL or absent parameter accepted. Use NULL */ | |
135 | ||
0f113f3e | 136 | # define EVP_MD_FLAG_DIGALGID_NULL 0x0000 |
09659916 DSH |
137 | |
138 | /* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */ | |
139 | ||
0f113f3e | 140 | # define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008 |
09659916 DSH |
141 | |
142 | /* Custom handling via ctrl */ | |
143 | ||
0f113f3e | 144 | # define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018 |
09659916 | 145 | |
dbd87ffc | 146 | /* Note if suitable for use in FIPS mode */ |
0f113f3e | 147 | # define EVP_MD_FLAG_FIPS 0x0400 |
7a4bd34a | 148 | |
09659916 DSH |
149 | /* Digest ctrls */ |
150 | ||
0f113f3e MC |
151 | # define EVP_MD_CTRL_DIGALGID 0x1 |
152 | # define EVP_MD_CTRL_MICALG 0x2 | |
cd8d1456 | 153 | # define EVP_MD_CTRL_XOF_LEN 0x3 |
09659916 DSH |
154 | |
155 | /* Minimum Algorithm specific ctrl value */ | |
156 | ||
0f113f3e | 157 | # define EVP_MD_CTRL_ALG_CTRL 0x1000 |
09659916 | 158 | |
0f113f3e MC |
159 | # endif /* !EVP_MD */ |
160 | ||
26188931 BL |
161 | /* values for EVP_MD_CTX flags */ |
162 | ||
0f113f3e MC |
163 | # define EVP_MD_CTX_FLAG_ONESHOT 0x0001/* digest update will be |
164 | * called once only */ | |
165 | # define EVP_MD_CTX_FLAG_CLEANED 0x0002/* context has already been | |
166 | * cleaned */ | |
167 | # define EVP_MD_CTX_FLAG_REUSE 0x0004/* Don't free up ctx->md_data | |
e79f8773 | 168 | * in EVP_MD_CTX_reset */ |
0f113f3e MC |
169 | /* |
170 | * FIPS and pad options are ignored in 1.0.0, definitions are here so we | |
171 | * don't accidentally reuse the values for other purposes. | |
43e12b6f | 172 | */ |
d02b48c6 | 173 | |
0f113f3e MC |
174 | # define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008/* Allow use of non FIPS |
175 | * digest in FIPS mode */ | |
09659916 | 176 | |
0f113f3e MC |
177 | /* |
178 | * The following PAD options are also currently ignored in 1.0.0, digest | |
43e12b6f DSH |
179 | * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*() |
180 | * instead. | |
181 | */ | |
0f113f3e MC |
182 | # define EVP_MD_CTX_FLAG_PAD_MASK 0xF0/* RSA mode to use */ |
183 | # define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00/* PKCS#1 v1.5 mode */ | |
184 | # define EVP_MD_CTX_FLAG_PAD_X931 0x10/* X9.31 mode */ | |
185 | # define EVP_MD_CTX_FLAG_PAD_PSS 0x20/* PSS mode */ | |
09659916 | 186 | |
0f113f3e MC |
187 | # define EVP_MD_CTX_FLAG_NO_INIT 0x0100/* Don't initialize md_data */ |
188 | /* | |
189 | * Some functions such as EVP_DigestSign only finalise copies of internal | |
afa23c46 DSH |
190 | * contexts so additional data can be included after the finalisation call. |
191 | * This is inefficient if this functionality is not required: it is disabled | |
192 | * if the following flag is set. | |
193 | */ | |
0f113f3e | 194 | # define EVP_MD_CTX_FLAG_FINALISE 0x0200 |
bd9faf11 | 195 | /* NOTE: 0x0400 is reserved for internal usage */ |
00902d94 | 196 | |
e79f8773 RL |
197 | EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); |
198 | EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher); | |
199 | void EVP_CIPHER_meth_free(EVP_CIPHER *cipher); | |
200 | ||
201 | int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); | |
202 | int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); | |
203 | int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size); | |
204 | int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher, | |
205 | int (*init) (EVP_CIPHER_CTX *ctx, | |
206 | const unsigned char *key, | |
207 | const unsigned char *iv, | |
208 | int enc)); | |
209 | int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher, | |
210 | int (*do_cipher) (EVP_CIPHER_CTX *ctx, | |
211 | unsigned char *out, | |
212 | const unsigned char *in, | |
213 | size_t inl)); | |
214 | int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher, | |
215 | int (*cleanup) (EVP_CIPHER_CTX *)); | |
216 | int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher, | |
217 | int (*set_asn1_parameters) (EVP_CIPHER_CTX *, | |
218 | ASN1_TYPE *)); | |
219 | int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher, | |
220 | int (*get_asn1_parameters) (EVP_CIPHER_CTX *, | |
221 | ASN1_TYPE *)); | |
222 | int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher, | |
223 | int (*ctrl) (EVP_CIPHER_CTX *, int type, | |
224 | int arg, void *ptr)); | |
225 | ||
226 | int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, | |
227 | const unsigned char *key, | |
228 | const unsigned char *iv, | |
229 | int enc); | |
230 | int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx, | |
231 | unsigned char *out, | |
232 | const unsigned char *in, | |
233 | size_t inl); | |
234 | int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *); | |
235 | int (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, | |
236 | ASN1_TYPE *); | |
237 | int (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, | |
238 | ASN1_TYPE *); | |
239 | int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *, | |
240 | int type, int arg, | |
241 | void *ptr); | |
7f060601 DSH |
242 | |
243 | /* Values for cipher flags */ | |
244 | ||
360370d9 | 245 | /* Modes for ciphers */ |
7f060601 | 246 | |
0f113f3e MC |
247 | # define EVP_CIPH_STREAM_CIPHER 0x0 |
248 | # define EVP_CIPH_ECB_MODE 0x1 | |
249 | # define EVP_CIPH_CBC_MODE 0x2 | |
250 | # define EVP_CIPH_CFB_MODE 0x3 | |
251 | # define EVP_CIPH_OFB_MODE 0x4 | |
252 | # define EVP_CIPH_CTR_MODE 0x5 | |
253 | # define EVP_CIPH_GCM_MODE 0x6 | |
254 | # define EVP_CIPH_CCM_MODE 0x7 | |
255 | # define EVP_CIPH_XTS_MODE 0x10001 | |
256 | # define EVP_CIPH_WRAP_MODE 0x10002 | |
257 | # define EVP_CIPH_OCB_MODE 0x10003 | |
b1ceb439 | 258 | # define EVP_CIPH_SIV_MODE 0x10004 |
0f113f3e | 259 | # define EVP_CIPH_MODE 0xF0007 |
7f060601 | 260 | /* Set if variable length cipher */ |
0f113f3e | 261 | # define EVP_CIPH_VARIABLE_LENGTH 0x8 |
360370d9 | 262 | /* Set if the iv handling should be done by the cipher itself */ |
0f113f3e | 263 | # define EVP_CIPH_CUSTOM_IV 0x10 |
360370d9 | 264 | /* Set if the cipher's init() function should be called if key is NULL */ |
0f113f3e | 265 | # define EVP_CIPH_ALWAYS_CALL_INIT 0x20 |
57ae2e24 | 266 | /* Call ctrl() to init cipher parameters */ |
0f113f3e | 267 | # define EVP_CIPH_CTRL_INIT 0x40 |
57ae2e24 | 268 | /* Don't use standard key length function */ |
0f113f3e | 269 | # define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80 |
f2e5ca84 | 270 | /* Don't use standard block padding */ |
0f113f3e | 271 | # define EVP_CIPH_NO_PADDING 0x100 |
216659eb | 272 | /* cipher handles random key generation */ |
0f113f3e | 273 | # define EVP_CIPH_RAND_KEY 0x200 |
c2bf7208 | 274 | /* cipher has its own additional copying logic */ |
0f113f3e | 275 | # define EVP_CIPH_CUSTOM_COPY 0x400 |
7dddf2fc SL |
276 | /* Don't use standard iv length function */ |
277 | # define EVP_CIPH_CUSTOM_IV_LENGTH 0x800 | |
c96399e2 RL |
278 | /* Legacy and no longer relevant: Allow use default ASN1 get/set iv */ |
279 | # define EVP_CIPH_FLAG_DEFAULT_ASN1 0 | |
280 | /* Free: 0x1000 */ | |
79cfc3ac | 281 | /* Buffer length in bits not bytes: CFB1 mode only */ |
0f113f3e | 282 | # define EVP_CIPH_FLAG_LENGTH_BITS 0x2000 |
7a4bd34a | 283 | /* Note if suitable for use in FIPS mode */ |
0f113f3e | 284 | # define EVP_CIPH_FLAG_FIPS 0x4000 |
7a4bd34a | 285 | /* Allow non FIPS cipher in FIPS mode */ |
0f113f3e MC |
286 | # define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000 |
287 | /* | |
288 | * Cipher handles any and all padding logic as well as finalisation. | |
3da0ca79 | 289 | */ |
0f113f3e MC |
290 | # define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000 |
291 | # define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000 | |
292 | # define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000 | |
4e392522 MC |
293 | /* Cipher can handle pipeline operations */ |
294 | # define EVP_CIPH_FLAG_PIPELINE 0X800000 | |
c96399e2 RL |
295 | /* For provider implementations that handle ASN1 get/set param themselves */ |
296 | # define EVP_CIPH_FLAG_CUSTOM_ASN1 0x1000000 | |
7f060601 | 297 | |
0f113f3e MC |
298 | /* |
299 | * Cipher context flag to indicate we can handle wrap mode: if allowed in | |
300 | * older applications it could overflow buffers. | |
97cf1f6c DSH |
301 | */ |
302 | ||
0f113f3e | 303 | # define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1 |
97cf1f6c | 304 | |
57ae2e24 DSH |
305 | /* ctrl() values */ |
306 | ||
0f113f3e MC |
307 | # define EVP_CTRL_INIT 0x0 |
308 | # define EVP_CTRL_SET_KEY_LENGTH 0x1 | |
309 | # define EVP_CTRL_GET_RC2_KEY_BITS 0x2 | |
310 | # define EVP_CTRL_SET_RC2_KEY_BITS 0x3 | |
311 | # define EVP_CTRL_GET_RC5_ROUNDS 0x4 | |
312 | # define EVP_CTRL_SET_RC5_ROUNDS 0x5 | |
313 | # define EVP_CTRL_RAND_KEY 0x6 | |
314 | # define EVP_CTRL_PBE_PRF_NID 0x7 | |
315 | # define EVP_CTRL_COPY 0x8 | |
e640fa02 MC |
316 | # define EVP_CTRL_AEAD_SET_IVLEN 0x9 |
317 | # define EVP_CTRL_AEAD_GET_TAG 0x10 | |
318 | # define EVP_CTRL_AEAD_SET_TAG 0x11 | |
e75c5a79 | 319 | # define EVP_CTRL_AEAD_SET_IV_FIXED 0x12 |
e640fa02 MC |
320 | # define EVP_CTRL_GCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN |
321 | # define EVP_CTRL_GCM_GET_TAG EVP_CTRL_AEAD_GET_TAG | |
322 | # define EVP_CTRL_GCM_SET_TAG EVP_CTRL_AEAD_SET_TAG | |
e75c5a79 | 323 | # define EVP_CTRL_GCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED |
0f113f3e | 324 | # define EVP_CTRL_GCM_IV_GEN 0x13 |
e640fa02 MC |
325 | # define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN |
326 | # define EVP_CTRL_CCM_GET_TAG EVP_CTRL_AEAD_GET_TAG | |
327 | # define EVP_CTRL_CCM_SET_TAG EVP_CTRL_AEAD_SET_TAG | |
e75c5a79 | 328 | # define EVP_CTRL_CCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED |
0f113f3e MC |
329 | # define EVP_CTRL_CCM_SET_L 0x14 |
330 | # define EVP_CTRL_CCM_SET_MSGLEN 0x15 | |
331 | /* | |
332 | * AEAD cipher deduces payload length and returns number of bytes required to | |
333 | * store MAC and eventual padding. Subsequent call to EVP_Cipher even | |
334 | * appends/verifies MAC. | |
a355cf9b | 335 | */ |
0f113f3e | 336 | # define EVP_CTRL_AEAD_TLS1_AAD 0x16 |
a355cf9b | 337 | /* Used by composite AEAD ciphers, no-op in GCM, CCM... */ |
0f113f3e | 338 | # define EVP_CTRL_AEAD_SET_MAC_KEY 0x17 |
28dd49fa | 339 | /* Set the GCM invocation field, decrypt only */ |
0f113f3e | 340 | # define EVP_CTRL_GCM_SET_IV_INV 0x18 |
28dd49fa | 341 | |
0f113f3e MC |
342 | # define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19 |
343 | # define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a | |
344 | # define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b | |
345 | # define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c | |
b1de640f | 346 | |
93972b8c DSH |
347 | # define EVP_CTRL_SSL3_MASTER_SECRET 0x1d |
348 | ||
6140f036 | 349 | /* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */ |
686cf15e | 350 | # define EVP_CTRL_SET_SBOX 0x1e |
6140f036 DB |
351 | /* |
352 | * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a | |
353 | * pre-allocated buffer with specified size | |
354 | */ | |
686cf15e | 355 | # define EVP_CTRL_SBOX_USED 0x1f |
6140f036 DB |
356 | /* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after, |
357 | * 0 switches meshing off | |
358 | */ | |
686cf15e | 359 | # define EVP_CTRL_KEY_MESH 0x20 |
6140f036 | 360 | /* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */ |
686cf15e | 361 | # define EVP_CTRL_BLOCK_PADDING_MODE 0x21 |
6140f036 | 362 | |
4e392522 MC |
363 | /* Set the output buffers to use for a pipelined operation */ |
364 | # define EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS 0x22 | |
365 | /* Set the input buffers to use for a pipelined operation */ | |
366 | # define EVP_CTRL_SET_PIPELINE_INPUT_BUFS 0x23 | |
367 | /* Set the input buffer lengths to use for a pipelined operation */ | |
368 | # define EVP_CTRL_SET_PIPELINE_INPUT_LENS 0x24 | |
7dddf2fc SL |
369 | /* Get the IV length used by the cipher */ |
370 | # define EVP_CTRL_GET_IVLEN 0x25 | |
ecd1557f | 371 | /* Get the IV used by the cipher */ |
7dddf2fc | 372 | # define EVP_CTRL_GET_IV 0x26 |
b1ceb439 | 373 | /* Tell the cipher it's doing a speed test (SIV disallows multiple ops) */ |
7dddf2fc | 374 | # define EVP_CTRL_SET_SPEED 0x27 |
4e392522 | 375 | |
6140f036 DB |
376 | /* Padding modes */ |
377 | #define EVP_PADDING_PKCS7 1 | |
378 | #define EVP_PADDING_ISO7816_4 2 | |
379 | #define EVP_PADDING_ANSI923 3 | |
380 | #define EVP_PADDING_ISO10126 4 | |
381 | #define EVP_PADDING_ZERO 5 | |
382 | ||
c8269881 MC |
383 | /* RFC 5246 defines additional data to be 13 bytes in length */ |
384 | # define EVP_AEAD_TLS1_AAD_LEN 13 | |
385 | ||
b1de640f | 386 | typedef struct { |
0f113f3e MC |
387 | unsigned char *out; |
388 | const unsigned char *inp; | |
389 | size_t len; | |
390 | unsigned int interleave; | |
b1de640f AP |
391 | } EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM; |
392 | ||
28dd49fa DSH |
393 | /* GCM TLS constants */ |
394 | /* Length of fixed part of IV derived from PRF */ | |
0f113f3e | 395 | # define EVP_GCM_TLS_FIXED_IV_LEN 4 |
28dd49fa | 396 | /* Length of explicit part of IV part of TLS records */ |
0f113f3e | 397 | # define EVP_GCM_TLS_EXPLICIT_IV_LEN 8 |
28dd49fa | 398 | /* Length of tag for TLS */ |
0f113f3e MC |
399 | # define EVP_GCM_TLS_TAG_LEN 16 |
400 | ||
e75c5a79 DSH |
401 | /* CCM TLS constants */ |
402 | /* Length of fixed part of IV derived from PRF */ | |
403 | # define EVP_CCM_TLS_FIXED_IV_LEN 4 | |
404 | /* Length of explicit part of IV part of TLS records */ | |
405 | # define EVP_CCM_TLS_EXPLICIT_IV_LEN 8 | |
aa24c47c DSH |
406 | /* Total length of CCM IV length for TLS */ |
407 | # define EVP_CCM_TLS_IV_LEN 12 | |
408 | /* Length of tag for TLS */ | |
409 | # define EVP_CCM_TLS_TAG_LEN 16 | |
410 | /* Length of CCM8 tag for TLS */ | |
411 | # define EVP_CCM8_TLS_TAG_LEN 8 | |
e75c5a79 | 412 | |
20fc2051 DSH |
413 | /* Length of tag for TLS */ |
414 | # define EVP_CHACHAPOLY_TLS_TAG_LEN 16 | |
415 | ||
0f113f3e MC |
416 | typedef struct evp_cipher_info_st { |
417 | const EVP_CIPHER *cipher; | |
418 | unsigned char iv[EVP_MAX_IV_LENGTH]; | |
419 | } EVP_CIPHER_INFO; | |
420 | ||
0f113f3e | 421 | |
cfcefcbe | 422 | /* Password based encryption function */ |
0f113f3e MC |
423 | typedef int (EVP_PBE_KEYGEN) (EVP_CIPHER_CTX *ctx, const char *pass, |
424 | int passlen, ASN1_TYPE *param, | |
425 | const EVP_CIPHER *cipher, const EVP_MD *md, | |
426 | int en_de); | |
427 | ||
428 | # ifndef OPENSSL_NO_RSA | |
429 | # define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ | |
9fdcc21f | 430 | (rsa)) |
0f113f3e | 431 | # endif |
9ef9e785 | 432 | |
0f113f3e MC |
433 | # ifndef OPENSSL_NO_DSA |
434 | # define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ | |
9fdcc21f | 435 | (dsa)) |
0f113f3e | 436 | # endif |
9ef9e785 | 437 | |
0f113f3e | 438 | # ifndef OPENSSL_NO_DH |
9fdcc21f | 439 | # define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,(dh)) |
0f113f3e | 440 | # endif |
d02b48c6 | 441 | |
0f113f3e MC |
442 | # ifndef OPENSSL_NO_EC |
443 | # define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\ | |
9fdcc21f | 444 | (eckey)) |
0f113f3e | 445 | # endif |
3f5616d7 | 446 | # ifndef OPENSSL_NO_SIPHASH |
9fdcc21f DO |
447 | # define EVP_PKEY_assign_SIPHASH(pkey,shkey) EVP_PKEY_assign((pkey),\ |
448 | EVP_PKEY_SIPHASH,(shkey)) | |
3f5616d7 | 449 | # endif |
4d94ae00 | 450 | |
52ad5b60 | 451 | # ifndef OPENSSL_NO_POLY1305 |
9fdcc21f DO |
452 | # define EVP_PKEY_assign_POLY1305(pkey,polykey) EVP_PKEY_assign((pkey),\ |
453 | EVP_PKEY_POLY1305,(polykey)) | |
52ad5b60 TS |
454 | # endif |
455 | ||
d02b48c6 | 456 | /* Add some extra combinations */ |
0f113f3e MC |
457 | # define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) |
458 | # define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) | |
459 | # define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) | |
460 | # define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) | |
d02b48c6 | 461 | |
7806f3dd | 462 | int EVP_MD_type(const EVP_MD *md); |
0f113f3e | 463 | # define EVP_MD_nid(e) EVP_MD_type(e) |
c750bc08 | 464 | const char *EVP_MD_name(const EVP_MD *md); |
1d2622d4 | 465 | const OSSL_PROVIDER *EVP_MD_provider(const EVP_MD *md); |
0f113f3e | 466 | int EVP_MD_pkey_type(const EVP_MD *md); |
6343829a GT |
467 | int EVP_MD_size(const EVP_MD *md); |
468 | int EVP_MD_block_size(const EVP_MD *md); | |
e5fa864f | 469 | unsigned long EVP_MD_flags(const EVP_MD *md); |
58964a49 | 470 | |
7806f3dd | 471 | const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx); |
7638370c RL |
472 | int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx, |
473 | const void *data, size_t count); | |
474 | void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx, | |
475 | int (*update) (EVP_MD_CTX *ctx, | |
476 | const void *data, size_t count)); | |
c750bc08 | 477 | # define EVP_MD_CTX_name(e) EVP_MD_name(EVP_MD_CTX_md(e)) |
0f113f3e MC |
478 | # define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e)) |
479 | # define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e)) | |
480 | # define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e)) | |
7638370c | 481 | EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx); |
00902d94 | 482 | void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx); |
7638370c | 483 | void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx); |
d02b48c6 | 484 | |
7806f3dd | 485 | int EVP_CIPHER_nid(const EVP_CIPHER *cipher); |
c750bc08 | 486 | const char *EVP_CIPHER_name(const EVP_CIPHER *cipher); |
7cfa1717 | 487 | int EVP_CIPHER_is_a(const EVP_CIPHER *cipher, const char *name); |
1d2622d4 | 488 | const OSSL_PROVIDER *EVP_CIPHER_provider(const EVP_CIPHER *cipher); |
6343829a | 489 | int EVP_CIPHER_block_size(const EVP_CIPHER *cipher); |
e79f8773 | 490 | int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher); |
6343829a GT |
491 | int EVP_CIPHER_key_length(const EVP_CIPHER *cipher); |
492 | int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher); | |
7806f3dd | 493 | unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher); |
718b133a | 494 | int EVP_CIPHER_mode(const EVP_CIPHER *cipher); |
df05f2ce MC |
495 | EVP_CIPHER *EVP_CIPHER_fetch(OPENSSL_CTX *ctx, const char *algorithm, |
496 | const char *properties); | |
550f974a RL |
497 | int EVP_CIPHER_up_ref(EVP_CIPHER *cipher); |
498 | void EVP_CIPHER_free(EVP_CIPHER *cipher); | |
7806f3dd | 499 | |
0f113f3e | 500 | const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx); |
83b06347 | 501 | int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx); |
7806f3dd | 502 | int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx); |
6343829a GT |
503 | int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx); |
504 | int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx); | |
505 | int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx); | |
dc64dc2e | 506 | int EVP_CIPHER_CTX_tag_length(const EVP_CIPHER_CTX *ctx); |
83b06347 RL |
507 | const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx); |
508 | const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx); | |
509 | unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx); | |
510 | unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx); | |
511 | int EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx); | |
13273237 | 512 | int EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num); |
c2bf7208 | 513 | int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in); |
0f113f3e | 514 | void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx); |
7806f3dd | 515 | void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data); |
44ab2dfd | 516 | void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx); |
98ee7543 | 517 | void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data); |
c750bc08 | 518 | # define EVP_CIPHER_CTX_name(c) EVP_CIPHER_name(EVP_CIPHER_CTX_cipher(c)) |
0f113f3e | 519 | # define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) |
fcd2d5a6 | 520 | # if !OPENSSL_API_1_1_0 |
0ce56222 RL |
521 | # define EVP_CIPHER_CTX_flags(c) EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c)) |
522 | # endif | |
480d3323 | 523 | # define EVP_CIPHER_CTX_mode(c) EVP_CIPHER_mode(EVP_CIPHER_CTX_cipher(c)) |
0f113f3e | 524 | |
37659ea4 BE |
525 | # define EVP_ENCODE_LENGTH(l) ((((l)+2)/3*4)+((l)/48+1)*2+80) |
526 | # define EVP_DECODE_LENGTH(l) (((l)+3)/4*3+80) | |
0f113f3e MC |
527 | |
528 | # define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) | |
529 | # define EVP_SignInit(a,b) EVP_DigestInit(a,b) | |
530 | # define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | |
531 | # define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c) | |
532 | # define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) | |
533 | # define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | |
534 | # define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) | |
535 | # define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) | |
0f113f3e MC |
536 | |
537 | # ifdef CONST_STRICT | |
538 | void BIO_set_md(BIO *, const EVP_MD *md); | |
539 | # else | |
9fdcc21f | 540 | # define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(void *)(md)) |
0f113f3e | 541 | # endif |
9fdcc21f DO |
542 | # define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(mdp)) |
543 | # define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(mdcp)) | |
544 | # define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(mdcp)) | |
37659ea4 | 545 | # define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) |
9fdcc21f | 546 | # define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(c_pp)) |
d02b48c6 | 547 | |
ae551760 | 548 | /*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c, |
0f113f3e MC |
549 | unsigned char *out, |
550 | const unsigned char *in, unsigned int inl); | |
551 | ||
552 | # define EVP_add_cipher_alias(n,alias) \ | |
553 | OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) | |
554 | # define EVP_add_digest_alias(n,alias) \ | |
555 | OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) | |
556 | # define EVP_delete_cipher_alias(alias) \ | |
557 | OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); | |
558 | # define EVP_delete_digest_alias(alias) \ | |
559 | OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); | |
560 | ||
ae3ff60e | 561 | int EVP_MD_get_params(const EVP_MD *digest, OSSL_PARAM params[]); |
d5e5e2ff | 562 | int EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[]); |
4e7991b4 | 563 | int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[]); |
ae3ff60e | 564 | const OSSL_PARAM *EVP_MD_gettable_params(const EVP_MD *digest); |
e6879a31 MC |
565 | const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md); |
566 | const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md); | |
567 | const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx); | |
568 | const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx); | |
83b4a243 | 569 | int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); |
959ed531 RL |
570 | EVP_MD_CTX *EVP_MD_CTX_new(void); |
571 | int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); | |
572 | void EVP_MD_CTX_free(EVP_MD_CTX *ctx); | |
f8137a62 VD |
573 | # define EVP_MD_CTX_create() EVP_MD_CTX_new() |
574 | # define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx)) | |
575 | # define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx)) | |
d166ed8c | 576 | __owur int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); |
0f113f3e MC |
577 | void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); |
578 | void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); | |
579 | int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); | |
d166ed8c | 580 | __owur int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, |
0f113f3e | 581 | ENGINE *impl); |
d166ed8c | 582 | __owur int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, |
0f113f3e | 583 | size_t cnt); |
d166ed8c | 584 | __owur int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, |
0f113f3e | 585 | unsigned int *s); |
d166ed8c | 586 | __owur int EVP_Digest(const void *data, size_t count, |
0f113f3e MC |
587 | unsigned char *md, unsigned int *size, |
588 | const EVP_MD *type, ENGINE *impl); | |
589 | ||
d166ed8c DSH |
590 | __owur int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); |
591 | __owur int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); | |
0f113f3e MC |
592 | __owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, |
593 | unsigned int *s); | |
cd8d1456 AP |
594 | __owur int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, |
595 | size_t len); | |
0f113f3e | 596 | |
3653d0c2 MC |
597 | __owur EVP_MD *EVP_MD_fetch(OPENSSL_CTX *ctx, const char *algorithm, |
598 | const char *properties); | |
3fd70262 RL |
599 | int EVP_MD_up_ref(EVP_MD *md); |
600 | void EVP_MD_free(EVP_MD *md); | |
3653d0c2 | 601 | |
0f113f3e MC |
602 | int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); |
603 | int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, | |
604 | const char *prompt, int verify); | |
605 | void EVP_set_pw_prompt(const char *prompt); | |
606 | char *EVP_get_pw_prompt(void); | |
607 | ||
608 | __owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, | |
609 | const unsigned char *salt, | |
610 | const unsigned char *data, int datal, int count, | |
611 | unsigned char *key, unsigned char *iv); | |
612 | ||
613 | void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); | |
614 | void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); | |
615 | int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); | |
616 | ||
617 | __owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | |
618 | const unsigned char *key, const unsigned char *iv); | |
619 | /*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, | |
620 | const EVP_CIPHER *cipher, ENGINE *impl, | |
621 | const unsigned char *key, | |
622 | const unsigned char *iv); | |
623 | /*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | |
624 | int *outl, const unsigned char *in, int inl); | |
625 | /*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, | |
626 | int *outl); | |
627 | /*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, | |
628 | int *outl); | |
629 | ||
630 | __owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | |
631 | const unsigned char *key, const unsigned char *iv); | |
632 | /*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, | |
633 | const EVP_CIPHER *cipher, ENGINE *impl, | |
634 | const unsigned char *key, | |
635 | const unsigned char *iv); | |
636 | /*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | |
637 | int *outl, const unsigned char *in, int inl); | |
638 | __owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, | |
639 | int *outl); | |
640 | /*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, | |
641 | int *outl); | |
642 | ||
643 | __owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, | |
644 | const unsigned char *key, const unsigned char *iv, | |
645 | int enc); | |
646 | /*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, | |
647 | const EVP_CIPHER *cipher, ENGINE *impl, | |
648 | const unsigned char *key, | |
649 | const unsigned char *iv, int enc); | |
650 | __owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | |
651 | int *outl, const unsigned char *in, int inl); | |
652 | __owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, | |
653 | int *outl); | |
654 | __owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, | |
655 | int *outl); | |
656 | ||
657 | __owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, | |
658 | EVP_PKEY *pkey); | |
659 | ||
75394189 DSH |
660 | __owur int EVP_DigestSign(EVP_MD_CTX *ctx, unsigned char *sigret, |
661 | size_t *siglen, const unsigned char *tbs, | |
662 | size_t tbslen); | |
663 | ||
0f113f3e MC |
664 | __owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, |
665 | unsigned int siglen, EVP_PKEY *pkey); | |
666 | ||
75394189 DSH |
667 | __owur int EVP_DigestVerify(EVP_MD_CTX *ctx, const unsigned char *sigret, |
668 | size_t siglen, const unsigned char *tbs, | |
669 | size_t tbslen); | |
670 | ||
d8c98d79 MC |
671 | int EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, |
672 | const char *mdname, const char *props, EVP_PKEY *pkey, | |
673 | EVP_SIGNATURE *signature); | |
0f113f3e MC |
674 | /*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, |
675 | const EVP_MD *type, ENGINE *e, | |
676 | EVP_PKEY *pkey); | |
d8c98d79 | 677 | int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *data, size_t dsize); |
0f113f3e MC |
678 | __owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, |
679 | size_t *siglen); | |
680 | ||
d8c98d79 MC |
681 | int EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, |
682 | const char *mdname, const char *props, | |
683 | EVP_PKEY *pkey, EVP_SIGNATURE *signature); | |
0f113f3e MC |
684 | __owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, |
685 | const EVP_MD *type, ENGINE *e, | |
686 | EVP_PKEY *pkey); | |
d8c98d79 | 687 | int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *data, size_t dsize); |
0f113f3e MC |
688 | __owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, |
689 | size_t siglen); | |
690 | ||
c3be59a4 | 691 | # ifndef OPENSSL_NO_RSA |
0f113f3e MC |
692 | __owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
693 | const unsigned char *ek, int ekl, | |
694 | const unsigned char *iv, EVP_PKEY *priv); | |
695 | __owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | |
696 | ||
697 | __owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | |
698 | unsigned char **ek, int *ekl, unsigned char *iv, | |
699 | EVP_PKEY **pubk, int npubk); | |
700 | __owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | |
c3be59a4 | 701 | # endif |
0f113f3e | 702 | |
a0be4fd1 RL |
703 | EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void); |
704 | void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx); | |
9fdcc21f | 705 | int EVP_ENCODE_CTX_copy(EVP_ENCODE_CTX *dctx, const EVP_ENCODE_CTX *sctx); |
a0be4fd1 | 706 | int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx); |
0f113f3e | 707 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); |
cf3404fc MC |
708 | int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, |
709 | const unsigned char *in, int inl); | |
0f113f3e MC |
710 | void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); |
711 | int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); | |
712 | ||
713 | void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); | |
714 | int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | |
715 | const unsigned char *in, int inl); | |
716 | int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned | |
717 | char *out, int *outl); | |
718 | int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); | |
d02b48c6 | 719 | |
fcd2d5a6 | 720 | # if !OPENSSL_API_1_1_0 |
ff4b7faf RL |
721 | # define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c) |
722 | # define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c) | |
0ce56222 | 723 | # endif |
b40228a6 | 724 | EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void); |
8baf9968 RL |
725 | int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c); |
726 | void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c); | |
6343829a | 727 | int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); |
f2e5ca84 | 728 | int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad); |
49528751 | 729 | int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); |
216659eb | 730 | int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key); |
ae3ff60e RL |
731 | int EVP_CIPHER_get_params(EVP_CIPHER *cipher, OSSL_PARAM params[]); |
732 | int EVP_CIPHER_CTX_set_params(EVP_CIPHER_CTX *ctx, const OSSL_PARAM params[]); | |
733 | int EVP_CIPHER_CTX_get_params(EVP_CIPHER_CTX *ctx, OSSL_PARAM params[]); | |
734 | const OSSL_PARAM *EVP_CIPHER_gettable_params(const EVP_CIPHER *cipher); | |
41f7ecf3 P |
735 | const OSSL_PARAM *EVP_CIPHER_settable_ctx_params(const EVP_CIPHER *cipher); |
736 | const OSSL_PARAM *EVP_CIPHER_gettable_ctx_params(const EVP_CIPHER *cipher); | |
d02b48c6 | 737 | |
04f6b0fd DB |
738 | const BIO_METHOD *BIO_f_md(void); |
739 | const BIO_METHOD *BIO_f_base64(void); | |
740 | const BIO_METHOD *BIO_f_cipher(void); | |
741 | const BIO_METHOD *BIO_f_reliable(void); | |
0f113f3e MC |
742 | __owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, |
743 | const unsigned char *i, int enc); | |
d02b48c6 | 744 | |
13588350 | 745 | const EVP_MD *EVP_md_null(void); |
0f113f3e | 746 | # ifndef OPENSSL_NO_MD2 |
13588350 | 747 | const EVP_MD *EVP_md2(void); |
0f113f3e MC |
748 | # endif |
749 | # ifndef OPENSSL_NO_MD4 | |
13588350 | 750 | const EVP_MD *EVP_md4(void); |
0f113f3e MC |
751 | # endif |
752 | # ifndef OPENSSL_NO_MD5 | |
13588350 | 753 | const EVP_MD *EVP_md5(void); |
2f142ada | 754 | const EVP_MD *EVP_md5_sha1(void); |
0f113f3e | 755 | # endif |
2d0b4412 | 756 | # ifndef OPENSSL_NO_BLAKE2 |
208527a7 KR |
757 | const EVP_MD *EVP_blake2b512(void); |
758 | const EVP_MD *EVP_blake2s256(void); | |
2d0b4412 | 759 | # endif |
13588350 | 760 | const EVP_MD *EVP_sha1(void); |
31c2ac1c AP |
761 | const EVP_MD *EVP_sha224(void); |
762 | const EVP_MD *EVP_sha256(void); | |
31c2ac1c AP |
763 | const EVP_MD *EVP_sha384(void); |
764 | const EVP_MD *EVP_sha512(void); | |
4bed94f0 P |
765 | const EVP_MD *EVP_sha512_224(void); |
766 | const EVP_MD *EVP_sha512_256(void); | |
91ce87c0 AP |
767 | const EVP_MD *EVP_sha3_224(void); |
768 | const EVP_MD *EVP_sha3_256(void); | |
769 | const EVP_MD *EVP_sha3_384(void); | |
770 | const EVP_MD *EVP_sha3_512(void); | |
771 | const EVP_MD *EVP_shake128(void); | |
772 | const EVP_MD *EVP_shake256(void); | |
6e624a64 | 773 | |
0f113f3e | 774 | # ifndef OPENSSL_NO_MDC2 |
13588350 | 775 | const EVP_MD *EVP_mdc2(void); |
0f113f3e MC |
776 | # endif |
777 | # ifndef OPENSSL_NO_RMD160 | |
13588350 | 778 | const EVP_MD *EVP_ripemd160(void); |
0f113f3e MC |
779 | # endif |
780 | # ifndef OPENSSL_NO_WHIRLPOOL | |
200fc028 | 781 | const EVP_MD *EVP_whirlpool(void); |
0f113f3e | 782 | # endif |
a0c3e4fa JL |
783 | # ifndef OPENSSL_NO_SM3 |
784 | const EVP_MD *EVP_sm3(void); | |
785 | # endif | |
0f113f3e MC |
786 | const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */ |
787 | # ifndef OPENSSL_NO_DES | |
13588350 DSH |
788 | const EVP_CIPHER *EVP_des_ecb(void); |
789 | const EVP_CIPHER *EVP_des_ede(void); | |
790 | const EVP_CIPHER *EVP_des_ede3(void); | |
65ee74fb LJ |
791 | const EVP_CIPHER *EVP_des_ede_ecb(void); |
792 | const EVP_CIPHER *EVP_des_ede3_ecb(void); | |
8d1ebe0b | 793 | const EVP_CIPHER *EVP_des_cfb64(void); |
0f113f3e | 794 | # define EVP_des_cfb EVP_des_cfb64 |
8d1ebe0b RL |
795 | const EVP_CIPHER *EVP_des_cfb1(void); |
796 | const EVP_CIPHER *EVP_des_cfb8(void); | |
797 | const EVP_CIPHER *EVP_des_ede_cfb64(void); | |
0f113f3e | 798 | # define EVP_des_ede_cfb EVP_des_ede_cfb64 |
8d1ebe0b | 799 | const EVP_CIPHER *EVP_des_ede3_cfb64(void); |
0f113f3e | 800 | # define EVP_des_ede3_cfb EVP_des_ede3_cfb64 |
8d1ebe0b RL |
801 | const EVP_CIPHER *EVP_des_ede3_cfb1(void); |
802 | const EVP_CIPHER *EVP_des_ede3_cfb8(void); | |
13588350 DSH |
803 | const EVP_CIPHER *EVP_des_ofb(void); |
804 | const EVP_CIPHER *EVP_des_ede_ofb(void); | |
805 | const EVP_CIPHER *EVP_des_ede3_ofb(void); | |
806 | const EVP_CIPHER *EVP_des_cbc(void); | |
807 | const EVP_CIPHER *EVP_des_ede_cbc(void); | |
808 | const EVP_CIPHER *EVP_des_ede3_cbc(void); | |
809 | const EVP_CIPHER *EVP_desx_cbc(void); | |
97cf1f6c | 810 | const EVP_CIPHER *EVP_des_ede3_wrap(void); |
0f113f3e MC |
811 | /* |
812 | * This should now be supported through the dev_crypto ENGINE. But also, why | |
813 | * are rc4 and md5 declarations made here inside a "NO_DES" precompiler | |
814 | * branch? | |
815 | */ | |
c518ade1 | 816 | # endif |
0f113f3e | 817 | # ifndef OPENSSL_NO_RC4 |
13588350 DSH |
818 | const EVP_CIPHER *EVP_rc4(void); |
819 | const EVP_CIPHER *EVP_rc4_40(void); | |
0f113f3e | 820 | # ifndef OPENSSL_NO_MD5 |
c608171d | 821 | const EVP_CIPHER *EVP_rc4_hmac_md5(void); |
0f113f3e MC |
822 | # endif |
823 | # endif | |
824 | # ifndef OPENSSL_NO_IDEA | |
13588350 | 825 | const EVP_CIPHER *EVP_idea_ecb(void); |
8d1ebe0b | 826 | const EVP_CIPHER *EVP_idea_cfb64(void); |
0f113f3e | 827 | # define EVP_idea_cfb EVP_idea_cfb64 |
13588350 DSH |
828 | const EVP_CIPHER *EVP_idea_ofb(void); |
829 | const EVP_CIPHER *EVP_idea_cbc(void); | |
0f113f3e MC |
830 | # endif |
831 | # ifndef OPENSSL_NO_RC2 | |
13588350 DSH |
832 | const EVP_CIPHER *EVP_rc2_ecb(void); |
833 | const EVP_CIPHER *EVP_rc2_cbc(void); | |
834 | const EVP_CIPHER *EVP_rc2_40_cbc(void); | |
835 | const EVP_CIPHER *EVP_rc2_64_cbc(void); | |
8d1ebe0b | 836 | const EVP_CIPHER *EVP_rc2_cfb64(void); |
0f113f3e | 837 | # define EVP_rc2_cfb EVP_rc2_cfb64 |
13588350 | 838 | const EVP_CIPHER *EVP_rc2_ofb(void); |
0f113f3e MC |
839 | # endif |
840 | # ifndef OPENSSL_NO_BF | |
13588350 DSH |
841 | const EVP_CIPHER *EVP_bf_ecb(void); |
842 | const EVP_CIPHER *EVP_bf_cbc(void); | |
8d1ebe0b | 843 | const EVP_CIPHER *EVP_bf_cfb64(void); |
0f113f3e | 844 | # define EVP_bf_cfb EVP_bf_cfb64 |
13588350 | 845 | const EVP_CIPHER *EVP_bf_ofb(void); |
0f113f3e MC |
846 | # endif |
847 | # ifndef OPENSSL_NO_CAST | |
13588350 DSH |
848 | const EVP_CIPHER *EVP_cast5_ecb(void); |
849 | const EVP_CIPHER *EVP_cast5_cbc(void); | |
8d1ebe0b | 850 | const EVP_CIPHER *EVP_cast5_cfb64(void); |
0f113f3e | 851 | # define EVP_cast5_cfb EVP_cast5_cfb64 |
13588350 | 852 | const EVP_CIPHER *EVP_cast5_ofb(void); |
0f113f3e MC |
853 | # endif |
854 | # ifndef OPENSSL_NO_RC5 | |
13588350 DSH |
855 | const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void); |
856 | const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void); | |
8d1ebe0b | 857 | const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void); |
0f113f3e | 858 | # define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64 |
13588350 | 859 | const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void); |
0f113f3e | 860 | # endif |
13588350 DSH |
861 | const EVP_CIPHER *EVP_aes_128_ecb(void); |
862 | const EVP_CIPHER *EVP_aes_128_cbc(void); | |
8d1ebe0b RL |
863 | const EVP_CIPHER *EVP_aes_128_cfb1(void); |
864 | const EVP_CIPHER *EVP_aes_128_cfb8(void); | |
865 | const EVP_CIPHER *EVP_aes_128_cfb128(void); | |
5158c763 | 866 | # define EVP_aes_128_cfb EVP_aes_128_cfb128 |
bd54d55c | 867 | const EVP_CIPHER *EVP_aes_128_ofb(void); |
bd54d55c | 868 | const EVP_CIPHER *EVP_aes_128_ctr(void); |
23916810 | 869 | const EVP_CIPHER *EVP_aes_128_ccm(void); |
bdaa5415 | 870 | const EVP_CIPHER *EVP_aes_128_gcm(void); |
32a2d8dd | 871 | const EVP_CIPHER *EVP_aes_128_xts(void); |
97cf1f6c | 872 | const EVP_CIPHER *EVP_aes_128_wrap(void); |
d31fed73 | 873 | const EVP_CIPHER *EVP_aes_128_wrap_pad(void); |
5158c763 | 874 | # ifndef OPENSSL_NO_OCB |
e6b336ef | 875 | const EVP_CIPHER *EVP_aes_128_ocb(void); |
5158c763 | 876 | # endif |
13588350 DSH |
877 | const EVP_CIPHER *EVP_aes_192_ecb(void); |
878 | const EVP_CIPHER *EVP_aes_192_cbc(void); | |
8d1ebe0b RL |
879 | const EVP_CIPHER *EVP_aes_192_cfb1(void); |
880 | const EVP_CIPHER *EVP_aes_192_cfb8(void); | |
881 | const EVP_CIPHER *EVP_aes_192_cfb128(void); | |
5158c763 | 882 | # define EVP_aes_192_cfb EVP_aes_192_cfb128 |
bd54d55c | 883 | const EVP_CIPHER *EVP_aes_192_ofb(void); |
bd54d55c | 884 | const EVP_CIPHER *EVP_aes_192_ctr(void); |
23916810 | 885 | const EVP_CIPHER *EVP_aes_192_ccm(void); |
bdaa5415 | 886 | const EVP_CIPHER *EVP_aes_192_gcm(void); |
97cf1f6c | 887 | const EVP_CIPHER *EVP_aes_192_wrap(void); |
d31fed73 | 888 | const EVP_CIPHER *EVP_aes_192_wrap_pad(void); |
5158c763 | 889 | # ifndef OPENSSL_NO_OCB |
e6b336ef | 890 | const EVP_CIPHER *EVP_aes_192_ocb(void); |
5158c763 | 891 | # endif |
13588350 DSH |
892 | const EVP_CIPHER *EVP_aes_256_ecb(void); |
893 | const EVP_CIPHER *EVP_aes_256_cbc(void); | |
8d1ebe0b RL |
894 | const EVP_CIPHER *EVP_aes_256_cfb1(void); |
895 | const EVP_CIPHER *EVP_aes_256_cfb8(void); | |
896 | const EVP_CIPHER *EVP_aes_256_cfb128(void); | |
5158c763 | 897 | # define EVP_aes_256_cfb EVP_aes_256_cfb128 |
bd54d55c | 898 | const EVP_CIPHER *EVP_aes_256_ofb(void); |
bd54d55c | 899 | const EVP_CIPHER *EVP_aes_256_ctr(void); |
23916810 | 900 | const EVP_CIPHER *EVP_aes_256_ccm(void); |
bdaa5415 | 901 | const EVP_CIPHER *EVP_aes_256_gcm(void); |
32a2d8dd | 902 | const EVP_CIPHER *EVP_aes_256_xts(void); |
97cf1f6c | 903 | const EVP_CIPHER *EVP_aes_256_wrap(void); |
d31fed73 | 904 | const EVP_CIPHER *EVP_aes_256_wrap_pad(void); |
5158c763 | 905 | # ifndef OPENSSL_NO_OCB |
e6b336ef | 906 | const EVP_CIPHER *EVP_aes_256_ocb(void); |
5158c763 | 907 | # endif |
c608171d AP |
908 | const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void); |
909 | const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void); | |
b25b8417 BL |
910 | const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void); |
911 | const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void); | |
b1ceb439 TS |
912 | # ifndef OPENSSL_NO_SIV |
913 | const EVP_CIPHER *EVP_aes_128_siv(void); | |
914 | const EVP_CIPHER *EVP_aes_192_siv(void); | |
915 | const EVP_CIPHER *EVP_aes_256_siv(void); | |
916 | # endif | |
d42d0a4d P |
917 | # ifndef OPENSSL_NO_ARIA |
918 | const EVP_CIPHER *EVP_aria_128_ecb(void); | |
919 | const EVP_CIPHER *EVP_aria_128_cbc(void); | |
920 | const EVP_CIPHER *EVP_aria_128_cfb1(void); | |
921 | const EVP_CIPHER *EVP_aria_128_cfb8(void); | |
922 | const EVP_CIPHER *EVP_aria_128_cfb128(void); | |
923 | # define EVP_aria_128_cfb EVP_aria_128_cfb128 | |
924 | const EVP_CIPHER *EVP_aria_128_ctr(void); | |
925 | const EVP_CIPHER *EVP_aria_128_ofb(void); | |
bc326738 JS |
926 | const EVP_CIPHER *EVP_aria_128_gcm(void); |
927 | const EVP_CIPHER *EVP_aria_128_ccm(void); | |
d42d0a4d P |
928 | const EVP_CIPHER *EVP_aria_192_ecb(void); |
929 | const EVP_CIPHER *EVP_aria_192_cbc(void); | |
930 | const EVP_CIPHER *EVP_aria_192_cfb1(void); | |
931 | const EVP_CIPHER *EVP_aria_192_cfb8(void); | |
932 | const EVP_CIPHER *EVP_aria_192_cfb128(void); | |
933 | # define EVP_aria_192_cfb EVP_aria_192_cfb128 | |
934 | const EVP_CIPHER *EVP_aria_192_ctr(void); | |
935 | const EVP_CIPHER *EVP_aria_192_ofb(void); | |
bc326738 JS |
936 | const EVP_CIPHER *EVP_aria_192_gcm(void); |
937 | const EVP_CIPHER *EVP_aria_192_ccm(void); | |
d42d0a4d P |
938 | const EVP_CIPHER *EVP_aria_256_ecb(void); |
939 | const EVP_CIPHER *EVP_aria_256_cbc(void); | |
940 | const EVP_CIPHER *EVP_aria_256_cfb1(void); | |
941 | const EVP_CIPHER *EVP_aria_256_cfb8(void); | |
942 | const EVP_CIPHER *EVP_aria_256_cfb128(void); | |
943 | # define EVP_aria_256_cfb EVP_aria_256_cfb128 | |
944 | const EVP_CIPHER *EVP_aria_256_ctr(void); | |
945 | const EVP_CIPHER *EVP_aria_256_ofb(void); | |
bc326738 JS |
946 | const EVP_CIPHER *EVP_aria_256_gcm(void); |
947 | const EVP_CIPHER *EVP_aria_256_ccm(void); | |
d42d0a4d | 948 | # endif |
0f113f3e | 949 | # ifndef OPENSSL_NO_CAMELLIA |
f3dea9a5 BM |
950 | const EVP_CIPHER *EVP_camellia_128_ecb(void); |
951 | const EVP_CIPHER *EVP_camellia_128_cbc(void); | |
952 | const EVP_CIPHER *EVP_camellia_128_cfb1(void); | |
953 | const EVP_CIPHER *EVP_camellia_128_cfb8(void); | |
954 | const EVP_CIPHER *EVP_camellia_128_cfb128(void); | |
0f113f3e | 955 | # define EVP_camellia_128_cfb EVP_camellia_128_cfb128 |
f3dea9a5 | 956 | const EVP_CIPHER *EVP_camellia_128_ofb(void); |
2b8f33a5 | 957 | const EVP_CIPHER *EVP_camellia_128_ctr(void); |
f3dea9a5 BM |
958 | const EVP_CIPHER *EVP_camellia_192_ecb(void); |
959 | const EVP_CIPHER *EVP_camellia_192_cbc(void); | |
960 | const EVP_CIPHER *EVP_camellia_192_cfb1(void); | |
961 | const EVP_CIPHER *EVP_camellia_192_cfb8(void); | |
962 | const EVP_CIPHER *EVP_camellia_192_cfb128(void); | |
0f113f3e | 963 | # define EVP_camellia_192_cfb EVP_camellia_192_cfb128 |
f3dea9a5 | 964 | const EVP_CIPHER *EVP_camellia_192_ofb(void); |
2b8f33a5 | 965 | const EVP_CIPHER *EVP_camellia_192_ctr(void); |
f3dea9a5 BM |
966 | const EVP_CIPHER *EVP_camellia_256_ecb(void); |
967 | const EVP_CIPHER *EVP_camellia_256_cbc(void); | |
968 | const EVP_CIPHER *EVP_camellia_256_cfb1(void); | |
969 | const EVP_CIPHER *EVP_camellia_256_cfb8(void); | |
970 | const EVP_CIPHER *EVP_camellia_256_cfb128(void); | |
0f113f3e | 971 | # define EVP_camellia_256_cfb EVP_camellia_256_cfb128 |
f3dea9a5 | 972 | const EVP_CIPHER *EVP_camellia_256_ofb(void); |
2b8f33a5 | 973 | const EVP_CIPHER *EVP_camellia_256_ctr(void); |
0f113f3e | 974 | # endif |
bd989745 AP |
975 | # ifndef OPENSSL_NO_CHACHA |
976 | const EVP_CIPHER *EVP_chacha20(void); | |
977 | # ifndef OPENSSL_NO_POLY1305 | |
978 | const EVP_CIPHER *EVP_chacha20_poly1305(void); | |
979 | # endif | |
980 | # endif | |
3ab56511 | 981 | |
0f113f3e | 982 | # ifndef OPENSSL_NO_SEED |
96afc1cf BM |
983 | const EVP_CIPHER *EVP_seed_ecb(void); |
984 | const EVP_CIPHER *EVP_seed_cbc(void); | |
985 | const EVP_CIPHER *EVP_seed_cfb128(void); | |
0f113f3e | 986 | # define EVP_seed_cfb EVP_seed_cfb128 |
96afc1cf | 987 | const EVP_CIPHER *EVP_seed_ofb(void); |
0f113f3e | 988 | # endif |
96afc1cf | 989 | |
f19a5ff9 RT |
990 | # ifndef OPENSSL_NO_SM4 |
991 | const EVP_CIPHER *EVP_sm4_ecb(void); | |
992 | const EVP_CIPHER *EVP_sm4_cbc(void); | |
993 | const EVP_CIPHER *EVP_sm4_cfb128(void); | |
994 | # define EVP_sm4_cfb EVP_sm4_cfb128 | |
995 | const EVP_CIPHER *EVP_sm4_ofb(void); | |
996 | const EVP_CIPHER *EVP_sm4_ctr(void); | |
997 | # endif | |
998 | ||
fcd2d5a6 | 999 | # if !OPENSSL_API_1_1_0 |
22c84afa | 1000 | # define OPENSSL_add_all_algorithms_conf() \ |
f672aee4 RS |
1001 | OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ |
1002 | | OPENSSL_INIT_ADD_ALL_DIGESTS \ | |
1003 | | OPENSSL_INIT_LOAD_CONFIG, NULL) | |
22c84afa | 1004 | # define OPENSSL_add_all_algorithms_noconf() \ |
f672aee4 RS |
1005 | OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \ |
1006 | | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) | |
1007 | ||
1008 | # ifdef OPENSSL_LOAD_CONF | |
c4734493 | 1009 | # define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_conf() |
f672aee4 | 1010 | # else |
c4734493 | 1011 | # define OpenSSL_add_all_algorithms() OPENSSL_add_all_algorithms_noconf() |
f672aee4 | 1012 | # endif |
e84be9b4 | 1013 | |
22c84afa | 1014 | # define OpenSSL_add_all_ciphers() \ |
f672aee4 | 1015 | OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL) |
22c84afa | 1016 | # define OpenSSL_add_all_digests() \ |
f672aee4 | 1017 | OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) |
22c84afa | 1018 | |
6457615a | 1019 | # define EVP_cleanup() while(0) continue |
f672aee4 | 1020 | # endif |
d02b48c6 | 1021 | |
13588350 DSH |
1022 | int EVP_add_cipher(const EVP_CIPHER *cipher); |
1023 | int EVP_add_digest(const EVP_MD *digest); | |
d02b48c6 | 1024 | |
e778802f BL |
1025 | const EVP_CIPHER *EVP_get_cipherbyname(const char *name); |
1026 | const EVP_MD *EVP_get_digestbyname(const char *name); | |
d02b48c6 | 1027 | |
0f113f3e MC |
1028 | void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph, |
1029 | const char *from, const char *to, void *x), | |
1030 | void *arg); | |
1031 | void EVP_CIPHER_do_all_sorted(void (*fn) | |
1032 | (const EVP_CIPHER *ciph, const char *from, | |
1033 | const char *to, void *x), void *arg); | |
c540f00f RL |
1034 | void EVP_CIPHER_do_all_ex(OPENSSL_CTX *libctx, |
1035 | void (*fn)(EVP_CIPHER *cipher, void *arg), | |
1036 | void *arg); | |
0f113f3e MC |
1037 | |
1038 | void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph, | |
1039 | const char *from, const char *to, void *x), | |
1040 | void *arg); | |
1041 | void EVP_MD_do_all_sorted(void (*fn) | |
1042 | (const EVP_MD *ciph, const char *from, | |
1043 | const char *to, void *x), void *arg); | |
c540f00f RL |
1044 | void EVP_MD_do_all_ex(OPENSSL_CTX *libctx, |
1045 | void (*fn)(EVP_MD *md, void *arg), | |
1046 | void *arg); | |
0f113f3e | 1047 | |
567db2c1 RL |
1048 | /* MAC stuff */ |
1049 | ||
e74bd290 RL |
1050 | EVP_MAC *EVP_MAC_fetch(OPENSSL_CTX *libctx, const char *algorithm, |
1051 | const char *properties); | |
1052 | int EVP_MAC_up_ref(EVP_MAC *mac); | |
1053 | void EVP_MAC_free(EVP_MAC *mac); | |
1054 | const char *EVP_MAC_name(const EVP_MAC *mac); | |
7cfa1717 | 1055 | int EVP_MAC_is_a(const EVP_MAC *mac, const char *name); |
7dd0f299 | 1056 | const OSSL_PROVIDER *EVP_MAC_provider(const EVP_MAC *mac); |
e74bd290 RL |
1057 | int EVP_MAC_get_params(EVP_MAC *mac, OSSL_PARAM params[]); |
1058 | ||
1059 | EVP_MAC_CTX *EVP_MAC_CTX_new(EVP_MAC *mac); | |
567db2c1 | 1060 | void EVP_MAC_CTX_free(EVP_MAC_CTX *ctx); |
be5fc053 | 1061 | EVP_MAC_CTX *EVP_MAC_CTX_dup(const EVP_MAC_CTX *src); |
e74bd290 RL |
1062 | EVP_MAC *EVP_MAC_CTX_mac(EVP_MAC_CTX *ctx); |
1063 | int EVP_MAC_CTX_get_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[]); | |
1064 | int EVP_MAC_CTX_set_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[]); | |
1065 | ||
567db2c1 RL |
1066 | size_t EVP_MAC_size(EVP_MAC_CTX *ctx); |
1067 | int EVP_MAC_init(EVP_MAC_CTX *ctx); | |
1068 | int EVP_MAC_update(EVP_MAC_CTX *ctx, const unsigned char *data, size_t datalen); | |
e74bd290 RL |
1069 | int EVP_MAC_final(EVP_MAC_CTX *ctx, |
1070 | unsigned char *out, size_t *outl, size_t outsize); | |
1071 | const OSSL_PARAM *EVP_MAC_gettable_params(const EVP_MAC *mac); | |
41f7ecf3 P |
1072 | const OSSL_PARAM *EVP_MAC_gettable_ctx_params(const EVP_MAC *mac); |
1073 | const OSSL_PARAM *EVP_MAC_settable_ctx_params(const EVP_MAC *mac); | |
5e55159b | 1074 | |
d1cafb08 RL |
1075 | void EVP_MAC_do_all_ex(OPENSSL_CTX *libctx, |
1076 | void (*fn)(EVP_MAC *mac, void *arg), | |
1077 | void *arg); | |
1078 | ||
567db2c1 | 1079 | /* PKEY stuff */ |
0f113f3e MC |
1080 | int EVP_PKEY_decrypt_old(unsigned char *dec_key, |
1081 | const unsigned char *enc_key, int enc_key_len, | |
1082 | EVP_PKEY *private_key); | |
1083 | int EVP_PKEY_encrypt_old(unsigned char *enc_key, | |
1084 | const unsigned char *key, int key_len, | |
1085 | EVP_PKEY *pub_key); | |
1086 | int EVP_PKEY_type(int type); | |
1087 | int EVP_PKEY_id(const EVP_PKEY *pkey); | |
1088 | int EVP_PKEY_base_id(const EVP_PKEY *pkey); | |
8900f3e3 | 1089 | int EVP_PKEY_bits(const EVP_PKEY *pkey); |
0f113f3e | 1090 | int EVP_PKEY_security_bits(const EVP_PKEY *pkey); |
47ec2367 | 1091 | int EVP_PKEY_size(const EVP_PKEY *pkey); |
0f113f3e MC |
1092 | int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); |
1093 | int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); | |
2f2e6b62 | 1094 | int EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type); |
d19b01ad DSH |
1095 | # ifndef OPENSSL_NO_ENGINE |
1096 | int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e); | |
229f7b38 | 1097 | ENGINE *EVP_PKEY_get0_engine(const EVP_PKEY *pkey); |
d19b01ad | 1098 | # endif |
0f113f3e | 1099 | int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); |
3aeb9348 | 1100 | void *EVP_PKEY_get0(const EVP_PKEY *pkey); |
ebad0b0b | 1101 | const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len); |
52ad5b60 TS |
1102 | # ifndef OPENSSL_NO_POLY1305 |
1103 | const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len); | |
1104 | # endif | |
3f5616d7 TS |
1105 | # ifndef OPENSSL_NO_SIPHASH |
1106 | const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len); | |
1107 | # endif | |
0f113f3e MC |
1108 | |
1109 | # ifndef OPENSSL_NO_RSA | |
bb2297a4 | 1110 | struct rsa_st; |
0f113f3e | 1111 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); |
9fdcc21f | 1112 | struct rsa_st *EVP_PKEY_get0_RSA(const EVP_PKEY *pkey); |
bb2297a4 | 1113 | struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); |
0f113f3e MC |
1114 | # endif |
1115 | # ifndef OPENSSL_NO_DSA | |
bb2297a4 | 1116 | struct dsa_st; |
0f113f3e | 1117 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); |
9fdcc21f | 1118 | struct dsa_st *EVP_PKEY_get0_DSA(const EVP_PKEY *pkey); |
bb2297a4 | 1119 | struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); |
0f113f3e MC |
1120 | # endif |
1121 | # ifndef OPENSSL_NO_DH | |
bb2297a4 | 1122 | struct dh_st; |
0f113f3e | 1123 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); |
9fdcc21f | 1124 | struct dh_st *EVP_PKEY_get0_DH(const EVP_PKEY *pkey); |
bb2297a4 | 1125 | struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); |
0f113f3e MC |
1126 | # endif |
1127 | # ifndef OPENSSL_NO_EC | |
14a7cfb3 | 1128 | struct ec_key_st; |
0f113f3e | 1129 | int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); |
9fdcc21f | 1130 | struct ec_key_st *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey); |
14a7cfb3 | 1131 | struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); |
0f113f3e | 1132 | # endif |
bb2297a4 | 1133 | |
0f113f3e | 1134 | EVP_PKEY *EVP_PKEY_new(void); |
c5ebfcab | 1135 | int EVP_PKEY_up_ref(EVP_PKEY *pkey); |
0f113f3e | 1136 | void EVP_PKEY_free(EVP_PKEY *pkey); |
b6995add | 1137 | |
0f113f3e MC |
1138 | EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, |
1139 | long length); | |
9fdcc21f | 1140 | int i2d_PublicKey(const EVP_PKEY *a, unsigned char **pp); |
d02b48c6 | 1141 | |
0f113f3e MC |
1142 | EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, |
1143 | long length); | |
1144 | EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, | |
1145 | long length); | |
9fdcc21f | 1146 | int i2d_PrivateKey(const EVP_PKEY *a, unsigned char **pp); |
d02b48c6 | 1147 | |
6aa2e59e SL |
1148 | int i2d_KeyParams(const EVP_PKEY *a, unsigned char **pp); |
1149 | EVP_PKEY *d2i_KeyParams(int type, EVP_PKEY **a, const unsigned char **pp, | |
1150 | long length); | |
1151 | int i2d_KeyParams_bio(BIO *bp, const EVP_PKEY *pkey); | |
1152 | EVP_PKEY *d2i_KeyParams_bio(int type, EVP_PKEY **a, BIO *in); | |
1153 | ||
af0f0f3e RL |
1154 | int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); |
1155 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); | |
0f113f3e | 1156 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); |
af0f0f3e | 1157 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); |
58964a49 | 1158 | |
af0f0f3e | 1159 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); |
e6526fbf | 1160 | |
35208f36 | 1161 | int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, |
0f113f3e | 1162 | int indent, ASN1_PCTX *pctx); |
35208f36 | 1163 | int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, |
0f113f3e | 1164 | int indent, ASN1_PCTX *pctx); |
35208f36 | 1165 | int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, |
0f113f3e | 1166 | int indent, ASN1_PCTX *pctx); |
35208f36 | 1167 | |
03919683 | 1168 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); |
ecbb2fca | 1169 | int EVP_PKEY_supports_digest_nid(EVP_PKEY *pkey, int nid); |
03919683 | 1170 | |
5d6aaf8a DSH |
1171 | int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey, |
1172 | const unsigned char *pt, size_t ptlen); | |
1173 | size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt); | |
1174 | ||
84fa704c | 1175 | int EVP_CIPHER_type(const EVP_CIPHER *ctx); |
884e8ec6 | 1176 | |
58964a49 RE |
1177 | /* calls methods */ |
1178 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | |
1179 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | |
1180 | ||
1181 | /* These are used by EVP_CIPHER methods */ | |
0f113f3e MC |
1182 | int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
1183 | int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | |
d02b48c6 | 1184 | |
b0c6fb80 | 1185 | /* PKCS5 password based encryption */ |
2bd83ca1 | 1186 | int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
0f113f3e MC |
1187 | ASN1_TYPE *param, const EVP_CIPHER *cipher, |
1188 | const EVP_MD *md, int en_de); | |
97e4a932 | 1189 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, |
0f113f3e MC |
1190 | const unsigned char *salt, int saltlen, int iter, |
1191 | int keylen, unsigned char *out); | |
777c47ac | 1192 | int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, |
0f113f3e MC |
1193 | const unsigned char *salt, int saltlen, int iter, |
1194 | const EVP_MD *digest, int keylen, unsigned char *out); | |
97e4a932 | 1195 | int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
0f113f3e MC |
1196 | ASN1_TYPE *param, const EVP_CIPHER *cipher, |
1197 | const EVP_MD *md, int en_de); | |
b0c6fb80 | 1198 | |
b0809bc8 | 1199 | #ifndef OPENSSL_NO_SCRYPT |
a95fb9e3 DSH |
1200 | int EVP_PBE_scrypt(const char *pass, size_t passlen, |
1201 | const unsigned char *salt, size_t saltlen, | |
1202 | uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem, | |
1203 | unsigned char *key, size_t keylen); | |
1204 | ||
e98aa30d DSH |
1205 | int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, |
1206 | int passlen, ASN1_TYPE *param, | |
1207 | const EVP_CIPHER *c, const EVP_MD *md, int en_de); | |
b0809bc8 | 1208 | #endif |
e98aa30d | 1209 | |
600dec15 DSH |
1210 | void PKCS5_PBE_add(void); |
1211 | ||
0f113f3e MC |
1212 | int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen, |
1213 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); | |
856640b5 DSH |
1214 | |
1215 | /* PBE type */ | |
1216 | ||
1217 | /* Can appear as the outermost AlgorithmIdentifier */ | |
0f113f3e | 1218 | # define EVP_PBE_TYPE_OUTER 0x0 |
856640b5 | 1219 | /* Is an PRF type OID */ |
0f113f3e | 1220 | # define EVP_PBE_TYPE_PRF 0x1 |
d6c5462e DSH |
1221 | /* Is a PKCS#5 v2.0 KDF */ |
1222 | # define EVP_PBE_TYPE_KDF 0x2 | |
856640b5 | 1223 | |
0f113f3e MC |
1224 | int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, |
1225 | int md_nid, EVP_PBE_KEYGEN *keygen); | |
13588350 | 1226 | int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, |
0f113f3e MC |
1227 | EVP_PBE_KEYGEN *keygen); |
1228 | int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, | |
1229 | EVP_PBE_KEYGEN **pkeygen); | |
69cbf468 | 1230 | void EVP_PBE_cleanup(void); |
d9546693 | 1231 | int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num); |
69cbf468 | 1232 | |
0f113f3e MC |
1233 | # define ASN1_PKEY_ALIAS 0x1 |
1234 | # define ASN1_PKEY_DYNAMIC 0x2 | |
1235 | # define ASN1_PKEY_SIGPARAM_NULL 0x4 | |
0b33dac3 | 1236 | |
0f113f3e MC |
1237 | # define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1 |
1238 | # define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2 | |
1239 | # define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3 | |
1240 | # define ASN1_PKEY_CTRL_CMS_SIGN 0x5 | |
1241 | # define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7 | |
1242 | # define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8 | |
492a9e24 | 1243 | |
5d6aaf8a DSH |
1244 | # define ASN1_PKEY_CTRL_SET1_TLS_ENCPT 0x9 |
1245 | # define ASN1_PKEY_CTRL_GET1_TLS_ENCPT 0xa | |
ecbb2fca | 1246 | # define ASN1_PKEY_CTRL_SUPPORTS_MD_NID 0xb |
5d6aaf8a | 1247 | |
e4263314 DSH |
1248 | int EVP_PKEY_asn1_get_count(void); |
1249 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); | |
01b8b3c7 DSH |
1250 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); |
1251 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, | |
0f113f3e | 1252 | const char *str, int len); |
e46691a0 DSH |
1253 | int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); |
1254 | int EVP_PKEY_asn1_add_alias(int to, int from); | |
0f113f3e MC |
1255 | int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, |
1256 | int *ppkey_flags, const char **pinfo, | |
1257 | const char **ppem_str, | |
1258 | const EVP_PKEY_ASN1_METHOD *ameth); | |
1259 | ||
8900f3e3 | 1260 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); |
0f113f3e MC |
1261 | EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, |
1262 | const char *pem_str, | |
1263 | const char *info); | |
1264 | void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, | |
1265 | const EVP_PKEY_ASN1_METHOD *src); | |
d82e2718 | 1266 | void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); |
42eae426 | 1267 | void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, |
0f113f3e MC |
1268 | int (*pub_decode) (EVP_PKEY *pk, |
1269 | X509_PUBKEY *pub), | |
1270 | int (*pub_encode) (X509_PUBKEY *pub, | |
1271 | const EVP_PKEY *pk), | |
1272 | int (*pub_cmp) (const EVP_PKEY *a, | |
1273 | const EVP_PKEY *b), | |
1274 | int (*pub_print) (BIO *out, | |
1275 | const EVP_PKEY *pkey, | |
1276 | int indent, ASN1_PCTX *pctx), | |
1277 | int (*pkey_size) (const EVP_PKEY *pk), | |
1278 | int (*pkey_bits) (const EVP_PKEY *pk)); | |
d82e2718 | 1279 | void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, |
0f113f3e | 1280 | int (*priv_decode) (EVP_PKEY *pk, |
245c6bc3 | 1281 | const PKCS8_PRIV_KEY_INFO |
0f113f3e MC |
1282 | *p8inf), |
1283 | int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, | |
1284 | const EVP_PKEY *pk), | |
1285 | int (*priv_print) (BIO *out, | |
1286 | const EVP_PKEY *pkey, | |
1287 | int indent, | |
1288 | ASN1_PCTX *pctx)); | |
d82e2718 | 1289 | void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, |
0f113f3e MC |
1290 | int (*param_decode) (EVP_PKEY *pkey, |
1291 | const unsigned char **pder, | |
1292 | int derlen), | |
1293 | int (*param_encode) (const EVP_PKEY *pkey, | |
1294 | unsigned char **pder), | |
1295 | int (*param_missing) (const EVP_PKEY *pk), | |
1296 | int (*param_copy) (EVP_PKEY *to, | |
1297 | const EVP_PKEY *from), | |
1298 | int (*param_cmp) (const EVP_PKEY *a, | |
1299 | const EVP_PKEY *b), | |
1300 | int (*param_print) (BIO *out, | |
1301 | const EVP_PKEY *pkey, | |
1302 | int indent, | |
1303 | ASN1_PCTX *pctx)); | |
db98bbc1 | 1304 | |
d82e2718 | 1305 | void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, |
0f113f3e | 1306 | void (*pkey_free) (EVP_PKEY *pkey)); |
d82e2718 | 1307 | void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, |
0f113f3e MC |
1308 | int (*pkey_ctrl) (EVP_PKEY *pkey, int op, |
1309 | long arg1, void *arg2)); | |
3418f7b7 SA |
1310 | void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, |
1311 | int (*item_verify) (EVP_MD_CTX *ctx, | |
1312 | const ASN1_ITEM *it, | |
1313 | void *asn, | |
1314 | X509_ALGOR *a, | |
1315 | ASN1_BIT_STRING *sig, | |
1316 | EVP_PKEY *pkey), | |
1317 | int (*item_sign) (EVP_MD_CTX *ctx, | |
1318 | const ASN1_ITEM *it, | |
1319 | void *asn, | |
1320 | X509_ALGOR *alg1, | |
1321 | X509_ALGOR *alg2, | |
1322 | ASN1_BIT_STRING *sig)); | |
448be743 | 1323 | |
5e006082 RL |
1324 | void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, |
1325 | int (*siginf_set) (X509_SIG_INFO *siginf, | |
1326 | const X509_ALGOR *alg, | |
1327 | const ASN1_STRING *sig)); | |
1328 | ||
1329 | void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, | |
1330 | int (*pkey_check) (const EVP_PKEY *pk)); | |
1331 | ||
b0004708 PY |
1332 | void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, |
1333 | int (*pkey_pub_check) (const EVP_PKEY *pk)); | |
1334 | ||
1335 | void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, | |
1336 | int (*pkey_param_check) (const EVP_PKEY *pk)); | |
1337 | ||
e8f9f08f MC |
1338 | void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, |
1339 | int (*set_priv_key) (EVP_PKEY *pk, | |
1340 | const unsigned char | |
1341 | *priv, | |
1342 | size_t len)); | |
1343 | void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, | |
1344 | int (*set_pub_key) (EVP_PKEY *pk, | |
1345 | const unsigned char *pub, | |
1346 | size_t len)); | |
72ff0a54 MC |
1347 | void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, |
1348 | int (*get_priv_key) (const EVP_PKEY *pk, | |
1349 | unsigned char *priv, | |
1350 | size_t *len)); | |
1351 | void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, | |
1352 | int (*get_pub_key) (const EVP_PKEY *pk, | |
1353 | unsigned char *pub, | |
1354 | size_t *len)); | |
e8f9f08f | 1355 | |
2514fa79 | 1356 | void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, |
0f113f3e MC |
1357 | int (*pkey_security_bits) (const EVP_PKEY |
1358 | *pk)); | |
5da98aa6 | 1359 | |
9c45222d | 1360 | int EVP_PKEY_CTX_get_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD **md); |
4889dadc MC |
1361 | int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); |
1362 | ||
0f113f3e MC |
1363 | # define EVP_PKEY_OP_UNDEFINED 0 |
1364 | # define EVP_PKEY_OP_PARAMGEN (1<<1) | |
1365 | # define EVP_PKEY_OP_KEYGEN (1<<2) | |
1366 | # define EVP_PKEY_OP_SIGN (1<<3) | |
1367 | # define EVP_PKEY_OP_VERIFY (1<<4) | |
1368 | # define EVP_PKEY_OP_VERIFYRECOVER (1<<5) | |
1369 | # define EVP_PKEY_OP_SIGNCTX (1<<6) | |
1370 | # define EVP_PKEY_OP_VERIFYCTX (1<<7) | |
1371 | # define EVP_PKEY_OP_ENCRYPT (1<<8) | |
1372 | # define EVP_PKEY_OP_DECRYPT (1<<9) | |
1373 | # define EVP_PKEY_OP_DERIVE (1<<10) | |
716630c0 | 1374 | |
0f113f3e MC |
1375 | # define EVP_PKEY_OP_TYPE_SIG \ |
1376 | (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \ | |
1377 | | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX) | |
716630c0 | 1378 | |
0f113f3e MC |
1379 | # define EVP_PKEY_OP_TYPE_CRYPT \ |
1380 | (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT) | |
716630c0 | 1381 | |
0f113f3e MC |
1382 | # define EVP_PKEY_OP_TYPE_NOGEN \ |
1383 | (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE) | |
29db322e | 1384 | |
0f113f3e MC |
1385 | # define EVP_PKEY_OP_TYPE_GEN \ |
1386 | (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN) | |
716630c0 | 1387 | |
eff1a4d2 DSH |
1388 | # define EVP_PKEY_CTX_set_mac_key(ctx, key, len) \ |
1389 | EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN, \ | |
37659ea4 | 1390 | EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)(key)) |
eff1a4d2 | 1391 | |
0f113f3e MC |
1392 | # define EVP_PKEY_CTRL_MD 1 |
1393 | # define EVP_PKEY_CTRL_PEER_KEY 2 | |
b7683e3a | 1394 | |
0f113f3e MC |
1395 | # define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3 |
1396 | # define EVP_PKEY_CTRL_PKCS7_DECRYPT 4 | |
399a6f0b | 1397 | |
0f113f3e | 1398 | # define EVP_PKEY_CTRL_PKCS7_SIGN 5 |
b2a97be7 | 1399 | |
0f113f3e | 1400 | # define EVP_PKEY_CTRL_SET_MAC_KEY 6 |
74633553 | 1401 | |
0f113f3e | 1402 | # define EVP_PKEY_CTRL_DIGESTINIT 7 |
74633553 | 1403 | |
0e1dba93 | 1404 | /* Used by GOST key encryption in TLS */ |
0f113f3e | 1405 | # define EVP_PKEY_CTRL_SET_IV 8 |
0e1dba93 | 1406 | |
0f113f3e MC |
1407 | # define EVP_PKEY_CTRL_CMS_ENCRYPT 9 |
1408 | # define EVP_PKEY_CTRL_CMS_DECRYPT 10 | |
1409 | # define EVP_PKEY_CTRL_CMS_SIGN 11 | |
8931b30d | 1410 | |
0f113f3e | 1411 | # define EVP_PKEY_CTRL_CIPHER 12 |
c8ef656d | 1412 | |
0f113f3e | 1413 | # define EVP_PKEY_CTRL_GET_MD 13 |
81063953 | 1414 | |
3f5616d7 TS |
1415 | # define EVP_PKEY_CTRL_SET_DIGEST_SIZE 14 |
1416 | ||
0f113f3e | 1417 | # define EVP_PKEY_ALG_CTRL 0x1000 |
b2a97be7 | 1418 | |
0f113f3e MC |
1419 | # define EVP_PKEY_FLAG_AUTOARGLEN 2 |
1420 | /* | |
1421 | * Method handles all operations: don't assume any digest related defaults. | |
c8ef656d | 1422 | */ |
0f113f3e | 1423 | # define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4 |
b010b7c4 | 1424 | |
c9777d26 | 1425 | const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); |
0f113f3e | 1426 | EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags); |
f830c68f | 1427 | void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, |
0f113f3e | 1428 | const EVP_PKEY_METHOD *meth); |
f830c68f | 1429 | void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); |
3207e612 | 1430 | void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); |
81cebb8b | 1431 | int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); |
0822e89a | 1432 | int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth); |
48ed9c23 DSH |
1433 | size_t EVP_PKEY_meth_get_count(void); |
1434 | const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx); | |
81cebb8b | 1435 | |
a94a3e0d RL |
1436 | EVP_KEYMGMT *EVP_KEYMGMT_fetch(OPENSSL_CTX *ctx, const char *algorithm, |
1437 | const char *properties); | |
1438 | int EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt); | |
1439 | void EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt); | |
1440 | const OSSL_PROVIDER *EVP_KEYMGMT_provider(const EVP_KEYMGMT *keymgmt); | |
1441 | ||
f5cda4cb DSH |
1442 | EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); |
1443 | EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); | |
9fdcc21f | 1444 | EVP_PKEY_CTX *EVP_PKEY_CTX_dup(const EVP_PKEY_CTX *ctx); |
5da98aa6 | 1445 | void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); |
4a3dc3c0 | 1446 | |
9c45222d MC |
1447 | int EVP_PKEY_CTX_get_params(EVP_PKEY_CTX *ctx, OSSL_PARAM *params); |
1448 | const OSSL_PARAM *EVP_PKEY_CTX_gettable_params(EVP_PKEY_CTX *ctx); | |
35aca9ec | 1449 | int EVP_PKEY_CTX_set_params(EVP_PKEY_CTX *ctx, OSSL_PARAM *params); |
9c45222d | 1450 | const OSSL_PARAM *EVP_PKEY_CTX_settable_params(EVP_PKEY_CTX *ctx); |
5da98aa6 | 1451 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, |
0f113f3e | 1452 | int cmd, int p1, void *p2); |
4a3dc3c0 | 1453 | int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, |
0f113f3e | 1454 | const char *value); |
cefa762e | 1455 | int EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype, |
64bf1016 | 1456 | int cmd, uint64_t value); |
5da98aa6 | 1457 | |
99119000 DSH |
1458 | int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str); |
1459 | int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex); | |
1460 | ||
410877ba DSH |
1461 | int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md); |
1462 | ||
b28dea4e DSH |
1463 | int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); |
1464 | void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); | |
1465 | ||
2022cfe0 | 1466 | EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, |
0f113f3e | 1467 | const unsigned char *key, int keylen); |
f929439f MC |
1468 | EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e, |
1469 | const unsigned char *priv, | |
1470 | size_t len); | |
1471 | EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e, | |
1472 | const unsigned char *pub, | |
1473 | size_t len); | |
0d124b0a MC |
1474 | int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv, |
1475 | size_t *len); | |
1476 | int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, | |
1477 | size_t *len); | |
1478 | ||
b3831fbb MC |
1479 | EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv, |
1480 | size_t len, const EVP_CIPHER *cipher); | |
2022cfe0 | 1481 | |
f5cda4cb | 1482 | void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); |
9fdcc21f | 1483 | void *EVP_PKEY_CTX_get_data(const EVP_PKEY_CTX *ctx); |
81cebb8b DSH |
1484 | EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx); |
1485 | ||
0e1dba93 DSH |
1486 | EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx); |
1487 | ||
f5cda4cb DSH |
1488 | void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); |
1489 | void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); | |
5da98aa6 | 1490 | |
dfcb5d29 MC |
1491 | void EVP_SIGNATURE_free(EVP_SIGNATURE *signature); |
1492 | int EVP_SIGNATURE_up_ref(EVP_SIGNATURE *signature); | |
1493 | OSSL_PROVIDER *EVP_SIGNATURE_provider(const EVP_SIGNATURE *signature); | |
1494 | EVP_SIGNATURE *EVP_SIGNATURE_fetch(OPENSSL_CTX *ctx, const char *algorithm, | |
1495 | const char *properties); | |
1496 | ||
1497 | int EVP_PKEY_sign_init_ex(EVP_PKEY_CTX *ctx, EVP_SIGNATURE *signature); | |
9e4d0f0b DSH |
1498 | int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); |
1499 | int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, | |
0f113f3e MC |
1500 | unsigned char *sig, size_t *siglen, |
1501 | const unsigned char *tbs, size_t tbslen); | |
390acbeb | 1502 | int EVP_PKEY_verify_init_ex(EVP_PKEY_CTX *ctx, EVP_SIGNATURE *signature); |
9e4d0f0b DSH |
1503 | int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); |
1504 | int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, | |
0f113f3e MC |
1505 | const unsigned char *sig, size_t siglen, |
1506 | const unsigned char *tbs, size_t tbslen); | |
390acbeb | 1507 | int EVP_PKEY_verify_recover_init_ex(EVP_PKEY_CTX *ctx, EVP_SIGNATURE *signature); |
9e4d0f0b DSH |
1508 | int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); |
1509 | int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, | |
0f113f3e MC |
1510 | unsigned char *rout, size_t *routlen, |
1511 | const unsigned char *sig, size_t siglen); | |
9e4d0f0b DSH |
1512 | int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); |
1513 | int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, | |
0f113f3e MC |
1514 | unsigned char *out, size_t *outlen, |
1515 | const unsigned char *in, size_t inlen); | |
9e4d0f0b DSH |
1516 | int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); |
1517 | int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, | |
0f113f3e MC |
1518 | unsigned char *out, size_t *outlen, |
1519 | const unsigned char *in, size_t inlen); | |
9e4d0f0b | 1520 | |
ff64702b | 1521 | int EVP_PKEY_derive_init_ex(EVP_PKEY_CTX *ctx, EVP_KEYEXCH *exchange); |
ffb1ac67 DSH |
1522 | int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); |
1523 | int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); | |
eaff5a14 | 1524 | int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); |
ffb1ac67 | 1525 | |
33bed28b | 1526 | typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); |
f5cda4cb DSH |
1527 | |
1528 | int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); | |
1529 | int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); | |
1530 | int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); | |
1531 | int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); | |
2aee35d3 | 1532 | int EVP_PKEY_check(EVP_PKEY_CTX *ctx); |
b0004708 PY |
1533 | int EVP_PKEY_public_check(EVP_PKEY_CTX *ctx); |
1534 | int EVP_PKEY_param_check(EVP_PKEY_CTX *ctx); | |
f5cda4cb DSH |
1535 | |
1536 | void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); | |
b28dea4e DSH |
1537 | EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); |
1538 | ||
f5cda4cb DSH |
1539 | int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); |
1540 | ||
ba30bad5 | 1541 | void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, |
0f113f3e | 1542 | int (*init) (EVP_PKEY_CTX *ctx)); |
ba30bad5 | 1543 | |
3207e612 | 1544 | void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, |
0f113f3e | 1545 | int (*copy) (EVP_PKEY_CTX *dst, |
9fdcc21f | 1546 | const EVP_PKEY_CTX *src)); |
3207e612 | 1547 | |
ba30bad5 | 1548 | void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, |
0f113f3e | 1549 | void (*cleanup) (EVP_PKEY_CTX *ctx)); |
ba30bad5 DSH |
1550 | |
1551 | void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, | |
0f113f3e MC |
1552 | int (*paramgen_init) (EVP_PKEY_CTX *ctx), |
1553 | int (*paramgen) (EVP_PKEY_CTX *ctx, | |
1554 | EVP_PKEY *pkey)); | |
ba30bad5 DSH |
1555 | |
1556 | void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, | |
0f113f3e MC |
1557 | int (*keygen_init) (EVP_PKEY_CTX *ctx), |
1558 | int (*keygen) (EVP_PKEY_CTX *ctx, | |
1559 | EVP_PKEY *pkey)); | |
ba30bad5 DSH |
1560 | |
1561 | void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, | |
0f113f3e MC |
1562 | int (*sign_init) (EVP_PKEY_CTX *ctx), |
1563 | int (*sign) (EVP_PKEY_CTX *ctx, | |
1564 | unsigned char *sig, size_t *siglen, | |
1565 | const unsigned char *tbs, | |
1566 | size_t tbslen)); | |
ba30bad5 DSH |
1567 | |
1568 | void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, | |
0f113f3e MC |
1569 | int (*verify_init) (EVP_PKEY_CTX *ctx), |
1570 | int (*verify) (EVP_PKEY_CTX *ctx, | |
1571 | const unsigned char *sig, | |
1572 | size_t siglen, | |
1573 | const unsigned char *tbs, | |
1574 | size_t tbslen)); | |
ba30bad5 DSH |
1575 | |
1576 | void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, | |
0f113f3e MC |
1577 | int (*verify_recover_init) (EVP_PKEY_CTX |
1578 | *ctx), | |
1579 | int (*verify_recover) (EVP_PKEY_CTX | |
1580 | *ctx, | |
1581 | unsigned char | |
1582 | *sig, | |
1583 | size_t *siglen, | |
1584 | const unsigned | |
1585 | char *tbs, | |
1586 | size_t tbslen)); | |
ba30bad5 DSH |
1587 | |
1588 | void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, | |
0f113f3e MC |
1589 | int (*signctx_init) (EVP_PKEY_CTX *ctx, |
1590 | EVP_MD_CTX *mctx), | |
1591 | int (*signctx) (EVP_PKEY_CTX *ctx, | |
1592 | unsigned char *sig, | |
1593 | size_t *siglen, | |
1594 | EVP_MD_CTX *mctx)); | |
ba30bad5 DSH |
1595 | |
1596 | void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, | |
0f113f3e MC |
1597 | int (*verifyctx_init) (EVP_PKEY_CTX *ctx, |
1598 | EVP_MD_CTX *mctx), | |
1599 | int (*verifyctx) (EVP_PKEY_CTX *ctx, | |
1600 | const unsigned char *sig, | |
1601 | int siglen, | |
1602 | EVP_MD_CTX *mctx)); | |
ba30bad5 DSH |
1603 | |
1604 | void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, | |
0f113f3e MC |
1605 | int (*encrypt_init) (EVP_PKEY_CTX *ctx), |
1606 | int (*encryptfn) (EVP_PKEY_CTX *ctx, | |
1607 | unsigned char *out, | |
1608 | size_t *outlen, | |
1609 | const unsigned char *in, | |
1610 | size_t inlen)); | |
ba30bad5 DSH |
1611 | |
1612 | void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, | |
0f113f3e MC |
1613 | int (*decrypt_init) (EVP_PKEY_CTX *ctx), |
1614 | int (*decrypt) (EVP_PKEY_CTX *ctx, | |
1615 | unsigned char *out, | |
1616 | size_t *outlen, | |
1617 | const unsigned char *in, | |
1618 | size_t inlen)); | |
ba30bad5 DSH |
1619 | |
1620 | void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, | |
0f113f3e MC |
1621 | int (*derive_init) (EVP_PKEY_CTX *ctx), |
1622 | int (*derive) (EVP_PKEY_CTX *ctx, | |
1623 | unsigned char *key, | |
1624 | size_t *keylen)); | |
ba30bad5 DSH |
1625 | |
1626 | void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, | |
0f113f3e MC |
1627 | int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, |
1628 | void *p2), | |
1629 | int (*ctrl_str) (EVP_PKEY_CTX *ctx, | |
1630 | const char *type, | |
1631 | const char *value)); | |
ba30bad5 | 1632 | |
2aee35d3 PY |
1633 | void EVP_PKEY_meth_set_check(EVP_PKEY_METHOD *pmeth, |
1634 | int (*check) (EVP_PKEY *pkey)); | |
1635 | ||
b0004708 PY |
1636 | void EVP_PKEY_meth_set_public_check(EVP_PKEY_METHOD *pmeth, |
1637 | int (*check) (EVP_PKEY *pkey)); | |
1638 | ||
1639 | void EVP_PKEY_meth_set_param_check(EVP_PKEY_METHOD *pmeth, | |
1640 | int (*check) (EVP_PKEY *pkey)); | |
1641 | ||
0a8fdef7 PY |
1642 | void EVP_PKEY_meth_set_digest_custom(EVP_PKEY_METHOD *pmeth, |
1643 | int (*digest_custom) (EVP_PKEY_CTX *ctx, | |
1644 | EVP_MD_CTX *mctx)); | |
1645 | ||
693be9a2 | 1646 | void EVP_PKEY_meth_get_init(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1647 | int (**pinit) (EVP_PKEY_CTX *ctx)); |
1648 | ||
693be9a2 | 1649 | void EVP_PKEY_meth_get_copy(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 | 1650 | int (**pcopy) (EVP_PKEY_CTX *dst, |
9fdcc21f | 1651 | const EVP_PKEY_CTX *src)); |
e7451ed1 | 1652 | |
693be9a2 | 1653 | void EVP_PKEY_meth_get_cleanup(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1654 | void (**pcleanup) (EVP_PKEY_CTX *ctx)); |
1655 | ||
693be9a2 | 1656 | void EVP_PKEY_meth_get_paramgen(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1657 | int (**pparamgen_init) (EVP_PKEY_CTX *ctx), |
1658 | int (**pparamgen) (EVP_PKEY_CTX *ctx, | |
1659 | EVP_PKEY *pkey)); | |
1660 | ||
693be9a2 | 1661 | void EVP_PKEY_meth_get_keygen(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1662 | int (**pkeygen_init) (EVP_PKEY_CTX *ctx), |
1663 | int (**pkeygen) (EVP_PKEY_CTX *ctx, | |
1664 | EVP_PKEY *pkey)); | |
1665 | ||
693be9a2 | 1666 | void EVP_PKEY_meth_get_sign(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1667 | int (**psign_init) (EVP_PKEY_CTX *ctx), |
1668 | int (**psign) (EVP_PKEY_CTX *ctx, | |
1669 | unsigned char *sig, size_t *siglen, | |
1670 | const unsigned char *tbs, | |
1671 | size_t tbslen)); | |
1672 | ||
693be9a2 | 1673 | void EVP_PKEY_meth_get_verify(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1674 | int (**pverify_init) (EVP_PKEY_CTX *ctx), |
1675 | int (**pverify) (EVP_PKEY_CTX *ctx, | |
1676 | const unsigned char *sig, | |
1677 | size_t siglen, | |
1678 | const unsigned char *tbs, | |
1679 | size_t tbslen)); | |
1680 | ||
693be9a2 | 1681 | void EVP_PKEY_meth_get_verify_recover(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1682 | int (**pverify_recover_init) (EVP_PKEY_CTX |
1683 | *ctx), | |
1684 | int (**pverify_recover) (EVP_PKEY_CTX | |
1685 | *ctx, | |
1686 | unsigned char | |
1687 | *sig, | |
1688 | size_t *siglen, | |
1689 | const unsigned | |
1690 | char *tbs, | |
1691 | size_t tbslen)); | |
1692 | ||
693be9a2 | 1693 | void EVP_PKEY_meth_get_signctx(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1694 | int (**psignctx_init) (EVP_PKEY_CTX *ctx, |
1695 | EVP_MD_CTX *mctx), | |
1696 | int (**psignctx) (EVP_PKEY_CTX *ctx, | |
1697 | unsigned char *sig, | |
1698 | size_t *siglen, | |
1699 | EVP_MD_CTX *mctx)); | |
1700 | ||
693be9a2 | 1701 | void EVP_PKEY_meth_get_verifyctx(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1702 | int (**pverifyctx_init) (EVP_PKEY_CTX *ctx, |
1703 | EVP_MD_CTX *mctx), | |
1704 | int (**pverifyctx) (EVP_PKEY_CTX *ctx, | |
1705 | const unsigned char *sig, | |
1706 | int siglen, | |
1707 | EVP_MD_CTX *mctx)); | |
1708 | ||
693be9a2 | 1709 | void EVP_PKEY_meth_get_encrypt(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1710 | int (**pencrypt_init) (EVP_PKEY_CTX *ctx), |
1711 | int (**pencryptfn) (EVP_PKEY_CTX *ctx, | |
1712 | unsigned char *out, | |
1713 | size_t *outlen, | |
1714 | const unsigned char *in, | |
1715 | size_t inlen)); | |
1716 | ||
693be9a2 | 1717 | void EVP_PKEY_meth_get_decrypt(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1718 | int (**pdecrypt_init) (EVP_PKEY_CTX *ctx), |
1719 | int (**pdecrypt) (EVP_PKEY_CTX *ctx, | |
1720 | unsigned char *out, | |
1721 | size_t *outlen, | |
1722 | const unsigned char *in, | |
1723 | size_t inlen)); | |
1724 | ||
693be9a2 | 1725 | void EVP_PKEY_meth_get_derive(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1726 | int (**pderive_init) (EVP_PKEY_CTX *ctx), |
1727 | int (**pderive) (EVP_PKEY_CTX *ctx, | |
1728 | unsigned char *key, | |
1729 | size_t *keylen)); | |
1730 | ||
693be9a2 | 1731 | void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth, |
e7451ed1 DSH |
1732 | int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1, |
1733 | void *p2), | |
1734 | int (**pctrl_str) (EVP_PKEY_CTX *ctx, | |
1735 | const char *type, | |
1736 | const char *value)); | |
1737 | ||
693be9a2 | 1738 | void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth, |
2aee35d3 PY |
1739 | int (**pcheck) (EVP_PKEY *pkey)); |
1740 | ||
693be9a2 | 1741 | void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth, |
b0004708 PY |
1742 | int (**pcheck) (EVP_PKEY *pkey)); |
1743 | ||
693be9a2 | 1744 | void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth, |
b0004708 PY |
1745 | int (**pcheck) (EVP_PKEY *pkey)); |
1746 | ||
0a8fdef7 PY |
1747 | void EVP_PKEY_meth_get_digest_custom(EVP_PKEY_METHOD *pmeth, |
1748 | int (**pdigest_custom) (EVP_PKEY_CTX *ctx, | |
1749 | EVP_MD_CTX *mctx)); | |
ff64702b MC |
1750 | |
1751 | void EVP_KEYEXCH_free(EVP_KEYEXCH *exchange); | |
1752 | int EVP_KEYEXCH_up_ref(EVP_KEYEXCH *exchange); | |
1753 | EVP_KEYEXCH *EVP_KEYEXCH_fetch(OPENSSL_CTX *ctx, const char *algorithm, | |
1754 | const char *properties); | |
8b84b075 | 1755 | OSSL_PROVIDER *EVP_KEYEXCH_provider(const EVP_KEYEXCH *exchange); |
ff64702b | 1756 | |
ea1d8435 DSH |
1757 | void EVP_add_alg_module(void); |
1758 | ||
f842b6b2 RL |
1759 | /* |
1760 | * Convenient helper functions to transfer string based controls. | |
1761 | * The callback gets called with the parsed value. | |
1762 | */ | |
1763 | int EVP_str2ctrl(int (*cb)(void *ctx, int cmd, void *buf, size_t buflen), | |
1764 | void *ctx, int cmd, const char *value); | |
1765 | int EVP_hex2ctrl(int (*cb)(void *ctx, int cmd, void *buf, size_t buflen), | |
1766 | void *ctx, int cmd, const char *hex); | |
6d311938 | 1767 | |
0cd0a820 | 1768 | # ifdef __cplusplus |
d02b48c6 | 1769 | } |
0cd0a820 | 1770 | # endif |
d02b48c6 | 1771 | #endif |