diff options
author | Jonas Maebe <jonas.maebe@elis.ugent.be> | 2013-12-08 18:09:58 +0100 |
---|---|---|
committer | Kurt Roeckx <kurt@roeckx.be> | 2014-08-17 18:51:35 +0200 |
commit | d8513b4abd00b89481cba59dd3d7f81b90a2e747 (patch) | |
tree | fd03034c139740a48662b272bf2996952afd6b30 | |
parent | c84029dbdc57edfb9c6cd94f3a730749adb0236a (diff) |
dev_crypto_cipher: return immediately if allocating cin/cout failed
Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
-rw-r--r-- | crypto/evp/openbsd_hw.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/evp/openbsd_hw.c b/crypto/evp/openbsd_hw.c index 93ed5d6515..0554019489 100644 --- a/crypto/evp/openbsd_hw.c +++ b/crypto/evp/openbsd_hw.c @@ -193,6 +193,8 @@ static int dev_crypto_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out, if(((unsigned long)in&3) || cinl != inl) { cin=OPENSSL_malloc(cinl); + if (cin == NULL) + return 0; memcpy(cin,in,inl); cryp.src=cin; } @@ -200,6 +202,12 @@ static int dev_crypto_cipher(EVP_CIPHER_CTX *ctx,unsigned char *out, if(((unsigned long)out&3) || cinl != inl) { cout=OPENSSL_malloc(cinl); + if (cout == NULL) + { + if (cin != NULL) + OPENSSL_free(cin); + return 0; + } cryp.dst=cout; } |