aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/engine
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-05-06 14:56:14 -0400
committerRich Salz <rsalz@openssl.org>2015-05-06 22:37:53 -0400
commit86885c289580066792415218754bd935b449f170 (patch)
tree8cab1bdeb50bfee21ce6677d9150c8d385379321 /crypto/engine
parentdab18ab596acb35eff2545643e25757e4f9cd777 (diff)
downloadopenssl-86885c289580066792415218754bd935b449f170.tar.gz
Use "==0" instead of "!strcmp" etc
For the various string-compare routines (strcmp, strcasecmp, str.*cmp) use "strcmp()==0" instead of "!strcmp()" Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/engine')
-rw-r--r--crypto/engine/eng_cnf.c12
-rw-r--r--crypto/engine/eng_fat.c24
-rw-r--r--crypto/engine/eng_openssl.c4
-rw-r--r--crypto/engine/tb_asnmth.c8
4 files changed, 24 insertions, 24 deletions
diff --git a/crypto/engine/eng_cnf.c b/crypto/engine/eng_cnf.c
index e84281f22e..ca45af564f 100644
--- a/crypto/engine/eng_cnf.c
+++ b/crypto/engine/eng_cnf.c
@@ -124,12 +124,12 @@ static int int_engine_configure(char *name, char *value, const CONF *cnf)
/* First handle some special pseudo ctrls */
/* Override engine name to use */
- if (!strcmp(ctrlname, "engine_id"))
+ if (strcmp(ctrlname, "engine_id") == 0)
name = ctrlvalue;
- else if (!strcmp(ctrlname, "soft_load"))
+ else if (strcmp(ctrlname, "soft_load") == 0)
soft = 1;
/* Load a dynamic ENGINE */
- else if (!strcmp(ctrlname, "dynamic_path")) {
+ else if (strcmp(ctrlname, "dynamic_path") == 0) {
e = ENGINE_by_id("dynamic");
if (!e)
goto err;
@@ -159,9 +159,9 @@ static int int_engine_configure(char *name, char *value, const CONF *cnf)
* Allow "EMPTY" to mean no value: this allows a valid "value" to
* be passed to ctrls of type NO_INPUT
*/
- if (!strcmp(ctrlvalue, "EMPTY"))
+ if (strcmp(ctrlvalue, "EMPTY") == 0)
ctrlvalue = NULL;
- if (!strcmp(ctrlname, "init")) {
+ if (strcmp(ctrlname, "init") == 0) {
if (!NCONF_get_number_e(cnf, value, "init", &do_init))
goto err;
if (do_init == 1) {
@@ -172,7 +172,7 @@ static int int_engine_configure(char *name, char *value, const CONF *cnf)
ENGINE_R_INVALID_INIT_VALUE);
goto err;
}
- } else if (!strcmp(ctrlname, "default_algorithms")) {
+ } else if (strcmp(ctrlname, "default_algorithms") == 0) {
if (!ENGINE_set_default_string(e, ctrlvalue))
goto err;
} else if (!ENGINE_ctrl_cmd_string(e, ctrlname, ctrlvalue, 0))
diff --git a/crypto/engine/eng_fat.c b/crypto/engine/eng_fat.c
index af353bd936..e0c8f96f69 100644
--- a/crypto/engine/eng_fat.c
+++ b/crypto/engine/eng_fat.c
@@ -103,29 +103,29 @@ static int int_def_cb(const char *alg, int len, void *arg)
unsigned int *pflags = arg;
if (alg == NULL)
return 0;
- if (!strncmp(alg, "ALL", len))
+ if (strncmp(alg, "ALL", len) == 0)
*pflags |= ENGINE_METHOD_ALL;
- else if (!strncmp(alg, "RSA", len))
+ else if (strncmp(alg, "RSA", len) == 0)
*pflags |= ENGINE_METHOD_RSA;
- else if (!strncmp(alg, "DSA", len))
+ else if (strncmp(alg, "DSA", len) == 0)
*pflags |= ENGINE_METHOD_DSA;
- else if (!strncmp(alg, "ECDH", len))
+ else if (strncmp(alg, "ECDH", len) == 0)
*pflags |= ENGINE_METHOD_ECDH;
- else if (!strncmp(alg, "ECDSA", len))
+ else if (strncmp(alg, "ECDSA", len) == 0)
*pflags |= ENGINE_METHOD_ECDSA;
- else if (!strncmp(alg, "DH", len))
+ else if (strncmp(alg, "DH", len) == 0)
*pflags |= ENGINE_METHOD_DH;
- else if (!strncmp(alg, "RAND", len))
+ else if (strncmp(alg, "RAND", len) == 0)
*pflags |= ENGINE_METHOD_RAND;
- else if (!strncmp(alg, "CIPHERS", len))
+ else if (strncmp(alg, "CIPHERS", len) == 0)
*pflags |= ENGINE_METHOD_CIPHERS;
- else if (!strncmp(alg, "DIGESTS", len))
+ else if (strncmp(alg, "DIGESTS", len) == 0)
*pflags |= ENGINE_METHOD_DIGESTS;
- else if (!strncmp(alg, "PKEY", len))
+ else if (strncmp(alg, "PKEY", len) == 0)
*pflags |= ENGINE_METHOD_PKEY_METHS | ENGINE_METHOD_PKEY_ASN1_METHS;
- else if (!strncmp(alg, "PKEY_CRYPTO", len))
+ else if (strncmp(alg, "PKEY_CRYPTO", len) == 0)
*pflags |= ENGINE_METHOD_PKEY_METHS;
- else if (!strncmp(alg, "PKEY_ASN1", len))
+ else if (strncmp(alg, "PKEY_ASN1", len) == 0)
*pflags |= ENGINE_METHOD_PKEY_ASN1_METHS;
else
return 0;
diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c
index e9bdd01043..560c9b3c93 100644
--- a/crypto/engine/eng_openssl.c
+++ b/crypto/engine/eng_openssl.c
@@ -556,11 +556,11 @@ static int ossl_hmac_ctrl_str(EVP_PKEY_CTX *ctx,
if (!value) {
return 0;
}
- if (!strcmp(type, "key")) {
+ if (strcmp(type, "key") == 0) {
void *p = (void *)value;
return ossl_hmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, -1, p);
}
- if (!strcmp(type, "hexkey")) {
+ if (strcmp(type, "hexkey") == 0) {
unsigned char *key;
int r;
long keylen;
diff --git a/crypto/engine/tb_asnmth.c b/crypto/engine/tb_asnmth.c
index 4685fcf2ad..407023fdf6 100644
--- a/crypto/engine/tb_asnmth.c
+++ b/crypto/engine/tb_asnmth.c
@@ -191,8 +191,8 @@ const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e,
nidcount = e->pkey_asn1_meths(e, NULL, &nids, 0);
for (i = 0; i < nidcount; i++) {
e->pkey_asn1_meths(e, &ameth, NULL, nids[i]);
- if (((int)strlen(ameth->pem_str) == len) &&
- !strncasecmp(ameth->pem_str, str, len))
+ if (((int)strlen(ameth->pem_str) == len)
+ && strncasecmp(ameth->pem_str, str, len) == 0)
return ameth;
}
return NULL;
@@ -215,8 +215,8 @@ static void look_str_cb(int nid, STACK_OF(ENGINE) *sk, ENGINE *def, void *arg)
ENGINE *e = sk_ENGINE_value(sk, i);
EVP_PKEY_ASN1_METHOD *ameth;
e->pkey_asn1_meths(e, &ameth, NULL, nid);
- if (((int)strlen(ameth->pem_str) == lk->len) &&
- !strncasecmp(ameth->pem_str, lk->str, lk->len)) {
+ if (((int)strlen(ameth->pem_str) == lk->len)
+ && strncasecmp(ameth->pem_str, lk->str, lk->len) == 0) {
lk->e = e;
lk->ameth = ameth;
return;