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