X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/609affae0305784d87f2357488fba35699a04098..141c12847a1c2f8cc8db03d420551584e689fb87:/pub/x448.c diff --git a/pub/x448.c b/pub/x448.c index 73ca6bf7..70ec10f4 100644 --- a/pub/x448.c +++ b/pub/x448.c @@ -97,10 +97,12 @@ void x448(octet zz[X448_OUTSZ], #ifdef TEST_RIG +#include #include -#include #include +#include "ct.h" + static int vrf_x448(dstr dv[]) { dstr dz = DSTR_INIT; @@ -110,11 +112,13 @@ static int vrf_x448(dstr dv[]) if (dv[1].len != X448_PUBSZ) die(1, "bad public length"); if (dv[2].len != X448_OUTSZ) die(1, "bad result length"); + ct_poison(dv[0].buf, dv[0].len); dstr_ensure(&dz, X448_OUTSZ); dz.len = X448_OUTSZ; x448((octet *)dz.buf, (const octet *)dv[0].buf, (const octet *)dv[1].buf); - if (memcmp(dz.buf, dv[2].buf, X448_OUTSZ) != 0) { + ct_remedy(dz.buf, dz.len); + if (MEMCMP(dz.buf, !=, dv[2].buf, X448_OUTSZ)) { ok = 0; fprintf(stderr, "failed!"); fprintf(stderr, "\n\t k = "); type_hex.dump(&dv[0], stderr); @@ -149,7 +153,7 @@ static int vrf_mct(dstr dv[]) } memcpy(d.buf, k, d.len); - if (memcmp(d.buf, dv[3].buf, d.len) != 0) { + if (MEMCMP(d.buf, !=, dv[3].buf, d.len)) { ok = 0; fprintf(stderr, "failed..."); fprintf(stderr, "\n\tinitial k = "); type_hex.dump(&dv[0], stderr);