[PATCH 2/5] Fix bizarre `if (!consttime_memeq(X, Y, N)!=0)' idioms.
Mark Wooding
mdw at distorted.org.uk
Thu Sep 19 19:41:09 BST 2019
Clang thinks the `!' is in the wrong place. I think the `!=0' isn't
doing any work, so I've deleted it.
Signed-off-by: Mark Wooding <mdw at distorted.org.uk>
---
site.c | 2 +-
transform-cbcmac.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/site.c b/site.c
index c702c78..4ec56df 100644
--- a/site.c
+++ b/site.c
@@ -767,7 +767,7 @@ static bool_t check_msg(struct site *st, uint32_t type, struct msg *m,
return False;
}
if (type==LABEL_MSG2) return True;
- if (!consttime_memeq(m->nR,st->remoteN,NONCELEN)!=0) {
+ if (!consttime_memeq(m->nR,st->remoteN,NONCELEN)) {
*error="wrong remotely-generated nonce";
return False;
}
diff --git a/transform-cbcmac.c b/transform-cbcmac.c
index 5e59e21..ad9e901 100644
--- a/transform-cbcmac.c
+++ b/transform-cbcmac.c
@@ -231,7 +231,7 @@ static transform_apply_return transform_reverse(void *sst,
serpentbe_encrypt(&ti->mackey,macplain,macacc);
}
serpentbe_encrypt(&ti->mackey,macacc,macacc);
- if (!consttime_memeq(macexpected,macacc,16)!=0) {
+ if (!consttime_memeq(macexpected,macacc,16)) {
*errmsg="invalid MAC";
return transform_apply_err;
}
--
[mdw]
More information about the sgo-software-discuss
mailing list