summaryrefslogtreecommitdiffstats
path: root/crypto/x509
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-12-20 00:32:36 +0000
committerDr. Stephen Henson <steve@openssl.org>2015-12-31 18:44:46 +0000
commit8382fd3a93cb076af5ad954613557152c878172f (patch)
tree77afac19fd26c7df42e8bec4c1d021d460745132 /crypto/x509
parent39a6a4a707f23992beefc93d99549466857d2b10 (diff)
Use X509_get0_pubkey where appropriate
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/x509')
-rw-r--r--crypto/x509/x509_cmp.c2
-rw-r--r--crypto/x509/x509_req.c3
-rw-r--r--crypto/x509/x509type.c4
3 files changed, 3 insertions, 6 deletions
diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c
index 9d9ea4b605..20834a079f 100644
--- a/crypto/x509/x509_cmp.c
+++ b/crypto/x509/x509_cmp.c
@@ -432,7 +432,7 @@ int X509_chain_check_suiteb(int *perror_depth, X509 *x, STACK_OF(X509) *chain,
rv = X509_V_ERR_SUITE_B_INVALID_VERSION;
goto end;
}
- pk = X509_get_pubkey(x);
+ pk = X509_get0_pubkey(x);
rv = check_suite_b(pk, sign_nid, &tflags);
if (rv != X509_V_OK)
goto end;
diff --git a/crypto/x509/x509_req.c b/crypto/x509/x509_req.c
index 8cc35b3365..b27f9f6010 100644
--- a/crypto/x509/x509_req.c
+++ b/crypto/x509/x509_req.c
@@ -92,11 +92,10 @@ X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md)
if (!X509_REQ_set_subject_name(ret, X509_get_subject_name(x)))
goto err;
- pktmp = X509_get_pubkey(x);
+ pktmp = X509_get0_pubkey(x);
if (pktmp == NULL)
goto err;
i = X509_REQ_set_pubkey(ret, pktmp);
- EVP_PKEY_free(pktmp);
if (!i)
goto err;
diff --git a/crypto/x509/x509type.c b/crypto/x509/x509type.c
index a7695cad77..a9116e7c77 100644
--- a/crypto/x509/x509type.c
+++ b/crypto/x509/x509type.c
@@ -71,7 +71,7 @@ int X509_certificate_type(X509 *x, EVP_PKEY *pkey)
return (0);
if (pkey == NULL)
- pk = X509_get_pubkey(x);
+ pk = X509_get0_pubkey(x);
else
pk = pkey;
@@ -122,7 +122,5 @@ int X509_certificate_type(X509 *x, EVP_PKEY *pkey)
}
}
- if (pkey == NULL)
- EVP_PKEY_free(pk);
return (ret);
}