summaryrefslogtreecommitdiffstats
path: root/crypto/pem/pem_pk8.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/pem/pem_pk8.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/pem/pem_pk8.c')
-rw-r--r--crypto/pem/pem_pk8.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c
index d8bb9bbf8f..642d4f6e24 100644
--- a/crypto/pem/pem_pk8.c
+++ b/crypto/pem/pem_pk8.c
@@ -117,10 +117,11 @@ EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
int klen;
EVP_PKEY *ret;
char psbuf[PEM_BUFSIZE];
+
p8 = d2i_PKCS8_bio(bp, NULL);
- if (!p8)
+ if (p8 == NULL)
return NULL;
- if (cb)
+ if (cb != NULL)
klen = cb(psbuf, PEM_BUFSIZE, 0, u);
else
klen = PEM_def_callback(psbuf, PEM_BUFSIZE, 0, u);
@@ -132,13 +133,13 @@ EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
p8inf = PKCS8_decrypt(p8, psbuf, klen);
X509_SIG_free(p8);
OPENSSL_cleanse(psbuf, klen);
- if (!p8inf)
+ if (p8inf == NULL)
return NULL;
ret = EVP_PKCS82PKEY(p8inf);
PKCS8_PRIV_KEY_INFO_free(p8inf);
if (!ret)
return NULL;
- if (x) {
+ if (x != NULL) {
EVP_PKEY_free(*x);
*x = ret;
}