Deploy the new <ctype.h> and `foocmp' macros from mLib.
[catacomb] / pub / ed448.c
index 6032802..681a3ca 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <string.h>
 
+#include <mLib/macros.h>
+
 #include "fgoldi.h"
 #include "ed448.h"
 #include "scaf.h"
@@ -394,7 +396,7 @@ int ed448_verify(const octet K[ED448_PUBSZ],
   scaf_loaddbl(tt, sig + 57, 57, 2*NPIECE, PIECEWD);
   scaf_reduce(s, tt, l, mu, NPIECE, PIECEWD, scratch);
   scaf_store(b, 57, s, NPIECE, PIECEWD);
-  if (memcmp(b, sig + 57, 57) != 0) return (-1);
+  if (MEMCMP(b, !=, sig + 57, 57)) return (-1);
 
   /* Check the signature. */
   psz = prefix(b, phflag, p, psz);
@@ -408,7 +410,7 @@ int ed448_verify(const octet K[ED448_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, 57) != 0) return (-1);
+  if (MEMCMP(b, !=, sig, 57)) return (-1);
 
   /* All is good. */
   return (0);
@@ -437,7 +439,7 @@ static int vrf_pubkey(dstr dv[])
   dstr_ensure(&dpub, ED448_PUBSZ); dpub.len = ED448_PUBSZ;
   ed448_pubkey((octet *)dpub.buf, dv[0].buf, dv[0].len);
   ct_remedy(dpub.buf, dpub.len);
-  if (memcmp(dpub.buf, dv[1].buf, ED448_PUBSZ) != 0) {
+  if (MEMCMP(dpub.buf, !=, dv[1].buf, ED448_PUBSZ)) {
     ok = 0;
     fprintf(stderr, "failed!");
     fprintf(stderr, "\n\tpriv = "); type_hex.dump(&dv[0], stderr);
@@ -476,7 +478,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, ED448_SIGSZ) != 0) {
+  if (MEMCMP(dsig.buf, !=, want->buf, ED448_SIGSZ)) {
     ok = 0;
     fprintf(stderr, "failed!");
     fprintf(stderr, "\n\tpriv = "); type_hex.dump(priv, stderr);