summaryrefslogtreecommitdiffstats
path: root/crypto/x509/x_pubkey.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2019-09-16 15:28:57 -0400
committerRichard Levitte <levitte@openssl.org>2019-10-09 21:32:15 +0200
commit12a765a5235f181c2f4992b615eb5f892c368e88 (patch)
tree67ece1a3fb210bd4895aea73649773fc912a60d6 /crypto/x509/x_pubkey.c
parent3a4e43de473ee80347036d78163889b6b1221210 (diff)
Explicitly test against NULL; do not use !p or similar
Also added blanks lines after declarations in a couple of places. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9916)
Diffstat (limited to 'crypto/x509/x_pubkey.c')
-rw-r--r--crypto/x509/x_pubkey.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/crypto/x509/x_pubkey.c b/crypto/x509/x_pubkey.c
index 6e8540835f..44b08e8bdf 100644
--- a/crypto/x509/x_pubkey.c
+++ b/crypto/x509/x_pubkey.c
@@ -185,16 +185,17 @@ EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length)
X509_PUBKEY *xpk;
EVP_PKEY *pktmp;
const unsigned char *q;
+
q = *pp;
xpk = d2i_X509_PUBKEY(NULL, &q, length);
- if (!xpk)
+ if (xpk == NULL)
return NULL;
pktmp = X509_PUBKEY_get(xpk);
X509_PUBKEY_free(xpk);
- if (!pktmp)
+ if (pktmp == NULL)
return NULL;
*pp = q;
- if (a) {
+ if (a != NULL) {
EVP_PKEY_free(*a);
*a = pktmp;
}
@@ -230,16 +231,17 @@ RSA *d2i_RSA_PUBKEY(RSA **a, const unsigned char **pp, long length)
EVP_PKEY *pkey;
RSA *key;
const unsigned char *q;
+
q = *pp;
pkey = d2i_PUBKEY(NULL, &q, length);
- if (!pkey)
+ if (pkey == NULL)
return NULL;
key = EVP_PKEY_get1_RSA(pkey);
EVP_PKEY_free(pkey);
- if (!key)
+ if (key == NULL)
return NULL;
*pp = q;
- if (a) {
+ if (a != NULL) {
RSA_free(*a);
*a = key;
}
@@ -271,16 +273,17 @@ DSA *d2i_DSA_PUBKEY(DSA **a, const unsigned char **pp, long length)
EVP_PKEY *pkey;
DSA *key;
const unsigned char *q;
+
q = *pp;
pkey = d2i_PUBKEY(NULL, &q, length);
- if (!pkey)
+ if (pkey == NULL)
return NULL;
key = EVP_PKEY_get1_DSA(pkey);
EVP_PKEY_free(pkey);
- if (!key)
+ if (key == NULL)
return NULL;
*pp = q;
- if (a) {
+ if (a != NULL) {
DSA_free(*a);
*a = key;
}
@@ -312,16 +315,17 @@ EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp, long length)
EVP_PKEY *pkey;
EC_KEY *key;
const unsigned char *q;
+
q = *pp;
pkey = d2i_PUBKEY(NULL, &q, length);
- if (!pkey)
+ if (pkey == NULL)
return NULL;
key = EVP_PKEY_get1_EC_KEY(pkey);
EVP_PKEY_free(pkey);
- if (!key)
+ if (key == NULL)
return NULL;
*pp = q;
- if (a) {
+ if (a != NULL) {
EC_KEY_free(*a);
*a = key;
}
@@ -332,7 +336,8 @@ int i2d_EC_PUBKEY(const EC_KEY *a, unsigned char **pp)
{
EVP_PKEY *pktmp;
int ret;
- if (!a)
+
+ if (a == NULL)
return 0;
if ((pktmp = EVP_PKEY_new()) == NULL) {
ASN1err(ASN1_F_I2D_EC_PUBKEY, ERR_R_MALLOC_FAILURE);