diff options
author | jsing <> | 2014-05-11 12:05:27 +0000 |
---|---|---|
committer | jsing <> | 2014-05-11 12:05:27 +0000 |
commit | 8516b9f21028e479132b3f445f93ee33102aa794 (patch) | |
tree | 69cd65e0e5a7509374c6f39412aa54ee8299c551 /src | |
parent | dbe5668a4dd59daf353f19ad5303726df6b618ae (diff) | |
download | openbsd-8516b9f21028e479132b3f445f93ee33102aa794.tar.gz openbsd-8516b9f21028e479132b3f445f93ee33102aa794.tar.bz2 openbsd-8516b9f21028e479132b3f445f93ee33102aa794.zip |
KNF.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/evp/evp.h | 570 | ||||
-rw-r--r-- | src/lib/libcrypto/evp/evp_locl.h | 39 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/evp/evp.h | 570 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/evp/evp_locl.h | 39 |
4 files changed, 574 insertions, 644 deletions
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index fa98d4d93c..54aa8a4a66 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
@@ -5,21 +5,21 @@ | |||
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -123,8 +123,7 @@ extern "C" { | |||
123 | /* Type needs to be a bit field | 123 | /* Type needs to be a bit field |
124 | * Sub-type needs to be for variations on the method, as in, can it do | 124 | * Sub-type needs to be for variations on the method, as in, can it do |
125 | * arbitrary encryption.... */ | 125 | * arbitrary encryption.... */ |
126 | struct evp_pkey_st | 126 | struct evp_pkey_st { |
127 | { | ||
128 | int type; | 127 | int type; |
129 | int save_type; | 128 | int save_type; |
130 | int references; | 129 | int references; |
@@ -144,10 +143,10 @@ struct evp_pkey_st | |||
144 | #ifndef OPENSSL_NO_EC | 143 | #ifndef OPENSSL_NO_EC |
145 | struct ec_key_st *ec; /* ECC */ | 144 | struct ec_key_st *ec; /* ECC */ |
146 | #endif | 145 | #endif |
147 | } pkey; | 146 | } pkey; |
148 | int save_parameters; | 147 | int save_parameters; |
149 | STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ | 148 | STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ |
150 | } /* EVP_PKEY */; | 149 | } /* EVP_PKEY */; |
151 | 150 | ||
152 | #define EVP_PKEY_MO_SIGN 0x0001 | 151 | #define EVP_PKEY_MO_SIGN 0x0001 |
153 | #define EVP_PKEY_MO_VERIFY 0x0002 | 152 | #define EVP_PKEY_MO_VERIFY 0x0002 |
@@ -155,37 +154,36 @@ struct evp_pkey_st | |||
155 | #define EVP_PKEY_MO_DECRYPT 0x0008 | 154 | #define EVP_PKEY_MO_DECRYPT 0x0008 |
156 | 155 | ||
157 | #ifndef EVP_MD | 156 | #ifndef EVP_MD |
158 | struct env_md_st | 157 | struct env_md_st { |
159 | { | ||
160 | int type; | 158 | int type; |
161 | int pkey_type; | 159 | int pkey_type; |
162 | int md_size; | 160 | int md_size; |
163 | unsigned long flags; | 161 | unsigned long flags; |
164 | int (*init)(EVP_MD_CTX *ctx); | 162 | int (*init)(EVP_MD_CTX *ctx); |
165 | int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count); | 163 | int (*update)(EVP_MD_CTX *ctx, const void *data, size_t count); |
166 | int (*final)(EVP_MD_CTX *ctx,unsigned char *md); | 164 | int (*final)(EVP_MD_CTX *ctx, unsigned char *md); |
167 | int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from); | 165 | int (*copy)(EVP_MD_CTX *to, const EVP_MD_CTX *from); |
168 | int (*cleanup)(EVP_MD_CTX *ctx); | 166 | int (*cleanup)(EVP_MD_CTX *ctx); |
169 | 167 | ||
170 | /* FIXME: prototype these some day */ | 168 | /* FIXME: prototype these some day */ |
171 | int (*sign)(int type, const unsigned char *m, unsigned int m_length, | 169 | int (*sign)(int type, const unsigned char *m, unsigned int m_length, |
172 | unsigned char *sigret, unsigned int *siglen, void *key); | 170 | unsigned char *sigret, unsigned int *siglen, void *key); |
173 | int (*verify)(int type, const unsigned char *m, unsigned int m_length, | 171 | int (*verify)(int type, const unsigned char *m, unsigned int m_length, |
174 | const unsigned char *sigbuf, unsigned int siglen, | 172 | const unsigned char *sigbuf, unsigned int siglen, |
175 | void *key); | 173 | void *key); |
176 | int required_pkey_type[5]; /*EVP_PKEY_xxx */ | 174 | int required_pkey_type[5]; /*EVP_PKEY_xxx */ |
177 | int block_size; | 175 | int block_size; |
178 | int ctx_size; /* how big does the ctx->md_data need to be */ | 176 | int ctx_size; /* how big does the ctx->md_data need to be */ |
179 | /* control function */ | 177 | /* control function */ |
180 | int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); | 178 | int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); |
181 | } /* EVP_MD */; | 179 | } /* EVP_MD */; |
182 | 180 | ||
183 | typedef int evp_sign_method(int type,const unsigned char *m, | 181 | typedef int evp_sign_method(int type, const unsigned char *m, |
184 | unsigned int m_length,unsigned char *sigret, | 182 | unsigned int m_length, unsigned char *sigret, unsigned int *siglen, |
185 | unsigned int *siglen, void *key); | 183 | void *key); |
186 | typedef int evp_verify_method(int type,const unsigned char *m, | 184 | typedef int evp_verify_method(int type, const unsigned char *m, |
187 | unsigned int m_length,const unsigned char *sigbuf, | 185 | unsigned int m_length, const unsigned char *sigbuf, unsigned int siglen, |
188 | unsigned int siglen, void *key); | 186 | void *key); |
189 | 187 | ||
190 | #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single | 188 | #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single |
191 | * block */ | 189 | * block */ |
@@ -241,7 +239,7 @@ typedef int evp_verify_method(int type,const unsigned char *m, | |||
241 | #define EVP_PKEY_ECDSA_method (evp_sign_method *)ECDSA_sign, \ | 239 | #define EVP_PKEY_ECDSA_method (evp_sign_method *)ECDSA_sign, \ |
242 | (evp_verify_method *)ECDSA_verify, \ | 240 | (evp_verify_method *)ECDSA_verify, \ |
243 | {EVP_PKEY_EC,0,0,0} | 241 | {EVP_PKEY_EC,0,0,0} |
244 | #else | 242 | #else |
245 | #define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method | 243 | #define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method |
246 | #endif | 244 | #endif |
247 | 245 | ||
@@ -260,8 +258,7 @@ typedef int evp_verify_method(int type,const unsigned char *m, | |||
260 | 258 | ||
261 | #endif /* !EVP_MD */ | 259 | #endif /* !EVP_MD */ |
262 | 260 | ||
263 | struct env_md_ctx_st | 261 | struct env_md_ctx_st { |
264 | { | ||
265 | const EVP_MD *digest; | 262 | const EVP_MD *digest; |
266 | ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ | 263 | ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ |
267 | unsigned long flags; | 264 | unsigned long flags; |
@@ -269,8 +266,8 @@ struct env_md_ctx_st | |||
269 | /* Public key context for sign/verify */ | 266 | /* Public key context for sign/verify */ |
270 | EVP_PKEY_CTX *pctx; | 267 | EVP_PKEY_CTX *pctx; |
271 | /* Update function: usually copied from EVP_MD */ | 268 | /* Update function: usually copied from EVP_MD */ |
272 | int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count); | 269 | int (*update)(EVP_MD_CTX *ctx, const void *data, size_t count); |
273 | } /* EVP_MD_CTX */; | 270 | } /* EVP_MD_CTX */; |
274 | 271 | ||
275 | /* values for EVP_MD_CTX flags */ | 272 | /* values for EVP_MD_CTX flags */ |
276 | 273 | ||
@@ -298,24 +295,23 @@ struct env_md_ctx_st | |||
298 | 295 | ||
299 | #define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */ | 296 | #define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */ |
300 | 297 | ||
301 | struct evp_cipher_st | 298 | struct evp_cipher_st { |
302 | { | ||
303 | int nid; | 299 | int nid; |
304 | int block_size; | 300 | int block_size; |
305 | int key_len; /* Default value for variable length ciphers */ | 301 | int key_len; /* Default value for variable length ciphers */ |
306 | int iv_len; | 302 | int iv_len; |
307 | unsigned long flags; /* Various flags */ | 303 | unsigned long flags; /* Various flags */ |
308 | int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 304 | int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
309 | const unsigned char *iv, int enc); /* init key */ | 305 | const unsigned char *iv, int enc); /* init key */ |
310 | int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, | 306 | int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, |
311 | const unsigned char *in, size_t inl);/* encrypt/decrypt data */ | 307 | const unsigned char *in, size_t inl);/* encrypt/decrypt data */ |
312 | int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ | 308 | int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ |
313 | int ctx_size; /* how big ctx->cipher_data needs to be */ | 309 | int ctx_size; /* how big ctx->cipher_data needs to be */ |
314 | int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ | 310 | int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ |
315 | int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */ | 311 | int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */ |
316 | int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */ | 312 | int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */ |
317 | void *app_data; /* Application data */ | 313 | void *app_data; /* Application data */ |
318 | } /* EVP_CIPHER */; | 314 | } /* EVP_CIPHER */; |
319 | 315 | ||
320 | /* Values for cipher flags */ | 316 | /* Values for cipher flags */ |
321 | 317 | ||
@@ -400,14 +396,12 @@ struct evp_cipher_st | |||
400 | /* Length of tag for TLS */ | 396 | /* Length of tag for TLS */ |
401 | #define EVP_GCM_TLS_TAG_LEN 16 | 397 | #define EVP_GCM_TLS_TAG_LEN 16 |
402 | 398 | ||
403 | typedef struct evp_cipher_info_st | 399 | typedef struct evp_cipher_info_st { |
404 | { | ||
405 | const EVP_CIPHER *cipher; | 400 | const EVP_CIPHER *cipher; |
406 | unsigned char iv[EVP_MAX_IV_LENGTH]; | 401 | unsigned char iv[EVP_MAX_IV_LENGTH]; |
407 | } EVP_CIPHER_INFO; | 402 | } EVP_CIPHER_INFO; |
408 | 403 | ||
409 | struct evp_cipher_ctx_st | 404 | struct evp_cipher_ctx_st { |
410 | { | ||
411 | const EVP_CIPHER *cipher; | 405 | const EVP_CIPHER *cipher; |
412 | ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */ | 406 | ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */ |
413 | int encrypt; /* encrypt or decrypt */ | 407 | int encrypt; /* encrypt or decrypt */ |
@@ -425,10 +419,9 @@ struct evp_cipher_ctx_st | |||
425 | int final_used; | 419 | int final_used; |
426 | int block_mask; | 420 | int block_mask; |
427 | unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */ | 421 | unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */ |
428 | } /* EVP_CIPHER_CTX */; | 422 | } /* EVP_CIPHER_CTX */; |
429 | 423 | ||
430 | typedef struct evp_Encode_Ctx_st | 424 | typedef struct evp_Encode_Ctx_st { |
431 | { | ||
432 | int num; /* number saved in a partial encode/decode */ | 425 | int num; /* number saved in a partial encode/decode */ |
433 | int length; /* The length is either the output line length | 426 | int length; /* The length is either the output line length |
434 | * (in input bytes) or the shortest input line | 427 | * (in input bytes) or the shortest input line |
@@ -438,12 +431,11 @@ typedef struct evp_Encode_Ctx_st | |||
438 | unsigned char enc_data[80]; /* data to encode */ | 431 | unsigned char enc_data[80]; /* data to encode */ |
439 | int line_num; /* number read on current line */ | 432 | int line_num; /* number read on current line */ |
440 | int expect_nl; | 433 | int expect_nl; |
441 | } EVP_ENCODE_CTX; | 434 | } EVP_ENCODE_CTX; |
442 | 435 | ||
443 | /* Password based encryption function */ | 436 | /* Password based encryption function */ |
444 | typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 437 | typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
445 | ASN1_TYPE *param, const EVP_CIPHER *cipher, | 438 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de); |
446 | const EVP_MD *md, int en_de); | ||
447 | 439 | ||
448 | #ifndef OPENSSL_NO_RSA | 440 | #ifndef OPENSSL_NO_RSA |
449 | #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ | 441 | #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ |
@@ -474,7 +466,7 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
474 | int EVP_MD_type(const EVP_MD *md); | 466 | int EVP_MD_type(const EVP_MD *md); |
475 | #define EVP_MD_nid(e) EVP_MD_type(e) | 467 | #define EVP_MD_nid(e) EVP_MD_type(e) |
476 | #define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) | 468 | #define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) |
477 | int EVP_MD_pkey_type(const EVP_MD *md); | 469 | int EVP_MD_pkey_type(const EVP_MD *md); |
478 | int EVP_MD_size(const EVP_MD *md); | 470 | int EVP_MD_size(const EVP_MD *md); |
479 | int EVP_MD_block_size(const EVP_MD *md); | 471 | int EVP_MD_block_size(const EVP_MD *md); |
480 | unsigned long EVP_MD_flags(const EVP_MD *md); | 472 | unsigned long EVP_MD_flags(const EVP_MD *md); |
@@ -514,12 +506,12 @@ unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx); | |||
514 | #define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) | 506 | #define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) |
515 | #define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | 507 | #define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) |
516 | #define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) | 508 | #define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) |
517 | #define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) | 509 | #define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) |
518 | #define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | 510 | #define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) |
519 | #define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | 511 | #define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) |
520 | 512 | ||
521 | #ifdef CONST_STRICT | 513 | #ifdef CONST_STRICT |
522 | void BIO_set_md(BIO *,const EVP_MD *md); | 514 | void BIO_set_md(BIO *, const EVP_MD *md); |
523 | #else | 515 | #else |
524 | # define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) | 516 | # define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) |
525 | #endif | 517 | #endif |
@@ -529,10 +521,8 @@ void BIO_set_md(BIO *,const EVP_MD *md); | |||
529 | #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) | 521 | #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) |
530 | #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) | 522 | #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) |
531 | 523 | ||
532 | int EVP_Cipher(EVP_CIPHER_CTX *c, | 524 | int EVP_Cipher(EVP_CIPHER_CTX *c, unsigned char *out, const unsigned char *in, |
533 | unsigned char *out, | 525 | unsigned int inl); |
534 | const unsigned char *in, | ||
535 | unsigned int inl); | ||
536 | 526 | ||
537 | #define EVP_add_cipher_alias(n,alias) \ | 527 | #define EVP_add_cipher_alias(n,alias) \ |
538 | OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) | 528 | OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) |
@@ -543,105 +533,99 @@ int EVP_Cipher(EVP_CIPHER_CTX *c, | |||
543 | #define EVP_delete_digest_alias(alias) \ | 533 | #define EVP_delete_digest_alias(alias) \ |
544 | OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); | 534 | OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); |
545 | 535 | ||
546 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx); | 536 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx); |
547 | int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); | 537 | int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); |
548 | EVP_MD_CTX *EVP_MD_CTX_create(void); | 538 | EVP_MD_CTX *EVP_MD_CTX_create(void); |
549 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); | 539 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); |
550 | int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in); | 540 | int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); |
551 | void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); | 541 | void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); |
552 | void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); | 542 | void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); |
553 | int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx,int flags); | 543 | int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); |
554 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); | 544 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); |
555 | int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d, | 545 | int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt); |
556 | size_t cnt); | 546 | int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s); |
557 | int EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); | 547 | int EVP_Digest(const void *data, size_t count, unsigned char *md, |
558 | int EVP_Digest(const void *data, size_t count, | 548 | unsigned int *size, const EVP_MD *type, ENGINE *impl); |
559 | unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl); | 549 | |
560 | 550 | int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); | |
561 | int EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in); | 551 | int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); |
562 | int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); | 552 | int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s); |
563 | int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); | 553 | |
564 | 554 | int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); | |
565 | int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); | 555 | int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, |
566 | int EVP_read_pw_string_min(char *buf,int minlen,int maxlen,const char *prompt,int verify); | 556 | const char *prompt, int verify); |
567 | void EVP_set_pw_prompt(const char *prompt); | 557 | void EVP_set_pw_prompt(const char *prompt); |
568 | char * EVP_get_pw_prompt(void); | 558 | char *EVP_get_pw_prompt(void); |
569 | 559 | ||
570 | int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md, | 560 | int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, |
571 | const unsigned char *salt, const unsigned char *data, | 561 | const unsigned char *salt, const unsigned char *data, int datal, int count, |
572 | int datal, int count, unsigned char *key,unsigned char *iv); | 562 | unsigned char *key, unsigned char *iv); |
573 | 563 | ||
574 | void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); | 564 | void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); |
575 | void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); | 565 | void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); |
576 | int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx,int flags); | 566 | int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); |
577 | 567 | ||
578 | int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, | 568 | int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
579 | const unsigned char *key, const unsigned char *iv); | 569 | const unsigned char *key, const unsigned char *iv); |
580 | int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, | 570 | int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
581 | const unsigned char *key, const unsigned char *iv); | 571 | ENGINE *impl, const unsigned char *key, const unsigned char *iv); |
582 | int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 572 | int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
583 | int *outl, const unsigned char *in, int inl); | 573 | const unsigned char *in, int inl); |
584 | int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | 574 | int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); |
585 | int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | 575 | int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); |
586 | 576 | ||
587 | int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, | 577 | int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
588 | const unsigned char *key, const unsigned char *iv); | 578 | const unsigned char *key, const unsigned char *iv); |
589 | int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, | 579 | int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
590 | const unsigned char *key, const unsigned char *iv); | 580 | ENGINE *impl, const unsigned char *key, const unsigned char *iv); |
591 | int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 581 | int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
592 | int *outl, const unsigned char *in, int inl); | 582 | const unsigned char *in, int inl); |
593 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | 583 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); |
594 | int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | 584 | int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); |
595 | 585 | ||
596 | int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, | 586 | int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
597 | const unsigned char *key,const unsigned char *iv, | 587 | const unsigned char *key, const unsigned char *iv, int enc); |
598 | int enc); | 588 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
599 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, | 589 | ENGINE *impl, const unsigned char *key, const unsigned char *iv, int enc); |
600 | const unsigned char *key,const unsigned char *iv, | 590 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
601 | int enc); | 591 | const unsigned char *in, int inl); |
602 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 592 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); |
603 | int *outl, const unsigned char *in, int inl); | 593 | int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); |
604 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | 594 | |
605 | int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | 595 | int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, |
606 | 596 | EVP_PKEY *pkey); | |
607 | int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s, | 597 | |
608 | EVP_PKEY *pkey); | 598 | int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, |
609 | 599 | unsigned int siglen, EVP_PKEY *pkey); | |
610 | int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf, | 600 | |
611 | unsigned int siglen,EVP_PKEY *pkey); | 601 | int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, |
612 | 602 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | |
613 | int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | 603 | int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen); |
614 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | 604 | |
615 | int EVP_DigestSignFinal(EVP_MD_CTX *ctx, | 605 | int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, |
616 | unsigned char *sigret, size_t *siglen); | 606 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); |
617 | 607 | int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen); | |
618 | int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | 608 | |
619 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | 609 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
620 | int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, | 610 | const unsigned char *ek, int ekl, const unsigned char *iv, EVP_PKEY *priv); |
621 | unsigned char *sig, size_t siglen); | 611 | int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); |
622 | 612 | ||
623 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, | 613 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
624 | const unsigned char *ek, int ekl, const unsigned char *iv, | 614 | unsigned char **ek, int *ekl, unsigned char *iv, EVP_PKEY **pubk, |
625 | EVP_PKEY *priv); | 615 | int npubk); |
626 | int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | 616 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); |
627 | 617 | ||
628 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 618 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); |
629 | unsigned char **ek, int *ekl, unsigned char *iv, | 619 | void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, |
630 | EVP_PKEY **pubk, int npubk); | 620 | const unsigned char *in, int inl); |
631 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); | 621 | void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); |
632 | 622 | int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); | |
633 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); | 623 | |
634 | void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, | 624 | void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); |
635 | const unsigned char *in,int inl); | 625 | int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, |
636 | void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl); | 626 | const unsigned char *in, int inl); |
637 | int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); | 627 | int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); |
638 | 628 | int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); | |
639 | void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); | ||
640 | int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, | ||
641 | const unsigned char *in, int inl); | ||
642 | int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned | ||
643 | char *out, int *outl); | ||
644 | int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); | ||
645 | 629 | ||
646 | void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); | 630 | void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); |
647 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | 631 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); |
@@ -657,8 +641,8 @@ BIO_METHOD *BIO_f_md(void); | |||
657 | BIO_METHOD *BIO_f_base64(void); | 641 | BIO_METHOD *BIO_f_base64(void); |
658 | BIO_METHOD *BIO_f_cipher(void); | 642 | BIO_METHOD *BIO_f_cipher(void); |
659 | BIO_METHOD *BIO_f_reliable(void); | 643 | BIO_METHOD *BIO_f_reliable(void); |
660 | void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,const unsigned char *k, | 644 | void BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, |
661 | const unsigned char *i, int enc); | 645 | const unsigned char *i, int enc); |
662 | #endif | 646 | #endif |
663 | 647 | ||
664 | const EVP_MD *EVP_md_null(void); | 648 | const EVP_MD *EVP_md_null(void); |
@@ -866,79 +850,77 @@ const EVP_CIPHER *EVP_get_cipherbyname(const char *name); | |||
866 | const EVP_MD *EVP_get_digestbyname(const char *name); | 850 | const EVP_MD *EVP_get_digestbyname(const char *name); |
867 | void EVP_cleanup(void); | 851 | void EVP_cleanup(void); |
868 | 852 | ||
869 | void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph, | 853 | void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph, const char *from, |
870 | const char *from, const char *to, void *x), void *arg); | 854 | const char *to, void *x), void *arg); |
871 | void EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph, | 855 | void EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph, |
872 | const char *from, const char *to, void *x), void *arg); | 856 | const char *from, const char *to, void *x), void *arg); |
873 | 857 | ||
874 | void EVP_MD_do_all(void (*fn)(const EVP_MD *ciph, | 858 | void EVP_MD_do_all(void (*fn)(const EVP_MD *ciph, const char *from, |
875 | const char *from, const char *to, void *x), void *arg); | 859 | const char *to, void *x), void *arg); |
876 | void EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *ciph, | 860 | void EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *ciph, const char *from, |
877 | const char *from, const char *to, void *x), void *arg); | 861 | const char *to, void *x), void *arg); |
878 | 862 | ||
879 | int EVP_PKEY_decrypt_old(unsigned char *dec_key, | 863 | int EVP_PKEY_decrypt_old(unsigned char *dec_key, const unsigned char *enc_key, |
880 | const unsigned char *enc_key,int enc_key_len, | 864 | int enc_key_len, EVP_PKEY *private_key); |
881 | EVP_PKEY *private_key); | 865 | int EVP_PKEY_encrypt_old(unsigned char *enc_key, const unsigned char *key, |
882 | int EVP_PKEY_encrypt_old(unsigned char *enc_key, | 866 | int key_len, EVP_PKEY *pub_key); |
883 | const unsigned char *key,int key_len, | 867 | int EVP_PKEY_type(int type); |
884 | EVP_PKEY *pub_key); | 868 | int EVP_PKEY_id(const EVP_PKEY *pkey); |
885 | int EVP_PKEY_type(int type); | 869 | int EVP_PKEY_base_id(const EVP_PKEY *pkey); |
886 | int EVP_PKEY_id(const EVP_PKEY *pkey); | 870 | int EVP_PKEY_bits(EVP_PKEY *pkey); |
887 | int EVP_PKEY_base_id(const EVP_PKEY *pkey); | 871 | int EVP_PKEY_size(EVP_PKEY *pkey); |
888 | int EVP_PKEY_bits(EVP_PKEY *pkey); | 872 | int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); |
889 | int EVP_PKEY_size(EVP_PKEY *pkey); | 873 | int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); |
890 | int EVP_PKEY_set_type(EVP_PKEY *pkey,int type); | 874 | int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); |
891 | int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); | 875 | void *EVP_PKEY_get0(EVP_PKEY *pkey); |
892 | int EVP_PKEY_assign(EVP_PKEY *pkey,int type,void *key); | ||
893 | void * EVP_PKEY_get0(EVP_PKEY *pkey); | ||
894 | 876 | ||
895 | #ifndef OPENSSL_NO_RSA | 877 | #ifndef OPENSSL_NO_RSA |
896 | struct rsa_st; | 878 | struct rsa_st; |
897 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,struct rsa_st *key); | 879 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); |
898 | struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); | 880 | struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); |
899 | #endif | 881 | #endif |
900 | #ifndef OPENSSL_NO_DSA | 882 | #ifndef OPENSSL_NO_DSA |
901 | struct dsa_st; | 883 | struct dsa_st; |
902 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,struct dsa_st *key); | 884 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); |
903 | struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); | 885 | struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); |
904 | #endif | 886 | #endif |
905 | #ifndef OPENSSL_NO_DH | 887 | #ifndef OPENSSL_NO_DH |
906 | struct dh_st; | 888 | struct dh_st; |
907 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key); | 889 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); |
908 | struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); | 890 | struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); |
909 | #endif | 891 | #endif |
910 | #ifndef OPENSSL_NO_EC | 892 | #ifndef OPENSSL_NO_EC |
911 | struct ec_key_st; | 893 | struct ec_key_st; |
912 | int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,struct ec_key_st *key); | 894 | int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); |
913 | struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); | 895 | struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); |
914 | #endif | 896 | #endif |
915 | 897 | ||
916 | EVP_PKEY * EVP_PKEY_new(void); | 898 | EVP_PKEY *EVP_PKEY_new(void); |
917 | void EVP_PKEY_free(EVP_PKEY *pkey); | 899 | void EVP_PKEY_free(EVP_PKEY *pkey); |
918 | 900 | ||
919 | EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp, | 901 | EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, |
920 | long length); | 902 | long length); |
921 | int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); | 903 | int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); |
922 | 904 | ||
923 | EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp, | 905 | EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, |
924 | long length); | 906 | long length); |
925 | EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, | 907 | EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, |
926 | long length); | 908 | long length); |
927 | int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); | 909 | int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); |
928 | 910 | ||
929 | int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); | 911 | int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); |
930 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); | 912 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); |
931 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode); | 913 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); |
932 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); | 914 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); |
933 | 915 | ||
934 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); | 916 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); |
935 | 917 | ||
936 | int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, | 918 | int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, int indent, |
937 | int indent, ASN1_PCTX *pctx); | 919 | ASN1_PCTX *pctx); |
938 | int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, | 920 | int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, int indent, |
939 | int indent, ASN1_PCTX *pctx); | 921 | ASN1_PCTX *pctx); |
940 | int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, | 922 | int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, int indent, |
941 | int indent, ASN1_PCTX *pctx); | 923 | ASN1_PCTX *pctx); |
942 | 924 | ||
943 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); | 925 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); |
944 | 926 | ||
@@ -949,28 +931,26 @@ int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | |||
949 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | 931 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
950 | 932 | ||
951 | /* These are used by EVP_CIPHER methods */ | 933 | /* These are used by EVP_CIPHER methods */ |
952 | int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); | 934 | int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
953 | int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); | 935 | int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
954 | 936 | ||
955 | /* PKCS5 password based encryption */ | 937 | /* PKCS5 password based encryption */ |
956 | int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 938 | int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
957 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, | 939 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de); |
958 | int en_de); | ||
959 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, | 940 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, |
960 | const unsigned char *salt, int saltlen, int iter, | 941 | const unsigned char *salt, int saltlen, int iter, int keylen, |
961 | int keylen, unsigned char *out); | 942 | unsigned char *out); |
962 | int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, | 943 | int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, const unsigned char *salt, |
963 | const unsigned char *salt, int saltlen, int iter, | 944 | int saltlen, int iter, const EVP_MD *digest, int keylen, |
964 | const EVP_MD *digest, | 945 | unsigned char *out); |
965 | int keylen, unsigned char *out); | ||
966 | int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 946 | int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
967 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, | 947 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, |
968 | int en_de); | 948 | int en_de); |
969 | 949 | ||
970 | void PKCS5_PBE_add(void); | 950 | void PKCS5_PBE_add(void); |
971 | 951 | ||
972 | int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | 952 | int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, |
973 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); | 953 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); |
974 | 954 | ||
975 | /* PBE type */ | 955 | /* PBE type */ |
976 | 956 | ||
@@ -980,11 +960,11 @@ int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | |||
980 | #define EVP_PBE_TYPE_PRF 0x1 | 960 | #define EVP_PBE_TYPE_PRF 0x1 |
981 | 961 | ||
982 | int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid, | 962 | int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid, |
983 | EVP_PBE_KEYGEN *keygen); | 963 | EVP_PBE_KEYGEN *keygen); |
984 | int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, | 964 | int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, |
985 | EVP_PBE_KEYGEN *keygen); | 965 | EVP_PBE_KEYGEN *keygen); |
986 | int EVP_PBE_find(int type, int pbe_nid, | 966 | int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, |
987 | int *pcnid, int *pmnid, EVP_PBE_KEYGEN **pkeygen); | 967 | EVP_PBE_KEYGEN **pkeygen); |
988 | void EVP_PBE_cleanup(void); | 968 | void EVP_PBE_cleanup(void); |
989 | 969 | ||
990 | #define ASN1_PKEY_ALIAS 0x1 | 970 | #define ASN1_PKEY_ALIAS 0x1 |
@@ -1001,48 +981,45 @@ int EVP_PKEY_asn1_get_count(void); | |||
1001 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); | 981 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); |
1002 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); | 982 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); |
1003 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, | 983 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, |
1004 | const char *str, int len); | 984 | const char *str, int len); |
1005 | int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); | 985 | int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); |
1006 | int EVP_PKEY_asn1_add_alias(int to, int from); | 986 | int EVP_PKEY_asn1_add_alias(int to, int from); |
1007 | int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_flags, | 987 | int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_flags, |
1008 | const char **pinfo, const char **ppem_str, | 988 | const char **pinfo, const char **ppem_str, |
1009 | const EVP_PKEY_ASN1_METHOD *ameth); | 989 | const EVP_PKEY_ASN1_METHOD *ameth); |
1010 | 990 | ||
1011 | const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY *pkey); | 991 | const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY *pkey); |
1012 | EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, | 992 | EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, const char *pem_str, |
1013 | const char *pem_str, const char *info); | 993 | const char *info); |
1014 | void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, | 994 | void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, |
1015 | const EVP_PKEY_ASN1_METHOD *src); | 995 | const EVP_PKEY_ASN1_METHOD *src); |
1016 | void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); | 996 | void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); |
1017 | void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, | 997 | void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, |
1018 | int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub), | 998 | int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub), |
1019 | int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk), | 999 | int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk), |
1020 | int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), | 1000 | int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), |
1021 | int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent, | 1001 | int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent, |
1022 | ASN1_PCTX *pctx), | 1002 | ASN1_PCTX *pctx), |
1023 | int (*pkey_size)(const EVP_PKEY *pk), | 1003 | int (*pkey_size)(const EVP_PKEY *pk), |
1024 | int (*pkey_bits)(const EVP_PKEY *pk)); | 1004 | int (*pkey_bits)(const EVP_PKEY *pk)); |
1025 | void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, | 1005 | void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, |
1026 | int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf), | 1006 | int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf), |
1027 | int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk), | 1007 | int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk), |
1028 | int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, | 1008 | int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, |
1029 | ASN1_PCTX *pctx)); | 1009 | ASN1_PCTX *pctx)); |
1030 | void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, | 1010 | void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, |
1031 | int (*param_decode)(EVP_PKEY *pkey, | 1011 | int (*param_decode)(EVP_PKEY *pkey, const unsigned char **pder, int derlen), |
1032 | const unsigned char **pder, int derlen), | 1012 | int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder), |
1033 | int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder), | 1013 | int (*param_missing)(const EVP_PKEY *pk), |
1034 | int (*param_missing)(const EVP_PKEY *pk), | 1014 | int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from), |
1035 | int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from), | 1015 | int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), |
1036 | int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), | 1016 | int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, |
1037 | int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, | 1017 | ASN1_PCTX *pctx)); |
1038 | ASN1_PCTX *pctx)); | ||
1039 | 1018 | ||
1040 | void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, | 1019 | void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, |
1041 | void (*pkey_free)(EVP_PKEY *pkey)); | 1020 | void (*pkey_free)(EVP_PKEY *pkey)); |
1042 | void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, | 1021 | void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, |
1043 | int (*pkey_ctrl)(EVP_PKEY *pkey, int op, | 1022 | int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2)); |
1044 | long arg1, void *arg2)); | ||
1045 | |||
1046 | 1023 | ||
1047 | #define EVP_PKEY_OP_UNDEFINED 0 | 1024 | #define EVP_PKEY_OP_UNDEFINED 0 |
1048 | #define EVP_PKEY_OP_PARAMGEN (1<<1) | 1025 | #define EVP_PKEY_OP_PARAMGEN (1<<1) |
@@ -1106,7 +1083,7 @@ void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, | |||
1106 | const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); | 1083 | const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); |
1107 | EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags); | 1084 | EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags); |
1108 | void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, | 1085 | void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, |
1109 | const EVP_PKEY_METHOD *meth); | 1086 | const EVP_PKEY_METHOD *meth); |
1110 | void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); | 1087 | void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); |
1111 | void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); | 1088 | void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); |
1112 | int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); | 1089 | int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); |
@@ -1116,16 +1093,16 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); | |||
1116 | EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); | 1093 | EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); |
1117 | void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); | 1094 | void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); |
1118 | 1095 | ||
1119 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, | 1096 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, int cmd, |
1120 | int cmd, int p1, void *p2); | 1097 | int p1, void *p2); |
1121 | int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, | 1098 | int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, |
1122 | const char *value); | 1099 | const char *value); |
1123 | 1100 | ||
1124 | int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); | 1101 | int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); |
1125 | void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); | 1102 | void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); |
1126 | 1103 | ||
1127 | EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, | 1104 | EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, const unsigned char *key, |
1128 | const unsigned char *key, int keylen); | 1105 | int keylen); |
1129 | 1106 | ||
1130 | void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); | 1107 | void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); |
1131 | void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); | 1108 | void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); |
@@ -1137,25 +1114,20 @@ void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); | |||
1137 | void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); | 1114 | void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); |
1138 | 1115 | ||
1139 | int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); | 1116 | int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); |
1140 | int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, | 1117 | int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
1141 | unsigned char *sig, size_t *siglen, | 1118 | const unsigned char *tbs, size_t tbslen); |
1142 | const unsigned char *tbs, size_t tbslen); | ||
1143 | int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); | 1119 | int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); |
1144 | int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, | 1120 | int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, |
1145 | const unsigned char *sig, size_t siglen, | 1121 | const unsigned char *tbs, size_t tbslen); |
1146 | const unsigned char *tbs, size_t tbslen); | ||
1147 | int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); | 1122 | int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); |
1148 | int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, | 1123 | int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, unsigned char *rout, |
1149 | unsigned char *rout, size_t *routlen, | 1124 | size_t *routlen, const unsigned char *sig, size_t siglen); |
1150 | const unsigned char *sig, size_t siglen); | ||
1151 | int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); | 1125 | int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); |
1152 | int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, | 1126 | int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
1153 | unsigned char *out, size_t *outlen, | 1127 | const unsigned char *in, size_t inlen); |
1154 | const unsigned char *in, size_t inlen); | ||
1155 | int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); | 1128 | int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); |
1156 | int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, | 1129 | int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
1157 | unsigned char *out, size_t *outlen, | 1130 | const unsigned char *in, size_t inlen); |
1158 | const unsigned char *in, size_t inlen); | ||
1159 | 1131 | ||
1160 | int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); | 1132 | int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); |
1161 | int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); | 1133 | int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); |
@@ -1174,66 +1146,64 @@ EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); | |||
1174 | int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); | 1146 | int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); |
1175 | 1147 | ||
1176 | void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, | 1148 | void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, |
1177 | int (*init)(EVP_PKEY_CTX *ctx)); | 1149 | int (*init)(EVP_PKEY_CTX *ctx)); |
1178 | 1150 | ||
1179 | void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, | 1151 | void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, |
1180 | int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)); | 1152 | int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)); |
1181 | 1153 | ||
1182 | void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, | 1154 | void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, |
1183 | void (*cleanup)(EVP_PKEY_CTX *ctx)); | 1155 | void (*cleanup)(EVP_PKEY_CTX *ctx)); |
1184 | 1156 | ||
1185 | void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, | 1157 | void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, |
1186 | int (*paramgen_init)(EVP_PKEY_CTX *ctx), | 1158 | int (*paramgen_init)(EVP_PKEY_CTX *ctx), |
1187 | int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); | 1159 | int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); |
1188 | 1160 | ||
1189 | void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, | 1161 | void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, |
1190 | int (*keygen_init)(EVP_PKEY_CTX *ctx), | 1162 | int (*keygen_init)(EVP_PKEY_CTX *ctx), |
1191 | int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); | 1163 | int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); |
1192 | 1164 | ||
1193 | void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, | 1165 | void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, |
1194 | int (*sign_init)(EVP_PKEY_CTX *ctx), | 1166 | int (*sign_init)(EVP_PKEY_CTX *ctx), |
1195 | int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 1167 | int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
1196 | const unsigned char *tbs, size_t tbslen)); | 1168 | const unsigned char *tbs, size_t tbslen)); |
1197 | 1169 | ||
1198 | void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, | 1170 | void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, |
1199 | int (*verify_init)(EVP_PKEY_CTX *ctx), | 1171 | int (*verify_init)(EVP_PKEY_CTX *ctx), |
1200 | int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, | 1172 | int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, |
1201 | const unsigned char *tbs, size_t tbslen)); | 1173 | const unsigned char *tbs, size_t tbslen)); |
1202 | 1174 | ||
1203 | void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, | 1175 | void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, |
1204 | int (*verify_recover_init)(EVP_PKEY_CTX *ctx), | 1176 | int (*verify_recover_init)(EVP_PKEY_CTX *ctx), |
1205 | int (*verify_recover)(EVP_PKEY_CTX *ctx, | 1177 | int (*verify_recover)(EVP_PKEY_CTX *ctx, unsigned char *sig, |
1206 | unsigned char *sig, size_t *siglen, | 1178 | size_t *siglen, const unsigned char *tbs, size_t tbslen)); |
1207 | const unsigned char *tbs, size_t tbslen)); | ||
1208 | 1179 | ||
1209 | void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, | 1180 | void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, |
1210 | int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), | 1181 | int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), |
1211 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 1182 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
1212 | EVP_MD_CTX *mctx)); | 1183 | EVP_MD_CTX *mctx)); |
1213 | 1184 | ||
1214 | void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, | 1185 | void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, |
1215 | int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), | 1186 | int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), |
1216 | int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,int siglen, | 1187 | int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen, |
1217 | EVP_MD_CTX *mctx)); | 1188 | EVP_MD_CTX *mctx)); |
1218 | 1189 | ||
1219 | void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, | 1190 | void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, |
1220 | int (*encrypt_init)(EVP_PKEY_CTX *ctx), | 1191 | int (*encrypt_init)(EVP_PKEY_CTX *ctx), |
1221 | int (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | 1192 | int (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
1222 | const unsigned char *in, size_t inlen)); | 1193 | const unsigned char *in, size_t inlen)); |
1223 | 1194 | ||
1224 | void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, | 1195 | void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, |
1225 | int (*decrypt_init)(EVP_PKEY_CTX *ctx), | 1196 | int (*decrypt_init)(EVP_PKEY_CTX *ctx), |
1226 | int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | 1197 | int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
1227 | const unsigned char *in, size_t inlen)); | 1198 | const unsigned char *in, size_t inlen)); |
1228 | 1199 | ||
1229 | void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, | 1200 | void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, |
1230 | int (*derive_init)(EVP_PKEY_CTX *ctx), | 1201 | int (*derive_init)(EVP_PKEY_CTX *ctx), |
1231 | int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)); | 1202 | int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)); |
1232 | 1203 | ||
1233 | void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, | 1204 | void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, |
1234 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2), | 1205 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2), |
1235 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, | 1206 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)); |
1236 | const char *type, const char *value)); | ||
1237 | 1207 | ||
1238 | void EVP_add_alg_module(void); | 1208 | void EVP_add_alg_module(void); |
1239 | 1209 | ||
diff --git a/src/lib/libcrypto/evp/evp_locl.h b/src/lib/libcrypto/evp/evp_locl.h index 9e71f39a47..673c85f8bd 100644 --- a/src/lib/libcrypto/evp/evp_locl.h +++ b/src/lib/libcrypto/evp/evp_locl.h | |||
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -65,7 +65,7 @@ | |||
65 | bl = ctx->cipher->block_size;\ | 65 | bl = ctx->cipher->block_size;\ |
66 | if(inl < bl) return 1;\ | 66 | if(inl < bl) return 1;\ |
67 | inl -= bl; \ | 67 | inl -= bl; \ |
68 | for(i=0; i <= inl; i+=bl) | 68 | for(i=0; i <= inl; i+=bl) |
69 | 69 | ||
70 | #define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \ | 70 | #define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \ |
71 | static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \ | 71 | static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \ |
@@ -263,8 +263,7 @@ const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; } | |||
263 | EVP_CIPHER_get_asn1_iv, \ | 263 | EVP_CIPHER_get_asn1_iv, \ |
264 | NULL) | 264 | NULL) |
265 | 265 | ||
266 | struct evp_pkey_ctx_st | 266 | struct evp_pkey_ctx_st { |
267 | { | ||
268 | /* Method associated with this operation */ | 267 | /* Method associated with this operation */ |
269 | const EVP_PKEY_METHOD *pmeth; | 268 | const EVP_PKEY_METHOD *pmeth; |
270 | /* Engine that implements this method or NULL if builtin */ | 269 | /* Engine that implements this method or NULL if builtin */ |
@@ -284,12 +283,11 @@ struct evp_pkey_ctx_st | |||
284 | /* implementation specific keygen data */ | 283 | /* implementation specific keygen data */ |
285 | int *keygen_info; | 284 | int *keygen_info; |
286 | int keygen_info_count; | 285 | int keygen_info_count; |
287 | } /* EVP_PKEY_CTX */; | 286 | } /* EVP_PKEY_CTX */; |
288 | 287 | ||
289 | #define EVP_PKEY_FLAG_DYNAMIC 1 | 288 | #define EVP_PKEY_FLAG_DYNAMIC 1 |
290 | 289 | ||
291 | struct evp_pkey_method_st | 290 | struct evp_pkey_method_st { |
292 | { | ||
293 | int pkey_id; | 291 | int pkey_id; |
294 | int flags; | 292 | int flags; |
295 | 293 | ||
@@ -305,45 +303,42 @@ struct evp_pkey_method_st | |||
305 | 303 | ||
306 | int (*sign_init)(EVP_PKEY_CTX *ctx); | 304 | int (*sign_init)(EVP_PKEY_CTX *ctx); |
307 | int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 305 | int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
308 | const unsigned char *tbs, size_t tbslen); | 306 | const unsigned char *tbs, size_t tbslen); |
309 | 307 | ||
310 | int (*verify_init)(EVP_PKEY_CTX *ctx); | 308 | int (*verify_init)(EVP_PKEY_CTX *ctx); |
311 | int (*verify)(EVP_PKEY_CTX *ctx, | 309 | int (*verify)(EVP_PKEY_CTX *ctx, |
312 | const unsigned char *sig, size_t siglen, | 310 | const unsigned char *sig, size_t siglen, |
313 | const unsigned char *tbs, size_t tbslen); | 311 | const unsigned char *tbs, size_t tbslen); |
314 | 312 | ||
315 | int (*verify_recover_init)(EVP_PKEY_CTX *ctx); | 313 | int (*verify_recover_init)(EVP_PKEY_CTX *ctx); |
316 | int (*verify_recover)(EVP_PKEY_CTX *ctx, | 314 | int (*verify_recover)(EVP_PKEY_CTX *ctx, |
317 | unsigned char *rout, size_t *routlen, | 315 | unsigned char *rout, size_t *routlen, |
318 | const unsigned char *sig, size_t siglen); | 316 | const unsigned char *sig, size_t siglen); |
319 | 317 | ||
320 | int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); | 318 | int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); |
321 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 319 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
322 | EVP_MD_CTX *mctx); | 320 | EVP_MD_CTX *mctx); |
323 | 321 | ||
324 | int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); | 322 | int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); |
325 | int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,int siglen, | 323 | int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig, |
326 | EVP_MD_CTX *mctx); | 324 | int siglen, EVP_MD_CTX *mctx); |
327 | 325 | ||
328 | int (*encrypt_init)(EVP_PKEY_CTX *ctx); | 326 | int (*encrypt_init)(EVP_PKEY_CTX *ctx); |
329 | int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | 327 | int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
330 | const unsigned char *in, size_t inlen); | 328 | const unsigned char *in, size_t inlen); |
331 | 329 | ||
332 | int (*decrypt_init)(EVP_PKEY_CTX *ctx); | 330 | int (*decrypt_init)(EVP_PKEY_CTX *ctx); |
333 | int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | 331 | int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
334 | const unsigned char *in, size_t inlen); | 332 | const unsigned char *in, size_t inlen); |
335 | 333 | ||
336 | int (*derive_init)(EVP_PKEY_CTX *ctx); | 334 | int (*derive_init)(EVP_PKEY_CTX *ctx); |
337 | int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); | 335 | int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); |
338 | 336 | ||
339 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2); | 337 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2); |
340 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value); | 338 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value); |
341 | 339 | } /* EVP_PKEY_METHOD */; | |
342 | |||
343 | } /* EVP_PKEY_METHOD */; | ||
344 | 340 | ||
345 | void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); | 341 | void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); |
346 | 342 | ||
347 | int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 343 | int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
348 | ASN1_TYPE *param, | 344 | ASN1_TYPE *param, const EVP_CIPHER *c, const EVP_MD *md, int en_de); |
349 | const EVP_CIPHER *c, const EVP_MD *md, int en_de); | ||
diff --git a/src/lib/libssl/src/crypto/evp/evp.h b/src/lib/libssl/src/crypto/evp/evp.h index fa98d4d93c..54aa8a4a66 100644 --- a/src/lib/libssl/src/crypto/evp/evp.h +++ b/src/lib/libssl/src/crypto/evp/evp.h | |||
@@ -5,21 +5,21 @@ | |||
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -123,8 +123,7 @@ extern "C" { | |||
123 | /* Type needs to be a bit field | 123 | /* Type needs to be a bit field |
124 | * Sub-type needs to be for variations on the method, as in, can it do | 124 | * Sub-type needs to be for variations on the method, as in, can it do |
125 | * arbitrary encryption.... */ | 125 | * arbitrary encryption.... */ |
126 | struct evp_pkey_st | 126 | struct evp_pkey_st { |
127 | { | ||
128 | int type; | 127 | int type; |
129 | int save_type; | 128 | int save_type; |
130 | int references; | 129 | int references; |
@@ -144,10 +143,10 @@ struct evp_pkey_st | |||
144 | #ifndef OPENSSL_NO_EC | 143 | #ifndef OPENSSL_NO_EC |
145 | struct ec_key_st *ec; /* ECC */ | 144 | struct ec_key_st *ec; /* ECC */ |
146 | #endif | 145 | #endif |
147 | } pkey; | 146 | } pkey; |
148 | int save_parameters; | 147 | int save_parameters; |
149 | STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ | 148 | STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */ |
150 | } /* EVP_PKEY */; | 149 | } /* EVP_PKEY */; |
151 | 150 | ||
152 | #define EVP_PKEY_MO_SIGN 0x0001 | 151 | #define EVP_PKEY_MO_SIGN 0x0001 |
153 | #define EVP_PKEY_MO_VERIFY 0x0002 | 152 | #define EVP_PKEY_MO_VERIFY 0x0002 |
@@ -155,37 +154,36 @@ struct evp_pkey_st | |||
155 | #define EVP_PKEY_MO_DECRYPT 0x0008 | 154 | #define EVP_PKEY_MO_DECRYPT 0x0008 |
156 | 155 | ||
157 | #ifndef EVP_MD | 156 | #ifndef EVP_MD |
158 | struct env_md_st | 157 | struct env_md_st { |
159 | { | ||
160 | int type; | 158 | int type; |
161 | int pkey_type; | 159 | int pkey_type; |
162 | int md_size; | 160 | int md_size; |
163 | unsigned long flags; | 161 | unsigned long flags; |
164 | int (*init)(EVP_MD_CTX *ctx); | 162 | int (*init)(EVP_MD_CTX *ctx); |
165 | int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count); | 163 | int (*update)(EVP_MD_CTX *ctx, const void *data, size_t count); |
166 | int (*final)(EVP_MD_CTX *ctx,unsigned char *md); | 164 | int (*final)(EVP_MD_CTX *ctx, unsigned char *md); |
167 | int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from); | 165 | int (*copy)(EVP_MD_CTX *to, const EVP_MD_CTX *from); |
168 | int (*cleanup)(EVP_MD_CTX *ctx); | 166 | int (*cleanup)(EVP_MD_CTX *ctx); |
169 | 167 | ||
170 | /* FIXME: prototype these some day */ | 168 | /* FIXME: prototype these some day */ |
171 | int (*sign)(int type, const unsigned char *m, unsigned int m_length, | 169 | int (*sign)(int type, const unsigned char *m, unsigned int m_length, |
172 | unsigned char *sigret, unsigned int *siglen, void *key); | 170 | unsigned char *sigret, unsigned int *siglen, void *key); |
173 | int (*verify)(int type, const unsigned char *m, unsigned int m_length, | 171 | int (*verify)(int type, const unsigned char *m, unsigned int m_length, |
174 | const unsigned char *sigbuf, unsigned int siglen, | 172 | const unsigned char *sigbuf, unsigned int siglen, |
175 | void *key); | 173 | void *key); |
176 | int required_pkey_type[5]; /*EVP_PKEY_xxx */ | 174 | int required_pkey_type[5]; /*EVP_PKEY_xxx */ |
177 | int block_size; | 175 | int block_size; |
178 | int ctx_size; /* how big does the ctx->md_data need to be */ | 176 | int ctx_size; /* how big does the ctx->md_data need to be */ |
179 | /* control function */ | 177 | /* control function */ |
180 | int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); | 178 | int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); |
181 | } /* EVP_MD */; | 179 | } /* EVP_MD */; |
182 | 180 | ||
183 | typedef int evp_sign_method(int type,const unsigned char *m, | 181 | typedef int evp_sign_method(int type, const unsigned char *m, |
184 | unsigned int m_length,unsigned char *sigret, | 182 | unsigned int m_length, unsigned char *sigret, unsigned int *siglen, |
185 | unsigned int *siglen, void *key); | 183 | void *key); |
186 | typedef int evp_verify_method(int type,const unsigned char *m, | 184 | typedef int evp_verify_method(int type, const unsigned char *m, |
187 | unsigned int m_length,const unsigned char *sigbuf, | 185 | unsigned int m_length, const unsigned char *sigbuf, unsigned int siglen, |
188 | unsigned int siglen, void *key); | 186 | void *key); |
189 | 187 | ||
190 | #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single | 188 | #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single |
191 | * block */ | 189 | * block */ |
@@ -241,7 +239,7 @@ typedef int evp_verify_method(int type,const unsigned char *m, | |||
241 | #define EVP_PKEY_ECDSA_method (evp_sign_method *)ECDSA_sign, \ | 239 | #define EVP_PKEY_ECDSA_method (evp_sign_method *)ECDSA_sign, \ |
242 | (evp_verify_method *)ECDSA_verify, \ | 240 | (evp_verify_method *)ECDSA_verify, \ |
243 | {EVP_PKEY_EC,0,0,0} | 241 | {EVP_PKEY_EC,0,0,0} |
244 | #else | 242 | #else |
245 | #define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method | 243 | #define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method |
246 | #endif | 244 | #endif |
247 | 245 | ||
@@ -260,8 +258,7 @@ typedef int evp_verify_method(int type,const unsigned char *m, | |||
260 | 258 | ||
261 | #endif /* !EVP_MD */ | 259 | #endif /* !EVP_MD */ |
262 | 260 | ||
263 | struct env_md_ctx_st | 261 | struct env_md_ctx_st { |
264 | { | ||
265 | const EVP_MD *digest; | 262 | const EVP_MD *digest; |
266 | ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ | 263 | ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */ |
267 | unsigned long flags; | 264 | unsigned long flags; |
@@ -269,8 +266,8 @@ struct env_md_ctx_st | |||
269 | /* Public key context for sign/verify */ | 266 | /* Public key context for sign/verify */ |
270 | EVP_PKEY_CTX *pctx; | 267 | EVP_PKEY_CTX *pctx; |
271 | /* Update function: usually copied from EVP_MD */ | 268 | /* Update function: usually copied from EVP_MD */ |
272 | int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count); | 269 | int (*update)(EVP_MD_CTX *ctx, const void *data, size_t count); |
273 | } /* EVP_MD_CTX */; | 270 | } /* EVP_MD_CTX */; |
274 | 271 | ||
275 | /* values for EVP_MD_CTX flags */ | 272 | /* values for EVP_MD_CTX flags */ |
276 | 273 | ||
@@ -298,24 +295,23 @@ struct env_md_ctx_st | |||
298 | 295 | ||
299 | #define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */ | 296 | #define EVP_MD_CTX_FLAG_NO_INIT 0x0100 /* Don't initialize md_data */ |
300 | 297 | ||
301 | struct evp_cipher_st | 298 | struct evp_cipher_st { |
302 | { | ||
303 | int nid; | 299 | int nid; |
304 | int block_size; | 300 | int block_size; |
305 | int key_len; /* Default value for variable length ciphers */ | 301 | int key_len; /* Default value for variable length ciphers */ |
306 | int iv_len; | 302 | int iv_len; |
307 | unsigned long flags; /* Various flags */ | 303 | unsigned long flags; /* Various flags */ |
308 | int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, | 304 | int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, |
309 | const unsigned char *iv, int enc); /* init key */ | 305 | const unsigned char *iv, int enc); /* init key */ |
310 | int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, | 306 | int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, |
311 | const unsigned char *in, size_t inl);/* encrypt/decrypt data */ | 307 | const unsigned char *in, size_t inl);/* encrypt/decrypt data */ |
312 | int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ | 308 | int (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */ |
313 | int ctx_size; /* how big ctx->cipher_data needs to be */ | 309 | int ctx_size; /* how big ctx->cipher_data needs to be */ |
314 | int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ | 310 | int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */ |
315 | int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */ | 311 | int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */ |
316 | int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */ | 312 | int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */ |
317 | void *app_data; /* Application data */ | 313 | void *app_data; /* Application data */ |
318 | } /* EVP_CIPHER */; | 314 | } /* EVP_CIPHER */; |
319 | 315 | ||
320 | /* Values for cipher flags */ | 316 | /* Values for cipher flags */ |
321 | 317 | ||
@@ -400,14 +396,12 @@ struct evp_cipher_st | |||
400 | /* Length of tag for TLS */ | 396 | /* Length of tag for TLS */ |
401 | #define EVP_GCM_TLS_TAG_LEN 16 | 397 | #define EVP_GCM_TLS_TAG_LEN 16 |
402 | 398 | ||
403 | typedef struct evp_cipher_info_st | 399 | typedef struct evp_cipher_info_st { |
404 | { | ||
405 | const EVP_CIPHER *cipher; | 400 | const EVP_CIPHER *cipher; |
406 | unsigned char iv[EVP_MAX_IV_LENGTH]; | 401 | unsigned char iv[EVP_MAX_IV_LENGTH]; |
407 | } EVP_CIPHER_INFO; | 402 | } EVP_CIPHER_INFO; |
408 | 403 | ||
409 | struct evp_cipher_ctx_st | 404 | struct evp_cipher_ctx_st { |
410 | { | ||
411 | const EVP_CIPHER *cipher; | 405 | const EVP_CIPHER *cipher; |
412 | ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */ | 406 | ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */ |
413 | int encrypt; /* encrypt or decrypt */ | 407 | int encrypt; /* encrypt or decrypt */ |
@@ -425,10 +419,9 @@ struct evp_cipher_ctx_st | |||
425 | int final_used; | 419 | int final_used; |
426 | int block_mask; | 420 | int block_mask; |
427 | unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */ | 421 | unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */ |
428 | } /* EVP_CIPHER_CTX */; | 422 | } /* EVP_CIPHER_CTX */; |
429 | 423 | ||
430 | typedef struct evp_Encode_Ctx_st | 424 | typedef struct evp_Encode_Ctx_st { |
431 | { | ||
432 | int num; /* number saved in a partial encode/decode */ | 425 | int num; /* number saved in a partial encode/decode */ |
433 | int length; /* The length is either the output line length | 426 | int length; /* The length is either the output line length |
434 | * (in input bytes) or the shortest input line | 427 | * (in input bytes) or the shortest input line |
@@ -438,12 +431,11 @@ typedef struct evp_Encode_Ctx_st | |||
438 | unsigned char enc_data[80]; /* data to encode */ | 431 | unsigned char enc_data[80]; /* data to encode */ |
439 | int line_num; /* number read on current line */ | 432 | int line_num; /* number read on current line */ |
440 | int expect_nl; | 433 | int expect_nl; |
441 | } EVP_ENCODE_CTX; | 434 | } EVP_ENCODE_CTX; |
442 | 435 | ||
443 | /* Password based encryption function */ | 436 | /* Password based encryption function */ |
444 | typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 437 | typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
445 | ASN1_TYPE *param, const EVP_CIPHER *cipher, | 438 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de); |
446 | const EVP_MD *md, int en_de); | ||
447 | 439 | ||
448 | #ifndef OPENSSL_NO_RSA | 440 | #ifndef OPENSSL_NO_RSA |
449 | #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ | 441 | #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ |
@@ -474,7 +466,7 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |||
474 | int EVP_MD_type(const EVP_MD *md); | 466 | int EVP_MD_type(const EVP_MD *md); |
475 | #define EVP_MD_nid(e) EVP_MD_type(e) | 467 | #define EVP_MD_nid(e) EVP_MD_type(e) |
476 | #define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) | 468 | #define EVP_MD_name(e) OBJ_nid2sn(EVP_MD_nid(e)) |
477 | int EVP_MD_pkey_type(const EVP_MD *md); | 469 | int EVP_MD_pkey_type(const EVP_MD *md); |
478 | int EVP_MD_size(const EVP_MD *md); | 470 | int EVP_MD_size(const EVP_MD *md); |
479 | int EVP_MD_block_size(const EVP_MD *md); | 471 | int EVP_MD_block_size(const EVP_MD *md); |
480 | unsigned long EVP_MD_flags(const EVP_MD *md); | 472 | unsigned long EVP_MD_flags(const EVP_MD *md); |
@@ -514,12 +506,12 @@ unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx); | |||
514 | #define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) | 506 | #define EVP_VerifyInit(a,b) EVP_DigestInit(a,b) |
515 | #define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | 507 | #define EVP_VerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) |
516 | #define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) | 508 | #define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) |
517 | #define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) | 509 | #define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) |
518 | #define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | 510 | #define EVP_DigestSignUpdate(a,b,c) EVP_DigestUpdate(a,b,c) |
519 | #define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) | 511 | #define EVP_DigestVerifyUpdate(a,b,c) EVP_DigestUpdate(a,b,c) |
520 | 512 | ||
521 | #ifdef CONST_STRICT | 513 | #ifdef CONST_STRICT |
522 | void BIO_set_md(BIO *,const EVP_MD *md); | 514 | void BIO_set_md(BIO *, const EVP_MD *md); |
523 | #else | 515 | #else |
524 | # define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) | 516 | # define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) |
525 | #endif | 517 | #endif |
@@ -529,10 +521,8 @@ void BIO_set_md(BIO *,const EVP_MD *md); | |||
529 | #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) | 521 | #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) |
530 | #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) | 522 | #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) |
531 | 523 | ||
532 | int EVP_Cipher(EVP_CIPHER_CTX *c, | 524 | int EVP_Cipher(EVP_CIPHER_CTX *c, unsigned char *out, const unsigned char *in, |
533 | unsigned char *out, | 525 | unsigned int inl); |
534 | const unsigned char *in, | ||
535 | unsigned int inl); | ||
536 | 526 | ||
537 | #define EVP_add_cipher_alias(n,alias) \ | 527 | #define EVP_add_cipher_alias(n,alias) \ |
538 | OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) | 528 | OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) |
@@ -543,105 +533,99 @@ int EVP_Cipher(EVP_CIPHER_CTX *c, | |||
543 | #define EVP_delete_digest_alias(alias) \ | 533 | #define EVP_delete_digest_alias(alias) \ |
544 | OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); | 534 | OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); |
545 | 535 | ||
546 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx); | 536 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx); |
547 | int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); | 537 | int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); |
548 | EVP_MD_CTX *EVP_MD_CTX_create(void); | 538 | EVP_MD_CTX *EVP_MD_CTX_create(void); |
549 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); | 539 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); |
550 | int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in); | 540 | int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in); |
551 | void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); | 541 | void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags); |
552 | void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); | 542 | void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags); |
553 | int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx,int flags); | 543 | int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags); |
554 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); | 544 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); |
555 | int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d, | 545 | int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt); |
556 | size_t cnt); | 546 | int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s); |
557 | int EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); | 547 | int EVP_Digest(const void *data, size_t count, unsigned char *md, |
558 | int EVP_Digest(const void *data, size_t count, | 548 | unsigned int *size, const EVP_MD *type, ENGINE *impl); |
559 | unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl); | 549 | |
560 | 550 | int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in); | |
561 | int EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in); | 551 | int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); |
562 | int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); | 552 | int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s); |
563 | int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); | 553 | |
564 | 554 | int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify); | |
565 | int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); | 555 | int EVP_read_pw_string_min(char *buf, int minlen, int maxlen, |
566 | int EVP_read_pw_string_min(char *buf,int minlen,int maxlen,const char *prompt,int verify); | 556 | const char *prompt, int verify); |
567 | void EVP_set_pw_prompt(const char *prompt); | 557 | void EVP_set_pw_prompt(const char *prompt); |
568 | char * EVP_get_pw_prompt(void); | 558 | char *EVP_get_pw_prompt(void); |
569 | 559 | ||
570 | int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md, | 560 | int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md, |
571 | const unsigned char *salt, const unsigned char *data, | 561 | const unsigned char *salt, const unsigned char *data, int datal, int count, |
572 | int datal, int count, unsigned char *key,unsigned char *iv); | 562 | unsigned char *key, unsigned char *iv); |
573 | 563 | ||
574 | void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); | 564 | void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags); |
575 | void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); | 565 | void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags); |
576 | int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx,int flags); | 566 | int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags); |
577 | 567 | ||
578 | int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, | 568 | int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
579 | const unsigned char *key, const unsigned char *iv); | 569 | const unsigned char *key, const unsigned char *iv); |
580 | int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, | 570 | int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
581 | const unsigned char *key, const unsigned char *iv); | 571 | ENGINE *impl, const unsigned char *key, const unsigned char *iv); |
582 | int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 572 | int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
583 | int *outl, const unsigned char *in, int inl); | 573 | const unsigned char *in, int inl); |
584 | int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | 574 | int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); |
585 | int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | 575 | int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); |
586 | 576 | ||
587 | int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, | 577 | int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
588 | const unsigned char *key, const unsigned char *iv); | 578 | const unsigned char *key, const unsigned char *iv); |
589 | int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, | 579 | int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
590 | const unsigned char *key, const unsigned char *iv); | 580 | ENGINE *impl, const unsigned char *key, const unsigned char *iv); |
591 | int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 581 | int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
592 | int *outl, const unsigned char *in, int inl); | 582 | const unsigned char *in, int inl); |
593 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | 583 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); |
594 | int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | 584 | int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); |
595 | 585 | ||
596 | int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, | 586 | int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
597 | const unsigned char *key,const unsigned char *iv, | 587 | const unsigned char *key, const unsigned char *iv, int enc); |
598 | int enc); | 588 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, |
599 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl, | 589 | ENGINE *impl, const unsigned char *key, const unsigned char *iv, int enc); |
600 | const unsigned char *key,const unsigned char *iv, | 590 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, |
601 | int enc); | 591 | const unsigned char *in, int inl); |
602 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 592 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); |
603 | int *outl, const unsigned char *in, int inl); | 593 | int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); |
604 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | 594 | |
605 | int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | 595 | int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s, |
606 | 596 | EVP_PKEY *pkey); | |
607 | int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s, | 597 | |
608 | EVP_PKEY *pkey); | 598 | int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, |
609 | 599 | unsigned int siglen, EVP_PKEY *pkey); | |
610 | int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf, | 600 | |
611 | unsigned int siglen,EVP_PKEY *pkey); | 601 | int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, |
612 | 602 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | |
613 | int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | 603 | int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, size_t *siglen); |
614 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | 604 | |
615 | int EVP_DigestSignFinal(EVP_MD_CTX *ctx, | 605 | int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, |
616 | unsigned char *sigret, size_t *siglen); | 606 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); |
617 | 607 | int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen); | |
618 | int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | 608 | |
619 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | 609 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
620 | int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, | 610 | const unsigned char *ek, int ekl, const unsigned char *iv, EVP_PKEY *priv); |
621 | unsigned char *sig, size_t siglen); | 611 | int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); |
622 | 612 | ||
623 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, | 613 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
624 | const unsigned char *ek, int ekl, const unsigned char *iv, | 614 | unsigned char **ek, int *ekl, unsigned char *iv, EVP_PKEY **pubk, |
625 | EVP_PKEY *priv); | 615 | int npubk); |
626 | int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | 616 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); |
627 | 617 | ||
628 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 618 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); |
629 | unsigned char **ek, int *ekl, unsigned char *iv, | 619 | void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, |
630 | EVP_PKEY **pubk, int npubk); | 620 | const unsigned char *in, int inl); |
631 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); | 621 | void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); |
632 | 622 | int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); | |
633 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); | 623 | |
634 | void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, | 624 | void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); |
635 | const unsigned char *in,int inl); | 625 | int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, |
636 | void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl); | 626 | const unsigned char *in, int inl); |
637 | int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n); | 627 | int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl); |
638 | 628 | int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); | |
639 | void EVP_DecodeInit(EVP_ENCODE_CTX *ctx); | ||
640 | int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl, | ||
641 | const unsigned char *in, int inl); | ||
642 | int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned | ||
643 | char *out, int *outl); | ||
644 | int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n); | ||
645 | 629 | ||
646 | void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); | 630 | void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); |
647 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | 631 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); |
@@ -657,8 +641,8 @@ BIO_METHOD *BIO_f_md(void); | |||
657 | BIO_METHOD *BIO_f_base64(void); | 641 | BIO_METHOD *BIO_f_base64(void); |
658 | BIO_METHOD *BIO_f_cipher(void); | 642 | BIO_METHOD *BIO_f_cipher(void); |
659 | BIO_METHOD *BIO_f_reliable(void); | 643 | BIO_METHOD *BIO_f_reliable(void); |
660 | void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,const unsigned char *k, | 644 | void BIO_set_cipher(BIO *b, const EVP_CIPHER *c, const unsigned char *k, |
661 | const unsigned char *i, int enc); | 645 | const unsigned char *i, int enc); |
662 | #endif | 646 | #endif |
663 | 647 | ||
664 | const EVP_MD *EVP_md_null(void); | 648 | const EVP_MD *EVP_md_null(void); |
@@ -866,79 +850,77 @@ const EVP_CIPHER *EVP_get_cipherbyname(const char *name); | |||
866 | const EVP_MD *EVP_get_digestbyname(const char *name); | 850 | const EVP_MD *EVP_get_digestbyname(const char *name); |
867 | void EVP_cleanup(void); | 851 | void EVP_cleanup(void); |
868 | 852 | ||
869 | void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph, | 853 | void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph, const char *from, |
870 | const char *from, const char *to, void *x), void *arg); | 854 | const char *to, void *x), void *arg); |
871 | void EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph, | 855 | void EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph, |
872 | const char *from, const char *to, void *x), void *arg); | 856 | const char *from, const char *to, void *x), void *arg); |
873 | 857 | ||
874 | void EVP_MD_do_all(void (*fn)(const EVP_MD *ciph, | 858 | void EVP_MD_do_all(void (*fn)(const EVP_MD *ciph, const char *from, |
875 | const char *from, const char *to, void *x), void *arg); | 859 | const char *to, void *x), void *arg); |
876 | void EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *ciph, | 860 | void EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *ciph, const char *from, |
877 | const char *from, const char *to, void *x), void *arg); | 861 | const char *to, void *x), void *arg); |
878 | 862 | ||
879 | int EVP_PKEY_decrypt_old(unsigned char *dec_key, | 863 | int EVP_PKEY_decrypt_old(unsigned char *dec_key, const unsigned char *enc_key, |
880 | const unsigned char *enc_key,int enc_key_len, | 864 | int enc_key_len, EVP_PKEY *private_key); |
881 | EVP_PKEY *private_key); | 865 | int EVP_PKEY_encrypt_old(unsigned char *enc_key, const unsigned char *key, |
882 | int EVP_PKEY_encrypt_old(unsigned char *enc_key, | 866 | int key_len, EVP_PKEY *pub_key); |
883 | const unsigned char *key,int key_len, | 867 | int EVP_PKEY_type(int type); |
884 | EVP_PKEY *pub_key); | 868 | int EVP_PKEY_id(const EVP_PKEY *pkey); |
885 | int EVP_PKEY_type(int type); | 869 | int EVP_PKEY_base_id(const EVP_PKEY *pkey); |
886 | int EVP_PKEY_id(const EVP_PKEY *pkey); | 870 | int EVP_PKEY_bits(EVP_PKEY *pkey); |
887 | int EVP_PKEY_base_id(const EVP_PKEY *pkey); | 871 | int EVP_PKEY_size(EVP_PKEY *pkey); |
888 | int EVP_PKEY_bits(EVP_PKEY *pkey); | 872 | int EVP_PKEY_set_type(EVP_PKEY *pkey, int type); |
889 | int EVP_PKEY_size(EVP_PKEY *pkey); | 873 | int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); |
890 | int EVP_PKEY_set_type(EVP_PKEY *pkey,int type); | 874 | int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key); |
891 | int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len); | 875 | void *EVP_PKEY_get0(EVP_PKEY *pkey); |
892 | int EVP_PKEY_assign(EVP_PKEY *pkey,int type,void *key); | ||
893 | void * EVP_PKEY_get0(EVP_PKEY *pkey); | ||
894 | 876 | ||
895 | #ifndef OPENSSL_NO_RSA | 877 | #ifndef OPENSSL_NO_RSA |
896 | struct rsa_st; | 878 | struct rsa_st; |
897 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,struct rsa_st *key); | 879 | int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); |
898 | struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); | 880 | struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey); |
899 | #endif | 881 | #endif |
900 | #ifndef OPENSSL_NO_DSA | 882 | #ifndef OPENSSL_NO_DSA |
901 | struct dsa_st; | 883 | struct dsa_st; |
902 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,struct dsa_st *key); | 884 | int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, struct dsa_st *key); |
903 | struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); | 885 | struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey); |
904 | #endif | 886 | #endif |
905 | #ifndef OPENSSL_NO_DH | 887 | #ifndef OPENSSL_NO_DH |
906 | struct dh_st; | 888 | struct dh_st; |
907 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key); | 889 | int EVP_PKEY_set1_DH(EVP_PKEY *pkey, struct dh_st *key); |
908 | struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); | 890 | struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey); |
909 | #endif | 891 | #endif |
910 | #ifndef OPENSSL_NO_EC | 892 | #ifndef OPENSSL_NO_EC |
911 | struct ec_key_st; | 893 | struct ec_key_st; |
912 | int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,struct ec_key_st *key); | 894 | int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, struct ec_key_st *key); |
913 | struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); | 895 | struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey); |
914 | #endif | 896 | #endif |
915 | 897 | ||
916 | EVP_PKEY * EVP_PKEY_new(void); | 898 | EVP_PKEY *EVP_PKEY_new(void); |
917 | void EVP_PKEY_free(EVP_PKEY *pkey); | 899 | void EVP_PKEY_free(EVP_PKEY *pkey); |
918 | 900 | ||
919 | EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp, | 901 | EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp, |
920 | long length); | 902 | long length); |
921 | int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); | 903 | int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp); |
922 | 904 | ||
923 | EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp, | 905 | EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp, |
924 | long length); | 906 | long length); |
925 | EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, | 907 | EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, |
926 | long length); | 908 | long length); |
927 | int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); | 909 | int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp); |
928 | 910 | ||
929 | int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); | 911 | int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); |
930 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); | 912 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); |
931 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode); | 913 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode); |
932 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); | 914 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); |
933 | 915 | ||
934 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); | 916 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); |
935 | 917 | ||
936 | int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, | 918 | int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, int indent, |
937 | int indent, ASN1_PCTX *pctx); | 919 | ASN1_PCTX *pctx); |
938 | int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, | 920 | int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, int indent, |
939 | int indent, ASN1_PCTX *pctx); | 921 | ASN1_PCTX *pctx); |
940 | int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, | 922 | int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, int indent, |
941 | int indent, ASN1_PCTX *pctx); | 923 | ASN1_PCTX *pctx); |
942 | 924 | ||
943 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); | 925 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); |
944 | 926 | ||
@@ -949,28 +931,26 @@ int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | |||
949 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | 931 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
950 | 932 | ||
951 | /* These are used by EVP_CIPHER methods */ | 933 | /* These are used by EVP_CIPHER methods */ |
952 | int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); | 934 | int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
953 | int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); | 935 | int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
954 | 936 | ||
955 | /* PKCS5 password based encryption */ | 937 | /* PKCS5 password based encryption */ |
956 | int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 938 | int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
957 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, | 939 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, int en_de); |
958 | int en_de); | ||
959 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, | 940 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, |
960 | const unsigned char *salt, int saltlen, int iter, | 941 | const unsigned char *salt, int saltlen, int iter, int keylen, |
961 | int keylen, unsigned char *out); | 942 | unsigned char *out); |
962 | int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, | 943 | int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, const unsigned char *salt, |
963 | const unsigned char *salt, int saltlen, int iter, | 944 | int saltlen, int iter, const EVP_MD *digest, int keylen, |
964 | const EVP_MD *digest, | 945 | unsigned char *out); |
965 | int keylen, unsigned char *out); | ||
966 | int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 946 | int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
967 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, | 947 | ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md, |
968 | int en_de); | 948 | int en_de); |
969 | 949 | ||
970 | void PKCS5_PBE_add(void); | 950 | void PKCS5_PBE_add(void); |
971 | 951 | ||
972 | int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | 952 | int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, |
973 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); | 953 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); |
974 | 954 | ||
975 | /* PBE type */ | 955 | /* PBE type */ |
976 | 956 | ||
@@ -980,11 +960,11 @@ int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | |||
980 | #define EVP_PBE_TYPE_PRF 0x1 | 960 | #define EVP_PBE_TYPE_PRF 0x1 |
981 | 961 | ||
982 | int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid, | 962 | int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid, |
983 | EVP_PBE_KEYGEN *keygen); | 963 | EVP_PBE_KEYGEN *keygen); |
984 | int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, | 964 | int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md, |
985 | EVP_PBE_KEYGEN *keygen); | 965 | EVP_PBE_KEYGEN *keygen); |
986 | int EVP_PBE_find(int type, int pbe_nid, | 966 | int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid, |
987 | int *pcnid, int *pmnid, EVP_PBE_KEYGEN **pkeygen); | 967 | EVP_PBE_KEYGEN **pkeygen); |
988 | void EVP_PBE_cleanup(void); | 968 | void EVP_PBE_cleanup(void); |
989 | 969 | ||
990 | #define ASN1_PKEY_ALIAS 0x1 | 970 | #define ASN1_PKEY_ALIAS 0x1 |
@@ -1001,48 +981,45 @@ int EVP_PKEY_asn1_get_count(void); | |||
1001 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); | 981 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); |
1002 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); | 982 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type); |
1003 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, | 983 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, |
1004 | const char *str, int len); | 984 | const char *str, int len); |
1005 | int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); | 985 | int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); |
1006 | int EVP_PKEY_asn1_add_alias(int to, int from); | 986 | int EVP_PKEY_asn1_add_alias(int to, int from); |
1007 | int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_flags, | 987 | int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_flags, |
1008 | const char **pinfo, const char **ppem_str, | 988 | const char **pinfo, const char **ppem_str, |
1009 | const EVP_PKEY_ASN1_METHOD *ameth); | 989 | const EVP_PKEY_ASN1_METHOD *ameth); |
1010 | 990 | ||
1011 | const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY *pkey); | 991 | const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY *pkey); |
1012 | EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, | 992 | EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags, const char *pem_str, |
1013 | const char *pem_str, const char *info); | 993 | const char *info); |
1014 | void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, | 994 | void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, |
1015 | const EVP_PKEY_ASN1_METHOD *src); | 995 | const EVP_PKEY_ASN1_METHOD *src); |
1016 | void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); | 996 | void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); |
1017 | void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, | 997 | void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, |
1018 | int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub), | 998 | int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub), |
1019 | int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk), | 999 | int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk), |
1020 | int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), | 1000 | int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), |
1021 | int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent, | 1001 | int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent, |
1022 | ASN1_PCTX *pctx), | 1002 | ASN1_PCTX *pctx), |
1023 | int (*pkey_size)(const EVP_PKEY *pk), | 1003 | int (*pkey_size)(const EVP_PKEY *pk), |
1024 | int (*pkey_bits)(const EVP_PKEY *pk)); | 1004 | int (*pkey_bits)(const EVP_PKEY *pk)); |
1025 | void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, | 1005 | void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, |
1026 | int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf), | 1006 | int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf), |
1027 | int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk), | 1007 | int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk), |
1028 | int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, | 1008 | int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, |
1029 | ASN1_PCTX *pctx)); | 1009 | ASN1_PCTX *pctx)); |
1030 | void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, | 1010 | void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, |
1031 | int (*param_decode)(EVP_PKEY *pkey, | 1011 | int (*param_decode)(EVP_PKEY *pkey, const unsigned char **pder, int derlen), |
1032 | const unsigned char **pder, int derlen), | 1012 | int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder), |
1033 | int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder), | 1013 | int (*param_missing)(const EVP_PKEY *pk), |
1034 | int (*param_missing)(const EVP_PKEY *pk), | 1014 | int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from), |
1035 | int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from), | 1015 | int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), |
1036 | int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b), | 1016 | int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, |
1037 | int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, | 1017 | ASN1_PCTX *pctx)); |
1038 | ASN1_PCTX *pctx)); | ||
1039 | 1018 | ||
1040 | void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, | 1019 | void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, |
1041 | void (*pkey_free)(EVP_PKEY *pkey)); | 1020 | void (*pkey_free)(EVP_PKEY *pkey)); |
1042 | void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, | 1021 | void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, |
1043 | int (*pkey_ctrl)(EVP_PKEY *pkey, int op, | 1022 | int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2)); |
1044 | long arg1, void *arg2)); | ||
1045 | |||
1046 | 1023 | ||
1047 | #define EVP_PKEY_OP_UNDEFINED 0 | 1024 | #define EVP_PKEY_OP_UNDEFINED 0 |
1048 | #define EVP_PKEY_OP_PARAMGEN (1<<1) | 1025 | #define EVP_PKEY_OP_PARAMGEN (1<<1) |
@@ -1106,7 +1083,7 @@ void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, | |||
1106 | const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); | 1083 | const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); |
1107 | EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags); | 1084 | EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags); |
1108 | void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, | 1085 | void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, |
1109 | const EVP_PKEY_METHOD *meth); | 1086 | const EVP_PKEY_METHOD *meth); |
1110 | void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); | 1087 | void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); |
1111 | void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); | 1088 | void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); |
1112 | int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); | 1089 | int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); |
@@ -1116,16 +1093,16 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); | |||
1116 | EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); | 1093 | EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); |
1117 | void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); | 1094 | void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); |
1118 | 1095 | ||
1119 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, | 1096 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, int cmd, |
1120 | int cmd, int p1, void *p2); | 1097 | int p1, void *p2); |
1121 | int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, | 1098 | int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, |
1122 | const char *value); | 1099 | const char *value); |
1123 | 1100 | ||
1124 | int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); | 1101 | int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx); |
1125 | void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); | 1102 | void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen); |
1126 | 1103 | ||
1127 | EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, | 1104 | EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e, const unsigned char *key, |
1128 | const unsigned char *key, int keylen); | 1105 | int keylen); |
1129 | 1106 | ||
1130 | void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); | 1107 | void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data); |
1131 | void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); | 1108 | void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx); |
@@ -1137,25 +1114,20 @@ void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); | |||
1137 | void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); | 1114 | void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); |
1138 | 1115 | ||
1139 | int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); | 1116 | int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); |
1140 | int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, | 1117 | int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
1141 | unsigned char *sig, size_t *siglen, | 1118 | const unsigned char *tbs, size_t tbslen); |
1142 | const unsigned char *tbs, size_t tbslen); | ||
1143 | int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); | 1119 | int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); |
1144 | int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, | 1120 | int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, |
1145 | const unsigned char *sig, size_t siglen, | 1121 | const unsigned char *tbs, size_t tbslen); |
1146 | const unsigned char *tbs, size_t tbslen); | ||
1147 | int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); | 1122 | int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx); |
1148 | int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, | 1123 | int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx, unsigned char *rout, |
1149 | unsigned char *rout, size_t *routlen, | 1124 | size_t *routlen, const unsigned char *sig, size_t siglen); |
1150 | const unsigned char *sig, size_t siglen); | ||
1151 | int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); | 1125 | int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); |
1152 | int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, | 1126 | int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
1153 | unsigned char *out, size_t *outlen, | 1127 | const unsigned char *in, size_t inlen); |
1154 | const unsigned char *in, size_t inlen); | ||
1155 | int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); | 1128 | int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); |
1156 | int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, | 1129 | int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
1157 | unsigned char *out, size_t *outlen, | 1130 | const unsigned char *in, size_t inlen); |
1158 | const unsigned char *in, size_t inlen); | ||
1159 | 1131 | ||
1160 | int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); | 1132 | int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); |
1161 | int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); | 1133 | int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); |
@@ -1174,66 +1146,64 @@ EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); | |||
1174 | int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); | 1146 | int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); |
1175 | 1147 | ||
1176 | void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, | 1148 | void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth, |
1177 | int (*init)(EVP_PKEY_CTX *ctx)); | 1149 | int (*init)(EVP_PKEY_CTX *ctx)); |
1178 | 1150 | ||
1179 | void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, | 1151 | void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth, |
1180 | int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)); | 1152 | int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)); |
1181 | 1153 | ||
1182 | void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, | 1154 | void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth, |
1183 | void (*cleanup)(EVP_PKEY_CTX *ctx)); | 1155 | void (*cleanup)(EVP_PKEY_CTX *ctx)); |
1184 | 1156 | ||
1185 | void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, | 1157 | void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth, |
1186 | int (*paramgen_init)(EVP_PKEY_CTX *ctx), | 1158 | int (*paramgen_init)(EVP_PKEY_CTX *ctx), |
1187 | int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); | 1159 | int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); |
1188 | 1160 | ||
1189 | void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, | 1161 | void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth, |
1190 | int (*keygen_init)(EVP_PKEY_CTX *ctx), | 1162 | int (*keygen_init)(EVP_PKEY_CTX *ctx), |
1191 | int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); | 1163 | int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)); |
1192 | 1164 | ||
1193 | void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, | 1165 | void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth, |
1194 | int (*sign_init)(EVP_PKEY_CTX *ctx), | 1166 | int (*sign_init)(EVP_PKEY_CTX *ctx), |
1195 | int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 1167 | int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
1196 | const unsigned char *tbs, size_t tbslen)); | 1168 | const unsigned char *tbs, size_t tbslen)); |
1197 | 1169 | ||
1198 | void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, | 1170 | void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth, |
1199 | int (*verify_init)(EVP_PKEY_CTX *ctx), | 1171 | int (*verify_init)(EVP_PKEY_CTX *ctx), |
1200 | int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, | 1172 | int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, |
1201 | const unsigned char *tbs, size_t tbslen)); | 1173 | const unsigned char *tbs, size_t tbslen)); |
1202 | 1174 | ||
1203 | void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, | 1175 | void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth, |
1204 | int (*verify_recover_init)(EVP_PKEY_CTX *ctx), | 1176 | int (*verify_recover_init)(EVP_PKEY_CTX *ctx), |
1205 | int (*verify_recover)(EVP_PKEY_CTX *ctx, | 1177 | int (*verify_recover)(EVP_PKEY_CTX *ctx, unsigned char *sig, |
1206 | unsigned char *sig, size_t *siglen, | 1178 | size_t *siglen, const unsigned char *tbs, size_t tbslen)); |
1207 | const unsigned char *tbs, size_t tbslen)); | ||
1208 | 1179 | ||
1209 | void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, | 1180 | void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth, |
1210 | int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), | 1181 | int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), |
1211 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 1182 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
1212 | EVP_MD_CTX *mctx)); | 1183 | EVP_MD_CTX *mctx)); |
1213 | 1184 | ||
1214 | void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, | 1185 | void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth, |
1215 | int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), | 1186 | int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx), |
1216 | int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,int siglen, | 1187 | int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen, |
1217 | EVP_MD_CTX *mctx)); | 1188 | EVP_MD_CTX *mctx)); |
1218 | 1189 | ||
1219 | void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, | 1190 | void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth, |
1220 | int (*encrypt_init)(EVP_PKEY_CTX *ctx), | 1191 | int (*encrypt_init)(EVP_PKEY_CTX *ctx), |
1221 | int (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | 1192 | int (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
1222 | const unsigned char *in, size_t inlen)); | 1193 | const unsigned char *in, size_t inlen)); |
1223 | 1194 | ||
1224 | void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, | 1195 | void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth, |
1225 | int (*decrypt_init)(EVP_PKEY_CTX *ctx), | 1196 | int (*decrypt_init)(EVP_PKEY_CTX *ctx), |
1226 | int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | 1197 | int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
1227 | const unsigned char *in, size_t inlen)); | 1198 | const unsigned char *in, size_t inlen)); |
1228 | 1199 | ||
1229 | void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, | 1200 | void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth, |
1230 | int (*derive_init)(EVP_PKEY_CTX *ctx), | 1201 | int (*derive_init)(EVP_PKEY_CTX *ctx), |
1231 | int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)); | 1202 | int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)); |
1232 | 1203 | ||
1233 | void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, | 1204 | void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth, |
1234 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2), | 1205 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2), |
1235 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, | 1206 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value)); |
1236 | const char *type, const char *value)); | ||
1237 | 1207 | ||
1238 | void EVP_add_alg_module(void); | 1208 | void EVP_add_alg_module(void); |
1239 | 1209 | ||
diff --git a/src/lib/libssl/src/crypto/evp/evp_locl.h b/src/lib/libssl/src/crypto/evp/evp_locl.h index 9e71f39a47..673c85f8bd 100644 --- a/src/lib/libssl/src/crypto/evp/evp_locl.h +++ b/src/lib/libssl/src/crypto/evp/evp_locl.h | |||
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -65,7 +65,7 @@ | |||
65 | bl = ctx->cipher->block_size;\ | 65 | bl = ctx->cipher->block_size;\ |
66 | if(inl < bl) return 1;\ | 66 | if(inl < bl) return 1;\ |
67 | inl -= bl; \ | 67 | inl -= bl; \ |
68 | for(i=0; i <= inl; i+=bl) | 68 | for(i=0; i <= inl; i+=bl) |
69 | 69 | ||
70 | #define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \ | 70 | #define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \ |
71 | static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \ | 71 | static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \ |
@@ -263,8 +263,7 @@ const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; } | |||
263 | EVP_CIPHER_get_asn1_iv, \ | 263 | EVP_CIPHER_get_asn1_iv, \ |
264 | NULL) | 264 | NULL) |
265 | 265 | ||
266 | struct evp_pkey_ctx_st | 266 | struct evp_pkey_ctx_st { |
267 | { | ||
268 | /* Method associated with this operation */ | 267 | /* Method associated with this operation */ |
269 | const EVP_PKEY_METHOD *pmeth; | 268 | const EVP_PKEY_METHOD *pmeth; |
270 | /* Engine that implements this method or NULL if builtin */ | 269 | /* Engine that implements this method or NULL if builtin */ |
@@ -284,12 +283,11 @@ struct evp_pkey_ctx_st | |||
284 | /* implementation specific keygen data */ | 283 | /* implementation specific keygen data */ |
285 | int *keygen_info; | 284 | int *keygen_info; |
286 | int keygen_info_count; | 285 | int keygen_info_count; |
287 | } /* EVP_PKEY_CTX */; | 286 | } /* EVP_PKEY_CTX */; |
288 | 287 | ||
289 | #define EVP_PKEY_FLAG_DYNAMIC 1 | 288 | #define EVP_PKEY_FLAG_DYNAMIC 1 |
290 | 289 | ||
291 | struct evp_pkey_method_st | 290 | struct evp_pkey_method_st { |
292 | { | ||
293 | int pkey_id; | 291 | int pkey_id; |
294 | int flags; | 292 | int flags; |
295 | 293 | ||
@@ -305,45 +303,42 @@ struct evp_pkey_method_st | |||
305 | 303 | ||
306 | int (*sign_init)(EVP_PKEY_CTX *ctx); | 304 | int (*sign_init)(EVP_PKEY_CTX *ctx); |
307 | int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 305 | int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
308 | const unsigned char *tbs, size_t tbslen); | 306 | const unsigned char *tbs, size_t tbslen); |
309 | 307 | ||
310 | int (*verify_init)(EVP_PKEY_CTX *ctx); | 308 | int (*verify_init)(EVP_PKEY_CTX *ctx); |
311 | int (*verify)(EVP_PKEY_CTX *ctx, | 309 | int (*verify)(EVP_PKEY_CTX *ctx, |
312 | const unsigned char *sig, size_t siglen, | 310 | const unsigned char *sig, size_t siglen, |
313 | const unsigned char *tbs, size_t tbslen); | 311 | const unsigned char *tbs, size_t tbslen); |
314 | 312 | ||
315 | int (*verify_recover_init)(EVP_PKEY_CTX *ctx); | 313 | int (*verify_recover_init)(EVP_PKEY_CTX *ctx); |
316 | int (*verify_recover)(EVP_PKEY_CTX *ctx, | 314 | int (*verify_recover)(EVP_PKEY_CTX *ctx, |
317 | unsigned char *rout, size_t *routlen, | 315 | unsigned char *rout, size_t *routlen, |
318 | const unsigned char *sig, size_t siglen); | 316 | const unsigned char *sig, size_t siglen); |
319 | 317 | ||
320 | int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); | 318 | int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); |
321 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 319 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
322 | EVP_MD_CTX *mctx); | 320 | EVP_MD_CTX *mctx); |
323 | 321 | ||
324 | int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); | 322 | int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); |
325 | int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,int siglen, | 323 | int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig, |
326 | EVP_MD_CTX *mctx); | 324 | int siglen, EVP_MD_CTX *mctx); |
327 | 325 | ||
328 | int (*encrypt_init)(EVP_PKEY_CTX *ctx); | 326 | int (*encrypt_init)(EVP_PKEY_CTX *ctx); |
329 | int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | 327 | int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
330 | const unsigned char *in, size_t inlen); | 328 | const unsigned char *in, size_t inlen); |
331 | 329 | ||
332 | int (*decrypt_init)(EVP_PKEY_CTX *ctx); | 330 | int (*decrypt_init)(EVP_PKEY_CTX *ctx); |
333 | int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | 331 | int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
334 | const unsigned char *in, size_t inlen); | 332 | const unsigned char *in, size_t inlen); |
335 | 333 | ||
336 | int (*derive_init)(EVP_PKEY_CTX *ctx); | 334 | int (*derive_init)(EVP_PKEY_CTX *ctx); |
337 | int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); | 335 | int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); |
338 | 336 | ||
339 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2); | 337 | int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2); |
340 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value); | 338 | int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value); |
341 | 339 | } /* EVP_PKEY_METHOD */; | |
342 | |||
343 | } /* EVP_PKEY_METHOD */; | ||
344 | 340 | ||
345 | void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); | 341 | void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); |
346 | 342 | ||
347 | int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | 343 | int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
348 | ASN1_TYPE *param, | 344 | ASN1_TYPE *param, const EVP_CIPHER *c, const EVP_MD *md, int en_de); |
349 | const EVP_CIPHER *c, const EVP_MD *md, int en_de); | ||