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