dev_crypto_init_key: return error if allocating CDATA(ctx)->key failed
authorJonas Maebe <jonas.maebe@elis.ugent.be>
Sun, 8 Dec 2013 17:09:20 +0000 (18:09 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Sun, 17 Aug 2014 16:51:16 +0000 (18:51 +0200)
Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/evp/openbsd_hw.c

index 3831a5731e9cd5340daccff94d64146403f34af4..93ed5d65156ef714d18a8157ed29c562e45a778f 100644 (file)
@@ -134,6 +134,8 @@ static int dev_crypto_init_key(EVP_CIPHER_CTX *ctx,int cipher,
        return 0;
 
     CDATA(ctx)->key=OPENSSL_malloc(MAX_HW_KEY);
+    if (CDATA(ctx)->key == NULL)
+        return 0;
 
     assert(ctx->cipher->iv_len <= MAX_HW_IV);