]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/evp.h
Add blake2 support.
[thirdparty/openssl.git] / include / openssl / evp.h
CommitLineData
58964a49 1/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
d02b48c6
RE
2 * All rights reserved.
3 *
4 * This package is an SSL implementation written
5 * by Eric Young (eay@cryptsoft.com).
6 * The implementation was written so as to conform with Netscapes SSL.
0f113f3e 7 *
d02b48c6
RE
8 * This library is free for commercial and non-commercial use as long as
9 * the following conditions are aheared to. The following conditions
10 * apply to all code found in this distribution, be it the RC4, RSA,
11 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
12 * included with this distribution is covered by the same copyright terms
13 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
0f113f3e 14 *
d02b48c6
RE
15 * Copyright remains Eric Young's, and as such any Copyright notices in
16 * the code are not to be removed.
17 * If this package is used in a product, Eric Young should be given attribution
18 * as the author of the parts of the library used.
19 * This can be in the form of a textual message at program startup or
20 * in documentation (online or textual) provided with the package.
0f113f3e 21 *
d02b48c6
RE
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
24 * are met:
25 * 1. Redistributions of source code must retain the copyright
26 * notice, this list of conditions and the following disclaimer.
27 * 2. Redistributions in binary form must reproduce the above copyright
28 * notice, this list of conditions and the following disclaimer in the
29 * documentation and/or other materials provided with the distribution.
30 * 3. All advertising materials mentioning features or use of this software
31 * must display the following acknowledgement:
32 * "This product includes cryptographic software written by
33 * Eric Young (eay@cryptsoft.com)"
34 * The word 'cryptographic' can be left out if the rouines from the library
35 * being used are not cryptographic related :-).
0f113f3e 36 * 4. If you include any Windows specific code (or a derivative thereof) from
d02b48c6
RE
37 * the apps directory (application code) you must include an acknowledgement:
38 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
0f113f3e 39 *
d02b48c6
RE
40 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50 * SUCH DAMAGE.
0f113f3e 51 *
d02b48c6
RE
52 * The licence and distribution terms for any publically available version or
53 * derivative of this code cannot be changed. i.e. this code cannot simply be
54 * copied and put under another distribution licence
55 * [including the GNU Public Licence.]
56 */
57
58#ifndef HEADER_ENVELOPE_H
0f113f3e
MC
59# define HEADER_ENVELOPE_H
60
cde052f5 61# include <openssl/opensslconf.h>
0f113f3e 62# include <openssl/ossl_typ.h>
0f113f3e 63# include <openssl/symhacks.h>
a00ae6c4 64# include <openssl/bio.h>
d02b48c6 65
0f113f3e
MC
66# define EVP_MAX_MD_SIZE 64/* longest known is SHA512 */
67# define EVP_MAX_KEY_LENGTH 64
68# define EVP_MAX_IV_LENGTH 16
69# define EVP_MAX_BLOCK_LENGTH 32
d02b48c6 70
0f113f3e 71# define PKCS5_SALT_LEN 8
b7d135b3 72/* Default PKCS#5 iteration count */
0f113f3e
MC
73# define PKCS5_DEFAULT_ITER 2048
74
75# include <openssl/objects.h>
76
77# define EVP_PK_RSA 0x0001
78# define EVP_PK_DSA 0x0002
79# define EVP_PK_DH 0x0004
80# define EVP_PK_EC 0x0008
81# define EVP_PKT_SIGN 0x0010
82# define EVP_PKT_ENC 0x0020
83# define EVP_PKT_EXCH 0x0040
84# define EVP_PKS_RSA 0x0100
85# define EVP_PKS_DSA 0x0200
86# define EVP_PKS_EC 0x0400
0f113f3e
MC
87
88# define EVP_PKEY_NONE NID_undef
89# define EVP_PKEY_RSA NID_rsaEncryption
90# define EVP_PKEY_RSA2 NID_rsa
91# define EVP_PKEY_DSA NID_dsa
92# define EVP_PKEY_DSA1 NID_dsa_2
93# define EVP_PKEY_DSA2 NID_dsaWithSHA
94# define EVP_PKEY_DSA3 NID_dsaWithSHA1
95# define EVP_PKEY_DSA4 NID_dsaWithSHA1_2
96# define EVP_PKEY_DH NID_dhKeyAgreement
97# define EVP_PKEY_DHX NID_dhpublicnumber
98# define EVP_PKEY_EC NID_X9_62_id_ecPublicKey
99# define EVP_PKEY_HMAC NID_hmac
100# define EVP_PKEY_CMAC NID_cmac
1eff3485 101# define EVP_PKEY_TLS1_PRF NID_tls1_prf
aacfb134 102# define EVP_PKEY_HKDF NID_hkdf
0f113f3e
MC
103
104#ifdef __cplusplus
82271cee
RL
105extern "C" {
106#endif
107
0f113f3e
MC
108# define EVP_PKEY_MO_SIGN 0x0001
109# define EVP_PKEY_MO_VERIFY 0x0002
110# define EVP_PKEY_MO_ENCRYPT 0x0004
111# define EVP_PKEY_MO_DECRYPT 0x0008
112
113# ifndef EVP_MD
2db6bf6f
RL
114EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type);
115EVP_MD *EVP_MD_meth_dup(const EVP_MD *md);
116void EVP_MD_meth_free(EVP_MD *md);
117
118int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize);
119int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize);
120int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize);
121int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags);
122int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx));
123int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx,
124 const void *data,
125 size_t count));
126int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx,
127 unsigned char *md));
128int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to,
129 const EVP_MD_CTX *from));
130int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx));
131int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd,
132 int p1, void *p2));
133
134int EVP_MD_meth_get_input_blocksize(const EVP_MD *md);
135int EVP_MD_meth_get_result_size(const EVP_MD *md);
136int EVP_MD_meth_get_app_datasize(const EVP_MD *md);
137unsigned long EVP_MD_meth_get_flags(const EVP_MD *md);
138int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx);
139int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx,
140 const void *data,
141 size_t count);
142int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx,
143 unsigned char *md);
144int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to,
145 const EVP_MD_CTX *from);
146int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx);
147int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,
148 int p1, void *p2);
0f113f3e 149
dbd87ffc 150/* digest can only handle a single block */
0f113f3e 151# define EVP_MD_FLAG_ONESHOT 0x0001
dbd87ffc 152
09659916
DSH
153/* DigestAlgorithmIdentifier flags... */
154
0f113f3e 155# define EVP_MD_FLAG_DIGALGID_MASK 0x0018
09659916
DSH
156
157/* NULL or absent parameter accepted. Use NULL */
158
0f113f3e 159# define EVP_MD_FLAG_DIGALGID_NULL 0x0000
09659916
DSH
160
161/* NULL or absent parameter accepted. Use NULL for PKCS#1 otherwise absent */
162
0f113f3e 163# define EVP_MD_FLAG_DIGALGID_ABSENT 0x0008
09659916
DSH
164
165/* Custom handling via ctrl */
166
0f113f3e 167# define EVP_MD_FLAG_DIGALGID_CUSTOM 0x0018
09659916 168
dbd87ffc 169/* Note if suitable for use in FIPS mode */
0f113f3e 170# define EVP_MD_FLAG_FIPS 0x0400
7a4bd34a 171
09659916
DSH
172/* Digest ctrls */
173
0f113f3e
MC
174# define EVP_MD_CTRL_DIGALGID 0x1
175# define EVP_MD_CTRL_MICALG 0x2
09659916
DSH
176
177/* Minimum Algorithm specific ctrl value */
178
0f113f3e 179# define EVP_MD_CTRL_ALG_CTRL 0x1000
09659916 180
0f113f3e
MC
181# endif /* !EVP_MD */
182
26188931
BL
183/* values for EVP_MD_CTX flags */
184
0f113f3e
MC
185# define EVP_MD_CTX_FLAG_ONESHOT 0x0001/* digest update will be
186 * called once only */
187# define EVP_MD_CTX_FLAG_CLEANED 0x0002/* context has already been
188 * cleaned */
189# define EVP_MD_CTX_FLAG_REUSE 0x0004/* Don't free up ctx->md_data
e79f8773 190 * in EVP_MD_CTX_reset */
0f113f3e
MC
191/*
192 * FIPS and pad options are ignored in 1.0.0, definitions are here so we
193 * don't accidentally reuse the values for other purposes.
43e12b6f 194 */
d02b48c6 195
0f113f3e
MC
196# define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW 0x0008/* Allow use of non FIPS
197 * digest in FIPS mode */
09659916 198
0f113f3e
MC
199/*
200 * The following PAD options are also currently ignored in 1.0.0, digest
43e12b6f
DSH
201 * parameters are handled through EVP_DigestSign*() and EVP_DigestVerify*()
202 * instead.
203 */
0f113f3e
MC
204# define EVP_MD_CTX_FLAG_PAD_MASK 0xF0/* RSA mode to use */
205# define EVP_MD_CTX_FLAG_PAD_PKCS1 0x00/* PKCS#1 v1.5 mode */
206# define EVP_MD_CTX_FLAG_PAD_X931 0x10/* X9.31 mode */
207# define EVP_MD_CTX_FLAG_PAD_PSS 0x20/* PSS mode */
09659916 208
0f113f3e
MC
209# define EVP_MD_CTX_FLAG_NO_INIT 0x0100/* Don't initialize md_data */
210/*
211 * Some functions such as EVP_DigestSign only finalise copies of internal
afa23c46
DSH
212 * contexts so additional data can be included after the finalisation call.
213 * This is inefficient if this functionality is not required: it is disabled
214 * if the following flag is set.
215 */
0f113f3e
MC
216# define EVP_MD_CTX_FLAG_FINALISE 0x0200
217
e79f8773
RL
218EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len);
219EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher);
220void EVP_CIPHER_meth_free(EVP_CIPHER *cipher);
221
222int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len);
223int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags);
224int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size);
225int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher,
226 int (*init) (EVP_CIPHER_CTX *ctx,
227 const unsigned char *key,
228 const unsigned char *iv,
229 int enc));
230int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher,
231 int (*do_cipher) (EVP_CIPHER_CTX *ctx,
232 unsigned char *out,
233 const unsigned char *in,
234 size_t inl));
235int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher,
236 int (*cleanup) (EVP_CIPHER_CTX *));
237int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher,
238 int (*set_asn1_parameters) (EVP_CIPHER_CTX *,
239 ASN1_TYPE *));
240int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher,
241 int (*get_asn1_parameters) (EVP_CIPHER_CTX *,
242 ASN1_TYPE *));
243int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher,
244 int (*ctrl) (EVP_CIPHER_CTX *, int type,
245 int arg, void *ptr));
246
247int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,
248 const unsigned char *key,
249 const unsigned char *iv,
250 int enc);
251int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,
252 unsigned char *out,
253 const unsigned char *in,
254 size_t inl);
255int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *);
256int (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,
257 ASN1_TYPE *);
258int (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,
259 ASN1_TYPE *);
260int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,
261 int type, int arg,
262 void *ptr);
7f060601
DSH
263
264/* Values for cipher flags */
265
360370d9 266/* Modes for ciphers */
7f060601 267
0f113f3e
MC
268# define EVP_CIPH_STREAM_CIPHER 0x0
269# define EVP_CIPH_ECB_MODE 0x1
270# define EVP_CIPH_CBC_MODE 0x2
271# define EVP_CIPH_CFB_MODE 0x3
272# define EVP_CIPH_OFB_MODE 0x4
273# define EVP_CIPH_CTR_MODE 0x5
274# define EVP_CIPH_GCM_MODE 0x6
275# define EVP_CIPH_CCM_MODE 0x7
276# define EVP_CIPH_XTS_MODE 0x10001
277# define EVP_CIPH_WRAP_MODE 0x10002
278# define EVP_CIPH_OCB_MODE 0x10003
279# define EVP_CIPH_MODE 0xF0007
7f060601 280/* Set if variable length cipher */
0f113f3e 281# define EVP_CIPH_VARIABLE_LENGTH 0x8
360370d9 282/* Set if the iv handling should be done by the cipher itself */
0f113f3e 283# define EVP_CIPH_CUSTOM_IV 0x10
360370d9 284/* Set if the cipher's init() function should be called if key is NULL */
0f113f3e 285# define EVP_CIPH_ALWAYS_CALL_INIT 0x20
57ae2e24 286/* Call ctrl() to init cipher parameters */
0f113f3e 287# define EVP_CIPH_CTRL_INIT 0x40
57ae2e24 288/* Don't use standard key length function */
0f113f3e 289# define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80
f2e5ca84 290/* Don't use standard block padding */
0f113f3e 291# define EVP_CIPH_NO_PADDING 0x100
216659eb 292/* cipher handles random key generation */
0f113f3e 293# define EVP_CIPH_RAND_KEY 0x200
c2bf7208 294/* cipher has its own additional copying logic */
0f113f3e 295# define EVP_CIPH_CUSTOM_COPY 0x400
79cfc3ac 296/* Allow use default ASN1 get/set iv */
0f113f3e 297# define EVP_CIPH_FLAG_DEFAULT_ASN1 0x1000
79cfc3ac 298/* Buffer length in bits not bytes: CFB1 mode only */
0f113f3e 299# define EVP_CIPH_FLAG_LENGTH_BITS 0x2000
7a4bd34a 300/* Note if suitable for use in FIPS mode */
0f113f3e 301# define EVP_CIPH_FLAG_FIPS 0x4000
7a4bd34a 302/* Allow non FIPS cipher in FIPS mode */
0f113f3e
MC
303# define EVP_CIPH_FLAG_NON_FIPS_ALLOW 0x8000
304/*
305 * Cipher handles any and all padding logic as well as finalisation.
3da0ca79 306 */
0f113f3e
MC
307# define EVP_CIPH_FLAG_CUSTOM_CIPHER 0x100000
308# define EVP_CIPH_FLAG_AEAD_CIPHER 0x200000
309# define EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK 0x400000
4e392522
MC
310/* Cipher can handle pipeline operations */
311# define EVP_CIPH_FLAG_PIPELINE 0X800000
7f060601 312
0f113f3e
MC
313/*
314 * Cipher context flag to indicate we can handle wrap mode: if allowed in
315 * older applications it could overflow buffers.
97cf1f6c
DSH
316 */
317
0f113f3e 318# define EVP_CIPHER_CTX_FLAG_WRAP_ALLOW 0x1
97cf1f6c 319
57ae2e24
DSH
320/* ctrl() values */
321
0f113f3e
MC
322# define EVP_CTRL_INIT 0x0
323# define EVP_CTRL_SET_KEY_LENGTH 0x1
324# define EVP_CTRL_GET_RC2_KEY_BITS 0x2
325# define EVP_CTRL_SET_RC2_KEY_BITS 0x3
326# define EVP_CTRL_GET_RC5_ROUNDS 0x4
327# define EVP_CTRL_SET_RC5_ROUNDS 0x5
328# define EVP_CTRL_RAND_KEY 0x6
329# define EVP_CTRL_PBE_PRF_NID 0x7
330# define EVP_CTRL_COPY 0x8
e640fa02
MC
331# define EVP_CTRL_AEAD_SET_IVLEN 0x9
332# define EVP_CTRL_AEAD_GET_TAG 0x10
333# define EVP_CTRL_AEAD_SET_TAG 0x11
e75c5a79 334# define EVP_CTRL_AEAD_SET_IV_FIXED 0x12
e640fa02
MC
335# define EVP_CTRL_GCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN
336# define EVP_CTRL_GCM_GET_TAG EVP_CTRL_AEAD_GET_TAG
337# define EVP_CTRL_GCM_SET_TAG EVP_CTRL_AEAD_SET_TAG
e75c5a79 338# define EVP_CTRL_GCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED
0f113f3e 339# define EVP_CTRL_GCM_IV_GEN 0x13
e640fa02
MC
340# define EVP_CTRL_CCM_SET_IVLEN EVP_CTRL_AEAD_SET_IVLEN
341# define EVP_CTRL_CCM_GET_TAG EVP_CTRL_AEAD_GET_TAG
342# define EVP_CTRL_CCM_SET_TAG EVP_CTRL_AEAD_SET_TAG
e75c5a79 343# define EVP_CTRL_CCM_SET_IV_FIXED EVP_CTRL_AEAD_SET_IV_FIXED
0f113f3e
MC
344# define EVP_CTRL_CCM_SET_L 0x14
345# define EVP_CTRL_CCM_SET_MSGLEN 0x15
346/*
347 * AEAD cipher deduces payload length and returns number of bytes required to
348 * store MAC and eventual padding. Subsequent call to EVP_Cipher even
349 * appends/verifies MAC.
a355cf9b 350 */
0f113f3e 351# define EVP_CTRL_AEAD_TLS1_AAD 0x16
a355cf9b 352/* Used by composite AEAD ciphers, no-op in GCM, CCM... */
0f113f3e 353# define EVP_CTRL_AEAD_SET_MAC_KEY 0x17
28dd49fa 354/* Set the GCM invocation field, decrypt only */
0f113f3e 355# define EVP_CTRL_GCM_SET_IV_INV 0x18
28dd49fa 356
0f113f3e
MC
357# define EVP_CTRL_TLS1_1_MULTIBLOCK_AAD 0x19
358# define EVP_CTRL_TLS1_1_MULTIBLOCK_ENCRYPT 0x1a
359# define EVP_CTRL_TLS1_1_MULTIBLOCK_DECRYPT 0x1b
360# define EVP_CTRL_TLS1_1_MULTIBLOCK_MAX_BUFSIZE 0x1c
b1de640f 361
93972b8c
DSH
362# define EVP_CTRL_SSL3_MASTER_SECRET 0x1d
363
6140f036 364/* EVP_CTRL_SET_SBOX takes the char * specifying S-boxes */
686cf15e 365# define EVP_CTRL_SET_SBOX 0x1e
6140f036
DB
366/*
367 * EVP_CTRL_SBOX_USED takes a 'size_t' and 'char *', pointing at a
368 * pre-allocated buffer with specified size
369 */
686cf15e 370# define EVP_CTRL_SBOX_USED 0x1f
6140f036
DB
371/* EVP_CTRL_KEY_MESH takes 'size_t' number of bytes to mesh the key after,
372 * 0 switches meshing off
373 */
686cf15e 374# define EVP_CTRL_KEY_MESH 0x20
6140f036 375/* EVP_CTRL_BLOCK_PADDING_MODE takes the padding mode */
686cf15e 376# define EVP_CTRL_BLOCK_PADDING_MODE 0x21
6140f036 377
4e392522
MC
378/* Set the output buffers to use for a pipelined operation */
379# define EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS 0x22
380/* Set the input buffers to use for a pipelined operation */
381# define EVP_CTRL_SET_PIPELINE_INPUT_BUFS 0x23
382/* Set the input buffer lengths to use for a pipelined operation */
383# define EVP_CTRL_SET_PIPELINE_INPUT_LENS 0x24
384
6140f036
DB
385/* Padding modes */
386#define EVP_PADDING_PKCS7 1
387#define EVP_PADDING_ISO7816_4 2
388#define EVP_PADDING_ANSI923 3
389#define EVP_PADDING_ISO10126 4
390#define EVP_PADDING_ZERO 5
391
c8269881
MC
392/* RFC 5246 defines additional data to be 13 bytes in length */
393# define EVP_AEAD_TLS1_AAD_LEN 13
394
b1de640f 395typedef struct {
0f113f3e
MC
396 unsigned char *out;
397 const unsigned char *inp;
398 size_t len;
399 unsigned int interleave;
b1de640f
AP
400} EVP_CTRL_TLS1_1_MULTIBLOCK_PARAM;
401
28dd49fa
DSH
402/* GCM TLS constants */
403/* Length of fixed part of IV derived from PRF */
0f113f3e 404# define EVP_GCM_TLS_FIXED_IV_LEN 4
28dd49fa 405/* Length of explicit part of IV part of TLS records */
0f113f3e 406# define EVP_GCM_TLS_EXPLICIT_IV_LEN 8
28dd49fa 407/* Length of tag for TLS */
0f113f3e
MC
408# define EVP_GCM_TLS_TAG_LEN 16
409
e75c5a79
DSH
410/* CCM TLS constants */
411/* Length of fixed part of IV derived from PRF */
412# define EVP_CCM_TLS_FIXED_IV_LEN 4
413/* Length of explicit part of IV part of TLS records */
414# define EVP_CCM_TLS_EXPLICIT_IV_LEN 8
415
0f113f3e
MC
416typedef 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
423typedef 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,\
430 (char *)(rsa))
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,\
435 (char *)(dsa))
436# endif
9ef9e785 437
0f113f3e
MC
438# ifndef OPENSSL_NO_DH
439# define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\
440 (char *)(dh))
441# endif
d02b48c6 442
0f113f3e
MC
443# ifndef OPENSSL_NO_EC
444# define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\
14a7cfb3 445 (char *)(eckey))
0f113f3e 446# endif
4d94ae00 447
d02b48c6 448/* Add some extra combinations */
0f113f3e
MC
449# define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
450# define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))
451# define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a))
452# define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a))
d02b48c6 453
7806f3dd 454int EVP_MD_type(const EVP_MD *md);
0f113f3e
MC
455# define EVP_MD_nid(e) EVP_MD_type(e)
456# define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e))
457int EVP_MD_pkey_type(const EVP_MD *md);
6343829a
GT
458int EVP_MD_size(const EVP_MD *md);
459int EVP_MD_block_size(const EVP_MD *md);
e5fa864f 460unsigned long EVP_MD_flags(const EVP_MD *md);
58964a49 461
7806f3dd 462const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
7638370c
RL
463int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx,
464 const void *data, size_t count);
465void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx,
466 int (*update) (EVP_MD_CTX *ctx,
467 const void *data, size_t count));
0f113f3e
MC
468# define EVP_MD_CTX_size(e) EVP_MD_size(EVP_MD_CTX_md(e))
469# define EVP_MD_CTX_block_size(e) EVP_MD_block_size(EVP_MD_CTX_md(e))
470# define EVP_MD_CTX_type(e) EVP_MD_type(EVP_MD_CTX_md(e))
7638370c
RL
471EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx);
472void *EVP_MD_CTX_md_data(const EVP_MD_CTX *ctx);
d02b48c6 473
7806f3dd 474int EVP_CIPHER_nid(const EVP_CIPHER *cipher);
0f113f3e 475# define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e))
6343829a 476int EVP_CIPHER_block_size(const EVP_CIPHER *cipher);
e79f8773 477int EVP_CIPHER_impl_ctx_size(const EVP_CIPHER *cipher);
6343829a
GT
478int EVP_CIPHER_key_length(const EVP_CIPHER *cipher);
479int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher);
7806f3dd 480unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher);
0f113f3e 481# define EVP_CIPHER_mode(e) (EVP_CIPHER_flags(e) & EVP_CIPH_MODE)
7806f3dd 482
0f113f3e 483const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);
83b06347 484int EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx);
7806f3dd 485int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx);
6343829a
GT
486int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx);
487int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx);
488int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx);
83b06347
RL
489const unsigned char *EVP_CIPHER_CTX_iv(const EVP_CIPHER_CTX *ctx);
490const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx);
491unsigned char *EVP_CIPHER_CTX_iv_noconst(EVP_CIPHER_CTX *ctx);
492unsigned char *EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx);
493int EVP_CIPHER_CTX_num(const EVP_CIPHER_CTX *ctx);
494void EVP_CIPHER_CTX_set_num(EVP_CIPHER_CTX *ctx, int num);
c2bf7208 495int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);
0f113f3e 496void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
7806f3dd 497void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);
44ab2dfd 498void *EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx);
98ee7543 499void *EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data);
0f113f3e 500# define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c))
0ce56222
RL
501# if OPENSSL_API_COMPAT < 0x10100000L
502# define EVP_CIPHER_CTX_flags(c) EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(c))
503# endif
480d3323 504# define EVP_CIPHER_CTX_mode(c) EVP_CIPHER_mode(EVP_CIPHER_CTX_cipher(c))
0f113f3e
MC
505
506# define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80)
507# define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80)
508
509# define EVP_SignInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c)
510# define EVP_SignInit(a,b) EVP_DigestInit(a,b)
511# define EVP_SignUpdate(a,b,c) EVP_DigestUpdate(a,b,c)
512# define EVP_VerifyInit_ex(a,b,c) EVP_DigestInit_ex(a,b,c)
513# define EVP_VerifyInit(a,b) EVP_DigestInit(a,b)
514# define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c)
515# define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e)
516# define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e)
517# define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c)
518# define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c)
519
520# ifdef CONST_STRICT
521void BIO_set_md(BIO *, const EVP_MD *md);
522# else
523# define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md)
524# endif
525# define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp)
526# define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp)
527# define BIO_set_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(char *)mdcp)
528# define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)
529# define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp)
d02b48c6 530
ae551760 531/*__owur*/ int EVP_Cipher(EVP_CIPHER_CTX *c,
0f113f3e
MC
532 unsigned char *out,
533 const unsigned char *in, unsigned int inl);
534
535# define EVP_add_cipher_alias(n,alias) \
536 OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))
537# define EVP_add_digest_alias(n,alias) \
538 OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))
539# define EVP_delete_cipher_alias(alias) \
540 OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS);
541# define EVP_delete_digest_alias(alias) \
542 OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);
543
396d5fd0 544int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
959ed531
RL
545EVP_MD_CTX *EVP_MD_CTX_new(void);
546int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
547void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
f8137a62
VD
548# define EVP_MD_CTX_create() EVP_MD_CTX_new()
549# define EVP_MD_CTX_init(ctx) EVP_MD_CTX_reset((ctx))
550# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx))
0f113f3e
MC
551/*__owur*/ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);
552void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);
553void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);
554int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags);
555/*__owur*/ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type,
556 ENGINE *impl);
557/*__owur*/ int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d,
558 size_t cnt);
559/*__owur*/ int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md,
560 unsigned int *s);
561/*__owur*/ int EVP_Digest(const void *data, size_t count,
562 unsigned char *md, unsigned int *size,
563 const EVP_MD *type, ENGINE *impl);
564
565/*__owur*/ int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in);
566/*__owur*/ int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
567__owur int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md,
568 unsigned int *s);
569
db922318 570#ifndef OPENSSL_NO_UI
0f113f3e
MC
571int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify);
572int EVP_read_pw_string_min(char *buf, int minlen, int maxlen,
573 const char *prompt, int verify);
574void EVP_set_pw_prompt(const char *prompt);
575char *EVP_get_pw_prompt(void);
db922318 576#endif
0f113f3e
MC
577
578__owur int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
579 const unsigned char *salt,
580 const unsigned char *data, int datal, int count,
581 unsigned char *key, unsigned char *iv);
582
583void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags);
584void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags);
585int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags);
586
587__owur int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
588 const unsigned char *key, const unsigned char *iv);
589/*__owur*/ int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,
590 const EVP_CIPHER *cipher, ENGINE *impl,
591 const unsigned char *key,
592 const unsigned char *iv);
593/*__owur*/ int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
594 int *outl, const unsigned char *in, int inl);
595/*__owur*/ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out,
596 int *outl);
597/*__owur*/ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out,
598 int *outl);
599
600__owur int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
601 const unsigned char *key, const unsigned char *iv);
602/*__owur*/ int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,
603 const EVP_CIPHER *cipher, ENGINE *impl,
604 const unsigned char *key,
605 const unsigned char *iv);
606/*__owur*/ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
607 int *outl, const unsigned char *in, int inl);
608__owur int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm,
609 int *outl);
610/*__owur*/ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,
611 int *outl);
612
613__owur int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
614 const unsigned char *key, const unsigned char *iv,
615 int enc);
616/*__owur*/ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,
617 const EVP_CIPHER *cipher, ENGINE *impl,
618 const unsigned char *key,
619 const unsigned char *iv, int enc);
620__owur int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
621 int *outl, const unsigned char *in, int inl);
622__owur int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm,
623 int *outl);
624__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,
625 int *outl);
626
627__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s,
628 EVP_PKEY *pkey);
629
630__owur int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
631 unsigned int siglen, EVP_PKEY *pkey);
632
633/*__owur*/ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
634 const EVP_MD *type, ENGINE *e,
635 EVP_PKEY *pkey);
636__owur int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
637 size_t *siglen);
638
639__owur int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
640 const EVP_MD *type, ENGINE *e,
641 EVP_PKEY *pkey);
642__owur int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig,
643 size_t siglen);
644
c3be59a4 645# ifndef OPENSSL_NO_RSA
0f113f3e
MC
646__owur int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
647 const unsigned char *ek, int ekl,
648 const unsigned char *iv, EVP_PKEY *priv);
649__owur int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
650
651__owur int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
652 unsigned char **ek, int *ekl, unsigned char *iv,
653 EVP_PKEY **pubk, int npubk);
654__owur int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
c3be59a4 655# endif
0f113f3e 656
a0be4fd1
RL
657EVP_ENCODE_CTX *EVP_ENCODE_CTX_new(void);
658void EVP_ENCODE_CTX_free(EVP_ENCODE_CTX *ctx);
659int EVP_ENCODE_CTX_num(EVP_ENCODE_CTX *ctx);
0f113f3e
MC
660void EVP_EncodeInit(EVP_ENCODE_CTX *ctx);
661void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
662 const unsigned char *in, int inl);
663void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl);
664int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);
665
666void EVP_DecodeInit(EVP_ENCODE_CTX *ctx);
667int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
668 const unsigned char *in, int inl);
669int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned
670 char *out, int *outl);
671int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);
d02b48c6 672
0ce56222 673# if OPENSSL_API_COMPAT < 0x10100000L
ff4b7faf
RL
674# define EVP_CIPHER_CTX_init(c) EVP_CIPHER_CTX_reset(c)
675# define EVP_CIPHER_CTX_cleanup(c) EVP_CIPHER_CTX_reset(c)
0ce56222 676# endif
b40228a6 677EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);
8baf9968
RL
678int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c);
679void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *c);
6343829a 680int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);
f2e5ca84 681int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);
49528751 682int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
216659eb 683int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);
d02b48c6 684
d02b48c6
RE
685BIO_METHOD *BIO_f_md(void);
686BIO_METHOD *BIO_f_base64(void);
687BIO_METHOD *BIO_f_cipher(void);
55ab3bf7 688BIO_METHOD *BIO_f_reliable(void);
0f113f3e
MC
689__owur int BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k,
690 const unsigned char *i, int enc);
d02b48c6 691
13588350 692const EVP_MD *EVP_md_null(void);
0f113f3e 693# ifndef OPENSSL_NO_MD2
13588350 694const EVP_MD *EVP_md2(void);
0f113f3e
MC
695# endif
696# ifndef OPENSSL_NO_MD4
13588350 697const EVP_MD *EVP_md4(void);
0f113f3e
MC
698# endif
699# ifndef OPENSSL_NO_MD5
13588350 700const EVP_MD *EVP_md5(void);
2f142ada 701const EVP_MD *EVP_md5_sha1(void);
0f113f3e 702# endif
2d0b4412
BC
703# ifndef OPENSSL_NO_BLAKE2
704const EVP_MD *EVP_blake2b(void);
705const EVP_MD *EVP_blake2s(void);
706# endif
13588350 707const EVP_MD *EVP_sha1(void);
31c2ac1c
AP
708const EVP_MD *EVP_sha224(void);
709const EVP_MD *EVP_sha256(void);
31c2ac1c
AP
710const EVP_MD *EVP_sha384(void);
711const EVP_MD *EVP_sha512(void);
0f113f3e 712# ifndef OPENSSL_NO_MDC2
13588350 713const EVP_MD *EVP_mdc2(void);
0f113f3e
MC
714# endif
715# ifndef OPENSSL_NO_RMD160
13588350 716const EVP_MD *EVP_ripemd160(void);
0f113f3e
MC
717# endif
718# ifndef OPENSSL_NO_WHIRLPOOL
200fc028 719const EVP_MD *EVP_whirlpool(void);
0f113f3e
MC
720# endif
721const EVP_CIPHER *EVP_enc_null(void); /* does nothing :-) */
722# ifndef OPENSSL_NO_DES
13588350
DSH
723const EVP_CIPHER *EVP_des_ecb(void);
724const EVP_CIPHER *EVP_des_ede(void);
725const EVP_CIPHER *EVP_des_ede3(void);
65ee74fb
LJ
726const EVP_CIPHER *EVP_des_ede_ecb(void);
727const EVP_CIPHER *EVP_des_ede3_ecb(void);
8d1ebe0b 728const EVP_CIPHER *EVP_des_cfb64(void);
0f113f3e 729# define EVP_des_cfb EVP_des_cfb64
8d1ebe0b
RL
730const EVP_CIPHER *EVP_des_cfb1(void);
731const EVP_CIPHER *EVP_des_cfb8(void);
732const EVP_CIPHER *EVP_des_ede_cfb64(void);
0f113f3e 733# define EVP_des_ede_cfb EVP_des_ede_cfb64
8d1ebe0b 734const EVP_CIPHER *EVP_des_ede3_cfb64(void);
0f113f3e 735# define EVP_des_ede3_cfb EVP_des_ede3_cfb64
8d1ebe0b
RL
736const EVP_CIPHER *EVP_des_ede3_cfb1(void);
737const EVP_CIPHER *EVP_des_ede3_cfb8(void);
13588350
DSH
738const EVP_CIPHER *EVP_des_ofb(void);
739const EVP_CIPHER *EVP_des_ede_ofb(void);
740const EVP_CIPHER *EVP_des_ede3_ofb(void);
741const EVP_CIPHER *EVP_des_cbc(void);
742const EVP_CIPHER *EVP_des_ede_cbc(void);
743const EVP_CIPHER *EVP_des_ede3_cbc(void);
744const EVP_CIPHER *EVP_desx_cbc(void);
97cf1f6c 745const EVP_CIPHER *EVP_des_ede3_wrap(void);
0f113f3e
MC
746/*
747 * This should now be supported through the dev_crypto ENGINE. But also, why
748 * are rc4 and md5 declarations made here inside a "NO_DES" precompiler
749 * branch?
750 */
c518ade1 751# endif
0f113f3e 752# ifndef OPENSSL_NO_RC4
13588350
DSH
753const EVP_CIPHER *EVP_rc4(void);
754const EVP_CIPHER *EVP_rc4_40(void);
0f113f3e 755# ifndef OPENSSL_NO_MD5
c608171d 756const EVP_CIPHER *EVP_rc4_hmac_md5(void);
0f113f3e
MC
757# endif
758# endif
759# ifndef OPENSSL_NO_IDEA
13588350 760const EVP_CIPHER *EVP_idea_ecb(void);
8d1ebe0b 761const EVP_CIPHER *EVP_idea_cfb64(void);
0f113f3e 762# define EVP_idea_cfb EVP_idea_cfb64
13588350
DSH
763const EVP_CIPHER *EVP_idea_ofb(void);
764const EVP_CIPHER *EVP_idea_cbc(void);
0f113f3e
MC
765# endif
766# ifndef OPENSSL_NO_RC2
13588350
DSH
767const EVP_CIPHER *EVP_rc2_ecb(void);
768const EVP_CIPHER *EVP_rc2_cbc(void);
769const EVP_CIPHER *EVP_rc2_40_cbc(void);
770const EVP_CIPHER *EVP_rc2_64_cbc(void);
8d1ebe0b 771const EVP_CIPHER *EVP_rc2_cfb64(void);
0f113f3e 772# define EVP_rc2_cfb EVP_rc2_cfb64
13588350 773const EVP_CIPHER *EVP_rc2_ofb(void);
0f113f3e
MC
774# endif
775# ifndef OPENSSL_NO_BF
13588350
DSH
776const EVP_CIPHER *EVP_bf_ecb(void);
777const EVP_CIPHER *EVP_bf_cbc(void);
8d1ebe0b 778const EVP_CIPHER *EVP_bf_cfb64(void);
0f113f3e 779# define EVP_bf_cfb EVP_bf_cfb64
13588350 780const EVP_CIPHER *EVP_bf_ofb(void);
0f113f3e
MC
781# endif
782# ifndef OPENSSL_NO_CAST
13588350
DSH
783const EVP_CIPHER *EVP_cast5_ecb(void);
784const EVP_CIPHER *EVP_cast5_cbc(void);
8d1ebe0b 785const EVP_CIPHER *EVP_cast5_cfb64(void);
0f113f3e 786# define EVP_cast5_cfb EVP_cast5_cfb64
13588350 787const EVP_CIPHER *EVP_cast5_ofb(void);
0f113f3e
MC
788# endif
789# ifndef OPENSSL_NO_RC5
13588350
DSH
790const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);
791const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);
8d1ebe0b 792const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);
0f113f3e 793# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64
13588350 794const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);
0f113f3e
MC
795# endif
796# ifndef OPENSSL_NO_AES
13588350
DSH
797const EVP_CIPHER *EVP_aes_128_ecb(void);
798const EVP_CIPHER *EVP_aes_128_cbc(void);
8d1ebe0b
RL
799const EVP_CIPHER *EVP_aes_128_cfb1(void);
800const EVP_CIPHER *EVP_aes_128_cfb8(void);
801const EVP_CIPHER *EVP_aes_128_cfb128(void);
0f113f3e 802# define EVP_aes_128_cfb EVP_aes_128_cfb128
bd54d55c 803const EVP_CIPHER *EVP_aes_128_ofb(void);
bd54d55c 804const EVP_CIPHER *EVP_aes_128_ctr(void);
23916810 805const EVP_CIPHER *EVP_aes_128_ccm(void);
bdaa5415 806const EVP_CIPHER *EVP_aes_128_gcm(void);
32a2d8dd 807const EVP_CIPHER *EVP_aes_128_xts(void);
97cf1f6c 808const EVP_CIPHER *EVP_aes_128_wrap(void);
d31fed73 809const EVP_CIPHER *EVP_aes_128_wrap_pad(void);
0f113f3e 810# ifndef OPENSSL_NO_OCB
e6b336ef 811const EVP_CIPHER *EVP_aes_128_ocb(void);
0f113f3e 812# endif
13588350
DSH
813const EVP_CIPHER *EVP_aes_192_ecb(void);
814const EVP_CIPHER *EVP_aes_192_cbc(void);
8d1ebe0b
RL
815const EVP_CIPHER *EVP_aes_192_cfb1(void);
816const EVP_CIPHER *EVP_aes_192_cfb8(void);
817const EVP_CIPHER *EVP_aes_192_cfb128(void);
0f113f3e 818# define EVP_aes_192_cfb EVP_aes_192_cfb128
bd54d55c 819const EVP_CIPHER *EVP_aes_192_ofb(void);
bd54d55c 820const EVP_CIPHER *EVP_aes_192_ctr(void);
23916810 821const EVP_CIPHER *EVP_aes_192_ccm(void);
bdaa5415 822const EVP_CIPHER *EVP_aes_192_gcm(void);
97cf1f6c 823const EVP_CIPHER *EVP_aes_192_wrap(void);
d31fed73 824const EVP_CIPHER *EVP_aes_192_wrap_pad(void);
0f113f3e 825# ifndef OPENSSL_NO_OCB
e6b336ef 826const EVP_CIPHER *EVP_aes_192_ocb(void);
0f113f3e 827# endif
13588350
DSH
828const EVP_CIPHER *EVP_aes_256_ecb(void);
829const EVP_CIPHER *EVP_aes_256_cbc(void);
8d1ebe0b
RL
830const EVP_CIPHER *EVP_aes_256_cfb1(void);
831const EVP_CIPHER *EVP_aes_256_cfb8(void);
832const EVP_CIPHER *EVP_aes_256_cfb128(void);
0f113f3e 833# define EVP_aes_256_cfb EVP_aes_256_cfb128
bd54d55c 834const EVP_CIPHER *EVP_aes_256_ofb(void);
bd54d55c 835const EVP_CIPHER *EVP_aes_256_ctr(void);
23916810 836const EVP_CIPHER *EVP_aes_256_ccm(void);
bdaa5415 837const EVP_CIPHER *EVP_aes_256_gcm(void);
32a2d8dd 838const EVP_CIPHER *EVP_aes_256_xts(void);
97cf1f6c 839const EVP_CIPHER *EVP_aes_256_wrap(void);
d31fed73 840const EVP_CIPHER *EVP_aes_256_wrap_pad(void);
0f113f3e 841# ifndef OPENSSL_NO_OCB
e6b336ef 842const EVP_CIPHER *EVP_aes_256_ocb(void);
0f113f3e 843# endif
c608171d
AP
844const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
845const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void);
b25b8417
BL
846const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void);
847const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha256(void);
848# endif
0f113f3e 849# ifndef OPENSSL_NO_CAMELLIA
f3dea9a5
BM
850const EVP_CIPHER *EVP_camellia_128_ecb(void);
851const EVP_CIPHER *EVP_camellia_128_cbc(void);
852const EVP_CIPHER *EVP_camellia_128_cfb1(void);
853const EVP_CIPHER *EVP_camellia_128_cfb8(void);
854const EVP_CIPHER *EVP_camellia_128_cfb128(void);
0f113f3e 855# define EVP_camellia_128_cfb EVP_camellia_128_cfb128
f3dea9a5 856const EVP_CIPHER *EVP_camellia_128_ofb(void);
2b8f33a5 857const EVP_CIPHER *EVP_camellia_128_ctr(void);
f3dea9a5
BM
858const EVP_CIPHER *EVP_camellia_192_ecb(void);
859const EVP_CIPHER *EVP_camellia_192_cbc(void);
860const EVP_CIPHER *EVP_camellia_192_cfb1(void);
861const EVP_CIPHER *EVP_camellia_192_cfb8(void);
862const EVP_CIPHER *EVP_camellia_192_cfb128(void);
0f113f3e 863# define EVP_camellia_192_cfb EVP_camellia_192_cfb128
f3dea9a5 864const EVP_CIPHER *EVP_camellia_192_ofb(void);
2b8f33a5 865const EVP_CIPHER *EVP_camellia_192_ctr(void);
f3dea9a5
BM
866const EVP_CIPHER *EVP_camellia_256_ecb(void);
867const EVP_CIPHER *EVP_camellia_256_cbc(void);
868const EVP_CIPHER *EVP_camellia_256_cfb1(void);
869const EVP_CIPHER *EVP_camellia_256_cfb8(void);
870const EVP_CIPHER *EVP_camellia_256_cfb128(void);
0f113f3e 871# define EVP_camellia_256_cfb EVP_camellia_256_cfb128
f3dea9a5 872const EVP_CIPHER *EVP_camellia_256_ofb(void);
2b8f33a5 873const EVP_CIPHER *EVP_camellia_256_ctr(void);
0f113f3e 874# endif
bd989745
AP
875# ifndef OPENSSL_NO_CHACHA
876const EVP_CIPHER *EVP_chacha20(void);
877# ifndef OPENSSL_NO_POLY1305
878const EVP_CIPHER *EVP_chacha20_poly1305(void);
879# endif
880# endif
3ab56511 881
0f113f3e 882# ifndef OPENSSL_NO_SEED
96afc1cf
BM
883const EVP_CIPHER *EVP_seed_ecb(void);
884const EVP_CIPHER *EVP_seed_cbc(void);
885const EVP_CIPHER *EVP_seed_cfb128(void);
0f113f3e 886# define EVP_seed_cfb EVP_seed_cfb128
96afc1cf 887const EVP_CIPHER *EVP_seed_ofb(void);
0f113f3e 888# endif
96afc1cf 889
f672aee4
RS
890# if OPENSSL_API_COMPAT < 0x10100000L
891# define OPENSSL_add_all_algorithms_conf() \
892 OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
893 | OPENSSL_INIT_ADD_ALL_DIGESTS \
894 | OPENSSL_INIT_LOAD_CONFIG, NULL)
895# define OPENSSL_add_all_algorithms_noconf() \
896 OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
897 | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
898
899# ifdef OPENSSL_LOAD_CONF
900# define OpenSSL_add_all_algorithms() \
901 OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
902 | OPENSSL_INIT_ADD_ALL_DIGESTS \
903 | OPENSSL_INIT_LOAD_CONFIG, NULL)
904# else
905# define OpenSSL_add_all_algorithms() \
906 OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
907 | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
908# endif
e84be9b4 909
f672aee4
RS
910# define OpenSSL_add_all_ciphers() \
911 OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL)
912# define OpenSSL_add_all_digests() \
913 OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
914# endif
d02b48c6 915
13588350
DSH
916int EVP_add_cipher(const EVP_CIPHER *cipher);
917int EVP_add_digest(const EVP_MD *digest);
d02b48c6 918
e778802f
BL
919const EVP_CIPHER *EVP_get_cipherbyname(const char *name);
920const EVP_MD *EVP_get_digestbyname(const char *name);
d02b48c6
RE
921void EVP_cleanup(void);
922
0f113f3e
MC
923void EVP_CIPHER_do_all(void (*fn) (const EVP_CIPHER *ciph,
924 const char *from, const char *to, void *x),
925 void *arg);
926void EVP_CIPHER_do_all_sorted(void (*fn)
927 (const EVP_CIPHER *ciph, const char *from,
928 const char *to, void *x), void *arg);
929
930void EVP_MD_do_all(void (*fn) (const EVP_MD *ciph,
931 const char *from, const char *to, void *x),
932 void *arg);
933void EVP_MD_do_all_sorted(void (*fn)
934 (const EVP_MD *ciph, const char *from,
935 const char *to, void *x), void *arg);
936
937int EVP_PKEY_decrypt_old(unsigned char *dec_key,
938 const unsigned char *enc_key, int enc_key_len,
939 EVP_PKEY *private_key);
940int EVP_PKEY_encrypt_old(unsigned char *enc_key,
941 const unsigned char *key, int key_len,
942 EVP_PKEY *pub_key);
943int EVP_PKEY_type(int type);
944int EVP_PKEY_id(const EVP_PKEY *pkey);
945int EVP_PKEY_base_id(const EVP_PKEY *pkey);
946int EVP_PKEY_bits(EVP_PKEY *pkey);
947int EVP_PKEY_security_bits(const EVP_PKEY *pkey);
948int EVP_PKEY_size(EVP_PKEY *pkey);
949int EVP_PKEY_set_type(EVP_PKEY *pkey, int type);
950int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
951int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key);
3aeb9348 952void *EVP_PKEY_get0(const EVP_PKEY *pkey);
0f113f3e
MC
953
954# ifndef OPENSSL_NO_RSA
bb2297a4 955struct rsa_st;
0f113f3e 956int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key);
2872dbe1 957struct rsa_st *EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
bb2297a4 958struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
0f113f3e
MC
959# endif
960# ifndef OPENSSL_NO_DSA
bb2297a4 961struct dsa_st;
0f113f3e 962int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key);
2872dbe1 963struct dsa_st *EVP_PKEY_get0_DSA(EVP_PKEY *pkey);
bb2297a4 964struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
0f113f3e
MC
965# endif
966# ifndef OPENSSL_NO_DH
bb2297a4 967struct dh_st;
0f113f3e 968int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key);
2872dbe1 969struct dh_st *EVP_PKEY_get0_DH(EVP_PKEY *pkey);
bb2297a4 970struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
0f113f3e
MC
971# endif
972# ifndef OPENSSL_NO_EC
14a7cfb3 973struct ec_key_st;
0f113f3e 974int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key);
2872dbe1 975struct ec_key_st *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey);
14a7cfb3 976struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
0f113f3e 977# endif
bb2297a4 978
0f113f3e 979EVP_PKEY *EVP_PKEY_new(void);
2872dbe1 980void EVP_PKEY_up_ref(EVP_PKEY *pkey);
0f113f3e 981void EVP_PKEY_free(EVP_PKEY *pkey);
b6995add 982
0f113f3e
MC
983EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
984 long length);
985int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
d02b48c6 986
0f113f3e
MC
987EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
988 long length);
989EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
990 long length);
991int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);
d02b48c6 992
af0f0f3e
RL
993int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
994int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);
0f113f3e 995int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode);
af0f0f3e 996int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);
58964a49 997
af0f0f3e 998int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
e6526fbf 999
35208f36 1000int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
0f113f3e 1001 int indent, ASN1_PCTX *pctx);
35208f36 1002int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
0f113f3e 1003 int indent, ASN1_PCTX *pctx);
35208f36 1004int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
0f113f3e 1005 int indent, ASN1_PCTX *pctx);
35208f36 1006
03919683
DSH
1007int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
1008
84fa704c 1009int EVP_CIPHER_type(const EVP_CIPHER *ctx);
884e8ec6 1010
58964a49
RE
1011/* calls methods */
1012int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
1013int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
1014
1015/* These are used by EVP_CIPHER methods */
0f113f3e
MC
1016int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
1017int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
d02b48c6 1018
b0c6fb80 1019/* PKCS5 password based encryption */
2bd83ca1 1020int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
0f113f3e
MC
1021 ASN1_TYPE *param, const EVP_CIPHER *cipher,
1022 const EVP_MD *md, int en_de);
97e4a932 1023int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
0f113f3e
MC
1024 const unsigned char *salt, int saltlen, int iter,
1025 int keylen, unsigned char *out);
777c47ac 1026int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
0f113f3e
MC
1027 const unsigned char *salt, int saltlen, int iter,
1028 const EVP_MD *digest, int keylen, unsigned char *out);
97e4a932 1029int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
0f113f3e
MC
1030 ASN1_TYPE *param, const EVP_CIPHER *cipher,
1031 const EVP_MD *md, int en_de);
b0c6fb80 1032
b0809bc8 1033#ifndef OPENSSL_NO_SCRYPT
a95fb9e3
DSH
1034int EVP_PBE_scrypt(const char *pass, size_t passlen,
1035 const unsigned char *salt, size_t saltlen,
1036 uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,
1037 unsigned char *key, size_t keylen);
1038
e98aa30d
DSH
1039int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,
1040 int passlen, ASN1_TYPE *param,
1041 const EVP_CIPHER *c, const EVP_MD *md, int en_de);
b0809bc8 1042#endif
e98aa30d 1043
600dec15
DSH
1044void PKCS5_PBE_add(void);
1045
0f113f3e
MC
1046int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
1047 ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
856640b5
DSH
1048
1049/* PBE type */
1050
1051/* Can appear as the outermost AlgorithmIdentifier */
0f113f3e 1052# define EVP_PBE_TYPE_OUTER 0x0
856640b5 1053/* Is an PRF type OID */
0f113f3e 1054# define EVP_PBE_TYPE_PRF 0x1
d6c5462e
DSH
1055/* Is a PKCS#5 v2.0 KDF */
1056# define EVP_PBE_TYPE_KDF 0x2
856640b5 1057
0f113f3e
MC
1058int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,
1059 int md_nid, EVP_PBE_KEYGEN *keygen);
13588350 1060int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
0f113f3e
MC
1061 EVP_PBE_KEYGEN *keygen);
1062int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid,
1063 EVP_PBE_KEYGEN **pkeygen);
69cbf468 1064void EVP_PBE_cleanup(void);
d9546693 1065int EVP_PBE_get(int *ptype, int *ppbe_nid, size_t num);
69cbf468 1066
0f113f3e
MC
1067# define ASN1_PKEY_ALIAS 0x1
1068# define ASN1_PKEY_DYNAMIC 0x2
1069# define ASN1_PKEY_SIGPARAM_NULL 0x4
0b33dac3 1070
0f113f3e
MC
1071# define ASN1_PKEY_CTRL_PKCS7_SIGN 0x1
1072# define ASN1_PKEY_CTRL_PKCS7_ENCRYPT 0x2
1073# define ASN1_PKEY_CTRL_DEFAULT_MD_NID 0x3
1074# define ASN1_PKEY_CTRL_CMS_SIGN 0x5
1075# define ASN1_PKEY_CTRL_CMS_ENVELOPE 0x7
1076# define ASN1_PKEY_CTRL_CMS_RI_TYPE 0x8
492a9e24 1077
e4263314
DSH
1078int EVP_PKEY_asn1_get_count(void);
1079const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx);
01b8b3c7
DSH
1080const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type);
1081const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
0f113f3e 1082 const char *str, int len);
e46691a0
DSH
1083int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth);
1084int EVP_PKEY_asn1_add_alias(int to, int from);
0f113f3e
MC
1085int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id,
1086 int *ppkey_flags, const char **pinfo,
1087 const char **ppem_str,
1088 const EVP_PKEY_ASN1_METHOD *ameth);
1089
1090const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(EVP_PKEY *pkey);
1091EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags,
1092 const char *pem_str,
1093 const char *info);
1094void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst,
1095 const EVP_PKEY_ASN1_METHOD *src);
d82e2718 1096void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth);
42eae426 1097void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,
0f113f3e
MC
1098 int (*pub_decode) (EVP_PKEY *pk,
1099 X509_PUBKEY *pub),
1100 int (*pub_encode) (X509_PUBKEY *pub,
1101 const EVP_PKEY *pk),
1102 int (*pub_cmp) (const EVP_PKEY *a,
1103 const EVP_PKEY *b),
1104 int (*pub_print) (BIO *out,
1105 const EVP_PKEY *pkey,
1106 int indent, ASN1_PCTX *pctx),
1107 int (*pkey_size) (const EVP_PKEY *pk),
1108 int (*pkey_bits) (const EVP_PKEY *pk));
d82e2718 1109void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
0f113f3e
MC
1110 int (*priv_decode) (EVP_PKEY *pk,
1111 PKCS8_PRIV_KEY_INFO
1112 *p8inf),
1113 int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8,
1114 const EVP_PKEY *pk),
1115 int (*priv_print) (BIO *out,
1116 const EVP_PKEY *pkey,
1117 int indent,
1118 ASN1_PCTX *pctx));
d82e2718 1119void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
0f113f3e
MC
1120 int (*param_decode) (EVP_PKEY *pkey,
1121 const unsigned char **pder,
1122 int derlen),
1123 int (*param_encode) (const EVP_PKEY *pkey,
1124 unsigned char **pder),
1125 int (*param_missing) (const EVP_PKEY *pk),
1126 int (*param_copy) (EVP_PKEY *to,
1127 const EVP_PKEY *from),
1128 int (*param_cmp) (const EVP_PKEY *a,
1129 const EVP_PKEY *b),
1130 int (*param_print) (BIO *out,
1131 const EVP_PKEY *pkey,
1132 int indent,
1133 ASN1_PCTX *pctx));
db98bbc1 1134
d82e2718 1135void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
0f113f3e 1136 void (*pkey_free) (EVP_PKEY *pkey));
d82e2718 1137void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
0f113f3e
MC
1138 int (*pkey_ctrl) (EVP_PKEY *pkey, int op,
1139 long arg1, void *arg2));
3418f7b7
SA
1140void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth,
1141 int (*item_verify) (EVP_MD_CTX *ctx,
1142 const ASN1_ITEM *it,
1143 void *asn,
1144 X509_ALGOR *a,
1145 ASN1_BIT_STRING *sig,
1146 EVP_PKEY *pkey),
1147 int (*item_sign) (EVP_MD_CTX *ctx,
1148 const ASN1_ITEM *it,
1149 void *asn,
1150 X509_ALGOR *alg1,
1151 X509_ALGOR *alg2,
1152 ASN1_BIT_STRING *sig));
448be743 1153
2514fa79 1154void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth,
0f113f3e
MC
1155 int (*pkey_security_bits) (const EVP_PKEY
1156 *pk));
5da98aa6 1157
0f113f3e
MC
1158# define EVP_PKEY_OP_UNDEFINED 0
1159# define EVP_PKEY_OP_PARAMGEN (1<<1)
1160# define EVP_PKEY_OP_KEYGEN (1<<2)
1161# define EVP_PKEY_OP_SIGN (1<<3)
1162# define EVP_PKEY_OP_VERIFY (1<<4)
1163# define EVP_PKEY_OP_VERIFYRECOVER (1<<5)
1164# define EVP_PKEY_OP_SIGNCTX (1<<6)
1165# define EVP_PKEY_OP_VERIFYCTX (1<<7)
1166# define EVP_PKEY_OP_ENCRYPT (1<<8)
1167# define EVP_PKEY_OP_DECRYPT (1<<9)
1168# define EVP_PKEY_OP_DERIVE (1<<10)
716630c0 1169
0f113f3e
MC
1170# define EVP_PKEY_OP_TYPE_SIG \
1171 (EVP_PKEY_OP_SIGN | EVP_PKEY_OP_VERIFY | EVP_PKEY_OP_VERIFYRECOVER \
1172 | EVP_PKEY_OP_SIGNCTX | EVP_PKEY_OP_VERIFYCTX)
716630c0 1173
0f113f3e
MC
1174# define EVP_PKEY_OP_TYPE_CRYPT \
1175 (EVP_PKEY_OP_ENCRYPT | EVP_PKEY_OP_DECRYPT)
716630c0 1176
0f113f3e
MC
1177# define EVP_PKEY_OP_TYPE_NOGEN \
1178 (EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT | EVP_PKEY_OP_DERIVE)
29db322e 1179
0f113f3e
MC
1180# define EVP_PKEY_OP_TYPE_GEN \
1181 (EVP_PKEY_OP_PARAMGEN | EVP_PKEY_OP_KEYGEN)
716630c0 1182
0f113f3e
MC
1183# define EVP_PKEY_CTX_set_signature_md(ctx, md) \
1184 EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \
1185 EVP_PKEY_CTRL_MD, 0, (void *)md)
5da98aa6 1186
0f113f3e
MC
1187# define EVP_PKEY_CTX_get_signature_md(ctx, pmd) \
1188 EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_TYPE_SIG, \
1189 EVP_PKEY_CTRL_GET_MD, 0, (void *)pmd)
81063953 1190
eff1a4d2
DSH
1191# define EVP_PKEY_CTX_set_mac_key(ctx, key, len) \
1192 EVP_PKEY_CTX_ctrl(ctx, -1, EVP_PKEY_OP_KEYGEN, \
1193 EVP_PKEY_CTRL_SET_MAC_KEY, len, (void *)key)
1194
0f113f3e
MC
1195# define EVP_PKEY_CTRL_MD 1
1196# define EVP_PKEY_CTRL_PEER_KEY 2
b7683e3a 1197
0f113f3e
MC
1198# define EVP_PKEY_CTRL_PKCS7_ENCRYPT 3
1199# define EVP_PKEY_CTRL_PKCS7_DECRYPT 4
399a6f0b 1200
0f113f3e 1201# define EVP_PKEY_CTRL_PKCS7_SIGN 5
b2a97be7 1202
0f113f3e 1203# define EVP_PKEY_CTRL_SET_MAC_KEY 6
74633553 1204
0f113f3e 1205# define EVP_PKEY_CTRL_DIGESTINIT 7
74633553 1206
0e1dba93 1207/* Used by GOST key encryption in TLS */
0f113f3e 1208# define EVP_PKEY_CTRL_SET_IV 8
0e1dba93 1209
0f113f3e
MC
1210# define EVP_PKEY_CTRL_CMS_ENCRYPT 9
1211# define EVP_PKEY_CTRL_CMS_DECRYPT 10
1212# define EVP_PKEY_CTRL_CMS_SIGN 11
8931b30d 1213
0f113f3e 1214# define EVP_PKEY_CTRL_CIPHER 12
c8ef656d 1215
0f113f3e 1216# define EVP_PKEY_CTRL_GET_MD 13
81063953 1217
0f113f3e 1218# define EVP_PKEY_ALG_CTRL 0x1000
b2a97be7 1219
0f113f3e
MC
1220# define EVP_PKEY_FLAG_AUTOARGLEN 2
1221/*
1222 * Method handles all operations: don't assume any digest related defaults.
c8ef656d 1223 */
0f113f3e 1224# define EVP_PKEY_FLAG_SIGCTX_CUSTOM 4
b010b7c4 1225
c9777d26 1226const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);
0f113f3e 1227EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags);
f830c68f 1228void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,
0f113f3e 1229 const EVP_PKEY_METHOD *meth);
f830c68f 1230void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);
3207e612 1231void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);
81cebb8b
DSH
1232int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
1233
f5cda4cb
DSH
1234EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
1235EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
3a828611 1236EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx);
5da98aa6 1237void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
4a3dc3c0 1238
5da98aa6 1239int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
0f113f3e 1240 int cmd, int p1, void *p2);
4a3dc3c0 1241int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
0f113f3e 1242 const char *value);
5da98aa6 1243
99119000
DSH
1244int EVP_PKEY_CTX_str2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *str);
1245int EVP_PKEY_CTX_hex2ctrl(EVP_PKEY_CTX *ctx, int cmd, const char *hex);
1246
b28dea4e
DSH
1247int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx);
1248void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen);
1249
2022cfe0 1250EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e,
0f113f3e 1251 const unsigned char *key, int keylen);
2022cfe0 1252
f5cda4cb
DSH
1253void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data);
1254void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx);
81cebb8b
DSH
1255EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx);
1256
0e1dba93
DSH
1257EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx);
1258
f5cda4cb
DSH
1259void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);
1260void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);
5da98aa6 1261
9e4d0f0b
DSH
1262int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
1263int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
0f113f3e
MC
1264 unsigned char *sig, size_t *siglen,
1265 const unsigned char *tbs, size_t tbslen);
9e4d0f0b
DSH
1266int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);
1267int EVP_PKEY_verify(EVP_PKEY_CTX *ctx,
0f113f3e
MC
1268 const unsigned char *sig, size_t siglen,
1269 const unsigned char *tbs, size_t tbslen);
9e4d0f0b
DSH
1270int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);
1271int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,
0f113f3e
MC
1272 unsigned char *rout, size_t *routlen,
1273 const unsigned char *sig, size_t siglen);
9e4d0f0b
DSH
1274int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);
1275int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,
0f113f3e
MC
1276 unsigned char *out, size_t *outlen,
1277 const unsigned char *in, size_t inlen);
9e4d0f0b
DSH
1278int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);
1279int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,
0f113f3e
MC
1280 unsigned char *out, size_t *outlen,
1281 const unsigned char *in, size_t inlen);
9e4d0f0b 1282
ffb1ac67
DSH
1283int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);
1284int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);
eaff5a14 1285int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
ffb1ac67 1286
33bed28b 1287typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx);
f5cda4cb
DSH
1288
1289int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);
1290int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
1291int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);
1292int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
1293
1294void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);
b28dea4e
DSH
1295EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);
1296
f5cda4cb
DSH
1297int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);
1298
ba30bad5 1299void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,
0f113f3e 1300 int (*init) (EVP_PKEY_CTX *ctx));
ba30bad5 1301
3207e612 1302void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1303 int (*copy) (EVP_PKEY_CTX *dst,
1304 EVP_PKEY_CTX *src));
3207e612 1305
ba30bad5 1306void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,
0f113f3e 1307 void (*cleanup) (EVP_PKEY_CTX *ctx));
ba30bad5
DSH
1308
1309void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1310 int (*paramgen_init) (EVP_PKEY_CTX *ctx),
1311 int (*paramgen) (EVP_PKEY_CTX *ctx,
1312 EVP_PKEY *pkey));
ba30bad5
DSH
1313
1314void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1315 int (*keygen_init) (EVP_PKEY_CTX *ctx),
1316 int (*keygen) (EVP_PKEY_CTX *ctx,
1317 EVP_PKEY *pkey));
ba30bad5
DSH
1318
1319void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1320 int (*sign_init) (EVP_PKEY_CTX *ctx),
1321 int (*sign) (EVP_PKEY_CTX *ctx,
1322 unsigned char *sig, size_t *siglen,
1323 const unsigned char *tbs,
1324 size_t tbslen));
ba30bad5
DSH
1325
1326void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1327 int (*verify_init) (EVP_PKEY_CTX *ctx),
1328 int (*verify) (EVP_PKEY_CTX *ctx,
1329 const unsigned char *sig,
1330 size_t siglen,
1331 const unsigned char *tbs,
1332 size_t tbslen));
ba30bad5
DSH
1333
1334void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1335 int (*verify_recover_init) (EVP_PKEY_CTX
1336 *ctx),
1337 int (*verify_recover) (EVP_PKEY_CTX
1338 *ctx,
1339 unsigned char
1340 *sig,
1341 size_t *siglen,
1342 const unsigned
1343 char *tbs,
1344 size_t tbslen));
ba30bad5
DSH
1345
1346void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1347 int (*signctx_init) (EVP_PKEY_CTX *ctx,
1348 EVP_MD_CTX *mctx),
1349 int (*signctx) (EVP_PKEY_CTX *ctx,
1350 unsigned char *sig,
1351 size_t *siglen,
1352 EVP_MD_CTX *mctx));
ba30bad5
DSH
1353
1354void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1355 int (*verifyctx_init) (EVP_PKEY_CTX *ctx,
1356 EVP_MD_CTX *mctx),
1357 int (*verifyctx) (EVP_PKEY_CTX *ctx,
1358 const unsigned char *sig,
1359 int siglen,
1360 EVP_MD_CTX *mctx));
ba30bad5
DSH
1361
1362void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1363 int (*encrypt_init) (EVP_PKEY_CTX *ctx),
1364 int (*encryptfn) (EVP_PKEY_CTX *ctx,
1365 unsigned char *out,
1366 size_t *outlen,
1367 const unsigned char *in,
1368 size_t inlen));
ba30bad5
DSH
1369
1370void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1371 int (*decrypt_init) (EVP_PKEY_CTX *ctx),
1372 int (*decrypt) (EVP_PKEY_CTX *ctx,
1373 unsigned char *out,
1374 size_t *outlen,
1375 const unsigned char *in,
1376 size_t inlen));
ba30bad5
DSH
1377
1378void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1379 int (*derive_init) (EVP_PKEY_CTX *ctx),
1380 int (*derive) (EVP_PKEY_CTX *ctx,
1381 unsigned char *key,
1382 size_t *keylen));
ba30bad5
DSH
1383
1384void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
0f113f3e
MC
1385 int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
1386 void *p2),
1387 int (*ctrl_str) (EVP_PKEY_CTX *ctx,
1388 const char *type,
1389 const char *value));
ba30bad5 1390
e7451ed1
DSH
1391void EVP_PKEY_meth_get_init(EVP_PKEY_METHOD *pmeth,
1392 int (**pinit) (EVP_PKEY_CTX *ctx));
1393
1394void EVP_PKEY_meth_get_copy(EVP_PKEY_METHOD *pmeth,
1395 int (**pcopy) (EVP_PKEY_CTX *dst,
1396 EVP_PKEY_CTX *src));
1397
1398void EVP_PKEY_meth_get_cleanup(EVP_PKEY_METHOD *pmeth,
1399 void (**pcleanup) (EVP_PKEY_CTX *ctx));
1400
1401void EVP_PKEY_meth_get_paramgen(EVP_PKEY_METHOD *pmeth,
1402 int (**pparamgen_init) (EVP_PKEY_CTX *ctx),
1403 int (**pparamgen) (EVP_PKEY_CTX *ctx,
1404 EVP_PKEY *pkey));
1405
1406void EVP_PKEY_meth_get_keygen(EVP_PKEY_METHOD *pmeth,
1407 int (**pkeygen_init) (EVP_PKEY_CTX *ctx),
1408 int (**pkeygen) (EVP_PKEY_CTX *ctx,
1409 EVP_PKEY *pkey));
1410
1411void EVP_PKEY_meth_get_sign(EVP_PKEY_METHOD *pmeth,
1412 int (**psign_init) (EVP_PKEY_CTX *ctx),
1413 int (**psign) (EVP_PKEY_CTX *ctx,
1414 unsigned char *sig, size_t *siglen,
1415 const unsigned char *tbs,
1416 size_t tbslen));
1417
1418void EVP_PKEY_meth_get_verify(EVP_PKEY_METHOD *pmeth,
1419 int (**pverify_init) (EVP_PKEY_CTX *ctx),
1420 int (**pverify) (EVP_PKEY_CTX *ctx,
1421 const unsigned char *sig,
1422 size_t siglen,
1423 const unsigned char *tbs,
1424 size_t tbslen));
1425
1426void EVP_PKEY_meth_get_verify_recover(EVP_PKEY_METHOD *pmeth,
1427 int (**pverify_recover_init) (EVP_PKEY_CTX
1428 *ctx),
1429 int (**pverify_recover) (EVP_PKEY_CTX
1430 *ctx,
1431 unsigned char
1432 *sig,
1433 size_t *siglen,
1434 const unsigned
1435 char *tbs,
1436 size_t tbslen));
1437
1438void EVP_PKEY_meth_get_signctx(EVP_PKEY_METHOD *pmeth,
1439 int (**psignctx_init) (EVP_PKEY_CTX *ctx,
1440 EVP_MD_CTX *mctx),
1441 int (**psignctx) (EVP_PKEY_CTX *ctx,
1442 unsigned char *sig,
1443 size_t *siglen,
1444 EVP_MD_CTX *mctx));
1445
1446void EVP_PKEY_meth_get_verifyctx(EVP_PKEY_METHOD *pmeth,
1447 int (**pverifyctx_init) (EVP_PKEY_CTX *ctx,
1448 EVP_MD_CTX *mctx),
1449 int (**pverifyctx) (EVP_PKEY_CTX *ctx,
1450 const unsigned char *sig,
1451 int siglen,
1452 EVP_MD_CTX *mctx));
1453
1454void EVP_PKEY_meth_get_encrypt(EVP_PKEY_METHOD *pmeth,
1455 int (**pencrypt_init) (EVP_PKEY_CTX *ctx),
1456 int (**pencryptfn) (EVP_PKEY_CTX *ctx,
1457 unsigned char *out,
1458 size_t *outlen,
1459 const unsigned char *in,
1460 size_t inlen));
1461
1462void EVP_PKEY_meth_get_decrypt(EVP_PKEY_METHOD *pmeth,
1463 int (**pdecrypt_init) (EVP_PKEY_CTX *ctx),
1464 int (**pdecrypt) (EVP_PKEY_CTX *ctx,
1465 unsigned char *out,
1466 size_t *outlen,
1467 const unsigned char *in,
1468 size_t inlen));
1469
1470void EVP_PKEY_meth_get_derive(EVP_PKEY_METHOD *pmeth,
1471 int (**pderive_init) (EVP_PKEY_CTX *ctx),
1472 int (**pderive) (EVP_PKEY_CTX *ctx,
1473 unsigned char *key,
1474 size_t *keylen));
1475
1476void EVP_PKEY_meth_get_ctrl(EVP_PKEY_METHOD *pmeth,
1477 int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
1478 void *p2),
1479 int (**pctrl_str) (EVP_PKEY_CTX *ctx,
1480 const char *type,
1481 const char *value));
1482
ea1d8435
DSH
1483void EVP_add_alg_module(void);
1484
d02b48c6 1485/* BEGIN ERROR CODES */
0f113f3e
MC
1486/*
1487 * The following lines are auto generated by the script mkerr.pl. Any changes
6d311938
DSH
1488 * made after this point may be overwritten when the script is next run.
1489 */
11a57c7b 1490void ERR_load_EVP_strings(void);
6d311938 1491
d02b48c6
RE
1492/* Error codes for the EVP functions. */
1493
1494/* Function codes. */
0f113f3e
MC
1495# define EVP_F_AESNI_INIT_KEY 165
1496# define EVP_F_AESNI_XTS_CIPHER 176
1497# define EVP_F_AES_INIT_KEY 133
1498# define EVP_F_AES_T4_INIT_KEY 178
1499# define EVP_F_AES_XTS 172
1500# define EVP_F_AES_XTS_CIPHER 175
1501# define EVP_F_ALG_MODULE_INIT 177
1502# define EVP_F_CAMELLIA_INIT_KEY 159
bd989745 1503# define EVP_F_CHACHA20_POLY1305_CTRL 182
0f113f3e
MC
1504# define EVP_F_CMAC_INIT 173
1505# define EVP_F_CMLL_T4_INIT_KEY 179
1506# define EVP_F_D2I_PKEY 100
1507# define EVP_F_DO_SIGVER_INIT 161
1508# define EVP_F_DSAPKEY2PKCS8 134
1509# define EVP_F_DSA_PKEY2PKCS8 135
1510# define EVP_F_ECDSA_PKEY2PKCS8 129
1511# define EVP_F_ECKEY_PKEY2PKCS8 132
1512# define EVP_F_EVP_CIPHERINIT_EX 123
1513# define EVP_F_EVP_CIPHER_CTX_COPY 163
1514# define EVP_F_EVP_CIPHER_CTX_CTRL 124
1515# define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122
1516# define EVP_F_EVP_DECRYPTFINAL_EX 101
1517# define EVP_F_EVP_DIGESTINIT_EX 128
1518# define EVP_F_EVP_ENCRYPTFINAL_EX 127
1519# define EVP_F_EVP_MD_CTX_COPY_EX 110
1520# define EVP_F_EVP_MD_SIZE 162
1521# define EVP_F_EVP_OPENINIT 102
1522# define EVP_F_EVP_PBE_ALG_ADD 115
1523# define EVP_F_EVP_PBE_ALG_ADD_TYPE 160
1524# define EVP_F_EVP_PBE_CIPHERINIT 116
fef034f8 1525# define EVP_F_EVP_PBE_SCRYPT 181
0f113f3e 1526# define EVP_F_EVP_PKCS82PKEY 111
54dbf423 1527# define EVP_F_EVP_PKEY2PKCS8 113
0f113f3e
MC
1528# define EVP_F_EVP_PKEY_COPY_PARAMETERS 103
1529# define EVP_F_EVP_PKEY_CTX_CTRL 137
1530# define EVP_F_EVP_PKEY_CTX_CTRL_STR 150
1531# define EVP_F_EVP_PKEY_CTX_DUP 156
1532# define EVP_F_EVP_PKEY_DECRYPT 104
1533# define EVP_F_EVP_PKEY_DECRYPT_INIT 138
1534# define EVP_F_EVP_PKEY_DECRYPT_OLD 151
1535# define EVP_F_EVP_PKEY_DERIVE 153
1536# define EVP_F_EVP_PKEY_DERIVE_INIT 154
1537# define EVP_F_EVP_PKEY_DERIVE_SET_PEER 155
1538# define EVP_F_EVP_PKEY_ENCRYPT 105
1539# define EVP_F_EVP_PKEY_ENCRYPT_INIT 139
1540# define EVP_F_EVP_PKEY_ENCRYPT_OLD 152
2872dbe1
DSH
1541# define EVP_F_EVP_PKEY_GET0_DH 119
1542# define EVP_F_EVP_PKEY_GET0_DSA 120
1543# define EVP_F_EVP_PKEY_GET0_ECDSA 130
1544# define EVP_F_EVP_PKEY_GET0_EC_KEY 131
1545# define EVP_F_EVP_PKEY_GET0_RSA 121
0f113f3e
MC
1546# define EVP_F_EVP_PKEY_KEYGEN 146
1547# define EVP_F_EVP_PKEY_KEYGEN_INIT 147
1548# define EVP_F_EVP_PKEY_NEW 106
1549# define EVP_F_EVP_PKEY_PARAMGEN 148
1550# define EVP_F_EVP_PKEY_PARAMGEN_INIT 149
1551# define EVP_F_EVP_PKEY_SIGN 140
1552# define EVP_F_EVP_PKEY_SIGN_INIT 141
1553# define EVP_F_EVP_PKEY_VERIFY 142
1554# define EVP_F_EVP_PKEY_VERIFY_INIT 143
1555# define EVP_F_EVP_PKEY_VERIFY_RECOVER 144
1556# define EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT 145
1557# define EVP_F_EVP_RIJNDAEL 126
1558# define EVP_F_EVP_SIGNFINAL 107
1559# define EVP_F_EVP_VERIFYFINAL 108
1560# define EVP_F_FIPS_CIPHERINIT 166
1561# define EVP_F_FIPS_CIPHER_CTX_COPY 170
1562# define EVP_F_FIPS_CIPHER_CTX_CTRL 167
1563# define EVP_F_FIPS_CIPHER_CTX_SET_KEY_LENGTH 171
1564# define EVP_F_FIPS_DIGESTINIT 168
1565# define EVP_F_FIPS_MD_CTX_COPY 169
1566# define EVP_F_HMAC_INIT_EX 174
1567# define EVP_F_INT_CTX_NEW 157
1568# define EVP_F_PKCS5_PBE_KEYIVGEN 117
1569# define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118
1570# define EVP_F_PKCS5_V2_PBKDF2_KEYIVGEN 164
e98aa30d 1571# define EVP_F_PKCS5_V2_SCRYPT_KEYIVGEN 180
0f113f3e
MC
1572# define EVP_F_PKCS8_SET_BROKEN 112
1573# define EVP_F_PKEY_SET_TYPE 158
1574# define EVP_F_RC2_MAGIC_TO_METH 109
1575# define EVP_F_RC5_CTRL 125
d02b48c6
RE
1576
1577/* Reason codes. */
0f113f3e
MC
1578# define EVP_R_AES_IV_SETUP_FAILED 162
1579# define EVP_R_AES_KEY_SETUP_FAILED 143
1580# define EVP_R_ASN1_LIB 140
1581# define EVP_R_BAD_BLOCK_LENGTH 136
1582# define EVP_R_BAD_DECRYPT 100
1583# define EVP_R_BAD_KEY_LENGTH 137
1584# define EVP_R_BN_DECODE_ERROR 112
1585# define EVP_R_BN_PUBKEY_ERROR 113
1586# define EVP_R_BUFFER_TOO_SMALL 155
1587# define EVP_R_CAMELLIA_KEY_SETUP_FAILED 157
1588# define EVP_R_CIPHER_PARAMETER_ERROR 122
1589# define EVP_R_COMMAND_NOT_SUPPORTED 147
bd989745 1590# define EVP_R_COPY_ERROR 173
0f113f3e
MC
1591# define EVP_R_CTRL_NOT_IMPLEMENTED 132
1592# define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED 133
1593# define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH 138
1594# define EVP_R_DECODE_ERROR 114
1595# define EVP_R_DIFFERENT_KEY_TYPES 101
1596# define EVP_R_DIFFERENT_PARAMETERS 153
1597# define EVP_R_DISABLED_FOR_FIPS 163
1598# define EVP_R_ENCODE_ERROR 115
1599# define EVP_R_ERROR_LOADING_SECTION 165
1600# define EVP_R_ERROR_SETTING_FIPS_MODE 166
1601# define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119
1602# define EVP_R_EXPECTING_AN_RSA_KEY 127
1603# define EVP_R_EXPECTING_A_DH_KEY 128
1604# define EVP_R_EXPECTING_A_DSA_KEY 129
1605# define EVP_R_EXPECTING_A_ECDSA_KEY 141
1606# define EVP_R_EXPECTING_A_EC_KEY 142
1607# define EVP_R_FIPS_MODE_NOT_SUPPORTED 167
e98aa30d 1608# define EVP_R_ILLEGAL_SCRYPT_PARAMETERS 171
0f113f3e
MC
1609# define EVP_R_INITIALIZATION_ERROR 134
1610# define EVP_R_INPUT_NOT_INITIALIZED 111
1611# define EVP_R_INVALID_DIGEST 152
1612# define EVP_R_INVALID_FIPS_MODE 168
1613# define EVP_R_INVALID_KEY_LENGTH 130
1614# define EVP_R_INVALID_OPERATION 148
1615# define EVP_R_IV_TOO_LARGE 102
1616# define EVP_R_KEYGEN_FAILURE 120
fef034f8 1617# define EVP_R_MEMORY_LIMIT_EXCEEDED 172
0f113f3e
MC
1618# define EVP_R_MESSAGE_DIGEST_IS_NULL 159
1619# define EVP_R_METHOD_NOT_SUPPORTED 144
1620# define EVP_R_MISSING_PARAMETERS 103
1621# define EVP_R_NO_CIPHER_SET 131
1622# define EVP_R_NO_DEFAULT_DIGEST 158
1623# define EVP_R_NO_DIGEST_SET 139
1624# define EVP_R_NO_DSA_PARAMETERS 116
1625# define EVP_R_NO_KEY_SET 154
1626# define EVP_R_NO_OPERATION_SET 149
1627# define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104
1628# define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105
1629# define EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 150
1630# define EVP_R_OPERATON_NOT_INITIALIZED 151
1631# define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117
1632# define EVP_R_PRIVATE_KEY_DECODE_ERROR 145
1633# define EVP_R_PRIVATE_KEY_ENCODE_ERROR 146
1634# define EVP_R_PUBLIC_KEY_NOT_RSA 106
1635# define EVP_R_TOO_LARGE 164
1636# define EVP_R_UNKNOWN_CIPHER 160
1637# define EVP_R_UNKNOWN_DIGEST 161
1638# define EVP_R_UNKNOWN_OPTION 169
1639# define EVP_R_UNKNOWN_PBE_ALGORITHM 121
1640# define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS 135
1641# define EVP_R_UNSUPPORTED_ALGORITHM 156
1642# define EVP_R_UNSUPPORTED_CIPHER 107
1643# define EVP_R_UNSUPPORTED_KEYLENGTH 123
1644# define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124
1645# define EVP_R_UNSUPPORTED_KEY_SIZE 108
1646# define EVP_R_UNSUPPORTED_PRF 125
1647# define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118
1648# define EVP_R_UNSUPPORTED_SALT_TYPE 126
1649# define EVP_R_WRAP_MODE_NOT_ALLOWED 170
1650# define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109
1651# define EVP_R_WRONG_PUBLIC_KEY_TYPE 110
6d311938 1652
d02b48c6
RE
1653#ifdef __cplusplus
1654}
1655#endif
1656#endif