summaryrefslogtreecommitdiffstats
path: root/ssl/t1_enc.c
diff options
context:
space:
mode:
authorNils Larsch <nils@openssl.org>2007-02-16 20:40:07 +0000
committerNils Larsch <nils@openssl.org>2007-02-16 20:40:07 +0000
commitd31a13953c633f48a5e30e89fc66604b68d79c34 (patch)
tree0ae107ea1eefba1941dabab454c5b7a5ff690833 /ssl/t1_enc.c
parent28f5873179b52f50b8d2be201c77592cd3a43e2e (diff)
ensure that the EVP_CIPHER_CTX object is initialized
PR: 1490
Diffstat (limited to 'ssl/t1_enc.c')
-rw-r--r--ssl/t1_enc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c
index e0ce681574..68448b98ca 100644
--- a/ssl/t1_enc.c
+++ b/ssl/t1_enc.c
@@ -267,6 +267,9 @@ int tls1_change_cipher_state(SSL *s, int which)
reuse_dd = 1;
else if ((s->enc_read_ctx=OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL)
goto err;
+ else
+ /* make sure it's intialized in case we exit later with an error */
+ EVP_CIPHER_CTX_init(s->enc_read_ctx);
dd= s->enc_read_ctx;
s->read_hash=m;
#ifndef OPENSSL_NO_COMP
@@ -301,10 +304,9 @@ int tls1_change_cipher_state(SSL *s, int which)
reuse_dd = 1;
else if ((s->enc_write_ctx=OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL)
goto err;
- if ((s->enc_write_ctx == NULL) &&
- ((s->enc_write_ctx=(EVP_CIPHER_CTX *)
- OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
- goto err;
+ else
+ /* make sure it's intialized in case we exit later with an error */
+ EVP_CIPHER_CTX_init(s->enc_write_ctx);
dd= s->enc_write_ctx;
s->write_hash=m;
#ifndef OPENSSL_NO_COMP
@@ -331,7 +333,6 @@ int tls1_change_cipher_state(SSL *s, int which)
if (reuse_dd)
EVP_CIPHER_CTX_cleanup(dd);
- EVP_CIPHER_CTX_init(dd);
p=s->s3->tmp.key_block;
i=EVP_MD_size(m);