aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-05-06 13:43:59 -0400
committerRich Salz <rsalz@openssl.org>2015-05-11 10:06:38 -0400
commit75ebbd9aa411c5b8b19ded6ace2b34181566b56a (patch)
tree6bc9cd77b2794b25f9cd9aac1c66f4626fb975a5 /apps
parent344c271eb339fc2982e9a3584a94e51112d84584 (diff)
downloadopenssl-75ebbd9aa411c5b8b19ded6ace2b34181566b56a.zip
openssl-75ebbd9aa411c5b8b19ded6ace2b34181566b56a.tar.gz
openssl-75ebbd9aa411c5b8b19ded6ace2b34181566b56a.tar.bz2
Use p==NULL not !p (in if statements, mainly)
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'apps')
-rw-r--r--apps/apps.c5
-rw-r--r--apps/ca.c2
-rw-r--r--apps/cms.c22
-rw-r--r--apps/crl.c2
-rw-r--r--apps/crl2p7.c3
-rw-r--r--apps/pkcs12.c18
-rw-r--r--apps/pkcs8.c10
-rw-r--r--apps/req.c2
-rw-r--r--apps/s_client.c3
-rw-r--r--apps/smime.c12
-rw-r--r--apps/srp.c27
-rw-r--r--apps/ts.c82
-rw-r--r--apps/verify.c2
-rw-r--r--apps/x509.c4
14 files changed, 101 insertions, 93 deletions
diff --git a/apps/apps.c b/apps/apps.c
index 1c182ba..ab6eb40 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -502,11 +502,12 @@ int add_oid_section(CONF *conf)
STACK_OF(CONF_VALUE) *sktmp;
CONF_VALUE *cnf;
int i;
- if (!(p = NCONF_get_string(conf, NULL, "oid_section"))) {
+
+ if ((p = NCONF_get_string(conf, NULL, "oid_section")) == NULL) {
ERR_clear_error();
return 1;
}
- if (!(sktmp = NCONF_get_section(conf, p))) {
+ if ((sktmp = NCONF_get_section(conf, p)) == NULL) {
BIO_printf(bio_err, "problem loading oid section %s\n", p);
return 0;
}
diff --git a/apps/ca.c b/apps/ca.c
index d7a9aca..58f1243 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -1703,7 +1703,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
* Its best to dup the subject DN and then delete any email addresses
* because this retains its structure.
*/
- if (!(dn_subject = X509_NAME_dup(subject))) {
+ if ((dn_subject = X509_NAME_dup(subject)) == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
goto end;
}
diff --git a/apps/cms.c b/apps/cms.c
index 5eb5d2d..5293fbd 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -717,8 +717,8 @@ int cms_main(int argc, char **argv)
if ((encerts = sk_X509_new_null()) == NULL)
goto end;
while (*argv) {
- if (!(cert = load_cert(*argv, FORMAT_PEM,
- NULL, e, "recipient certificate file")))
+ if ((cert = load_cert(*argv, FORMAT_PEM, NULL, e,
+ "recipient certificate file")) == NULL)
goto end;
sk_X509_push(encerts, cert);
cert = NULL;
@@ -727,24 +727,24 @@ int cms_main(int argc, char **argv)
}
if (certfile) {
- if (!(other = load_certs(certfile, FORMAT_PEM, NULL,
- e, "certificate file"))) {
+ if ((other = load_certs(certfile, FORMAT_PEM, NULL, e,
+ "certificate file")) == NULL) {
ERR_print_errors(bio_err);
goto end;
}
}
if (recipfile && (operation == SMIME_DECRYPT)) {
- if (!(recip = load_cert(recipfile, FORMAT_PEM, NULL,
- e, "recipient certificate file"))) {
+ if ((recip = load_cert(recipfile, FORMAT_PEM, NULL, e,
+ "recipient certificate file")) == NULL) {
ERR_print_errors(bio_err);
goto end;
}
}
if (operation == SMIME_SIGN_RECEIPT) {
- if (!(signer = load_cert(signerfile, FORMAT_PEM, NULL,
- e, "receipt signer certificate file"))) {
+ if ((signer = load_cert(signerfile, FORMAT_PEM, NULL, e,
+ "receipt signer certificate file")) == NULL) {
ERR_print_errors(bio_err);
goto end;
}
@@ -787,7 +787,7 @@ int cms_main(int argc, char **argv)
}
if (contfile) {
BIO_free(indata);
- if (!(indata = BIO_new_file(contfile, "rb"))) {
+ if ((indata = BIO_new_file(contfile, "rb")) == NULL) {
BIO_printf(bio_err, "Can't read content file %s\n", contfile);
goto end;
}
@@ -807,7 +807,7 @@ int cms_main(int argc, char **argv)
if (rctfile) {
char *rctmode = (rctformat == FORMAT_ASN1) ? "rb" : "r";
- if (!(rctin = BIO_new_file(rctfile, rctmode))) {
+ if ((rctin = BIO_new_file(rctfile, rctmode)) == NULL) {
BIO_printf(bio_err, "Can't open receipt file %s\n", rctfile);
goto end;
}
@@ -834,7 +834,7 @@ int cms_main(int argc, char **argv)
goto end;
if ((operation == SMIME_VERIFY) || (operation == SMIME_VERIFY_RECEIPT)) {
- if (!(store = setup_verify(CAfile, CApath)))
+ if ((store = setup_verify(CAfile, CApath)) == NULL)
goto end;
X509_STORE_set_verify_cb(store, cms_cb);
if (vpmtouched)
diff --git a/apps/crl.c b/apps/crl.c
index b8c592c..443889a 100644
--- a/apps/crl.c
+++ b/apps/crl.c
@@ -222,7 +222,7 @@ int crl_main(int argc, char **argv)
goto end;
if (do_ver) {
- if (!(store = setup_verify(CAfile, CApath)))
+ if ((store = setup_verify(CAfile, CApath)) == NULL)
goto end;
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
if (lookup == NULL)
diff --git a/apps/crl2p7.c b/apps/crl2p7.c
index fb2b085..f05ad4a 100644
--- a/apps/crl2p7.c
+++ b/apps/crl2p7.c
@@ -135,7 +135,8 @@ int crl2pkcs7_main(int argc, char **argv)
nocrl = 1;
break;
case OPT_CERTFILE:
- if (!certflst && !(certflst = sk_OPENSSL_STRING_new_null()))
+ if ((certflst == NULL)
+ && (certflst = sk_OPENSSL_STRING_new_null()) == NULL)
goto end;
if (!sk_OPENSSL_STRING_push(certflst, *(++argv))) {
sk_OPENSSL_STRING_free(certflst);
diff --git a/apps/pkcs12.c b/apps/pkcs12.c
index 67d33a2..367ba87 100644
--- a/apps/pkcs12.c
+++ b/apps/pkcs12.c
@@ -421,8 +421,8 @@ int pkcs12_main(int argc, char **argv)
/* Add any more certificates asked for */
if (certfile) {
STACK_OF(X509) *morecerts = NULL;
- if (!(morecerts = load_certs(certfile, FORMAT_PEM, NULL, e,
- "certificates from certfile")))
+ if ((morecerts = load_certs(certfile, FORMAT_PEM, NULL, e,
+ "certificates from certfile")) == NULL)
goto export_end;
while (sk_X509_num(morecerts) > 0)
sk_X509_push(certs, sk_X509_shift(morecerts));
@@ -434,7 +434,7 @@ int pkcs12_main(int argc, char **argv)
int vret;
STACK_OF(X509) *chain2;
X509_STORE *store;
- if (!(store = setup_verify(CAfile, CApath)))
+ if ((store = setup_verify(CAfile, CApath)) == NULL)
goto export_end;
vret = get_cert_chain(ucert, store, &chain2);
@@ -511,7 +511,7 @@ int pkcs12_main(int argc, char **argv)
}
- if (!(p12 = d2i_PKCS12_bio(in, NULL))) {
+ if ((p12 = d2i_PKCS12_bio(in, NULL)) == NULL) {
ERR_print_errors(bio_err);
goto end;
}
@@ -570,7 +570,7 @@ int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass,
int ret = 0;
PKCS7 *p7;
- if (!(asafes = PKCS12_unpack_authsafes(p12)))
+ if ((asafes = PKCS12_unpack_authsafes(p12)) == NULL)
return 0;
for (i = 0; i < sk_PKCS7_num(asafes); i++) {
p7 = sk_PKCS7_value(asafes, i);
@@ -634,7 +634,7 @@ int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass,
return 1;
print_attribs(out, bag->attrib, "Bag Attributes");
p8 = bag->value.keybag;
- if (!(pkey = EVP_PKCS82PKEY(p8)))
+ if ((pkey = EVP_PKCS82PKEY(p8)) == NULL)
return 0;
print_attribs(out, p8->attributes, "Key Attributes");
PEM_write_bio_PrivateKey(out, pkey, enc, NULL, 0, NULL, pempass);
@@ -649,9 +649,9 @@ int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass,
if (options & NOKEYS)
return 1;
print_attribs(out, bag->attrib, "Bag Attributes");
- if (!(p8 = PKCS12_decrypt_skey(bag, pass, passlen)))
+ if ((p8 = PKCS12_decrypt_skey(bag, pass, passlen)) == NULL)
return 0;
- if (!(pkey = EVP_PKCS82PKEY(p8))) {
+ if ((pkey = EVP_PKCS82PKEY(p8)) == NULL) {
PKCS8_PRIV_KEY_INFO_free(p8);
return 0;
}
@@ -674,7 +674,7 @@ int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bag, char *pass,
print_attribs(out, bag->attrib, "Bag Attributes");
if (M_PKCS12_cert_bag_type(bag) != NID_x509Certificate)
return 1;
- if (!(x509 = PKCS12_certbag2x509(bag)))
+ if ((x509 = PKCS12_certbag2x509(bag)) == NULL)
return 0;
dump_cert_text(out, x509);
PEM_write_bio_X509(out, x509);
diff --git a/apps/pkcs8.c b/apps/pkcs8.c
index 07ebf3b..55c4eea 100644
--- a/apps/pkcs8.c
+++ b/apps/pkcs8.c
@@ -211,7 +211,7 @@ int pkcs8_main(int argc, char **argv)
pkey = load_key(infile, informat, 1, passin, e, "key");
if (!pkey)
goto end;
- if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) {
+ if ((p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken)) == NULL) {
BIO_printf(bio_err, "Error converting key\n");
ERR_print_errors(bio_err);
goto end;
@@ -235,9 +235,9 @@ int pkcs8_main(int argc, char **argv)
goto end;
}
app_RAND_load_file(NULL, 0);
- if (!(p8 = PKCS8_encrypt(pbe_nid, cipher,
- p8pass, strlen(p8pass),
- NULL, 0, iter, p8inf))) {
+ if ((p8 = PKCS8_encrypt(pbe_nid, cipher,
+ p8pass, strlen(p8pass),
+ NULL, 0, iter, p8inf)) == NULL) {
BIO_printf(bio_err, "Error encrypting key\n");
ERR_print_errors(bio_err);
goto end;
@@ -296,7 +296,7 @@ int pkcs8_main(int argc, char **argv)
goto end;
}
- if (!(pkey = EVP_PKCS82PKEY(p8inf))) {
+ if ((pkey = EVP_PKCS82PKEY(p8inf)) == NULL) {
BIO_printf(bio_err, "Error converting key\n");
ERR_print_errors(bio_err);
goto end;
diff --git a/apps/req.c b/apps/req.c
index 225474b..8acdad3 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -962,7 +962,7 @@ static int build_subject(X509_REQ *req, char *subject, unsigned long chtype,
{
X509_NAME *n;
- if (!(n = parse_name(subject, chtype, multirdn)))
+ if ((n = parse_name(subject, chtype, multirdn)) == NULL)
return 0;
if (!X509_REQ_set_subject_name(req, n)) {
diff --git a/apps/s_client.c b/apps/s_client.c
index a24d2f3..b257727 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -345,7 +345,8 @@ static int ssl_srp_verify_param_cb(SSL *s, void *arg)
{
SRP_ARG *srp_arg = (SRP_ARG *)arg;
BIGNUM *N = NULL, *g = NULL;
- if (!(N = SSL_get_srp_N(s)) || !(g = SSL_get_srp_g(s)))
+
+ if (((N = SSL_get_srp_N(s)) == NULL) || ((g = SSL_get_srp_g(s)) == NULL))
return 0;
if (srp_arg->debug || srp_arg->msg || srp_arg->amp == 1) {
BIO_printf(bio_err, "SRP parameters:\n");
diff --git a/apps/smime.c b/apps/smime.c
index e544ca2..3f48278 100644
--- a/apps/smime.c
+++ b/apps/smime.c
@@ -463,16 +463,16 @@ int smime_main(int argc, char **argv)
}
if (certfile) {
- if (!(other = load_certs(certfile, FORMAT_PEM, NULL,
- e, "certificate file"))) {
+ if ((other = load_certs(certfile, FORMAT_PEM, NULL,
+ e, "certificate file")) == NULL) {
ERR_print_errors(bio_err);
goto end;
}
}
if (recipfile && (operation == SMIME_DECRYPT)) {
- if (!(recip = load_cert(recipfile, FORMAT_PEM, NULL,
- e, "recipient certificate file"))) {
+ if ((recip = load_cert(recipfile, FORMAT_PEM, NULL,
+ e, "recipient certificate file")) == NULL) {
ERR_print_errors(bio_err);
goto end;
}
@@ -515,7 +515,7 @@ int smime_main(int argc, char **argv)
}
if (contfile) {
BIO_free(indata);
- if (!(indata = BIO_new_file(contfile, "rb"))) {
+ if ((indata = BIO_new_file(contfile, "rb")) == NULL) {
BIO_printf(bio_err, "Can't read content file %s\n", contfile);
goto end;
}
@@ -527,7 +527,7 @@ int smime_main(int argc, char **argv)
goto end;
if (operation == SMIME_VERIFY) {
- if (!(store = setup_verify(CAfile, CApath)))
+ if ((store = setup_verify(CAfile, CApath)) == NULL)
goto end;
X509_STORE_set_verify_cb(store, smime_cb);
if (vpmtouched)
diff --git a/apps/srp.c b/apps/srp.c
index 111f829..ec875cb 100644
--- a/apps/srp.c
+++ b/apps/srp.c
@@ -516,10 +516,13 @@ int srp_main(int argc, char **argv)
row[DB_srptype] = BUF_strdup("v");
row[DB_srpgN] = BUF_strdup(gNid);
- if (!row[DB_srpid] || !row[DB_srpgN] || !row[DB_srptype]
- || !row[DB_srpverifier] || !row[DB_srpsalt]
- || (userinfo &&
- (!(row [DB_srpinfo] = BUF_strdup (userinfo))))
+ if ((row[DB_srpid] == NULL)
+ || (row[DB_srpgN] == NULL)
+ || (row[DB_srptype] == NULL)
+ || (row[DB_srpverifier] == NULL)
+ || (row[DB_srpsalt] == NULL)
+ || (userinfo
+ && ((row[DB_srpinfo] = BUF_strdup(userinfo)) == NULL))
|| !update_index(db, row)) {
OPENSSL_free(row[DB_srpid]);
OPENSSL_free(row[DB_srpgN]);
@@ -596,10 +599,14 @@ int srp_main(int argc, char **argv)
row[DB_srptype][0] = 'v';
row[DB_srpgN] = BUF_strdup(gNid);
- if (!row[DB_srpid] || !row[DB_srpgN] || !row[DB_srptype]
- || !row[DB_srpverifier] || !row[DB_srpsalt]
+ if (row[DB_srpid] == NULL
+ || row[DB_srpgN] == NULL
+ || row[DB_srptype] == NULL
+ || row[DB_srpverifier] == NULL
+ || row[DB_srpsalt] == NULL
|| (userinfo
- && (!(row[DB_srpinfo] = BUF_strdup(userinfo)))))
+ && ((row[DB_srpinfo] = BUF_strdup(userinfo))
+ == NULL)))
goto end;
doupdatedb = 1;
@@ -612,12 +619,10 @@ int srp_main(int argc, char **argv)
user);
errors++;
} else {
- char **xpp =
- sk_OPENSSL_PSTRING_value(db->db->data, userindex);
- BIO_printf(bio_err, "user \"%s\" revoked. t\n", user);
+ char **xpp = sk_OPENSSL_PSTRING_value(db->db->data, userindex);
+ BIO_printf(bio_err, "user \"%s\" revoked. t\n", user);
xpp[DB_srptype][0] = 'R';
-
doupdatedb = 1;
}
}
diff --git a/apps/ts.c b/apps/ts.c
index 3cfdc79..5c42ff5 100644
--- a/apps/ts.c
+++ b/apps/ts.c
@@ -381,7 +381,7 @@ static ASN1_OBJECT *txt2obj(const char *oid)
{
ASN1_OBJECT *oid_obj = NULL;
- if (!(oid_obj = OBJ_txt2obj(oid, 0)))
+ if ((oid_obj = OBJ_txt2obj(oid, 0)) == NULL)
BIO_printf(bio_err, "cannot convert %s to OID\n", oid);
return oid_obj;
@@ -398,8 +398,8 @@ static CONF *load_config_file(const char *configfile)
configfile = getenv("SSLEAY_CONF");
if (configfile &&
- (!(conf = NCONF_new(NULL)) ||
- NCONF_load(conf, configfile, &errorline) <= 0)) {
+ ((conf = NCONF_new(NULL)) == NULL
+ || NCONF_load(conf, configfile, &errorline) <= 0)) {
if (errorline <= 0)
BIO_printf(bio_err, "error loading the config file "
"'%s'\n", configfile);
@@ -449,7 +449,8 @@ static int query_command(const char *data, char *digest, const EVP_MD *md,
query = d2i_TS_REQ_bio(in_bio, NULL);
} else {
/* Open the file if no explicit digest bytes were specified. */
- if (!digest && !(data_bio = bio_open_default(data, "rb")))
+ if (digest == NULL
+ && (data_bio = bio_open_default(data, "rb")) == NULL)
goto end;
query = create_query(data_bio, digest, md, policy, no_nonce, cert);
}
@@ -496,11 +497,11 @@ static TS_REQ *create_query(BIO *data_bio, char *digest, const EVP_MD *md,
ASN1_INTEGER *nonce_asn1 = NULL;
/* Setting default message digest. */
- if (!md && !(md = EVP_get_digestbyname("sha1")))
+ if (md == NULL && (md = EVP_get_digestbyname("sha1")) == NULL)
goto err;
/* Creating request object. */
- if (!(ts_req = TS_REQ_new()))
+ if ((ts_req = TS_REQ_new()) == NULL)
goto err;
/* Setting version. */
@@ -508,15 +509,15 @@ static TS_REQ *create_query(BIO *data_bio, char *digest, const EVP_MD *md,
goto err;
/* Creating and adding MSG_IMPRINT object. */
- if (!(msg_imprint = TS_MSG_IMPRINT_new()))
+ if ((msg_imprint = TS_MSG_IMPRINT_new()) == NULL)
goto err;
/* Adding algorithm. */
- if (!(algo = X509_ALGOR_new()))
+ if ((algo = X509_ALGOR_new()) == NULL)
goto err;
- if (!(algo->algorithm = OBJ_nid2obj(EVP_MD_type(md))))
+ if ((algo->algorithm = OBJ_nid2obj(EVP_MD_type(md))) == NULL)
goto err;
- if (!(algo->parameter = ASN1_TYPE_new()))
+ if ((algo->parameter = ASN1_TYPE_new()) == NULL)
goto err;
algo->parameter->type = V_ASN1_NULL;
if (!TS_MSG_IMPRINT_set_algo(msg_imprint, algo))
@@ -532,13 +533,13 @@ static TS_REQ *create_query(BIO *data_bio, char *digest, const EVP_MD *md,
goto err;
/* Setting policy if requested. */
- if (policy && !(policy_obj = txt2obj(policy)))
+ if (policy && (policy_obj = txt2obj(policy)) == NULL)
goto err;
if (policy_obj && !TS_REQ_set_policy_id(ts_req, policy_obj))
goto err;
/* Setting nonce if requested. */
- if (!no_nonce && !(nonce_asn1 = create_nonce(NONCE_LENGTH)))
+ if (!no_nonce && (nonce_asn1 = create_nonce(NONCE_LENGTH)) == NULL)
goto err;
if (nonce_asn1 && !TS_REQ_set_nonce(ts_req, nonce_asn1))
goto err;
@@ -615,8 +616,9 @@ static ASN1_INTEGER *create_nonce(int bits)
goto err;
/* Find the first non-zero byte and creating ASN1_INTEGER object. */
- for (i = 0; i < len && !buf[i]; ++i) ;
- if (!(nonce = ASN1_INTEGER_new()))
+ for (i = 0; i < len && !buf[i]; ++i)
+ continue;
+ if ((nonce = ASN1_INTEGER_new()) == NULL)
goto err;
OPENSSL_free(nonce->data);
/* Allocate at least one byte. */
@@ -725,17 +727,17 @@ static TS_RESP *read_PKCS7(BIO *in_bio)
TS_STATUS_INFO *si = NULL;
/* Read PKCS7 object and extract the signed time stamp info. */
- if (!(token = d2i_PKCS7_bio(in_bio, NULL)))
+ if ((token = d2i_PKCS7_bio(in_bio, NULL)) == NULL)
goto end;
- if (!(tst_info = PKCS7_to_TS_TST_INFO(token)))
+ if ((tst_info = PKCS7_to_TS_TST_INFO(token)) == NULL)
goto end;
/* Creating response object. */
- if (!(resp = TS_RESP_new()))
+ if ((resp = TS_RESP_new()) == NULL)
goto end;
/* Create granted status info. */
- if (!(si = TS_STATUS_INFO_new()))
+ if ((si = TS_STATUS_INFO_new()) == NULL)
goto end;
if (!(ASN1_INTEGER_set(si->status, TS_STATUS_GRANTED)))
goto end;
@@ -769,15 +771,15 @@ static TS_RESP *create_response(CONF *conf, const char *section, char *engine,
BIO *query_bio = NULL;
TS_RESP_CTX *resp_ctx = NULL;
- if (!(query_bio = BIO_new_file(queryfile, "rb")))
+ if ((query_bio = BIO_new_file(queryfile, "rb")) == NULL)
goto end;
/* Getting TSA configuration section. */
- if (!(section = TS_CONF_get_tsa_section(conf, section)))
+ if ((section = TS_CONF_get_tsa_section(conf, section)) == NULL)
goto end;
/* Setting up response generation context. */
- if (!(resp_ctx = TS_RESP_CTX_new()))
+ if ((resp_ctx = TS_RESP_CTX_new()) == NULL)
goto end;
/* Setting serial number provider callback. */
@@ -834,7 +836,7 @@ static TS_RESP *create_response(CONF *conf, const char *section, char *engine,
goto end;
/* Creating the response. */
- if (!(response = TS_RESP_create_response(resp_ctx, query_bio)))
+ if ((response = TS_RESP_create_response(resp_ctx, query_bio)) == NULL)
goto end;
ret = 1;
@@ -872,10 +874,10 @@ static ASN1_INTEGER *next_serial(const char *serialfile)
ASN1_INTEGER *serial = NULL;
BIGNUM *bn = NULL;
- if (!(serial = ASN1_INTEGER_new()))
+ if ((serial = ASN1_INTEGER_new()) == NULL)
goto err;
- if (!(in = BIO_new_file(serialfile, "r"))) {
+ if ((in = BIO_new_file(serialfile, "r")) == NULL) {
ERR_clear_error();
BIO_printf(bio_err, "Warning: could not open file %s for "
"reading, using serial number: 1\n", serialfile);
@@ -888,13 +890,13 @@ static ASN1_INTEGER *next_serial(const char *serialfile)
serialfile);
goto err;
}
- if (!(bn = ASN1_INTEGER_to_BN(serial, NULL)))
+ if ((bn = ASN1_INTEGER_to_BN(serial, NULL)) == NULL)
goto err;
ASN1_INTEGER_free(serial);
serial = NULL;
if (!BN_add_word(bn, 1))
goto err;
- if (!(serial = BN_to_ASN1_INTEGER(bn, NULL)))
+ if ((serial = BN_to_ASN1_INTEGER(bn, NULL)) == NULL)
goto err;
}
ret = 1;
@@ -913,7 +915,7 @@ static int save_ts_serial(const char *serialfile, ASN1_INTEGER *serial)
int ret = 0;
BIO *out = NULL;
- if (!(out = BIO_new_file(serialfile, "w")))
+ if ((out = BIO_new_file(serialfile, "w")) == NULL)
goto err;
if (i2a_ASN1_INTEGER(out, serial) <= 0)
goto err;
@@ -943,18 +945,18 @@ static int verify_command(char *data, char *digest, char *queryfile,
int ret = 0;
/* Decode the token (PKCS7) or response (TS_RESP) files. */
- if (!(in_bio = BIO_new_file(in, "rb")))
+ if ((in_bio = BIO_new_file(in, "rb")) == NULL)
goto end;
if (token_in) {
- if (!(token = d2i_PKCS7_bio(in_bio, NULL)))
+ if ((token = d2i_PKCS7_bio(in_bio, NULL)) == NULL)
goto end;
} else {
- if (!(response = d2i_TS_RESP_bio(in_bio, NULL)))
+ if ((response = d2i_TS_RESP_bio(in_bio, NULL)) == NULL)
goto end;
}
- if (!(verify_ctx = create_verify_ctx(data, digest, queryfile,
- CApath, CAfile, untrusted)))
+ if ((verify_ctx = create_verify_ctx(data, digest, queryfile,
+ CApath, CAfile, untrusted)) == NULL)
goto end;
/* Checking the token or response against the request. */
@@ -991,17 +993,17 @@ static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest,
int ret = 0;
if (data != NULL || digest != NULL) {
- if (!(ctx = TS_VERIFY_CTX_new()))
+ if ((ctx = TS_VERIFY_CTX_new()) == NULL)
goto err;
ctx->flags = TS_VFY_VERSION | TS_VFY_SIGNER;
if (data != NULL) {
ctx->flags |= TS_VFY_DATA;
- if (!(ctx->data = BIO_new_file(data, "rb")))
+ if ((ctx->data = BIO_new_file(data, "rb")) == NULL)
goto err;
} else if (digest != NULL) {
long imprint_len;
ctx->flags |= TS_VFY_IMPRINT;
- if (!(ctx->imprint = string_to_hex(digest, &imprint_len))) {
+ if ((ctx->imprint = string_to_hex(digest, &imprint_len)) == NULL) {
BIO_printf(bio_err, "invalid digest string\n");
goto err;
}
@@ -1013,11 +1015,11 @@ static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest,
* The request has just to be read, decoded and converted to a verify
* context object.
*/
- if (!(input = BIO_new_file(queryfile, "rb")))
+ if ((input = BIO_new_file(queryfile, "rb")) == NULL)
goto err;
- if (!(request = d2i_TS_REQ_bio(input, NULL)))
+ if ((request = d2i_TS_REQ_bio(input, NULL)) == NULL)
goto err;
- if (!(ctx = TS_REQ_to_TS_VERIFY_CTX(request, NULL)))
+ if ((ctx = TS_REQ_to_TS_VERIFY_CTX(request, NULL)) == NULL)
goto err;
} else
return NULL;
@@ -1026,11 +1028,11 @@ static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest,
ctx->flags |= TS_VFY_SIGNATURE;
/* Initialising the X509_STORE object. */
- if (!(ctx->store = create_cert_store(CApath, CAfile)))
+ if ((ctx->store = create_cert_store(CApath, CAfile)) == NULL)
goto err;
/* Loading untrusted certificates. */
- if (untrusted && !(ctx->certs = TS_CONF_load_certs(untrusted)))
+ if (untrusted && (ctx->certs = TS_CONF_load_certs(untrusted)) == NULL)
goto err;
ret = 1;
diff --git a/apps/verify.c b/apps/verify.c
index f4e18f0..cb1be9a 100644
--- a/apps/verify.c
+++ b/apps/verify.c
@@ -177,7 +177,7 @@ int verify_main(int argc, char **argv)
argc = opt_num_rest();
argv = opt_rest();
- if (!(store = setup_verify(CAfile, CApath)))
+ if ((store = setup_verify(CAfile, CApath)) == NULL)
goto end;
X509_STORE_set_verify_cb(store, cb);
diff --git a/apps/x509.c b/apps/x509.c
index 5938b43..f22eef1 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -1021,11 +1021,9 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
}
if (sno)
bs = sno;
- else if (!(bs = x509_load_serial(CAfile, serialfile, create)))
+ else if ((bs = x509_load_serial(CAfile, serialfile, create)) == NULL)
goto end;
-/* if (!X509_STORE_add_cert(ctx,x)) goto end;*/
-
/*
* NOTE: this certificate can/should be self signed, unless it was a
* certificate request in which case it is not.