ensure that the EVP_CIPHER_CTX object is initialized

PR: 1490
This commit is contained in:
Nils Larsch
2007-02-16 20:40:07 +00:00
parent 28f5873179
commit d31a13953c
3 changed files with 18 additions and 9 deletions

View File

@@ -82,15 +82,18 @@ int ssl2_enc_init(SSL *s, int client)
((s->enc_read_ctx=(EVP_CIPHER_CTX *)
OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
goto err;
/* make sure it's intialized in case the malloc for enc_write_ctx fails
* and we exit with an error */
rs= s->enc_read_ctx;
EVP_CIPHER_CTX_init(rs);
if ((s->enc_write_ctx == NULL) &&
((s->enc_write_ctx=(EVP_CIPHER_CTX *)
OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL))
goto err;
rs= s->enc_read_ctx;
ws= s->enc_write_ctx;
EVP_CIPHER_CTX_init(rs);
EVP_CIPHER_CTX_init(ws);
num=c->key_len;