X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/6af2607b63ce649a919513949d5f8a8deb2e6663..HEAD:/symm/ocb1-def.h diff --git a/symm/ocb1-def.h b/symm/ocb1-def.h index 7c7eb295..09b3824d 100644 --- a/symm/ocb1-def.h +++ b/symm/ocb1-def.h @@ -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 #include +#include #include #include @@ -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); \