aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/x509/x509_r2x.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/crypto/x509/x509_r2x.c b/crypto/x509/x509_r2x.c
index dc7e41265c..d082636de4 100644
--- a/crypto/x509/x509_r2x.c
+++ b/crypto/x509/x509_r2x.c
@@ -101,21 +101,14 @@ X509 *X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey)
NULL)
goto err;
- pubkey = X509_REQ_get_pubkey(r);
- if (pubkey == NULL)
+ pubkey = X509_REQ_get0_pubkey(r);
+ if (pubkey == NULL || !X509_set_pubkey(ret, pubkey))
goto err;
- if (!X509_set_pubkey(ret, pubkey))
- goto err_pkey;
-
- EVP_PKEY_free(pubkey);
-
if (!X509_sign(ret, pkey, EVP_md5()))
goto err;
return ret;
- err_pkey:
- EVP_PKEY_free(pubkey);
err:
X509_free(ret);
return NULL;