summaryrefslogtreecommitdiffstats
path: root/crypto/pem/pem_pkey.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2004-02-26 22:07:45 +0000
committerRichard Levitte <levitte@openssl.org>2004-02-26 22:07:45 +0000
commitf727266ae843eaa3502f1e35fe594b195a3879ed (patch)
tree37e56f9f77083475d9f1ef6642ccb251b798f198 /crypto/pem/pem_pkey.c
parent8bb0c8522a3980a82bf0ebfbdf782ec306c35ea6 (diff)
Make sure the given EVP_PKEY is updated in the PEM_STRING_PKCS8INF case also.
PR: 833
Diffstat (limited to 'crypto/pem/pem_pkey.c')
-rw-r--r--crypto/pem/pem_pkey.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/pem/pem_pkey.c b/crypto/pem/pem_pkey.c
index 92a55f536a..d23adf3028 100644
--- a/crypto/pem/pem_pkey.c
+++ b/crypto/pem/pem_pkey.c
@@ -89,6 +89,10 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, vo
p8inf=d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len);
if(!p8inf) goto p8err;
ret = EVP_PKCS82PKEY(p8inf);
+ if(x) {
+ if(*x) EVP_PKEY_free((EVP_PKEY *)*x);
+ *x = ret;
+ }
PKCS8_PRIV_KEY_INFO_free(p8inf);
} else if (strcmp(nm,PEM_STRING_PKCS8) == 0) {
PKCS8_PRIV_KEY_INFO *p8inf;