summaryrefslogtreecommitdiffstats
path: root/apps
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 /apps
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 'apps')
-rw-r--r--apps/crl.c4
-rw-r--r--apps/genpkey.c4
-rw-r--r--apps/lib/apps.c6
-rw-r--r--apps/pkcs12.c2
-rw-r--r--apps/req.c5
-rw-r--r--apps/ts.c3
6 files changed, 13 insertions, 11 deletions
diff --git a/apps/crl.c b/apps/crl.c
index 49ad97b774..d36b93ba64 100644
--- a/apps/crl.c
+++ b/apps/crl.c
@@ -204,7 +204,7 @@ int crl_main(int argc, char **argv)
}
pkey = X509_get_pubkey(X509_OBJECT_get0_X509(xobj));
X509_OBJECT_free(xobj);
- if (!pkey) {
+ if (pkey == NULL) {
BIO_printf(bio_err, "Error getting CRL issuer public key\n");
goto end;
}
@@ -228,7 +228,7 @@ int crl_main(int argc, char **argv)
if (!newcrl)
goto end;
pkey = load_key(keyfile, keyformat, 0, NULL, NULL, "CRL signing key");
- if (!pkey) {
+ if (pkey == NULL) {
X509_CRL_free(newcrl);
goto end;
}
diff --git a/apps/genpkey.c b/apps/genpkey.c
index f8faf3ba94..afae4b656c 100644
--- a/apps/genpkey.c
+++ b/apps/genpkey.c
@@ -217,7 +217,7 @@ static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e)
}
pbio = BIO_new_file(file, "r");
- if (!pbio) {
+ if (pbio == NULL) {
BIO_printf(bio_err, "Can't open parameter file %s\n", file);
return 0;
}
@@ -225,7 +225,7 @@ static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e)
pkey = PEM_read_bio_Parameters(pbio, NULL);
BIO_free(pbio);
- if (!pkey) {
+ if (pkey == NULL) {
BIO_printf(bio_err, "Error reading parameter file %s\n", file);
return 0;
}
diff --git a/apps/lib/apps.c b/apps/lib/apps.c
index 5038817750..65bd5a4070 100644
--- a/apps/lib/apps.c
+++ b/apps/lib/apps.c
@@ -85,7 +85,7 @@ int chopup_args(ARGS *arg, char *buf)
/* Skip whitespace. */
while (*p && isspace(_UC(*p)))
p++;
- if (!*p)
+ if (*p == '\0')
break;
/* The start of something good :-) */
@@ -258,7 +258,7 @@ static char *app_get_pass(const char *arg, int keepbio)
#endif
} else if (strcmp(arg, "stdin") == 0) {
pwdbio = dup_bio_in(FORMAT_TEXT);
- if (!pwdbio) {
+ if (pwdbio == NULL) {
BIO_printf(bio_err, "Can't open BIO for stdin\n");
return NULL;
}
@@ -407,7 +407,7 @@ static int load_pkcs12(BIO *in, const char *desc,
if (PKCS12_verify_mac(p12, "", 0) || PKCS12_verify_mac(p12, NULL, 0)) {
pass = "";
} else {
- if (!pem_cb)
+ if (pem_cb == NULL)
pem_cb = (pem_password_cb *)password_callback;
len = pem_cb(tpass, PEM_BUFSIZE, 0, cb_data);
if (len < 0) {
diff --git a/apps/pkcs12.c b/apps/pkcs12.c
index 902b75029c..a708064db1 100644
--- a/apps/pkcs12.c
+++ b/apps/pkcs12.c
@@ -465,7 +465,7 @@ int pkcs12_main(int argc, char **argv)
p12 = PKCS12_create(cpass, name, key, ucert, certs,
key_pbe, cert_pbe, iter, -1, keytype);
- if (!p12) {
+ if (p12 == NULL) {
ERR_print_errors(bio_err);
goto export_end;
}
diff --git a/apps/req.c b/apps/req.c
index 1c9672cca1..70b4f0d657 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -325,9 +325,10 @@ int req_main(int argc, char **argv)
newreq = 1;
break;
case OPT_PKEYOPT:
- if (!pkeyopts)
+ if (pkeyopts == NULL)
pkeyopts = sk_OPENSSL_STRING_new_null();
- if (!pkeyopts || !sk_OPENSSL_STRING_push(pkeyopts, opt_arg()))
+ if (pkeyopts == NULL
+ || !sk_OPENSSL_STRING_push(pkeyopts, opt_arg()))
goto opthelp;
break;
case OPT_SIGOPT:
diff --git a/apps/ts.c b/apps/ts.c
index 4ef8a72eef..aef74adce8 100644
--- a/apps/ts.c
+++ b/apps/ts.c
@@ -507,8 +507,9 @@ static int create_digest(BIO *input, const char *digest, const EVP_MD *md,
md_value_len = EVP_MD_size(md);
} else {
long digest_len;
+
*md_value = OPENSSL_hexstr2buf(digest, &digest_len);
- if (!*md_value || md_value_len != digest_len) {
+ if (*md_value == NULL || md_value_len != digest_len) {
OPENSSL_free(*md_value);
*md_value = NULL;
BIO_printf(bio_err, "bad digest, %d bytes "