Coverity CID 1444953: Null pointer dereferences
[openssl.git] / crypto / evp / evp_enc.c
index 0ccea3599ecbc7916d8e066e6e9761185e89aea2..44d88a1f048b1de1bf16eb445d90d3f50bccb797 100644 (file)
@@ -338,6 +338,9 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
 #ifndef OPENSSL_NO_ENGINE
  skip_to_init:
 #endif
+    if (ctx->cipher == NULL)
+        return 0;
+
     /* we assume block size is a power of 2 in *cryptUpdate */
     OPENSSL_assert(ctx->cipher->block_size == 1
                    || ctx->cipher->block_size == 8