Skip to content

Commit

Permalink
crypto: testmgr - Wrap the LHS in expressions of the form !x == y
Browse files Browse the repository at this point in the history
In the test manager, there are a number of if-statements with expressions of
the form !x == y that incur warnings with gcc-5 of the following form:

../crypto/testmgr.c: In function '__test_aead':
../crypto/testmgr.c:523:12: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
   if (!ret == template[i].fail) {
            ^

By converting the 'fail' member of struct aead_testvec and struct
cipher_testvec to a bool, we can get rid of the warnings.

Signed-off-by: David Howells <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
dhowells authored and herbertx committed May 1, 2015
1 parent f94a359 commit 09e2178
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crypto/testmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct cipher_testvec {
unsigned short tap[MAX_TAP];
int np;
unsigned char also_non_np;
unsigned char fail;
bool fail;
unsigned char wk; /* weak key flag */
unsigned char klen;
unsigned short ilen;
Expand All @@ -71,7 +71,7 @@ struct aead_testvec {
unsigned char atap[MAX_TAP];
int np;
int anp;
unsigned char fail;
bool fail;
unsigned char novrfy; /* ccm dec verification failure expected */
unsigned char wk; /* weak key flag */
unsigned char klen;
Expand Down Expand Up @@ -3018,7 +3018,7 @@ static struct cipher_testvec des_enc_tv_template[] = {
"\xb4\x99\x26\xf7\x1f\xe1\xd4\x90",
.rlen = 24,
}, { /* Weak key */
.fail = 1,
.fail = true,
.wk = 1,
.key = "\x01\x01\x01\x01\x01\x01\x01\x01",
.klen = 8,
Expand Down

0 comments on commit 09e2178

Please sign in to comment.