progs/perftest.c: Use from Glibc syscall numbers.
[catacomb] / symm / sha3.c
index 97a3f7a..36bd430 100644 (file)
@@ -231,7 +231,7 @@ static void leftenc_sz(shake_ctx *ctx, size_t n)
   octet b[9];
   unsigned i;
 
-  SET64(t, ((n&~MASK32) >> 16) >> 16, n&MASK32);
+  SET64(t, ((n&~(size_t)MASK32) >> 16) >> 16, n&MASK32);
   STORE64_B_(b + 1, t);
   for (i = 1; i < 8 && !b[i]; i++);
   i--; b[i] = 8 - i;
@@ -244,7 +244,7 @@ static void rightenc_sz(shake_ctx *ctx, size_t n)
   octet b[9];
   unsigned i;
 
-  SET64(t, ((n&~MASK32) >> 16) >> 16, n&MASK32);
+  SET64(t, ((n&~(size_t)MASK32) >> 16) >> 16, n&MASK32);
   STORE64_B_(b, t);
   for (i = 0; i < 7 && !b[i]; i++);
   b[8] = 8 - i;
@@ -957,6 +957,7 @@ grand *kmac256_rand(const void *perso, size_t psz, const void *k, size_t sz)
 
 #include <stdio.h>
 
+#include <mLib/macros.h>
 #include <mLib/report.h>
 #include <mLib/testrig.h>
 
@@ -979,7 +980,7 @@ static int vrf_sha3_mct(void (*initfn)(sha3_ctx *),
     sha3_done(&ctx, d.buf);
   }
 
-  if (memcmp(d.buf, out->buf, out->len) != 0) {
+  if (MEMCMP(d.buf, !=, out->buf, out->len)) {
     ok = 0;
     printf("\nfail\n\tsteps = %d\n\tinput = ", n);
     type_hex.dump(in, stdout);
@@ -1037,7 +1038,7 @@ static int vrf_shaky(void (*initfn)(shake_ctx *,
       p += i; sz -= i;
     }
 
-    if (memcmp(d.buf, want->buf, want->len) != 0) {
+    if (MEMCMP(d.buf, !=, want->buf, want->len)) {
       ok = 0;
       printf("\nfail (get):\n\tstep = %i\n\tinput = ", *ip);
       type_hex.dump(m, stdout);
@@ -1071,7 +1072,7 @@ static int vrf_shaky(void (*initfn)(shake_ctx *,
       p += i; sz -= i;
     }
 
-    if (memcmp(d.buf, want->buf, want->len) != 0) {
+    if (MEMCMP(d.buf, !=, want->buf, want->len)) {
       ok = 0;
       printf("\nfail (mask):\n\tstep = %i\n\tinput = ", *ip);
       type_hex.dump(m, stdout);
@@ -1131,7 +1132,7 @@ static int vrf_kmac(void (*initfn)(kmac_ctx *, const void *, size_t,
   if (tsz) kmac_done(&ctx, d.buf, tsz);
   else { kmac_xof(&ctx); kmac_get(&ctx, d.buf, d.len); }
 
-  if (memcmp(d.buf, want->buf, want->len) != 0) {
+  if (MEMCMP(d.buf, !=, want->buf, want->len)) {
     ok = 0;
     printf("\nfail");
     printf("\n\tperso = `%s'", perso->buf);