progs/perftest.c: Use from Glibc syscall numbers.
[catacomb] / symm / ocb1-def.h
index 7c7eb29..09b3824 100644 (file)
@@ -495,11 +495,14 @@ static gaead_key *gckey(const void *k, size_t ksz)                        \
   return (&key->k);                                                    \
 }                                                                      \
                                                                        \
+static int gcszok(size_t nsz, size_t hsz, size_t msz, size_t tsz)      \
+  { return (gaead_szokcommon(&pre##_ocb1, nsz, hsz, msz, tsz)); }      \
+                                                                       \
 const gcaead pre##_ocb1 = {                                            \
   name "-ocb1",                                                                \
   pre##_keysz, pre##_ocb1noncesz, pre##_ocb1tagsz,                     \
   PRE##_BLKSZ, PRE##_BLKSZ, 0, 0,                                      \
-  gckey                                                                        \
+  gckey, gcszok                                                                \
 };                                                                     \
                                                                        \
 OCB1_TESTX(PRE, pre, name, fname)
@@ -520,6 +523,7 @@ OCB1_TESTX(PRE, pre, name, fname)
 #include <stdio.h>
 
 #include <mLib/dstr.h>
+#include <mLib/macros.h>
 #include <mLib/quis.h>
 #include <mLib/testrig.h>
 
@@ -581,8 +585,8 @@ static int ocb1verify(dstr *v)                                              \
     d.len = BLEN(&b);                                                  \
                                                                        \
     if (d.len != v[4].len ||                                           \
-       memcmp(d.buf, v[4].buf, v[4].len) != 0 ||                       \
-       memcmp(t.buf, v[5].buf, v[5].len) != 0) {                       \
+       MEMCMP(d.buf, !=, v[4].buf, v[4].len) ||                        \
+       MEMCMP(t.buf, !=, v[5].buf, v[5].len)) {                        \
     fail_enc:                                                          \
       printf("\nfail encrypt:\n\tstep = %i", *ip);                     \
       fputs("\n\tkey = ", stdout); type_hex.dump(&v[0], stdout);       \
@@ -623,7 +627,7 @@ static int ocb1verify(dstr *v)                                              \
     d.len = BLEN(&b);                                                  \
                                                                        \
     if (d.len != v[3].len || !win ||                                   \
-       memcmp(d.buf, v[3].buf, v[3].len) != 0) {                       \
+       MEMCMP(d.buf, !=, v[3].buf, v[3].len)) {                        \
     fail_dec:                                                          \
       printf("\nfail decrypt:\n\tstep = %i", *ip);                     \
       fputs("\n\tkey = ", stdout); type_hex.dump(&v[0], stdout);       \