diff options
Diffstat (limited to 'src')
36 files changed, 210 insertions, 235 deletions
diff --git a/src/lib/libcrypto/asn1/p5_pbev2.c b/src/lib/libcrypto/asn1/p5_pbev2.c index 43dfe09479..91e1c8987d 100644 --- a/src/lib/libcrypto/asn1/p5_pbev2.c +++ b/src/lib/libcrypto/asn1/p5_pbev2.c | |||
| @@ -116,6 +116,8 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
| 116 | if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) | 116 | if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) |
| 117 | goto err; | 117 | goto err; |
| 118 | 118 | ||
| 119 | EVP_CIPHER_CTX_init(&ctx); | ||
| 120 | |||
| 119 | /* Dummy cipherinit to just setup the IV */ | 121 | /* Dummy cipherinit to just setup the IV */ |
| 120 | EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0); | 122 | EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0); |
| 121 | if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { | 123 | if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { |
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index b7e268f092..3ce1290772 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/lib/libcrypto/bio/b_print.c | |||
| @@ -56,6 +56,13 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | /* disable assert() unless BIO_DEBUG has been defined */ | ||
| 60 | #ifndef BIO_DEBUG | ||
| 61 | # ifndef NDEBUG | ||
| 62 | # define NDEBUG | ||
| 63 | # endif | ||
| 64 | #endif | ||
| 65 | |||
| 59 | /* | 66 | /* |
| 60 | * Stolen from tjh's ssl/ssl_trc.c stuff. | 67 | * Stolen from tjh's ssl/ssl_trc.c stuff. |
| 61 | */ | 68 | */ |
| @@ -716,12 +723,13 @@ doapr_outch( | |||
| 716 | if (buffer) { | 723 | if (buffer) { |
| 717 | while (*currlen >= *maxlen) { | 724 | while (*currlen >= *maxlen) { |
| 718 | if (*buffer == NULL) { | 725 | if (*buffer == NULL) { |
| 719 | assert(*sbuffer != NULL); | ||
| 720 | if (*maxlen == 0) | 726 | if (*maxlen == 0) |
| 721 | *maxlen = 1024; | 727 | *maxlen = 1024; |
| 722 | *buffer = OPENSSL_malloc(*maxlen); | 728 | *buffer = OPENSSL_malloc(*maxlen); |
| 723 | if (*currlen > 0) | 729 | if (*currlen > 0) { |
| 730 | assert(*sbuffer != NULL); | ||
| 724 | memcpy(*buffer, *sbuffer, *currlen); | 731 | memcpy(*buffer, *sbuffer, *currlen); |
| 732 | } | ||
| 725 | *sbuffer = NULL; | 733 | *sbuffer = NULL; |
| 726 | } else { | 734 | } else { |
| 727 | *maxlen += 1024; | 735 | *maxlen += 1024; |
| @@ -761,7 +769,9 @@ int BIO_vprintf (BIO *bio, const char *format, va_list args) | |||
| 761 | { | 769 | { |
| 762 | int ret; | 770 | int ret; |
| 763 | size_t retlen; | 771 | size_t retlen; |
| 764 | MS_STATIC char hugebuf[1024*10]; | 772 | char hugebuf[1024*2]; /* Was previously 10k, which is unreasonable |
| 773 | in small-stack environments, like threads | ||
| 774 | or DOS programs. */ | ||
| 765 | char *hugebufp = hugebuf; | 775 | char *hugebufp = hugebuf; |
| 766 | size_t hugebufsize = sizeof(hugebuf); | 776 | size_t hugebufsize = sizeof(hugebuf); |
| 767 | char *dynbuf = NULL; | 777 | char *dynbuf = NULL; |
diff --git a/src/lib/libcrypto/bio/bss_bio.c b/src/lib/libcrypto/bio/bss_bio.c index a5da473031..1c485a4479 100644 --- a/src/lib/libcrypto/bio/bss_bio.c +++ b/src/lib/libcrypto/bio/bss_bio.c | |||
| @@ -7,9 +7,18 @@ | |||
| 7 | * for which no specific BIO method is available. | 7 | * for which no specific BIO method is available. |
| 8 | * See ssl/ssltest.c for some hints on how this can be used. */ | 8 | * See ssl/ssltest.c for some hints on how this can be used. */ |
| 9 | 9 | ||
| 10 | /* BIO_DEBUG implies BIO_PAIR_DEBUG */ | ||
| 11 | #ifdef BIO_DEBUG | ||
| 12 | # ifndef BIO_PAIR_DEBUG | ||
| 13 | # define BIO_PAIR_DEBUG | ||
| 14 | # endif | ||
| 15 | #endif | ||
| 16 | |||
| 17 | /* disable assert() unless BIO_PAIR_DEBUG has been defined */ | ||
| 10 | #ifndef BIO_PAIR_DEBUG | 18 | #ifndef BIO_PAIR_DEBUG |
| 11 | # undef NDEBUG /* avoid conflicting definitions */ | 19 | # ifndef NDEBUG |
| 12 | # define NDEBUG | 20 | # define NDEBUG |
| 21 | # endif | ||
| 13 | #endif | 22 | #endif |
| 14 | 23 | ||
| 15 | #include <assert.h> | 24 | #include <assert.h> |
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index d25b49c9d8..1eaf879553 100644 --- a/src/lib/libcrypto/bn/bn.h +++ b/src/lib/libcrypto/bn/bn.h | |||
| @@ -136,7 +136,7 @@ extern "C" { | |||
| 136 | #define BN_MASK2h (0xffffffff00000000LL) | 136 | #define BN_MASK2h (0xffffffff00000000LL) |
| 137 | #define BN_MASK2h1 (0xffffffff80000000LL) | 137 | #define BN_MASK2h1 (0xffffffff80000000LL) |
| 138 | #define BN_TBIT (0x8000000000000000LL) | 138 | #define BN_TBIT (0x8000000000000000LL) |
| 139 | #define BN_DEC_CONV (10000000000000000000LL) | 139 | #define BN_DEC_CONV (10000000000000000000ULL) |
| 140 | #define BN_DEC_FMT1 "%llu" | 140 | #define BN_DEC_FMT1 "%llu" |
| 141 | #define BN_DEC_FMT2 "%019llu" | 141 | #define BN_DEC_FMT2 "%019llu" |
| 142 | #define BN_DEC_NUM 19 | 142 | #define BN_DEC_NUM 19 |
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c index 41ea925b8d..7bffc9c16a 100644 --- a/src/lib/libcrypto/bn/bn_mul.c +++ b/src/lib/libcrypto/bn/bn_mul.c | |||
| @@ -408,16 +408,22 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, | |||
| 408 | return; | 408 | return; |
| 409 | } | 409 | } |
| 410 | # endif | 410 | # endif |
| 411 | if (n2 == 8) | 411 | /* Only call bn_mul_comba 8 if n2 == 8 and the |
| 412 | * two arrays are complete [steve] | ||
| 413 | */ | ||
| 414 | if (n2 == 8 && dna == 0 && dnb == 0) | ||
| 412 | { | 415 | { |
| 413 | bn_mul_comba8(r,a,b); | 416 | bn_mul_comba8(r,a,b); |
| 414 | return; | 417 | return; |
| 415 | } | 418 | } |
| 416 | # endif /* BN_MUL_COMBA */ | 419 | # endif /* BN_MUL_COMBA */ |
| 420 | /* Else do normal multiply */ | ||
| 417 | if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) | 421 | if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) |
| 418 | { | 422 | { |
| 419 | /* This should not happen */ | 423 | bn_mul_normal(r,a,n2+dna,b,n2+dnb); |
| 420 | bn_mul_normal(r,a,n2,b,n2); | 424 | if ((dna + dnb) < 0) |
| 425 | memset(&r[2*n2 + dna + dnb], 0, | ||
| 426 | sizeof(BN_ULONG) * -(dna + dnb)); | ||
| 421 | return; | 427 | return; |
| 422 | } | 428 | } |
| 423 | /* r=(a[0]-a[1])*(b[1]-b[0]) */ | 429 | /* r=(a[0]-a[1])*(b[1]-b[0]) */ |
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index 915fe62341..0d870d60be 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
| @@ -184,7 +184,7 @@ typedef struct evp_pkey_md_st | |||
| 184 | EVP_rsa_octet_string(),EVP_mdc2()) | 184 | EVP_rsa_octet_string(),EVP_mdc2()) |
| 185 | #define EVP_dsa_sha() \ | 185 | #define EVP_dsa_sha() \ |
| 186 | EVP_PKEY_MD_add(NID_dsaWithSHA,\ | 186 | EVP_PKEY_MD_add(NID_dsaWithSHA,\ |
| 187 | EVP_dsa(),EVP_mdc2()) | 187 | EVP_dsa(),EVP_sha()) |
| 188 | #define EVP_dsa_sha1() \ | 188 | #define EVP_dsa_sha1() \ |
| 189 | EVP_PKEY_MD_add(NID_dsaWithSHA1,\ | 189 | EVP_PKEY_MD_add(NID_dsaWithSHA1,\ |
| 190 | EVP_dsa(),EVP_sha1()) | 190 | EVP_dsa(),EVP_sha1()) |
| @@ -525,7 +525,7 @@ int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | |||
| 525 | 525 | ||
| 526 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek, | 526 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek, |
| 527 | int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); | 527 | int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); |
| 528 | void EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); | 528 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); |
| 529 | 529 | ||
| 530 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); | 530 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); |
| 531 | void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out, | 531 | void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out, |
diff --git a/src/lib/libcrypto/evp/evp_enc.c b/src/lib/libcrypto/evp/evp_enc.c index d28a7d266e..32a1c7a2e9 100644 --- a/src/lib/libcrypto/evp/evp_enc.c +++ b/src/lib/libcrypto/evp/evp_enc.c | |||
| @@ -102,11 +102,13 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp | |||
| 102 | goto skip_to_init; | 102 | goto skip_to_init; |
| 103 | if (cipher) | 103 | if (cipher) |
| 104 | { | 104 | { |
| 105 | /* Ensure an ENGINE left lying around from last time is cleared | 105 | /* Ensure a context left lying around from last time is cleared |
| 106 | * (the previous check attempted to avoid this if the same | 106 | * (the previous check attempted to avoid this if the same |
| 107 | * ENGINE and EVP_CIPHER could be used). */ | 107 | * ENGINE and EVP_CIPHER could be used). */ |
| 108 | if(ctx->engine) | 108 | EVP_CIPHER_CTX_cleanup(ctx); |
| 109 | ENGINE_finish(ctx->engine); | 109 | |
| 110 | /* Restore encrypt field: it is zeroed by cleanup */ | ||
| 111 | ctx->encrypt = enc; | ||
| 110 | if(impl) | 112 | if(impl) |
| 111 | { | 113 | { |
| 112 | if (!ENGINE_init(impl)) | 114 | if (!ENGINE_init(impl)) |
| @@ -140,6 +142,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp | |||
| 140 | } | 142 | } |
| 141 | else | 143 | else |
| 142 | ctx->engine = NULL; | 144 | ctx->engine = NULL; |
| 145 | |||
| 143 | ctx->cipher=cipher; | 146 | ctx->cipher=cipher; |
| 144 | ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size); | 147 | ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size); |
| 145 | ctx->key_len = cipher->key_len; | 148 | ctx->key_len = cipher->key_len; |
| @@ -303,7 +306,6 @@ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 303 | { | 306 | { |
| 304 | int ret; | 307 | int ret; |
| 305 | ret = EVP_EncryptFinal_ex(ctx, out, outl); | 308 | ret = EVP_EncryptFinal_ex(ctx, out, outl); |
| 306 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 307 | return ret; | 309 | return ret; |
| 308 | } | 310 | } |
| 309 | 311 | ||
| @@ -314,14 +316,12 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 314 | b=ctx->cipher->block_size; | 316 | b=ctx->cipher->block_size; |
| 315 | if (b == 1) | 317 | if (b == 1) |
| 316 | { | 318 | { |
| 317 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 318 | *outl=0; | 319 | *outl=0; |
| 319 | return 1; | 320 | return 1; |
| 320 | } | 321 | } |
| 321 | bl=ctx->buf_len; | 322 | bl=ctx->buf_len; |
| 322 | if (ctx->flags & EVP_CIPH_NO_PADDING) | 323 | if (ctx->flags & EVP_CIPH_NO_PADDING) |
| 323 | { | 324 | { |
| 324 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 325 | if(bl) | 325 | if(bl) |
| 326 | { | 326 | { |
| 327 | EVPerr(EVP_F_EVP_ENCRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH); | 327 | EVPerr(EVP_F_EVP_ENCRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH); |
| @@ -336,7 +336,6 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 336 | ctx->buf[i]=n; | 336 | ctx->buf[i]=n; |
| 337 | ret=ctx->cipher->do_cipher(ctx,out,ctx->buf,b); | 337 | ret=ctx->cipher->do_cipher(ctx,out,ctx->buf,b); |
| 338 | 338 | ||
| 339 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 340 | 339 | ||
| 341 | if(ret) | 340 | if(ret) |
| 342 | *outl=b; | 341 | *outl=b; |
| @@ -394,7 +393,6 @@ int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 394 | { | 393 | { |
| 395 | int ret; | 394 | int ret; |
| 396 | ret = EVP_DecryptFinal_ex(ctx, out, outl); | 395 | ret = EVP_DecryptFinal_ex(ctx, out, outl); |
| 397 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 398 | return ret; | 396 | return ret; |
| 399 | } | 397 | } |
| 400 | 398 | ||
| @@ -407,7 +405,6 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 407 | b=ctx->cipher->block_size; | 405 | b=ctx->cipher->block_size; |
| 408 | if (ctx->flags & EVP_CIPH_NO_PADDING) | 406 | if (ctx->flags & EVP_CIPH_NO_PADDING) |
| 409 | { | 407 | { |
| 410 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 411 | if(ctx->buf_len) | 408 | if(ctx->buf_len) |
| 412 | { | 409 | { |
| 413 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH); | 410 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH); |
| @@ -420,14 +417,12 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 420 | { | 417 | { |
| 421 | if (ctx->buf_len || !ctx->final_used) | 418 | if (ctx->buf_len || !ctx->final_used) |
| 422 | { | 419 | { |
| 423 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 424 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_WRONG_FINAL_BLOCK_LENGTH); | 420 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_WRONG_FINAL_BLOCK_LENGTH); |
| 425 | return(0); | 421 | return(0); |
| 426 | } | 422 | } |
| 427 | n=ctx->final[b-1]; | 423 | n=ctx->final[b-1]; |
| 428 | if (n > b) | 424 | if (n > b) |
| 429 | { | 425 | { |
| 430 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 431 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT); | 426 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT); |
| 432 | return(0); | 427 | return(0); |
| 433 | } | 428 | } |
| @@ -435,7 +430,6 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 435 | { | 430 | { |
| 436 | if (ctx->final[--b] != n) | 431 | if (ctx->final[--b] != n) |
| 437 | { | 432 | { |
| 438 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 439 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT); | 433 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT); |
| 440 | return(0); | 434 | return(0); |
| 441 | } | 435 | } |
| @@ -447,17 +441,21 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 447 | } | 441 | } |
| 448 | else | 442 | else |
| 449 | *outl=0; | 443 | *outl=0; |
| 450 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 451 | return(1); | 444 | return(1); |
| 452 | } | 445 | } |
| 453 | 446 | ||
| 454 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | 447 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) |
| 455 | { | 448 | { |
| 456 | if ((c->cipher != NULL) && (c->cipher->cleanup != NULL)) | 449 | if (c->cipher != NULL) |
| 457 | { | 450 | { |
| 458 | if(!c->cipher->cleanup(c)) return 0; | 451 | if(c->cipher->cleanup && !c->cipher->cleanup(c)) |
| 452 | return 0; | ||
| 453 | /* Zero cipher context data */ | ||
| 454 | if (c->cipher_data) | ||
| 455 | memset(c->cipher_data, 0, c->cipher->ctx_size); | ||
| 459 | } | 456 | } |
| 460 | OPENSSL_free(c->cipher_data); | 457 | if (c->cipher_data) |
| 458 | OPENSSL_free(c->cipher_data); | ||
| 461 | if (c->engine) | 459 | if (c->engine) |
| 462 | /* The EVP_CIPHER we used belongs to an ENGINE, release the | 460 | /* The EVP_CIPHER we used belongs to an ENGINE, release the |
| 463 | * functional reference we held for this reason. */ | 461 | * functional reference we held for this reason. */ |
diff --git a/src/lib/libcrypto/evp/evp_test.c b/src/lib/libcrypto/evp/evp_test.c index 3607fe7776..decd0713d6 100644 --- a/src/lib/libcrypto/evp/evp_test.c +++ b/src/lib/libcrypto/evp/evp_test.c | |||
| @@ -209,6 +209,8 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
| 209 | exit(9); | 209 | exit(9); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | EVP_CIPHER_CTX_cleanup(&ctx); | ||
| 213 | |||
| 212 | printf("\n"); | 214 | printf("\n"); |
| 213 | } | 215 | } |
| 214 | 216 | ||
| @@ -279,6 +281,8 @@ static int test_digest(const char *digest, | |||
| 279 | 281 | ||
| 280 | printf("\n"); | 282 | printf("\n"); |
| 281 | 283 | ||
| 284 | EVP_MD_CTX_cleanup(&ctx); | ||
| 285 | |||
| 282 | return 1; | 286 | return 1; |
| 283 | } | 287 | } |
| 284 | 288 | ||
diff --git a/src/lib/libcrypto/evp/p_seal.c b/src/lib/libcrypto/evp/p_seal.c index 5570ca3745..37e547fe72 100644 --- a/src/lib/libcrypto/evp/p_seal.c +++ b/src/lib/libcrypto/evp/p_seal.c | |||
| @@ -106,8 +106,10 @@ int inl; | |||
| 106 | } | 106 | } |
| 107 | */ | 107 | */ |
| 108 | 108 | ||
| 109 | void EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | 109 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) |
| 110 | { | 110 | { |
| 111 | EVP_EncryptFinal_ex(ctx,out,outl); | 111 | int i; |
| 112 | i = EVP_EncryptFinal_ex(ctx,out,outl); | ||
| 112 | EVP_EncryptInit_ex(ctx,NULL,NULL,NULL,NULL); | 113 | EVP_EncryptInit_ex(ctx,NULL,NULL,NULL,NULL); |
| 114 | return i; | ||
| 113 | } | 115 | } |
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c index 3aa03f74aa..4e12165410 100644 --- a/src/lib/libcrypto/ui/ui_openssl.c +++ b/src/lib/libcrypto/ui/ui_openssl.c | |||
| @@ -465,7 +465,7 @@ static int open_console(UI *ui) | |||
| 465 | tty_out=stderr; | 465 | tty_out=stderr; |
| 466 | #endif | 466 | #endif |
| 467 | 467 | ||
| 468 | #if defined(TTY_get) && !defined(VMS) | 468 | #if defined(TTY_get) && !defined(OPENSSL_SYS_VMS) |
| 469 | if (TTY_get(fileno(tty_in),&tty_orig) == -1) | 469 | if (TTY_get(fileno(tty_in),&tty_orig) == -1) |
| 470 | { | 470 | { |
| 471 | #ifdef ENOTTY | 471 | #ifdef ENOTTY |
diff --git a/src/lib/libcrypto/util/pl/Mingw32.pl b/src/lib/libcrypto/util/pl/Mingw32.pl index 37f36126f3..45ab685974 100644 --- a/src/lib/libcrypto/util/pl/Mingw32.pl +++ b/src/lib/libcrypto/util/pl/Mingw32.pl | |||
| @@ -25,6 +25,8 @@ if ($gaswin and !$no_asm) | |||
| 25 | { | 25 | { |
| 26 | $bn_asm_obj='$(OBJ_D)/bn-win32.o'; | 26 | $bn_asm_obj='$(OBJ_D)/bn-win32.o'; |
| 27 | $bn_asm_src='crypto/bn/asm/bn-win32.s'; | 27 | $bn_asm_src='crypto/bn/asm/bn-win32.s'; |
| 28 | $bnco_asm_obj='$(OBJ_D)/co-win32.o'; | ||
| 29 | $bnco_asm_src='crypto/bn/asm/co-win32.s'; | ||
| 28 | $des_enc_obj='$(OBJ_D)/d-win32.o $(OBJ_D)/y-win32.o'; | 30 | $des_enc_obj='$(OBJ_D)/d-win32.o $(OBJ_D)/y-win32.o'; |
| 29 | $des_enc_src='crypto/des/asm/d-win32.s crypto/des/asm/y-win32.s'; | 31 | $des_enc_src='crypto/des/asm/d-win32.s crypto/des/asm/y-win32.s'; |
| 30 | $bf_enc_obj='$(OBJ_D)/b-win32.o'; | 32 | $bf_enc_obj='$(OBJ_D)/b-win32.o'; |
| @@ -66,12 +68,12 @@ $lfile=''; | |||
| 66 | 68 | ||
| 67 | $asm='as'; | 69 | $asm='as'; |
| 68 | $afile='-o '; | 70 | $afile='-o '; |
| 69 | $bn_asm_obj=""; | 71 | #$bn_asm_obj=""; |
| 70 | $bn_asm_src=""; | 72 | #$bn_asm_src=""; |
| 71 | $des_enc_obj=""; | 73 | #$des_enc_obj=""; |
| 72 | $des_enc_src=""; | 74 | #$des_enc_src=""; |
| 73 | $bf_enc_obj=""; | 75 | #$bf_enc_obj=""; |
| 74 | $bf_enc_src=""; | 76 | #$bf_enc_src=""; |
| 75 | 77 | ||
| 76 | sub do_lib_rule | 78 | sub do_lib_rule |
| 77 | { | 79 | { |
diff --git a/src/lib/libssl/src/CHANGES b/src/lib/libssl/src/CHANGES index b8399a3500..500d3d481a 100644 --- a/src/lib/libssl/src/CHANGES +++ b/src/lib/libssl/src/CHANGES | |||
| @@ -4,6 +4,19 @@ | |||
| 4 | 4 | ||
| 5 | Changes between 0.9.6d and 0.9.7 [XX xxx 2002] | 5 | Changes between 0.9.6d and 0.9.7 [XX xxx 2002] |
| 6 | 6 | ||
| 7 | *) Remove most calls to EVP_CIPHER_CTX_cleanup() in evp_enc.c, this | ||
| 8 | allows existing EVP_CIPHER_CTX structures to be reused after | ||
| 9 | calling EVP_*Final(). This behaviour is used by encryption | ||
| 10 | BIOs and some applications. This has the side effect that | ||
| 11 | applications must explicitly clean up cipher contexts with | ||
| 12 | EVP_CIPHER_CTX_cleanup() or they will leak memory. | ||
| 13 | [Steve Henson] | ||
| 14 | |||
| 15 | *) Check the values of dna and dnb in bn_mul_recursive before calling | ||
| 16 | bn_mul_comba (a non zero value means the a or b arrays do not contain | ||
| 17 | n2 elements) and fallback to bn_mul_normal if either is not zero. | ||
| 18 | [Steve Henson] | ||
| 19 | |||
| 7 | *) Fix escaping of non-ASCII characters when using the -subj option | 20 | *) Fix escaping of non-ASCII characters when using the -subj option |
| 8 | of the "openssl req" command line tool. (Robert Joop <joop@fokus.gmd.de>) | 21 | of the "openssl req" command line tool. (Robert Joop <joop@fokus.gmd.de>) |
| 9 | [Lutz Jaenicke] | 22 | [Lutz Jaenicke] |
| @@ -1600,7 +1613,12 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k | |||
| 1600 | *) Clean old EAY MD5 hack from e_os.h. | 1613 | *) Clean old EAY MD5 hack from e_os.h. |
| 1601 | [Richard Levitte] | 1614 | [Richard Levitte] |
| 1602 | 1615 | ||
| 1603 | Changes between 0.9.6c and 0.9.6d [XX xxx 2002] | 1616 | Changes between 0.9.6d and 0.9.6e [XX xxx XXXX] |
| 1617 | |||
| 1618 | *) Fix EVP_dsa_sha macro. | ||
| 1619 | [Nils Larsch] | ||
| 1620 | |||
| 1621 | Changes between 0.9.6c and 0.9.6d [9 May 2002] | ||
| 1604 | 1622 | ||
| 1605 | *) Fix crypto/asn1/a_sign.c so that 'parameters' is omitted (not | 1623 | *) Fix crypto/asn1/a_sign.c so that 'parameters' is omitted (not |
| 1606 | encoded as NULL) with id-dsa-with-sha1. | 1624 | encoded as NULL) with id-dsa-with-sha1. |
diff --git a/src/lib/libssl/src/Configure b/src/lib/libssl/src/Configure index 1ffe1ac856..f6d8a919be 100644 --- a/src/lib/libssl/src/Configure +++ b/src/lib/libssl/src/Configure | |||
| @@ -144,6 +144,7 @@ my %table=( | |||
| 144 | "debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -m486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", | 144 | "debug-bodo", "gcc:-DL_ENDIAN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DBIO_PAIR_DEBUG -DPEDANTIC -g -m486 -pedantic -Wshadow -Wall::-D_REENTRANT:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", |
| 145 | "debug-ulf", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -O2 -m486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT:::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", | 145 | "debug-ulf", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG_ALL -g -O2 -m486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT:::${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}", |
| 146 | "debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -mcpu=i486 -pedantic -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", | 146 | "debug-steve", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DPEDANTIC -g -mcpu=i486 -pedantic -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn", |
| 147 | "debug-steve-linux-pseudo64", "gcc:-DL_ENDIAN -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DDEBUG_SAFESTACK -DCRYPTO_MDEBUG_ALL -DOPENSSL_NO_ASM -g -mcpu=i486 -Wall -Werror -Wshadow -pipe::-D_REENTRANT::-rdynamic -ldl:SIXTY_FOUR_BIT::dlfcn", | ||
| 147 | "debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 148 | "debug-levitte-linux-elf","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 148 | "debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", | 149 | "debug-levitte-linux-noasm","gcc:-DLEVITTE_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -DL_ENDIAN -DTERMIO -D_POSIX_SOURCE -DPEDANTIC -ggdb -g3 -mcpu=i486 -pedantic -ansi -Wall -Wshadow -Wid-clash-31 -Wno-long-long -pipe::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", |
| 149 | "dist", "cc:-O::(unknown)::::::", | 150 | "dist", "cc:-O::(unknown)::::::", |
diff --git a/src/lib/libssl/src/FAQ b/src/lib/libssl/src/FAQ index 8b53581c5a..bea8fcfde0 100644 --- a/src/lib/libssl/src/FAQ +++ b/src/lib/libssl/src/FAQ | |||
| @@ -60,7 +60,7 @@ OpenSSL - Frequently Asked Questions | |||
| 60 | * Which is the current version of OpenSSL? | 60 | * Which is the current version of OpenSSL? |
| 61 | 61 | ||
| 62 | The current version is available from <URL: http://www.openssl.org>. | 62 | The current version is available from <URL: http://www.openssl.org>. |
| 63 | OpenSSL 0.9.6c was released on December 21st, 2001. | 63 | OpenSSL 0.9.6d was released on May 9, 2002. |
| 64 | 64 | ||
| 65 | In addition to the current stable release, you can also access daily | 65 | In addition to the current stable release, you can also access daily |
| 66 | snapshots of the OpenSSL development version at <URL: | 66 | snapshots of the OpenSSL development version at <URL: |
diff --git a/src/lib/libssl/src/INSTALL.W32 b/src/lib/libssl/src/INSTALL.W32 index da061b289e..852a82831f 100644 --- a/src/lib/libssl/src/INSTALL.W32 +++ b/src/lib/libssl/src/INSTALL.W32 | |||
| @@ -112,10 +112,10 @@ | |||
| 112 | * Compiler installation: | 112 | * Compiler installation: |
| 113 | 113 | ||
| 114 | Mingw32 is available from <ftp://ftp.xraylith.wisc.edu/pub/khan/ | 114 | Mingw32 is available from <ftp://ftp.xraylith.wisc.edu/pub/khan/ |
| 115 | gnu-win32/mingw32/gcc-2.95.2/gcc-2.95.2-msvcrt.exe>. GNU make is at | 115 | gnu-win32/mingw32/gcc-2.95.2/gcc-2.95.2-msvcrt.exe>. Extract it |
| 116 | <ftp://agnes.dida.physik.uni-essen.de/home/janjaap/mingw32/binaries/ | 116 | to a directory such as C:\gcc-2.95.2 and add c:\gcc-2.95.2\bin to |
| 117 | make-3.76.1.zip>. Install both of them in C:\egcs-1.1.2 and run | 117 | the PATH environment variable in "System Properties"; or edit and |
| 118 | C:\egcs-1.1.2\mingw32.bat to set the PATH. | 118 | run C:\gcc-2.95.2\mingw32.bat to set the PATH. |
| 119 | 119 | ||
| 120 | * Compile OpenSSL: | 120 | * Compile OpenSSL: |
| 121 | 121 | ||
diff --git a/src/lib/libssl/src/STATUS b/src/lib/libssl/src/STATUS index 3438215ee7..2b285d1db5 100644 --- a/src/lib/libssl/src/STATUS +++ b/src/lib/libssl/src/STATUS | |||
| @@ -1,10 +1,11 @@ | |||
| 1 | 1 | ||
| 2 | OpenSSL STATUS Last modified at | 2 | OpenSSL STATUS Last modified at |
| 3 | ______________ $Date: 2002/05/15 02:29:08 $ | 3 | ______________ $Date: 2002/05/21 01:49:11 $ |
| 4 | 4 | ||
| 5 | DEVELOPMENT STATE | 5 | DEVELOPMENT STATE |
| 6 | 6 | ||
| 7 | o OpenSSL 0.9.7: Under development... | 7 | o OpenSSL 0.9.7: Under development... |
| 8 | o OpenSSL 0.9.6d: Released on May 9th, 2002 | ||
| 8 | o OpenSSL 0.9.6c: Released on December 21st, 2001 | 9 | o OpenSSL 0.9.6c: Released on December 21st, 2001 |
| 9 | o OpenSSL 0.9.6b: Released on July 9th, 2001 | 10 | o OpenSSL 0.9.6b: Released on July 9th, 2001 |
| 10 | o OpenSSL 0.9.6a: Released on April 5th, 2001 | 11 | o OpenSSL 0.9.6a: Released on April 5th, 2001 |
| @@ -17,23 +18,12 @@ | |||
| 17 | o OpenSSL 0.9.2b: Released on March 22th, 1999 | 18 | o OpenSSL 0.9.2b: Released on March 22th, 1999 |
| 18 | o OpenSSL 0.9.1c: Released on December 23th, 1998 | 19 | o OpenSSL 0.9.1c: Released on December 23th, 1998 |
| 19 | 20 | ||
| 20 | RELEASE SHOWSTOPPERS | 21 | [See also http://www.openssl.org/support/rt2.html] |
| 21 | |||
| 22 | o BIGNUM library failures on 64-bit platforms (0.9.7-dev): | ||
| 23 | - BN_mod_mul verificiation (bc) fails for solaris64-sparcv9-cc | ||
| 24 | and other 64-bit platforms | ||
| 25 | 22 | ||
| 26 | Checked on Result | 23 | RELEASE SHOWSTOPPERS |
| 27 | alpha-cc (Tru64 version 4.0) works | ||
| 28 | linux-alpha+bwx-gcc doesn't work. Reported by | ||
| 29 | Sean O'Riordain <seanpor@acm.org> | ||
| 30 | OpenBSD-sparc64 doesn't work. BN_mod_mul breaks. | ||
| 31 | |||
| 32 | Needs checked on | ||
| 33 | [add platforms here] | ||
| 34 | 24 | ||
| 35 | - BN_mod_mul verification fails for mips3-sgi-irix | 25 | o BN_mod_mul verification fails for mips3-sgi-irix |
| 36 | unless configured with no-asm | 26 | unless configured with no-asm |
| 37 | 27 | ||
| 38 | AVAILABLE PATCHES | 28 | AVAILABLE PATCHES |
| 39 | 29 | ||
diff --git a/src/lib/libssl/src/apps/apps.h b/src/lib/libssl/src/apps/apps.h index a05ba712be..5b3836ab22 100644 --- a/src/lib/libssl/src/apps/apps.h +++ b/src/lib/libssl/src/apps/apps.h | |||
| @@ -253,6 +253,8 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, | |||
| 253 | ASN1_GENERALIZEDTIME **pinvtm, char *str); | 253 | ASN1_GENERALIZEDTIME **pinvtm, char *str); |
| 254 | int make_serial_index(TXT_DB *db); | 254 | int make_serial_index(TXT_DB *db); |
| 255 | 255 | ||
| 256 | X509_NAME *do_subject(char *str, long chtype); | ||
| 257 | |||
| 256 | #define FORMAT_UNDEF 0 | 258 | #define FORMAT_UNDEF 0 |
| 257 | #define FORMAT_ASN1 1 | 259 | #define FORMAT_ASN1 1 |
| 258 | #define FORMAT_TEXT 2 | 260 | #define FORMAT_TEXT 2 |
diff --git a/src/lib/libssl/src/apps/ca.c b/src/lib/libssl/src/apps/ca.c index 8be557c956..51d9470aa1 100644 --- a/src/lib/libssl/src/apps/ca.c +++ b/src/lib/libssl/src/apps/ca.c | |||
| @@ -238,7 +238,6 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, | |||
| 238 | int verbose, X509_REQ *req, char *ext_sect, CONF *conf, | 238 | int verbose, X509_REQ *req, char *ext_sect, CONF *conf, |
| 239 | unsigned long certopt, unsigned long nameopt, int default_op, | 239 | unsigned long certopt, unsigned long nameopt, int default_op, |
| 240 | int ext_copy); | 240 | int ext_copy); |
| 241 | static X509_NAME *do_subject(char *subject); | ||
| 242 | static int do_revoke(X509 *x509, TXT_DB *db, int ext, char *extval); | 241 | static int do_revoke(X509 *x509, TXT_DB *db, int ext, char *extval); |
| 243 | static int get_certificate_status(const char *ser_status, TXT_DB *db); | 242 | static int get_certificate_status(const char *ser_status, TXT_DB *db); |
| 244 | static int do_updatedb(TXT_DB *db); | 243 | static int do_updatedb(TXT_DB *db); |
| @@ -1874,7 +1873,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, | |||
| 1874 | 1873 | ||
| 1875 | if (subj) | 1874 | if (subj) |
| 1876 | { | 1875 | { |
| 1877 | X509_NAME *n = do_subject(subj); | 1876 | X509_NAME *n = do_subject(subj, MBSTRING_ASC); |
| 1878 | 1877 | ||
| 1879 | if (!n) | 1878 | if (!n) |
| 1880 | { | 1879 | { |
| @@ -3012,13 +3011,13 @@ int make_revoked(X509_REVOKED *rev, char *str) | |||
| 3012 | * subject is expected to be in the format /type0=value0/type1=value1/type2=... | 3011 | * subject is expected to be in the format /type0=value0/type1=value1/type2=... |
| 3013 | * where characters may be escaped by \ | 3012 | * where characters may be escaped by \ |
| 3014 | */ | 3013 | */ |
| 3015 | static X509_NAME *do_subject(char *subject) | 3014 | X509_NAME *do_subject(char *subject, long chtype) |
| 3016 | { | 3015 | { |
| 3017 | size_t buflen = strlen (subject)+1; /* to copy the types and values into. due to escaping, the copy can only become shorter */ | 3016 | size_t buflen = strlen(subject)+1; /* to copy the types and values into. due to escaping, the copy can only become shorter */ |
| 3018 | char *buf = malloc (buflen); | 3017 | char *buf = OPENSSL_malloc(buflen); |
| 3019 | size_t max_ne = buflen / 2 + 1; /* maximum number of name elements */ | 3018 | size_t max_ne = buflen / 2 + 1; /* maximum number of name elements */ |
| 3020 | char **ne_types = malloc (max_ne * sizeof (char *)); | 3019 | char **ne_types = OPENSSL_malloc(max_ne * sizeof (char *)); |
| 3021 | char **ne_values = malloc (max_ne * sizeof (char *)); | 3020 | char **ne_values = OPENSSL_malloc(max_ne * sizeof (char *)); |
| 3022 | 3021 | ||
| 3023 | char *sp = subject, *bp = buf; | 3022 | char *sp = subject, *bp = buf; |
| 3024 | int i, ne_num = 0; | 3023 | int i, ne_num = 0; |
| @@ -3029,13 +3028,13 @@ static X509_NAME *do_subject(char *subject) | |||
| 3029 | if (!buf || !ne_types || !ne_values) | 3028 | if (!buf || !ne_types || !ne_values) |
| 3030 | { | 3029 | { |
| 3031 | BIO_printf(bio_err, "malloc error\n"); | 3030 | BIO_printf(bio_err, "malloc error\n"); |
| 3032 | goto error0; | 3031 | goto error; |
| 3033 | } | 3032 | } |
| 3034 | 3033 | ||
| 3035 | if (*subject != '/') | 3034 | if (*subject != '/') |
| 3036 | { | 3035 | { |
| 3037 | BIO_printf(bio_err, "Subject does not start with '/'.\n"); | 3036 | BIO_printf(bio_err, "Subject does not start with '/'.\n"); |
| 3038 | goto error0; | 3037 | goto error; |
| 3039 | } | 3038 | } |
| 3040 | sp++; /* skip leading / */ | 3039 | sp++; /* skip leading / */ |
| 3041 | 3040 | ||
| @@ -3051,7 +3050,7 @@ static X509_NAME *do_subject(char *subject) | |||
| 3051 | else | 3050 | else |
| 3052 | { | 3051 | { |
| 3053 | BIO_printf(bio_err, "escape character at end of string\n"); | 3052 | BIO_printf(bio_err, "escape character at end of string\n"); |
| 3054 | goto error0; | 3053 | goto error; |
| 3055 | } | 3054 | } |
| 3056 | else if (*sp == '=') | 3055 | else if (*sp == '=') |
| 3057 | { | 3056 | { |
| @@ -3065,7 +3064,7 @@ static X509_NAME *do_subject(char *subject) | |||
| 3065 | if (!*sp) | 3064 | if (!*sp) |
| 3066 | { | 3065 | { |
| 3067 | BIO_printf(bio_err, "end of string encountered while processing type of subject name element #%d\n", ne_num); | 3066 | BIO_printf(bio_err, "end of string encountered while processing type of subject name element #%d\n", ne_num); |
| 3068 | goto error0; | 3067 | goto error; |
| 3069 | } | 3068 | } |
| 3070 | ne_values[ne_num] = bp; | 3069 | ne_values[ne_num] = bp; |
| 3071 | while (*sp) | 3070 | while (*sp) |
| @@ -3076,12 +3075,11 @@ static X509_NAME *do_subject(char *subject) | |||
| 3076 | else | 3075 | else |
| 3077 | { | 3076 | { |
| 3078 | BIO_printf(bio_err, "escape character at end of string\n"); | 3077 | BIO_printf(bio_err, "escape character at end of string\n"); |
| 3079 | goto error0; | 3078 | goto error; |
| 3080 | } | 3079 | } |
| 3081 | else if (*sp == '/') | 3080 | else if (*sp == '/') |
| 3082 | { | 3081 | { |
| 3083 | sp++; | 3082 | sp++; |
| 3084 | *bp++ = '\0'; | ||
| 3085 | break; | 3083 | break; |
| 3086 | } | 3084 | } |
| 3087 | else | 3085 | else |
| @@ -3092,7 +3090,7 @@ static X509_NAME *do_subject(char *subject) | |||
| 3092 | } | 3090 | } |
| 3093 | 3091 | ||
| 3094 | if (!(n = X509_NAME_new())) | 3092 | if (!(n = X509_NAME_new())) |
| 3095 | goto error0; | 3093 | goto error; |
| 3096 | 3094 | ||
| 3097 | for (i = 0; i < ne_num; i++) | 3095 | for (i = 0; i < ne_num; i++) |
| 3098 | { | 3096 | { |
| @@ -3108,25 +3106,26 @@ static X509_NAME *do_subject(char *subject) | |||
| 3108 | continue; | 3106 | continue; |
| 3109 | } | 3107 | } |
| 3110 | 3108 | ||
| 3111 | if (!X509_NAME_add_entry_by_NID(n, nid, MBSTRING_ASC, (unsigned char*)ne_values[i], -1,-1,0)) | 3109 | if (!X509_NAME_add_entry_by_NID(n, nid, chtype, (unsigned char*)ne_values[i], -1,-1,0)) |
| 3112 | goto error1; | 3110 | goto error; |
| 3113 | } | 3111 | } |
| 3114 | 3112 | ||
| 3115 | free (ne_values); | 3113 | OPENSSL_free(ne_values); |
| 3116 | free (ne_types); | 3114 | OPENSSL_free(ne_types); |
| 3117 | free (buf); | 3115 | OPENSSL_free(buf); |
| 3118 | return n; | 3116 | return n; |
| 3119 | 3117 | ||
| 3120 | error1: | 3118 | error: |
| 3121 | X509_NAME_free(n); | 3119 | X509_NAME_free(n); |
| 3122 | error0: | 3120 | if (ne_values) |
| 3123 | free (ne_values); | 3121 | OPENSSL_free(ne_values); |
| 3124 | free (ne_types); | 3122 | if (ne_types) |
| 3125 | free (buf); | 3123 | OPENSSL_free(ne_types); |
| 3124 | if (buf) | ||
| 3125 | OPENSSL_free(buf); | ||
| 3126 | return NULL; | 3126 | return NULL; |
| 3127 | } | 3127 | } |
| 3128 | 3128 | ||
| 3129 | |||
| 3130 | int old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str) | 3129 | int old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str) |
| 3131 | { | 3130 | { |
| 3132 | char buf[25],*pbuf, *p; | 3131 | char buf[25],*pbuf, *p; |
diff --git a/src/lib/libssl/src/apps/req.c b/src/lib/libssl/src/apps/req.c index 790aa90eb6..5631a3839b 100644 --- a/src/lib/libssl/src/apps/req.c +++ b/src/lib/libssl/src/apps/req.c | |||
| @@ -1144,120 +1144,18 @@ err: | |||
| 1144 | */ | 1144 | */ |
| 1145 | static int build_subject(X509_REQ *req, char *subject, unsigned long chtype) | 1145 | static int build_subject(X509_REQ *req, char *subject, unsigned long chtype) |
| 1146 | { | 1146 | { |
| 1147 | size_t buflen = strlen (subject)+1; /* to copy the types and values into. due to escaping, the copy can only become shorter */ | 1147 | X509_NAME *n; |
| 1148 | char *buf = malloc (buflen); | ||
| 1149 | size_t max_ne = buflen / 2 + 1; /* maximum number of name elements */ | ||
| 1150 | char **ne_types = malloc (max_ne * sizeof (char *)); | ||
| 1151 | char **ne_values = malloc (max_ne * sizeof (char *)); | ||
| 1152 | 1148 | ||
| 1153 | char *sp = subject, *bp = buf; | 1149 | if (!(n = do_subject(subject, chtype))) |
| 1154 | int i, ne_num = 0; | 1150 | return 0; |
| 1155 | |||
| 1156 | X509_NAME *n = NULL; | ||
| 1157 | int nid; | ||
| 1158 | |||
| 1159 | if (!buf || !ne_types || !ne_values) | ||
| 1160 | { | ||
| 1161 | BIO_printf(bio_err, "malloc error\n"); | ||
| 1162 | goto error0; | ||
| 1163 | } | ||
| 1164 | |||
| 1165 | if (*subject != '/') | ||
| 1166 | { | ||
| 1167 | BIO_printf(bio_err, "Subject does not start with '/'.\n"); | ||
| 1168 | goto error0; | ||
| 1169 | } | ||
| 1170 | sp++; /* skip leading / */ | ||
| 1171 | |||
| 1172 | while (*sp) | ||
| 1173 | { | ||
| 1174 | /* collect type */ | ||
| 1175 | ne_types[ne_num] = bp; | ||
| 1176 | while (*sp) | ||
| 1177 | { | ||
| 1178 | if (*sp == '\\') /* is there anything to escape in the type...? */ | ||
| 1179 | if (*++sp) | ||
| 1180 | *bp++ = *sp++; | ||
| 1181 | else | ||
| 1182 | { | ||
| 1183 | BIO_printf(bio_err, "escape character at end of string\n"); | ||
| 1184 | goto error0; | ||
| 1185 | } | ||
| 1186 | else if (*sp == '=') | ||
| 1187 | { | ||
| 1188 | sp++; | ||
| 1189 | *bp++ = '\0'; | ||
| 1190 | break; | ||
| 1191 | } | ||
| 1192 | else | ||
| 1193 | *bp++ = *sp++; | ||
| 1194 | } | ||
| 1195 | if (!*sp) | ||
| 1196 | { | ||
| 1197 | BIO_printf(bio_err, "end of string encountered while processing type of subject name element #%d\n", ne_num); | ||
| 1198 | goto error0; | ||
| 1199 | } | ||
| 1200 | ne_values[ne_num] = bp; | ||
| 1201 | while (*sp) | ||
| 1202 | { | ||
| 1203 | if (*sp == '\\') | ||
| 1204 | if (*++sp) | ||
| 1205 | *bp++ = *sp++; | ||
| 1206 | else | ||
| 1207 | { | ||
| 1208 | BIO_printf(bio_err, "escape character at end of string\n"); | ||
| 1209 | goto error0; | ||
| 1210 | } | ||
| 1211 | else if (*sp == '/') | ||
| 1212 | { | ||
| 1213 | sp++; | ||
| 1214 | *bp++ = '\0'; | ||
| 1215 | break; | ||
| 1216 | } | ||
| 1217 | else | ||
| 1218 | *bp++ = *sp++; | ||
| 1219 | } | ||
| 1220 | *bp++ = '\0'; | ||
| 1221 | ne_num++; | ||
| 1222 | } | ||
| 1223 | |||
| 1224 | if (!(n = X509_NAME_new())) | ||
| 1225 | goto error0; | ||
| 1226 | 1151 | ||
| 1227 | for(i = 0; i < ne_num; i++) | 1152 | if (!X509_REQ_set_subject_name(req, n)) |
| 1228 | { | 1153 | { |
| 1229 | if ((nid=OBJ_txt2nid(ne_types[i])) == NID_undef) | 1154 | X509_NAME_free(n); |
| 1230 | { | 1155 | return 0; |
| 1231 | BIO_printf(bio_err, "Subject Attribute %s has no known NID, skipped\n", ne_types[i]); | ||
| 1232 | continue; | ||
| 1233 | } | ||
| 1234 | |||
| 1235 | if (!*ne_values[i]) | ||
| 1236 | { | ||
| 1237 | BIO_printf(bio_err, "No value provided for Subject Attribute %s, skipped\n", ne_types[i]); | ||
| 1238 | continue; | ||
| 1239 | } | ||
| 1240 | |||
| 1241 | if (!X509_NAME_add_entry_by_NID(n, nid, chtype, (unsigned char*)ne_values[i], -1,-1,0)) | ||
| 1242 | goto error1; | ||
| 1243 | |||
| 1244 | } | 1156 | } |
| 1245 | |||
| 1246 | if (!X509_REQ_set_subject_name(req, n)) | ||
| 1247 | goto error1; | ||
| 1248 | X509_NAME_free(n); | 1157 | X509_NAME_free(n); |
| 1249 | free (ne_values); | ||
| 1250 | free (ne_types); | ||
| 1251 | free (buf); | ||
| 1252 | return 1; | 1158 | return 1; |
| 1253 | |||
| 1254 | error1: | ||
| 1255 | X509_NAME_free(n); | ||
| 1256 | error0: | ||
| 1257 | free (ne_values); | ||
| 1258 | free (ne_types); | ||
| 1259 | free (buf); | ||
| 1260 | return 0; | ||
| 1261 | } | 1159 | } |
| 1262 | 1160 | ||
| 1263 | 1161 | ||
diff --git a/src/lib/libssl/src/config b/src/lib/libssl/src/config index a7a40e04db..132fb7a0ce 100644 --- a/src/lib/libssl/src/config +++ b/src/lib/libssl/src/config | |||
| @@ -517,6 +517,10 @@ EOF | |||
| 517 | ${CC} -o dummy dummy.c && OUT=`./dummy ${MACHINE}` | 517 | ${CC} -o dummy dummy.c && OUT=`./dummy ${MACHINE}` |
| 518 | rm dummy dummy.c | 518 | rm dummy dummy.c |
| 519 | ;; | 519 | ;; |
| 520 | ppc64-*-linux2) | ||
| 521 | #Use the standard target for PPC architecture until we create a | ||
| 522 | #special one for the 64bit architecture. | ||
| 523 | OUT="linux-ppc" ;; | ||
| 520 | ppc-*-linux2) OUT="linux-ppc" ;; | 524 | ppc-*-linux2) OUT="linux-ppc" ;; |
| 521 | m68k-*-linux*) OUT="linux-m68k" ;; | 525 | m68k-*-linux*) OUT="linux-m68k" ;; |
| 522 | ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;; | 526 | ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;; |
diff --git a/src/lib/libssl/src/crypto/asn1/p5_pbev2.c b/src/lib/libssl/src/crypto/asn1/p5_pbev2.c index 43dfe09479..91e1c8987d 100644 --- a/src/lib/libssl/src/crypto/asn1/p5_pbev2.c +++ b/src/lib/libssl/src/crypto/asn1/p5_pbev2.c | |||
| @@ -116,6 +116,8 @@ X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter, | |||
| 116 | if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) | 116 | if (RAND_pseudo_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0) |
| 117 | goto err; | 117 | goto err; |
| 118 | 118 | ||
| 119 | EVP_CIPHER_CTX_init(&ctx); | ||
| 120 | |||
| 119 | /* Dummy cipherinit to just setup the IV */ | 121 | /* Dummy cipherinit to just setup the IV */ |
| 120 | EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0); | 122 | EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0); |
| 121 | if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { | 123 | if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) { |
diff --git a/src/lib/libssl/src/crypto/bio/b_print.c b/src/lib/libssl/src/crypto/bio/b_print.c index b7e268f092..3ce1290772 100644 --- a/src/lib/libssl/src/crypto/bio/b_print.c +++ b/src/lib/libssl/src/crypto/bio/b_print.c | |||
| @@ -56,6 +56,13 @@ | |||
| 56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | /* disable assert() unless BIO_DEBUG has been defined */ | ||
| 60 | #ifndef BIO_DEBUG | ||
| 61 | # ifndef NDEBUG | ||
| 62 | # define NDEBUG | ||
| 63 | # endif | ||
| 64 | #endif | ||
| 65 | |||
| 59 | /* | 66 | /* |
| 60 | * Stolen from tjh's ssl/ssl_trc.c stuff. | 67 | * Stolen from tjh's ssl/ssl_trc.c stuff. |
| 61 | */ | 68 | */ |
| @@ -716,12 +723,13 @@ doapr_outch( | |||
| 716 | if (buffer) { | 723 | if (buffer) { |
| 717 | while (*currlen >= *maxlen) { | 724 | while (*currlen >= *maxlen) { |
| 718 | if (*buffer == NULL) { | 725 | if (*buffer == NULL) { |
| 719 | assert(*sbuffer != NULL); | ||
| 720 | if (*maxlen == 0) | 726 | if (*maxlen == 0) |
| 721 | *maxlen = 1024; | 727 | *maxlen = 1024; |
| 722 | *buffer = OPENSSL_malloc(*maxlen); | 728 | *buffer = OPENSSL_malloc(*maxlen); |
| 723 | if (*currlen > 0) | 729 | if (*currlen > 0) { |
| 730 | assert(*sbuffer != NULL); | ||
| 724 | memcpy(*buffer, *sbuffer, *currlen); | 731 | memcpy(*buffer, *sbuffer, *currlen); |
| 732 | } | ||
| 725 | *sbuffer = NULL; | 733 | *sbuffer = NULL; |
| 726 | } else { | 734 | } else { |
| 727 | *maxlen += 1024; | 735 | *maxlen += 1024; |
| @@ -761,7 +769,9 @@ int BIO_vprintf (BIO *bio, const char *format, va_list args) | |||
| 761 | { | 769 | { |
| 762 | int ret; | 770 | int ret; |
| 763 | size_t retlen; | 771 | size_t retlen; |
| 764 | MS_STATIC char hugebuf[1024*10]; | 772 | char hugebuf[1024*2]; /* Was previously 10k, which is unreasonable |
| 773 | in small-stack environments, like threads | ||
| 774 | or DOS programs. */ | ||
| 765 | char *hugebufp = hugebuf; | 775 | char *hugebufp = hugebuf; |
| 766 | size_t hugebufsize = sizeof(hugebuf); | 776 | size_t hugebufsize = sizeof(hugebuf); |
| 767 | char *dynbuf = NULL; | 777 | char *dynbuf = NULL; |
diff --git a/src/lib/libssl/src/crypto/bio/bss_bio.c b/src/lib/libssl/src/crypto/bio/bss_bio.c index a5da473031..1c485a4479 100644 --- a/src/lib/libssl/src/crypto/bio/bss_bio.c +++ b/src/lib/libssl/src/crypto/bio/bss_bio.c | |||
| @@ -7,9 +7,18 @@ | |||
| 7 | * for which no specific BIO method is available. | 7 | * for which no specific BIO method is available. |
| 8 | * See ssl/ssltest.c for some hints on how this can be used. */ | 8 | * See ssl/ssltest.c for some hints on how this can be used. */ |
| 9 | 9 | ||
| 10 | /* BIO_DEBUG implies BIO_PAIR_DEBUG */ | ||
| 11 | #ifdef BIO_DEBUG | ||
| 12 | # ifndef BIO_PAIR_DEBUG | ||
| 13 | # define BIO_PAIR_DEBUG | ||
| 14 | # endif | ||
| 15 | #endif | ||
| 16 | |||
| 17 | /* disable assert() unless BIO_PAIR_DEBUG has been defined */ | ||
| 10 | #ifndef BIO_PAIR_DEBUG | 18 | #ifndef BIO_PAIR_DEBUG |
| 11 | # undef NDEBUG /* avoid conflicting definitions */ | 19 | # ifndef NDEBUG |
| 12 | # define NDEBUG | 20 | # define NDEBUG |
| 21 | # endif | ||
| 13 | #endif | 22 | #endif |
| 14 | 23 | ||
| 15 | #include <assert.h> | 24 | #include <assert.h> |
diff --git a/src/lib/libssl/src/crypto/bn/bn.h b/src/lib/libssl/src/crypto/bn/bn.h index d25b49c9d8..1eaf879553 100644 --- a/src/lib/libssl/src/crypto/bn/bn.h +++ b/src/lib/libssl/src/crypto/bn/bn.h | |||
| @@ -136,7 +136,7 @@ extern "C" { | |||
| 136 | #define BN_MASK2h (0xffffffff00000000LL) | 136 | #define BN_MASK2h (0xffffffff00000000LL) |
| 137 | #define BN_MASK2h1 (0xffffffff80000000LL) | 137 | #define BN_MASK2h1 (0xffffffff80000000LL) |
| 138 | #define BN_TBIT (0x8000000000000000LL) | 138 | #define BN_TBIT (0x8000000000000000LL) |
| 139 | #define BN_DEC_CONV (10000000000000000000LL) | 139 | #define BN_DEC_CONV (10000000000000000000ULL) |
| 140 | #define BN_DEC_FMT1 "%llu" | 140 | #define BN_DEC_FMT1 "%llu" |
| 141 | #define BN_DEC_FMT2 "%019llu" | 141 | #define BN_DEC_FMT2 "%019llu" |
| 142 | #define BN_DEC_NUM 19 | 142 | #define BN_DEC_NUM 19 |
diff --git a/src/lib/libssl/src/crypto/bn/bn_mul.c b/src/lib/libssl/src/crypto/bn/bn_mul.c index 41ea925b8d..7bffc9c16a 100644 --- a/src/lib/libssl/src/crypto/bn/bn_mul.c +++ b/src/lib/libssl/src/crypto/bn/bn_mul.c | |||
| @@ -408,16 +408,22 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, | |||
| 408 | return; | 408 | return; |
| 409 | } | 409 | } |
| 410 | # endif | 410 | # endif |
| 411 | if (n2 == 8) | 411 | /* Only call bn_mul_comba 8 if n2 == 8 and the |
| 412 | * two arrays are complete [steve] | ||
| 413 | */ | ||
| 414 | if (n2 == 8 && dna == 0 && dnb == 0) | ||
| 412 | { | 415 | { |
| 413 | bn_mul_comba8(r,a,b); | 416 | bn_mul_comba8(r,a,b); |
| 414 | return; | 417 | return; |
| 415 | } | 418 | } |
| 416 | # endif /* BN_MUL_COMBA */ | 419 | # endif /* BN_MUL_COMBA */ |
| 420 | /* Else do normal multiply */ | ||
| 417 | if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) | 421 | if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) |
| 418 | { | 422 | { |
| 419 | /* This should not happen */ | 423 | bn_mul_normal(r,a,n2+dna,b,n2+dnb); |
| 420 | bn_mul_normal(r,a,n2,b,n2); | 424 | if ((dna + dnb) < 0) |
| 425 | memset(&r[2*n2 + dna + dnb], 0, | ||
| 426 | sizeof(BN_ULONG) * -(dna + dnb)); | ||
| 421 | return; | 427 | return; |
| 422 | } | 428 | } |
| 423 | /* r=(a[0]-a[1])*(b[1]-b[0]) */ | 429 | /* r=(a[0]-a[1])*(b[1]-b[0]) */ |
diff --git a/src/lib/libssl/src/crypto/evp/evp.h b/src/lib/libssl/src/crypto/evp/evp.h index 915fe62341..0d870d60be 100644 --- a/src/lib/libssl/src/crypto/evp/evp.h +++ b/src/lib/libssl/src/crypto/evp/evp.h | |||
| @@ -184,7 +184,7 @@ typedef struct evp_pkey_md_st | |||
| 184 | EVP_rsa_octet_string(),EVP_mdc2()) | 184 | EVP_rsa_octet_string(),EVP_mdc2()) |
| 185 | #define EVP_dsa_sha() \ | 185 | #define EVP_dsa_sha() \ |
| 186 | EVP_PKEY_MD_add(NID_dsaWithSHA,\ | 186 | EVP_PKEY_MD_add(NID_dsaWithSHA,\ |
| 187 | EVP_dsa(),EVP_mdc2()) | 187 | EVP_dsa(),EVP_sha()) |
| 188 | #define EVP_dsa_sha1() \ | 188 | #define EVP_dsa_sha1() \ |
| 189 | EVP_PKEY_MD_add(NID_dsaWithSHA1,\ | 189 | EVP_PKEY_MD_add(NID_dsaWithSHA1,\ |
| 190 | EVP_dsa(),EVP_sha1()) | 190 | EVP_dsa(),EVP_sha1()) |
| @@ -525,7 +525,7 @@ int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl); | |||
| 525 | 525 | ||
| 526 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek, | 526 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek, |
| 527 | int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); | 527 | int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); |
| 528 | void EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); | 528 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl); |
| 529 | 529 | ||
| 530 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); | 530 | void EVP_EncodeInit(EVP_ENCODE_CTX *ctx); |
| 531 | void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out, | 531 | void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out, |
diff --git a/src/lib/libssl/src/crypto/evp/evp_enc.c b/src/lib/libssl/src/crypto/evp/evp_enc.c index d28a7d266e..32a1c7a2e9 100644 --- a/src/lib/libssl/src/crypto/evp/evp_enc.c +++ b/src/lib/libssl/src/crypto/evp/evp_enc.c | |||
| @@ -102,11 +102,13 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp | |||
| 102 | goto skip_to_init; | 102 | goto skip_to_init; |
| 103 | if (cipher) | 103 | if (cipher) |
| 104 | { | 104 | { |
| 105 | /* Ensure an ENGINE left lying around from last time is cleared | 105 | /* Ensure a context left lying around from last time is cleared |
| 106 | * (the previous check attempted to avoid this if the same | 106 | * (the previous check attempted to avoid this if the same |
| 107 | * ENGINE and EVP_CIPHER could be used). */ | 107 | * ENGINE and EVP_CIPHER could be used). */ |
| 108 | if(ctx->engine) | 108 | EVP_CIPHER_CTX_cleanup(ctx); |
| 109 | ENGINE_finish(ctx->engine); | 109 | |
| 110 | /* Restore encrypt field: it is zeroed by cleanup */ | ||
| 111 | ctx->encrypt = enc; | ||
| 110 | if(impl) | 112 | if(impl) |
| 111 | { | 113 | { |
| 112 | if (!ENGINE_init(impl)) | 114 | if (!ENGINE_init(impl)) |
| @@ -140,6 +142,7 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *imp | |||
| 140 | } | 142 | } |
| 141 | else | 143 | else |
| 142 | ctx->engine = NULL; | 144 | ctx->engine = NULL; |
| 145 | |||
| 143 | ctx->cipher=cipher; | 146 | ctx->cipher=cipher; |
| 144 | ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size); | 147 | ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size); |
| 145 | ctx->key_len = cipher->key_len; | 148 | ctx->key_len = cipher->key_len; |
| @@ -303,7 +306,6 @@ int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 303 | { | 306 | { |
| 304 | int ret; | 307 | int ret; |
| 305 | ret = EVP_EncryptFinal_ex(ctx, out, outl); | 308 | ret = EVP_EncryptFinal_ex(ctx, out, outl); |
| 306 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 307 | return ret; | 309 | return ret; |
| 308 | } | 310 | } |
| 309 | 311 | ||
| @@ -314,14 +316,12 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 314 | b=ctx->cipher->block_size; | 316 | b=ctx->cipher->block_size; |
| 315 | if (b == 1) | 317 | if (b == 1) |
| 316 | { | 318 | { |
| 317 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 318 | *outl=0; | 319 | *outl=0; |
| 319 | return 1; | 320 | return 1; |
| 320 | } | 321 | } |
| 321 | bl=ctx->buf_len; | 322 | bl=ctx->buf_len; |
| 322 | if (ctx->flags & EVP_CIPH_NO_PADDING) | 323 | if (ctx->flags & EVP_CIPH_NO_PADDING) |
| 323 | { | 324 | { |
| 324 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 325 | if(bl) | 325 | if(bl) |
| 326 | { | 326 | { |
| 327 | EVPerr(EVP_F_EVP_ENCRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH); | 327 | EVPerr(EVP_F_EVP_ENCRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH); |
| @@ -336,7 +336,6 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 336 | ctx->buf[i]=n; | 336 | ctx->buf[i]=n; |
| 337 | ret=ctx->cipher->do_cipher(ctx,out,ctx->buf,b); | 337 | ret=ctx->cipher->do_cipher(ctx,out,ctx->buf,b); |
| 338 | 338 | ||
| 339 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 340 | 339 | ||
| 341 | if(ret) | 340 | if(ret) |
| 342 | *outl=b; | 341 | *outl=b; |
| @@ -394,7 +393,6 @@ int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 394 | { | 393 | { |
| 395 | int ret; | 394 | int ret; |
| 396 | ret = EVP_DecryptFinal_ex(ctx, out, outl); | 395 | ret = EVP_DecryptFinal_ex(ctx, out, outl); |
| 397 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 398 | return ret; | 396 | return ret; |
| 399 | } | 397 | } |
| 400 | 398 | ||
| @@ -407,7 +405,6 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 407 | b=ctx->cipher->block_size; | 405 | b=ctx->cipher->block_size; |
| 408 | if (ctx->flags & EVP_CIPH_NO_PADDING) | 406 | if (ctx->flags & EVP_CIPH_NO_PADDING) |
| 409 | { | 407 | { |
| 410 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 411 | if(ctx->buf_len) | 408 | if(ctx->buf_len) |
| 412 | { | 409 | { |
| 413 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH); | 410 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH); |
| @@ -420,14 +417,12 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 420 | { | 417 | { |
| 421 | if (ctx->buf_len || !ctx->final_used) | 418 | if (ctx->buf_len || !ctx->final_used) |
| 422 | { | 419 | { |
| 423 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 424 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_WRONG_FINAL_BLOCK_LENGTH); | 420 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_WRONG_FINAL_BLOCK_LENGTH); |
| 425 | return(0); | 421 | return(0); |
| 426 | } | 422 | } |
| 427 | n=ctx->final[b-1]; | 423 | n=ctx->final[b-1]; |
| 428 | if (n > b) | 424 | if (n > b) |
| 429 | { | 425 | { |
| 430 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 431 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT); | 426 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT); |
| 432 | return(0); | 427 | return(0); |
| 433 | } | 428 | } |
| @@ -435,7 +430,6 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 435 | { | 430 | { |
| 436 | if (ctx->final[--b] != n) | 431 | if (ctx->final[--b] != n) |
| 437 | { | 432 | { |
| 438 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 439 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT); | 433 | EVPerr(EVP_F_EVP_DECRYPTFINAL,EVP_R_BAD_DECRYPT); |
| 440 | return(0); | 434 | return(0); |
| 441 | } | 435 | } |
| @@ -447,17 +441,21 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | |||
| 447 | } | 441 | } |
| 448 | else | 442 | else |
| 449 | *outl=0; | 443 | *outl=0; |
| 450 | EVP_CIPHER_CTX_cleanup(ctx); | ||
| 451 | return(1); | 444 | return(1); |
| 452 | } | 445 | } |
| 453 | 446 | ||
| 454 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) | 447 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) |
| 455 | { | 448 | { |
| 456 | if ((c->cipher != NULL) && (c->cipher->cleanup != NULL)) | 449 | if (c->cipher != NULL) |
| 457 | { | 450 | { |
| 458 | if(!c->cipher->cleanup(c)) return 0; | 451 | if(c->cipher->cleanup && !c->cipher->cleanup(c)) |
| 452 | return 0; | ||
| 453 | /* Zero cipher context data */ | ||
| 454 | if (c->cipher_data) | ||
| 455 | memset(c->cipher_data, 0, c->cipher->ctx_size); | ||
| 459 | } | 456 | } |
| 460 | OPENSSL_free(c->cipher_data); | 457 | if (c->cipher_data) |
| 458 | OPENSSL_free(c->cipher_data); | ||
| 461 | if (c->engine) | 459 | if (c->engine) |
| 462 | /* The EVP_CIPHER we used belongs to an ENGINE, release the | 460 | /* The EVP_CIPHER we used belongs to an ENGINE, release the |
| 463 | * functional reference we held for this reason. */ | 461 | * functional reference we held for this reason. */ |
diff --git a/src/lib/libssl/src/crypto/evp/evp_test.c b/src/lib/libssl/src/crypto/evp/evp_test.c index 3607fe7776..decd0713d6 100644 --- a/src/lib/libssl/src/crypto/evp/evp_test.c +++ b/src/lib/libssl/src/crypto/evp/evp_test.c | |||
| @@ -209,6 +209,8 @@ static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn, | |||
| 209 | exit(9); | 209 | exit(9); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | EVP_CIPHER_CTX_cleanup(&ctx); | ||
| 213 | |||
| 212 | printf("\n"); | 214 | printf("\n"); |
| 213 | } | 215 | } |
| 214 | 216 | ||
| @@ -279,6 +281,8 @@ static int test_digest(const char *digest, | |||
| 279 | 281 | ||
| 280 | printf("\n"); | 282 | printf("\n"); |
| 281 | 283 | ||
| 284 | EVP_MD_CTX_cleanup(&ctx); | ||
| 285 | |||
| 282 | return 1; | 286 | return 1; |
| 283 | } | 287 | } |
| 284 | 288 | ||
diff --git a/src/lib/libssl/src/crypto/evp/p_seal.c b/src/lib/libssl/src/crypto/evp/p_seal.c index 5570ca3745..37e547fe72 100644 --- a/src/lib/libssl/src/crypto/evp/p_seal.c +++ b/src/lib/libssl/src/crypto/evp/p_seal.c | |||
| @@ -106,8 +106,10 @@ int inl; | |||
| 106 | } | 106 | } |
| 107 | */ | 107 | */ |
| 108 | 108 | ||
| 109 | void EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) | 109 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) |
| 110 | { | 110 | { |
| 111 | EVP_EncryptFinal_ex(ctx,out,outl); | 111 | int i; |
| 112 | i = EVP_EncryptFinal_ex(ctx,out,outl); | ||
| 112 | EVP_EncryptInit_ex(ctx,NULL,NULL,NULL,NULL); | 113 | EVP_EncryptInit_ex(ctx,NULL,NULL,NULL,NULL); |
| 114 | return i; | ||
| 113 | } | 115 | } |
diff --git a/src/lib/libssl/src/crypto/ui/ui_openssl.c b/src/lib/libssl/src/crypto/ui/ui_openssl.c index 3aa03f74aa..4e12165410 100644 --- a/src/lib/libssl/src/crypto/ui/ui_openssl.c +++ b/src/lib/libssl/src/crypto/ui/ui_openssl.c | |||
| @@ -465,7 +465,7 @@ static int open_console(UI *ui) | |||
| 465 | tty_out=stderr; | 465 | tty_out=stderr; |
| 466 | #endif | 466 | #endif |
| 467 | 467 | ||
| 468 | #if defined(TTY_get) && !defined(VMS) | 468 | #if defined(TTY_get) && !defined(OPENSSL_SYS_VMS) |
| 469 | if (TTY_get(fileno(tty_in),&tty_orig) == -1) | 469 | if (TTY_get(fileno(tty_in),&tty_orig) == -1) |
| 470 | { | 470 | { |
| 471 | #ifdef ENOTTY | 471 | #ifdef ENOTTY |
diff --git a/src/lib/libssl/src/doc/apps/x509.pod b/src/lib/libssl/src/doc/apps/x509.pod index 23367b7659..4a17e338dd 100644 --- a/src/lib/libssl/src/doc/apps/x509.pod +++ b/src/lib/libssl/src/doc/apps/x509.pod | |||
| @@ -505,6 +505,8 @@ As well as customising the name output format, it is also possible to | |||
| 505 | customise the actual fields printed using the B<certopt> options when | 505 | customise the actual fields printed using the B<certopt> options when |
| 506 | the B<text> option is present. The default behaviour is to print all fields. | 506 | the B<text> option is present. The default behaviour is to print all fields. |
| 507 | 507 | ||
| 508 | =over 4 | ||
| 509 | |||
| 508 | =item B<compatible> | 510 | =item B<compatible> |
| 509 | 511 | ||
| 510 | use the old format. This is equivalent to specifying no output options at all. | 512 | use the old format. This is equivalent to specifying no output options at all. |
| @@ -574,10 +576,6 @@ hex dump unsupported extensions. | |||
| 574 | the value used by the B<ca> utility, equivalent to B<no_issuer>, B<no_pubkey>, B<no_header>, | 576 | the value used by the B<ca> utility, equivalent to B<no_issuer>, B<no_pubkey>, B<no_header>, |
| 575 | B<no_version>, B<no_sigdump> and B<no_signame>. | 577 | B<no_version>, B<no_sigdump> and B<no_signame>. |
| 576 | 578 | ||
| 577 | |||
| 578 | |||
| 579 | =over 4 | ||
| 580 | |||
| 581 | =back | 579 | =back |
| 582 | 580 | ||
| 583 | =head1 EXAMPLES | 581 | =head1 EXAMPLES |
diff --git a/src/lib/libssl/src/ms/mingw32.bat b/src/lib/libssl/src/ms/mingw32.bat index db70b8580e..1968f4150b 100644 --- a/src/lib/libssl/src/ms/mingw32.bat +++ b/src/lib/libssl/src/ms/mingw32.bat | |||
| @@ -12,7 +12,8 @@ echo Generating x86 for GNU assember | |||
| 12 | 12 | ||
| 13 | echo Bignum | 13 | echo Bignum |
| 14 | cd crypto\bn\asm | 14 | cd crypto\bn\asm |
| 15 | perl x86.pl gaswin > bn-win32.s | 15 | perl bn-586.pl gaswin > bn-win32.s |
| 16 | perl co-586.pl gaswin > co-win32.s | ||
| 16 | cd ..\..\.. | 17 | cd ..\..\.. |
| 17 | 18 | ||
| 18 | echo DES | 19 | echo DES |
diff --git a/src/lib/libssl/src/shlib/svr5-shared-gcc.sh b/src/lib/libssl/src/shlib/svr5-shared-gcc.sh index b36a0375a6..76957df947 100644 --- a/src/lib/libssl/src/shlib/svr5-shared-gcc.sh +++ b/src/lib/libssl/src/shlib/svr5-shared-gcc.sh | |||
| @@ -9,7 +9,7 @@ sh_slib=$slib.so.$major.$minor | |||
| 9 | clib=libcrypto | 9 | clib=libcrypto |
| 10 | sh_clib=$clib.so.$major.$minor | 10 | sh_clib=$clib.so.$major.$minor |
| 11 | 11 | ||
| 12 | FLAGS="-O3 -DFILIO_H -fomit-frame-pointer -pthread | 12 | FLAGS="-O3 -DFILIO_H -fomit-frame-pointer -pthread" |
| 13 | SHFLAGS="-DPIC -fPIC" | 13 | SHFLAGS="-DPIC -fPIC" |
| 14 | 14 | ||
| 15 | touch $sh_clib | 15 | touch $sh_clib |
diff --git a/src/lib/libssl/src/ssl/ssl_cert.c b/src/lib/libssl/src/ssl/ssl_cert.c index 79e89fe14a..3d31bbf05f 100644 --- a/src/lib/libssl/src/ssl/ssl_cert.c +++ b/src/lib/libssl/src/ssl/ssl_cert.c | |||
| @@ -825,7 +825,6 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, | |||
| 825 | err: | 825 | err: |
| 826 | FindClose(hFind); | 826 | FindClose(hFind); |
| 827 | err_noclose: | 827 | err_noclose: |
| 828 | if (d) closedir(d); | ||
| 829 | CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); | 828 | CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); |
| 830 | return ret; | 829 | return ret; |
| 831 | } | 830 | } |
diff --git a/src/lib/libssl/src/util/pl/Mingw32.pl b/src/lib/libssl/src/util/pl/Mingw32.pl index 37f36126f3..45ab685974 100644 --- a/src/lib/libssl/src/util/pl/Mingw32.pl +++ b/src/lib/libssl/src/util/pl/Mingw32.pl | |||
| @@ -25,6 +25,8 @@ if ($gaswin and !$no_asm) | |||
| 25 | { | 25 | { |
| 26 | $bn_asm_obj='$(OBJ_D)/bn-win32.o'; | 26 | $bn_asm_obj='$(OBJ_D)/bn-win32.o'; |
| 27 | $bn_asm_src='crypto/bn/asm/bn-win32.s'; | 27 | $bn_asm_src='crypto/bn/asm/bn-win32.s'; |
| 28 | $bnco_asm_obj='$(OBJ_D)/co-win32.o'; | ||
| 29 | $bnco_asm_src='crypto/bn/asm/co-win32.s'; | ||
| 28 | $des_enc_obj='$(OBJ_D)/d-win32.o $(OBJ_D)/y-win32.o'; | 30 | $des_enc_obj='$(OBJ_D)/d-win32.o $(OBJ_D)/y-win32.o'; |
| 29 | $des_enc_src='crypto/des/asm/d-win32.s crypto/des/asm/y-win32.s'; | 31 | $des_enc_src='crypto/des/asm/d-win32.s crypto/des/asm/y-win32.s'; |
| 30 | $bf_enc_obj='$(OBJ_D)/b-win32.o'; | 32 | $bf_enc_obj='$(OBJ_D)/b-win32.o'; |
| @@ -66,12 +68,12 @@ $lfile=''; | |||
| 66 | 68 | ||
| 67 | $asm='as'; | 69 | $asm='as'; |
| 68 | $afile='-o '; | 70 | $afile='-o '; |
| 69 | $bn_asm_obj=""; | 71 | #$bn_asm_obj=""; |
| 70 | $bn_asm_src=""; | 72 | #$bn_asm_src=""; |
| 71 | $des_enc_obj=""; | 73 | #$des_enc_obj=""; |
| 72 | $des_enc_src=""; | 74 | #$des_enc_src=""; |
| 73 | $bf_enc_obj=""; | 75 | #$bf_enc_obj=""; |
| 74 | $bf_enc_src=""; | 76 | #$bf_enc_src=""; |
| 75 | 77 | ||
| 76 | sub do_lib_rule | 78 | sub do_lib_rule |
| 77 | { | 79 | { |
diff --git a/src/lib/libssl/ssl_cert.c b/src/lib/libssl/ssl_cert.c index 79e89fe14a..3d31bbf05f 100644 --- a/src/lib/libssl/ssl_cert.c +++ b/src/lib/libssl/ssl_cert.c | |||
| @@ -825,7 +825,6 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, | |||
| 825 | err: | 825 | err: |
| 826 | FindClose(hFind); | 826 | FindClose(hFind); |
| 827 | err_noclose: | 827 | err_noclose: |
| 828 | if (d) closedir(d); | ||
| 829 | CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); | 828 | CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); |
| 830 | return ret; | 829 | return ret; |
| 831 | } | 830 | } |
