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