Backport libcrypto audit: check return values of EVP functions instead
[openssl.git] / crypto / asn1 / p5_pbev2.c
index cb49b6651dcdd90b988b1c1499c08abc30bb4cab..377edaffc922e4083a59e9a2f953e5f68c8510eb 100644 (file)
@@ -127,7 +127,8 @@ X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
        EVP_CIPHER_CTX_init(&ctx);
 
        /* Dummy cipherinit to just setup the IV, and PRF */
-       EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0);
+       if (!EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, iv, 0))
+               goto err;
        if(EVP_CIPHER_param_to_asn1(&ctx, scheme->parameter) < 0) {
                ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,
                                        ASN1_R_ERROR_SETTING_CIPHER_PARAMS);