diff options
Diffstat (limited to 'src/lib/libcrypto/evp/evp.h')
-rw-r--r-- | src/lib/libcrypto/evp/evp.h | 347 |
1 files changed, 137 insertions, 210 deletions
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index b39fad93a4..570fe27d39 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
@@ -64,40 +64,40 @@ extern "C" { | |||
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #ifndef NO_MD2 | 66 | #ifndef NO_MD2 |
67 | #include "md2.h" | 67 | #include <openssl/md2.h> |
68 | #endif | 68 | #endif |
69 | #ifndef NO_MD5 | 69 | #ifndef NO_MD5 |
70 | #include "md5.h" | 70 | #include <openssl/md5.h> |
71 | #endif | 71 | #endif |
72 | #if !defined(NO_SHA) || !defined(NO_SHA1) | 72 | #ifndef NO_SHA |
73 | #include "sha.h" | 73 | #include <openssl/sha.h> |
74 | #endif | 74 | #endif |
75 | #ifndef NO_RIPEMD | 75 | #ifndef NO_RIPEMD |
76 | #include "ripemd.h" | 76 | #include <openssl/ripemd.h> |
77 | #endif | 77 | #endif |
78 | #ifndef NO_DES | 78 | #ifndef NO_DES |
79 | #include "des.h" | 79 | #include <openssl/des.h> |
80 | #endif | 80 | #endif |
81 | #ifndef NO_RC4 | 81 | #ifndef NO_RC4 |
82 | #include "rc4.h" | 82 | #include <openssl/rc4.h> |
83 | #endif | 83 | #endif |
84 | #ifndef NO_RC2 | 84 | #ifndef NO_RC2 |
85 | #include "rc2.h" | 85 | #include <openssl/rc2.h> |
86 | #endif | 86 | #endif |
87 | #ifndef NO_RC5 | 87 | #ifndef NO_RC5 |
88 | #include "rc5.h" | 88 | #include <openssl/rc5.h> |
89 | #endif | 89 | #endif |
90 | #ifndef NO_BLOWFISH | 90 | #ifndef NO_BF |
91 | #include "blowfish.h" | 91 | #include <openssl/blowfish.h> |
92 | #endif | 92 | #endif |
93 | #ifndef NO_CAST | 93 | #ifndef NO_CAST |
94 | #include "cast.h" | 94 | #include <openssl/cast.h> |
95 | #endif | 95 | #endif |
96 | #ifndef NO_IDEA | 96 | #ifndef NO_IDEA |
97 | #include "idea.h" | 97 | #include <openssl/idea.h> |
98 | #endif | 98 | #endif |
99 | #ifndef NO_MDC2 | 99 | #ifndef NO_MDC2 |
100 | #include "mdc2.h" | 100 | #include <openssl/mdc2.h> |
101 | #endif | 101 | #endif |
102 | 102 | ||
103 | #define EVP_RC2_KEY_SIZE 16 | 103 | #define EVP_RC2_KEY_SIZE 16 |
@@ -109,25 +109,23 @@ extern "C" { | |||
109 | #define EVP_MAX_KEY_LENGTH 24 | 109 | #define EVP_MAX_KEY_LENGTH 24 |
110 | #define EVP_MAX_IV_LENGTH 8 | 110 | #define EVP_MAX_IV_LENGTH 8 |
111 | 111 | ||
112 | #define PKCS5_SALT_LEN 8 | ||
113 | /* Default PKCS#5 iteration count */ | ||
114 | #define PKCS5_DEFAULT_ITER 2048 | ||
115 | |||
112 | #ifndef NO_RSA | 116 | #ifndef NO_RSA |
113 | #include "rsa.h" | 117 | #include <openssl/rsa.h> |
114 | #else | ||
115 | #define RSA long | ||
116 | #endif | 118 | #endif |
117 | 119 | ||
118 | #ifndef NO_DSA | 120 | #ifndef NO_DSA |
119 | #include "dsa.h" | 121 | #include <openssl/dsa.h> |
120 | #else | ||
121 | #define DSA long | ||
122 | #endif | 122 | #endif |
123 | 123 | ||
124 | #ifndef NO_DH | 124 | #ifndef NO_DH |
125 | #include "dh.h" | 125 | #include <openssl/dh.h> |
126 | #else | ||
127 | #define DH long | ||
128 | #endif | 126 | #endif |
129 | 127 | ||
130 | #include "objects.h" | 128 | #include <openssl/objects.h> |
131 | 129 | ||
132 | #define EVP_PK_RSA 0x0001 | 130 | #define EVP_PK_RSA 0x0001 |
133 | #define EVP_PK_DSA 0x0002 | 131 | #define EVP_PK_DSA 0x0002 |
@@ -159,16 +157,18 @@ typedef struct evp_pkey_st | |||
159 | int references; | 157 | int references; |
160 | union { | 158 | union { |
161 | char *ptr; | 159 | char *ptr; |
160 | #ifndef NO_RSA | ||
162 | struct rsa_st *rsa; /* RSA */ | 161 | struct rsa_st *rsa; /* RSA */ |
162 | #endif | ||
163 | #ifndef NO_DSA | ||
163 | struct dsa_st *dsa; /* DSA */ | 164 | struct dsa_st *dsa; /* DSA */ |
165 | #endif | ||
166 | #ifndef NO_DH | ||
164 | struct dh_st *dh; /* DH */ | 167 | struct dh_st *dh; /* DH */ |
168 | #endif | ||
165 | } pkey; | 169 | } pkey; |
166 | int save_parameters; | 170 | int save_parameters; |
167 | #ifdef HEADER_STACK_H | 171 | STACK /*X509_ATTRIBUTE*/ *attributes; /* [ 0 ] */ |
168 | STACK /* X509_ATTRIBUTE */ *attributes; /* [ 0 ] */ | ||
169 | #else | ||
170 | char /* X509_ATTRIBUTE */ *attributes; /* [ 0 ] */ | ||
171 | #endif | ||
172 | } EVP_PKEY; | 172 | } EVP_PKEY; |
173 | 173 | ||
174 | #define EVP_PKEY_MO_SIGN 0x0001 | 174 | #define EVP_PKEY_MO_SIGN 0x0001 |
@@ -183,7 +183,7 @@ typedef struct evp_pkey_st | |||
183 | * This is required because for various smart-card perform the digest and | 183 | * This is required because for various smart-card perform the digest and |
184 | * signing/verification on-board. To handle this case, the specific | 184 | * signing/verification on-board. To handle this case, the specific |
185 | * EVP_MD and EVP_PKEY_METHODs need to be closely associated. | 185 | * EVP_MD and EVP_PKEY_METHODs need to be closely associated. |
186 | * When a PKEY is created, it will have a EVP_PKEY_METHOD ossociated with it. | 186 | * When a PKEY is created, it will have a EVP_PKEY_METHOD associated with it. |
187 | * This can either be software or a token to provide the required low level | 187 | * This can either be software or a token to provide the required low level |
188 | * routines. | 188 | * routines. |
189 | */ | 189 | */ |
@@ -194,28 +194,28 @@ typedef struct evp_pkey_md_st | |||
194 | EVP_PKEY_METHOD *pkey; | 194 | EVP_PKEY_METHOD *pkey; |
195 | } EVP_PKEY_MD; | 195 | } EVP_PKEY_MD; |
196 | 196 | ||
197 | #define EVP_rsa_md2() | 197 | #define EVP_rsa_md2() \ |
198 | EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\ | 198 | EVP_PKEY_MD_add(NID_md2WithRSAEncryption,\ |
199 | EVP_rsa_pkcs1(),EVP_md2()) | 199 | EVP_rsa_pkcs1(),EVP_md2()) |
200 | #define EVP_rsa_md5() | 200 | #define EVP_rsa_md5() \ |
201 | EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\ | 201 | EVP_PKEY_MD_add(NID_md5WithRSAEncryption,\ |
202 | EVP_rsa_pkcs1(),EVP_md5()) | 202 | EVP_rsa_pkcs1(),EVP_md5()) |
203 | #define EVP_rsa_sha0() | 203 | #define EVP_rsa_sha0() \ |
204 | EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\ | 204 | EVP_PKEY_MD_add(NID_shaWithRSAEncryption,\ |
205 | EVP_rsa_pkcs1(),EVP_sha()) | 205 | EVP_rsa_pkcs1(),EVP_sha()) |
206 | #define EVP_rsa_sha1() | 206 | #define EVP_rsa_sha1() \ |
207 | EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\ | 207 | EVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\ |
208 | EVP_rsa_pkcs1(),EVP_sha1()) | 208 | EVP_rsa_pkcs1(),EVP_sha1()) |
209 | #define EVP_rsa_ripemd160() | 209 | #define EVP_rsa_ripemd160() \ |
210 | EVP_PKEY_MD_add(NID_ripemd160WithRSA,\ | 210 | EVP_PKEY_MD_add(NID_ripemd160WithRSA,\ |
211 | EVP_rsa_pkcs1(),EVP_ripemd160()) | 211 | EVP_rsa_pkcs1(),EVP_ripemd160()) |
212 | #define EVP_rsa_mdc2() | 212 | #define EVP_rsa_mdc2() \ |
213 | EVP_PKEY_MD_add(NID_mdc2WithRSA,\ | 213 | EVP_PKEY_MD_add(NID_mdc2WithRSA,\ |
214 | EVP_rsa_octet_string(),EVP_mdc2()) | 214 | EVP_rsa_octet_string(),EVP_mdc2()) |
215 | #define EVP_dsa_sha() | 215 | #define EVP_dsa_sha() \ |
216 | EVP_PKEY_MD_add(NID_dsaWithSHA,\ | 216 | EVP_PKEY_MD_add(NID_dsaWithSHA,\ |
217 | EVP_dsa(),EVP_mdc2()) | 217 | EVP_dsa(),EVP_mdc2()) |
218 | #define EVP_dsa_sha1() | 218 | #define EVP_dsa_sha1() \ |
219 | EVP_PKEY_MD_add(NID_dsaWithSHA1,\ | 219 | EVP_PKEY_MD_add(NID_dsaWithSHA1,\ |
220 | EVP_dsa(),EVP_sha1()) | 220 | EVP_dsa(),EVP_sha1()) |
221 | 221 | ||
@@ -261,6 +261,8 @@ typedef struct env_md_st | |||
261 | int ctx_size; /* how big does the ctx need to be */ | 261 | int ctx_size; /* how big does the ctx need to be */ |
262 | } EVP_MD; | 262 | } EVP_MD; |
263 | 263 | ||
264 | |||
265 | |||
264 | #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} | 266 | #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0} |
265 | 267 | ||
266 | #ifndef NO_DSA | 268 | #ifndef NO_DSA |
@@ -287,7 +289,7 @@ typedef struct env_md_st | |||
287 | 289 | ||
288 | typedef struct env_md_ctx_st | 290 | typedef struct env_md_ctx_st |
289 | { | 291 | { |
290 | EVP_MD *digest; | 292 | const EVP_MD *digest; |
291 | union { | 293 | union { |
292 | unsigned char base[4]; | 294 | unsigned char base[4]; |
293 | #ifndef NO_MD2 | 295 | #ifndef NO_MD2 |
@@ -296,10 +298,10 @@ typedef struct env_md_ctx_st | |||
296 | #ifndef NO_MD5 | 298 | #ifndef NO_MD5 |
297 | MD5_CTX md5; | 299 | MD5_CTX md5; |
298 | #endif | 300 | #endif |
299 | #ifndef NO_MD5 | 301 | #ifndef NO_RIPEMD |
300 | RIPEMD160_CTX ripemd160; | 302 | RIPEMD160_CTX ripemd160; |
301 | #endif | 303 | #endif |
302 | #if !defined(NO_SHA) || !defined(NO_SHA1) | 304 | #ifndef NO_SHA |
303 | SHA_CTX sha; | 305 | SHA_CTX sha; |
304 | #endif | 306 | #endif |
305 | #ifndef NO_MDC2 | 307 | #ifndef NO_MDC2 |
@@ -326,13 +328,13 @@ typedef struct evp_cipher_st | |||
326 | 328 | ||
327 | typedef struct evp_cipher_info_st | 329 | typedef struct evp_cipher_info_st |
328 | { | 330 | { |
329 | EVP_CIPHER *cipher; | 331 | const EVP_CIPHER *cipher; |
330 | unsigned char iv[EVP_MAX_IV_LENGTH]; | 332 | unsigned char iv[EVP_MAX_IV_LENGTH]; |
331 | } EVP_CIPHER_INFO; | 333 | } EVP_CIPHER_INFO; |
332 | 334 | ||
333 | typedef struct evp_cipher_ctx_st | 335 | typedef struct evp_cipher_ctx_st |
334 | { | 336 | { |
335 | EVP_CIPHER *cipher; | 337 | const EVP_CIPHER *cipher; |
336 | int encrypt; /* encrypt or decrypt */ | 338 | int encrypt; /* encrypt or decrypt */ |
337 | int buf_len; /* number we have left */ | 339 | int buf_len; /* number we have left */ |
338 | 340 | ||
@@ -355,8 +357,8 @@ typedef struct evp_cipher_ctx_st | |||
355 | struct | 357 | struct |
356 | { | 358 | { |
357 | des_key_schedule ks;/* key schedule */ | 359 | des_key_schedule ks;/* key schedule */ |
358 | C_Block inw; | 360 | des_cblock inw; |
359 | C_Block outw; | 361 | des_cblock outw; |
360 | } desx_cbc; | 362 | } desx_cbc; |
361 | struct | 363 | struct |
362 | { | 364 | { |
@@ -374,7 +376,7 @@ typedef struct evp_cipher_ctx_st | |||
374 | #ifndef NO_RC5 | 376 | #ifndef NO_RC5 |
375 | RC5_32_KEY rc5_ks;/* key schedule */ | 377 | RC5_32_KEY rc5_ks;/* key schedule */ |
376 | #endif | 378 | #endif |
377 | #ifndef NO_BLOWFISH | 379 | #ifndef NO_BF |
378 | BF_KEY bf_ks;/* key schedule */ | 380 | BF_KEY bf_ks;/* key schedule */ |
379 | #endif | 381 | #endif |
380 | #ifndef NO_CAST | 382 | #ifndef NO_CAST |
@@ -396,6 +398,11 @@ typedef struct evp_Encode_Ctx_st | |||
396 | int expect_nl; | 398 | int expect_nl; |
397 | } EVP_ENCODE_CTX; | 399 | } EVP_ENCODE_CTX; |
398 | 400 | ||
401 | /* Password based encryption function */ | ||
402 | typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | ||
403 | ASN1_TYPE *param, EVP_CIPHER *cipher, | ||
404 | EVP_MD *md, int en_de); | ||
405 | |||
399 | #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ | 406 | #define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\ |
400 | (char *)(rsa)) | 407 | (char *)(rsa)) |
401 | #define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ | 408 | #define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\ |
@@ -430,6 +437,7 @@ typedef struct evp_Encode_Ctx_st | |||
430 | #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) | 437 | #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) |
431 | #define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data) | 438 | #define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data) |
432 | #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) | 439 | #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) |
440 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) | ||
433 | 441 | ||
434 | #define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) | 442 | #define EVP_ENCODE_LENGTH(l) (((l+2)/3*4)+(l/48+1)*2+80) |
435 | #define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80) | 443 | #define EVP_DECODE_LENGTH(l) ((l+3)/4*3+80) |
@@ -441,43 +449,56 @@ typedef struct evp_Encode_Ctx_st | |||
441 | #define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) | 449 | #define EVP_OpenUpdate(a,b,c,d,e) EVP_DecryptUpdate(a,b,c,d,e) |
442 | #define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) | 450 | #define EVP_SealUpdate(a,b,c,d,e) EVP_EncryptUpdate(a,b,c,d,e) |
443 | 451 | ||
444 | #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) | 452 | #ifdef CONST_STRICT |
453 | void BIO_set_md(BIO *,const EVP_MD *md); | ||
454 | #else | ||
455 | # define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,0,(char *)md) | ||
456 | #endif | ||
445 | #define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) | 457 | #define BIO_get_md(b,mdp) BIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp) |
446 | #define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) | 458 | #define BIO_get_md_ctx(b,mdcp) BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp) |
447 | #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) | 459 | #define BIO_get_cipher_status(b) BIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL) |
460 | #define BIO_get_cipher_ctx(b,c_pp) BIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp) | ||
448 | 461 | ||
449 | #define EVP_Cipher(c,o,i,l) (c)->cipher->do_cipher((c),(o),(i),(l)) | 462 | #define EVP_Cipher(c,o,i,l) (c)->cipher->do_cipher((c),(o),(i),(l)) |
450 | 463 | ||
451 | #ifndef NOPROTO | 464 | #define EVP_add_cipher_alias(n,alias) \ |
465 | OBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n)) | ||
466 | #define EVP_add_digest_alias(n,alias) \ | ||
467 | OBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n)) | ||
468 | #define EVP_delete_cipher_alias(alias) \ | ||
469 | OBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS); | ||
470 | #define EVP_delete_digest_alias(alias) \ | ||
471 | OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS); | ||
452 | 472 | ||
453 | void EVP_DigestInit(EVP_MD_CTX *ctx, EVP_MD *type); | 473 | |
454 | void EVP_DigestUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt); | 474 | int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in); |
475 | void EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); | ||
476 | void EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d, | ||
477 | unsigned int cnt); | ||
455 | void EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); | 478 | void EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s); |
456 | 479 | ||
457 | int EVP_read_pw_string(char *buf,int length,char *prompt,int verify); | 480 | int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); |
458 | void EVP_set_pw_prompt(char *prompt); | 481 | void EVP_set_pw_prompt(char *prompt); |
459 | char * EVP_get_pw_prompt(void); | 482 | char * EVP_get_pw_prompt(void); |
460 | 483 | ||
461 | int EVP_BytesToKey(EVP_CIPHER *type,EVP_MD *md,unsigned char *salt, | 484 | int EVP_BytesToKey(const EVP_CIPHER *type,EVP_MD *md,unsigned char *salt, |
462 | unsigned char *data, int datal, int count, | 485 | unsigned char *data, int datal, int count, |
463 | unsigned char *key,unsigned char *iv); | 486 | unsigned char *key,unsigned char *iv); |
464 | 487 | ||
465 | EVP_CIPHER *EVP_get_cipherbyname(char *name); | 488 | void EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, |
466 | |||
467 | void EVP_EncryptInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type, | ||
468 | unsigned char *key, unsigned char *iv); | 489 | unsigned char *key, unsigned char *iv); |
469 | void EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 490 | void EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
470 | int *outl, unsigned char *in, int inl); | 491 | int *outl, unsigned char *in, int inl); |
471 | void EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | 492 | void EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); |
472 | 493 | ||
473 | void EVP_DecryptInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type, | 494 | void EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, |
474 | unsigned char *key, unsigned char *iv); | 495 | unsigned char *key, unsigned char *iv); |
475 | void EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 496 | void EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
476 | int *outl, unsigned char *in, int inl); | 497 | int *outl, unsigned char *in, int inl); |
477 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | 498 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); |
478 | 499 | ||
479 | void EVP_CipherInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type, unsigned char *key, | 500 | void EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, |
480 | unsigned char *iv,int enc); | 501 | unsigned char *key,unsigned char *iv,int enc); |
481 | void EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 502 | void EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
482 | int *outl, unsigned char *in, int inl); | 503 | int *outl, unsigned char *in, int inl); |
483 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); | 504 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl); |
@@ -519,7 +540,8 @@ void EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | |||
519 | BIO_METHOD *BIO_f_md(void); | 540 | BIO_METHOD *BIO_f_md(void); |
520 | BIO_METHOD *BIO_f_base64(void); | 541 | BIO_METHOD *BIO_f_base64(void); |
521 | BIO_METHOD *BIO_f_cipher(void); | 542 | BIO_METHOD *BIO_f_cipher(void); |
522 | void BIO_set_cipher(BIO *b,EVP_CIPHER *c,unsigned char *k, | 543 | BIO_METHOD *BIO_f_reliable(void); |
544 | void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,unsigned char *k, | ||
523 | unsigned char *i, int enc); | 545 | unsigned char *i, int enc); |
524 | #endif | 546 | #endif |
525 | 547 | ||
@@ -556,6 +578,7 @@ EVP_CIPHER *EVP_idea_cbc(void); | |||
556 | EVP_CIPHER *EVP_rc2_ecb(void); | 578 | EVP_CIPHER *EVP_rc2_ecb(void); |
557 | EVP_CIPHER *EVP_rc2_cbc(void); | 579 | EVP_CIPHER *EVP_rc2_cbc(void); |
558 | EVP_CIPHER *EVP_rc2_40_cbc(void); | 580 | EVP_CIPHER *EVP_rc2_40_cbc(void); |
581 | EVP_CIPHER *EVP_rc2_64_cbc(void); | ||
559 | EVP_CIPHER *EVP_rc2_cfb(void); | 582 | EVP_CIPHER *EVP_rc2_cfb(void); |
560 | EVP_CIPHER *EVP_rc2_ofb(void); | 583 | EVP_CIPHER *EVP_rc2_ofb(void); |
561 | EVP_CIPHER *EVP_bf_ecb(void); | 584 | EVP_CIPHER *EVP_bf_ecb(void); |
@@ -577,11 +600,9 @@ void SSLeay_add_all_digests(void); | |||
577 | 600 | ||
578 | int EVP_add_cipher(EVP_CIPHER *cipher); | 601 | int EVP_add_cipher(EVP_CIPHER *cipher); |
579 | int EVP_add_digest(EVP_MD *digest); | 602 | int EVP_add_digest(EVP_MD *digest); |
580 | int EVP_add_alias(char *name,char *alias); | ||
581 | int EVP_delete_alias(char *name); | ||
582 | 603 | ||
583 | EVP_CIPHER *EVP_get_cipherbyname(char *name); | 604 | const EVP_CIPHER *EVP_get_cipherbyname(const char *name); |
584 | EVP_MD *EVP_get_digestbyname(char *name); | 605 | const EVP_MD *EVP_get_digestbyname(const char *name); |
585 | void EVP_cleanup(void); | 606 | void EVP_cleanup(void); |
586 | 607 | ||
587 | int EVP_PKEY_decrypt(unsigned char *dec_key,unsigned char *enc_key, | 608 | int EVP_PKEY_decrypt(unsigned char *dec_key,unsigned char *enc_key, |
@@ -607,6 +628,8 @@ int EVP_PKEY_missing_parameters(EVP_PKEY *pkey); | |||
607 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode); | 628 | int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode); |
608 | int EVP_PKEY_cmp_parameters(EVP_PKEY *a,EVP_PKEY *b); | 629 | int EVP_PKEY_cmp_parameters(EVP_PKEY *a,EVP_PKEY *b); |
609 | 630 | ||
631 | int EVP_CIPHER_type(const EVP_CIPHER *ctx); | ||
632 | |||
610 | /* calls methods */ | 633 | /* calls methods */ |
611 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | 634 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
612 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | 635 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
@@ -615,177 +638,81 @@ int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | |||
615 | int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); | 638 | int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); |
616 | int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); | 639 | int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type); |
617 | 640 | ||
618 | #else | 641 | /* PKCS5 password based encryption */ |
619 | 642 | int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, | |
620 | void EVP_DigestInit(); | 643 | ASN1_TYPE *param, EVP_CIPHER *cipher, EVP_MD *md, |
621 | void EVP_DigestUpdate(); | 644 | int en_de); |
622 | void EVP_DigestFinal(); | 645 | int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen, |
623 | 646 | unsigned char *salt, int saltlen, int iter, | |
624 | int EVP_read_pw_string(); | 647 | int keylen, unsigned char *out); |
625 | void EVP_set_pw_prompt(); | 648 | int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, |
626 | char * EVP_get_pw_prompt(); | 649 | ASN1_TYPE *param, EVP_CIPHER *cipher, EVP_MD *md, |
627 | 650 | int en_de); | |
628 | int EVP_BytesToKey(); | 651 | |
629 | 652 | void PKCS5_PBE_add(void); | |
630 | EVP_CIPHER *EVP_get_cipherbyname(); | 653 | |
631 | 654 | int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen, | |
632 | void EVP_EncryptInit(); | 655 | ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de); |
633 | void EVP_EncryptUpdate(); | 656 | int EVP_PBE_alg_add(int nid, EVP_CIPHER *cipher, EVP_MD *md, |
634 | void EVP_EncryptFinal(); | 657 | EVP_PBE_KEYGEN *keygen); |
635 | 658 | void EVP_PBE_cleanup(void); | |
636 | void EVP_DecryptInit(); | ||
637 | void EVP_DecryptUpdate(); | ||
638 | int EVP_DecryptFinal(); | ||
639 | |||
640 | void EVP_CipherInit(); | ||
641 | void EVP_CipherUpdate(); | ||
642 | int EVP_CipherFinal(); | ||
643 | |||
644 | int EVP_SignFinal(); | ||
645 | |||
646 | int EVP_VerifyFinal(); | ||
647 | |||
648 | int EVP_OpenInit(); | ||
649 | int EVP_OpenFinal(); | ||
650 | |||
651 | int EVP_SealInit(); | ||
652 | void EVP_SealFinal(); | ||
653 | |||
654 | void EVP_EncodeInit(); | ||
655 | void EVP_EncodeUpdate(); | ||
656 | void EVP_EncodeFinal(); | ||
657 | int EVP_EncodeBlock(); | ||
658 | |||
659 | void EVP_DecodeInit(); | ||
660 | int EVP_DecodeUpdate(); | ||
661 | int EVP_DecodeFinal(); | ||
662 | int EVP_DecodeBlock(); | ||
663 | |||
664 | void ERR_load_EVP_strings(); | ||
665 | |||
666 | void EVP_CIPHER_CTX_init(); | ||
667 | void EVP_CIPHER_CTX_cleanup(); | ||
668 | |||
669 | #ifdef HEADER_BIO_H | ||
670 | BIO_METHOD *BIO_f_md(); | ||
671 | BIO_METHOD *BIO_f_base64(); | ||
672 | BIO_METHOD *BIO_f_cipher(); | ||
673 | void BIO_set_cipher(); | ||
674 | #endif | ||
675 | |||
676 | EVP_MD *EVP_md_null(); | ||
677 | EVP_MD *EVP_md2(); | ||
678 | EVP_MD *EVP_md5(); | ||
679 | EVP_MD *EVP_sha(); | ||
680 | EVP_MD *EVP_sha1(); | ||
681 | EVP_MD *EVP_dss(); | ||
682 | EVP_MD *EVP_dss1(); | ||
683 | EVP_MD *EVP_mdc2(); | ||
684 | |||
685 | EVP_CIPHER *EVP_enc_null(); | ||
686 | EVP_CIPHER *EVP_des_ecb(); | ||
687 | EVP_CIPHER *EVP_des_ede(); | ||
688 | EVP_CIPHER *EVP_des_ede3(); | ||
689 | EVP_CIPHER *EVP_des_cfb(); | ||
690 | EVP_CIPHER *EVP_des_ede_cfb(); | ||
691 | EVP_CIPHER *EVP_des_ede3_cfb(); | ||
692 | EVP_CIPHER *EVP_des_ofb(); | ||
693 | EVP_CIPHER *EVP_des_ede_ofb(); | ||
694 | EVP_CIPHER *EVP_des_ede3_ofb(); | ||
695 | EVP_CIPHER *EVP_des_cbc(); | ||
696 | EVP_CIPHER *EVP_des_ede_cbc(); | ||
697 | EVP_CIPHER *EVP_des_ede3_cbc(); | ||
698 | EVP_CIPHER *EVP_desx_cbc(); | ||
699 | EVP_CIPHER *EVP_rc4(); | ||
700 | EVP_CIPHER *EVP_rc4_40(); | ||
701 | EVP_CIPHER *EVP_idea_ecb(); | ||
702 | EVP_CIPHER *EVP_idea_cfb(); | ||
703 | EVP_CIPHER *EVP_idea_ofb(); | ||
704 | EVP_CIPHER *EVP_idea_cbc(); | ||
705 | EVP_CIPHER *EVP_rc2_ecb(); | ||
706 | EVP_CIPHER *EVP_rc2_cbc(); | ||
707 | EVP_CIPHER *EVP_rc2_40_cbc(); | ||
708 | EVP_CIPHER *EVP_rc2_cfb(); | ||
709 | EVP_CIPHER *EVP_rc2_ofb(); | ||
710 | EVP_CIPHER *EVP_bf_ecb(); | ||
711 | EVP_CIPHER *EVP_bf_cbc(); | ||
712 | EVP_CIPHER *EVP_bf_cfb(); | ||
713 | EVP_CIPHER *EVP_bf_ofb(); | ||
714 | EVP_CIPHER *EVP_cast5_ecb(); | ||
715 | EVP_CIPHER *EVP_cast5_cbc(); | ||
716 | EVP_CIPHER *EVP_cast5_cfb(); | ||
717 | EVP_CIPHER *EVP_cast5_ofb(); | ||
718 | EVP_CIPHER *EVP_rc5_32_12_16_cbc(); | ||
719 | EVP_CIPHER *EVP_rc5_32_12_16_ecb(); | ||
720 | EVP_CIPHER *EVP_rc5_32_12_16_cfb(); | ||
721 | EVP_CIPHER *EVP_rc5_32_12_16_ofb(); | ||
722 | |||
723 | void SSLeay_add_all_algorithms(); | ||
724 | void SSLeay_add_all_ciphers(); | ||
725 | void SSLeay_add_all_digests(); | ||
726 | |||
727 | int EVP_add_cipher(); | ||
728 | int EVP_add_digest(); | ||
729 | int EVP_add_alias(); | ||
730 | int EVP_delete_alias(); | ||
731 | |||
732 | EVP_CIPHER *EVP_get_cipherbyname(); | ||
733 | EVP_MD *EVP_get_digestbyname(); | ||
734 | void EVP_cleanup(); | ||
735 | |||
736 | int EVP_PKEY_decrypt(); | ||
737 | int EVP_PKEY_encrypt(); | ||
738 | int EVP_PKEY_type(); | ||
739 | int EVP_PKEY_bits(); | ||
740 | int EVP_PKEY_size(); | ||
741 | int EVP_PKEY_assign(); | ||
742 | EVP_PKEY * EVP_PKEY_new(); | ||
743 | void EVP_PKEY_free(); | ||
744 | EVP_PKEY * d2i_PublicKey(); | ||
745 | int i2d_PublicKey(); | ||
746 | |||
747 | EVP_PKEY * d2i_PrivateKey(); | ||
748 | int i2d_PrivateKey(); | ||
749 | |||
750 | int EVP_PKEY_copy_parameters(); | ||
751 | int EVP_PKEY_missing_parameters(); | ||
752 | int EVP_PKEY_save_parameters(); | ||
753 | int EVP_PKEY_cmp_parameters(); | ||
754 | |||
755 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | ||
756 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | ||
757 | |||
758 | int EVP_CIPHER_set_asn1_iv(); | ||
759 | int EVP_CIPHER_get_asn1_iv(); | ||
760 | |||
761 | #endif | ||
762 | 659 | ||
763 | /* BEGIN ERROR CODES */ | 660 | /* BEGIN ERROR CODES */ |
661 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
662 | * made after this point may be overwritten when the script is next run. | ||
663 | */ | ||
664 | |||
764 | /* Error codes for the EVP functions. */ | 665 | /* Error codes for the EVP functions. */ |
765 | 666 | ||
766 | /* Function codes. */ | 667 | /* Function codes. */ |
767 | #define EVP_F_D2I_PKEY 100 | 668 | #define EVP_F_D2I_PKEY 100 |
768 | #define EVP_F_EVP_DECRYPTFINAL 101 | 669 | #define EVP_F_EVP_DECRYPTFINAL 101 |
670 | #define EVP_F_EVP_MD_CTX_COPY 110 | ||
769 | #define EVP_F_EVP_OPENINIT 102 | 671 | #define EVP_F_EVP_OPENINIT 102 |
672 | #define EVP_F_EVP_PBE_ALG_ADD 115 | ||
673 | #define EVP_F_EVP_PBE_CIPHERINIT 116 | ||
674 | #define EVP_F_EVP_PKCS82PKEY 111 | ||
675 | #define EVP_F_EVP_PKCS8_SET_BROKEN 112 | ||
676 | #define EVP_F_EVP_PKEY2PKCS8 113 | ||
770 | #define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 | 677 | #define EVP_F_EVP_PKEY_COPY_PARAMETERS 103 |
771 | #define EVP_F_EVP_PKEY_DECRYPT 104 | 678 | #define EVP_F_EVP_PKEY_DECRYPT 104 |
772 | #define EVP_F_EVP_PKEY_ENCRYPT 105 | 679 | #define EVP_F_EVP_PKEY_ENCRYPT 105 |
773 | #define EVP_F_EVP_PKEY_NEW 106 | 680 | #define EVP_F_EVP_PKEY_NEW 106 |
774 | #define EVP_F_EVP_SIGNFINAL 107 | 681 | #define EVP_F_EVP_SIGNFINAL 107 |
775 | #define EVP_F_EVP_VERIFYFINAL 108 | 682 | #define EVP_F_EVP_VERIFYFINAL 108 |
683 | #define EVP_F_PKCS5_PBE_KEYIVGEN 117 | ||
684 | #define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118 | ||
685 | #define EVP_F_RC2_MAGIC_TO_METH 109 | ||
776 | 686 | ||
777 | /* Reason codes. */ | 687 | /* Reason codes. */ |
778 | #define EVP_R_BAD_DECRYPT 100 | 688 | #define EVP_R_BAD_DECRYPT 100 |
689 | #define EVP_R_BN_DECODE_ERROR 112 | ||
690 | #define EVP_R_BN_PUBKEY_ERROR 113 | ||
691 | #define EVP_R_CIPHER_PARAMETER_ERROR 122 | ||
692 | #define EVP_R_DECODE_ERROR 114 | ||
779 | #define EVP_R_DIFFERENT_KEY_TYPES 101 | 693 | #define EVP_R_DIFFERENT_KEY_TYPES 101 |
694 | #define EVP_R_ENCODE_ERROR 115 | ||
695 | #define EVP_R_EVP_PBE_CIPHERINIT_ERROR 119 | ||
696 | #define EVP_R_INPUT_NOT_INITIALIZED 111 | ||
780 | #define EVP_R_IV_TOO_LARGE 102 | 697 | #define EVP_R_IV_TOO_LARGE 102 |
698 | #define EVP_R_KEYGEN_FAILURE 120 | ||
781 | #define EVP_R_MISSING_PARMATERS 103 | 699 | #define EVP_R_MISSING_PARMATERS 103 |
700 | #define EVP_R_NO_DSA_PARAMETERS 116 | ||
782 | #define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 | 701 | #define EVP_R_NO_SIGN_FUNCTION_CONFIGURED 104 |
783 | #define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 | 702 | #define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED 105 |
703 | #define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE 117 | ||
784 | #define EVP_R_PUBLIC_KEY_NOT_RSA 106 | 704 | #define EVP_R_PUBLIC_KEY_NOT_RSA 106 |
705 | #define EVP_R_UNKNOWN_PBE_ALGORITHM 121 | ||
785 | #define EVP_R_UNSUPPORTED_CIPHER 107 | 706 | #define EVP_R_UNSUPPORTED_CIPHER 107 |
786 | #define EVP_R_WRONG_FINAL_BLOCK_LENGTH 108 | 707 | #define EVP_R_UNSUPPORTED_KEYLENGTH 123 |
787 | #define EVP_R_WRONG_PUBLIC_KEY_TYPE 109 | 708 | #define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION 124 |
788 | 709 | #define EVP_R_UNSUPPORTED_KEY_SIZE 108 | |
710 | #define EVP_R_UNSUPPORTED_PRF 125 | ||
711 | #define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM 118 | ||
712 | #define EVP_R_UNSUPPORTED_SALT_TYPE 126 | ||
713 | #define EVP_R_WRONG_FINAL_BLOCK_LENGTH 109 | ||
714 | #define EVP_R_WRONG_PUBLIC_KEY_TYPE 110 | ||
715 | |||
789 | #ifdef __cplusplus | 716 | #ifdef __cplusplus |
790 | } | 717 | } |
791 | #endif | 718 | #endif |