summaryrefslogtreecommitdiffstats
path: root/crypto/pkcs12
diff options
context:
space:
mode:
authorEmilia Kasper <emilia@openssl.org>2015-09-01 14:56:58 +0200
committerEmilia Kasper <emilia@openssl.org>2015-09-01 20:03:04 +0200
commit59793f5c1e0138928d9e5fc24c743d8e38d450e1 (patch)
treee16b13eb0bf3bac3e8b7d816cb6d78ee3efc473a /crypto/pkcs12
parent5f623eb61655688501cb1817a7ad0592299d894a (diff)
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 <matt@openssl.org> (cherry picked from commit 394f7b6fcc38132b8ccff0a3253b9dd15640cfc0)
Diffstat (limited to 'crypto/pkcs12')
-rw-r--r--crypto/pkcs12/p12_crpt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/pkcs12/p12_crpt.c b/crypto/pkcs12/p12_crpt.c
index 3a166e6130..9c2dcab024 100644
--- a/crypto/pkcs12/p12_crpt.c
+++ b/crypto/pkcs12/p12_crpt.c
@@ -77,6 +77,9 @@ int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
const unsigned char *pbuf;
unsigned char key[EVP_MAX_KEY_LENGTH], iv[EVP_MAX_IV_LENGTH];
+ if (cipher == NULL)
+ return 0;
+
/* Extract useful info from parameter */
if (param == NULL || param->type != V_ASN1_SEQUENCE ||
param->value.sequence == NULL) {