From 394f7b6fcc38132b8ccff0a3253b9dd15640cfc0 Mon Sep 17 00:00:00 2001 From: Emilia Kasper Date: Tue, 1 Sep 2015 14:56:58 +0200 Subject: [PATCH] RT4002: check for NULL cipher in p12_crpt.c The NULL cipher case can't actually happen because we have no EVP_PBE_CTL combinations where cipher_nid is -1 and keygen is PKCS12_PBE_keyivgen. But make the code more obviously correct. Reviewed-by: Matt Caswell --- crypto/pkcs12/p12_crpt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto/pkcs12/p12_crpt.c b/crypto/pkcs12/p12_crpt.c index 08be40c61f..e7d5ac9f6b 100644 --- a/crypto/pkcs12/p12_crpt.c +++ b/crypto/pkcs12/p12_crpt.c @@ -76,6 +76,9 @@ int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen, unsigned char *salt; unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH]; + if (cipher == NULL) + return 0; + /* Extract useful info from parameter */ pbe = ASN1_TYPE_unpack_sequence(ASN1_ITEM_rptr(PBEPARAM), param); -- 2.25.1