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