X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/6baf2beaba0a9e7df4a3781be9dcc70671fdc550..bd6d65e32b835551677456bf286d09ced6859882:/pub/ed25519.c diff --git a/pub/ed25519.c b/pub/ed25519.c index 676fe8ca..83741091 100644 --- a/pub/ed25519.c +++ b/pub/ed25519.c @@ -29,6 +29,8 @@ #include +#include + #include "f25519.h" #include "ed25519.h" #include "scaf.h" @@ -406,7 +408,7 @@ int ed25519ctx_verify(const octet K[ED25519_PUBSZ], scaf_loaddbl(tt, sig + 32, 32, 2*NPIECE, PIECEWD); scaf_reduce(s, tt, l, mu, NPIECE, PIECEWD, scratch); scaf_store(b, 32, s, NPIECE, PIECEWD); - if (memcmp(b, sig + 32, 32) != 0) return (-1); + if (MEMCMP(b, !=, sig + 32, 32)) return (-1); /* Check the signature. */ psz = prefix(b, phflag, p, psz); @@ -420,7 +422,7 @@ int ed25519ctx_verify(const octet K[ED25519_PUBSZ], scaf_reduce(t, tt, l, mu, NPIECE, PIECEWD, scratch); ptsimmul(&RX, &RY, &RZ, s, BX, BY, BZ, t, &AX, &AY, &AZ); ptencode(b, &RX, &RY, &RZ); - if (memcmp(b, sig, 32) != 0) return (-1); + if (MEMCMP(b, !=, sig, 32)) return (-1); /* All is good. */ return (0); @@ -454,7 +456,7 @@ static int vrf_pubkey(dstr dv[]) dstr_ensure(&dpub, ED25519_PUBSZ); dpub.len = ED25519_PUBSZ; ed25519_pubkey((octet *)dpub.buf, dv[0].buf, dv[0].len); ct_remedy(dpub.buf, dpub.len); - if (memcmp(dpub.buf, dv[1].buf, ED25519_PUBSZ) != 0) { + if (MEMCMP(dpub.buf, !=, dv[1].buf, ED25519_PUBSZ)) { ok = 0; fprintf(stderr, "failed!"); fprintf(stderr, "\n\tpriv = "); type_hex.dump(&dv[0], stderr); @@ -493,7 +495,7 @@ static int vrf_sign(dstr *priv, int phflag, dstr *perso, phflag, perso ? perso->buf : 0, perso ? perso->len : 0, m->buf, m->len); ct_remedy(dsig.buf, dsig.len); - if (memcmp(dsig.buf, want->buf, ED25519_SIGSZ) != 0) { + if (MEMCMP(dsig.buf, !=, want->buf, ED25519_SIGSZ)) { ok = 0; fprintf(stderr, "failed!"); fprintf(stderr, "\n\tpriv = "); type_hex.dump(priv, stderr);