X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/6e088aad60fd1a7b16da1bb2be07f46fdbd55561..HEAD:/math/ec-test.c diff --git a/math/ec-test.c b/math/ec-test.c index c75de613..ff01a2ea 100644 --- a/math/ec-test.c +++ b/math/ec-test.c @@ -215,6 +215,8 @@ const test_type type_ec = { eccvt, ecdump }; #ifdef TEST_RIG +#include + static void ecdestroy(ec_curve *c) { field *f = c->f; @@ -232,7 +234,7 @@ static void ecdestroy(ec_curve *c) int ok = 1; \ ec_##op(e, &c, a); \ if (!EC_EQ(r, &c)) { \ - fprintf(stderr, #op "failed"); \ + fprintf(stderr, #op " failed"); \ fprintf(stderr, "\ncurve = "); type_ecurve.dump(v, stderr); \ fprintf(stderr, "\n a = "); ecdodump(a, stderr); \ fprintf(stderr, "\n r = "); ecdodump(r, stderr); \ @@ -256,7 +258,7 @@ static void ecdestroy(ec_curve *c) int ok = 1; \ ec_##op(e, &c, a, b); \ if (!EC_EQ(r, &c)) { \ - fprintf(stderr, #op "failed"); \ + fprintf(stderr, #op " failed"); \ fprintf(stderr, "\ncurve = "); type_ecurve.dump(v, stderr); \ fprintf(stderr, "\n a = "); ecdodump(a, stderr); \ fprintf(stderr, "\n b = "); ecdodump(b, stderr); \ @@ -354,7 +356,7 @@ static int vec2osp(dstr v[]) int ok = 1; int win, wantwin; - if (strcmp(v[3].buf, "FAIL") == 0) wantwin = 0; + if (STRCMP(v[3].buf, ==, "FAIL")) wantwin = 0; else { wantwin = 1; type_hex.cvt(v[3].buf, &d); } dstr_ensure(&dd, n); buf_init(&b, dd.buf, n); @@ -362,7 +364,7 @@ static int vec2osp(dstr v[]) win = !ec_ec2osp(e, f, &b, p); if (!win != !wantwin || (win && (BLEN(&b) != d.len || - memcmp(BBASE(&b), d.buf, BLEN(&b)) != 0))) { + MEMCMP(BBASE(&b), !=, d.buf, BLEN(&b))))) { ok = 0; fprintf(stderr, "ec2osp failed"); fprintf(stderr, "\ncurve = "); type_ecurve.dump(v, stderr); @@ -393,7 +395,7 @@ static int vos2ecp(dstr v[]) int ok = 1; int win; - if (strcmp(v[3].buf, "FAIL") == 0) p = 0; + if (STRCMP(v[3].buf, ==, "FAIL")) p = 0; else { type_ec.cvt(v[3].buf, &d); p = (ec *)d.buf; } buf_init(&b, v[2].buf, v[2].len);