summaryrefslogtreecommitdiff
path: root/drivers/builtin_openssl2/crypto/pkcs12/p12_p8e.c
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-04-18 19:21:46 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-04-18 19:21:46 +0200
commit206895afae413df9a3961ce6793ce295babb5920 (patch)
tree0b16a8466e9f0f054176ecfb2fa24a6b942fcec6 /drivers/builtin_openssl2/crypto/pkcs12/p12_p8e.c
parent336cbfa7b63721757874f0fc5c33ec5dd31c5076 (diff)
parente97922f22038e9049ed4c2db5b3736dfaa0edde3 (diff)
Merge pull request #4329 from mrezai/openssl-1.0.2g
Update OpenSSL to version 1.0.2g
Diffstat (limited to 'drivers/builtin_openssl2/crypto/pkcs12/p12_p8e.c')
-rw-r--r--drivers/builtin_openssl2/crypto/pkcs12/p12_p8e.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/builtin_openssl2/crypto/pkcs12/p12_p8e.c b/drivers/builtin_openssl2/crypto/pkcs12/p12_p8e.c
index d970f0544c..861a087f80 100644
--- a/drivers/builtin_openssl2/crypto/pkcs12/p12_p8e.c
+++ b/drivers/builtin_openssl2/crypto/pkcs12/p12_p8e.c
@@ -76,8 +76,12 @@ X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
if (pbe_nid == -1)
pbe = PKCS5_pbe2_set(cipher, iter, salt, saltlen);
- else
+ else if (EVP_PBE_find(EVP_PBE_TYPE_PRF, pbe_nid, NULL, NULL, 0))
+ pbe = PKCS5_pbe2_set_iv(cipher, iter, salt, saltlen, NULL, pbe_nid);
+ else {
+ ERR_clear_error();
pbe = PKCS5_pbe_set(pbe_nid, iter, salt, saltlen);
+ }
if (!pbe) {
PKCS12err(PKCS12_F_PKCS8_ENCRYPT, ERR_R_ASN1_LIB);
goto err;