From 60414bc5ac5bedef6e9c975220c4ec971cb56450 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sat, 24 Feb 2024 01:42:49 -0500 Subject: tests/cavp-tests/main.c: regenerate --- tests/cavp-tests/main.c | 102 ++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 50 deletions(-) (limited to 'tests/cavp-tests') diff --git a/tests/cavp-tests/main.c b/tests/cavp-tests/main.c index dd16cce..2f206e6 100644 --- a/tests/cavp-tests/main.c +++ b/tests/cavp-tests/main.c @@ -1,11 +1,13 @@ // Run test vectors for FIPS202 hash functions and XOFs. // (generated by `gen-main.rb`) + #include // uint8_t #include // printf() #include // memcmp() #include "hex.h" // hex_write() #include "sha3.h" +// test failure typedef struct { const char *test_fn; // test function name size_t test_i; // test case index @@ -6275,14 +6277,14 @@ static void test_sha3_224(void) { // check for expected result if (memcmp(got, exp, sizeof(got))) { fail(stderr, (failure_t) { - .test_fn = __func__, - .test_i = i, - .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], - .rsp_line = TESTS[i].rsp_file_line, - .got = got, - .got_len = sizeof(got), - .exp = exp, - .exp_len = sizeof(got), + .test_fn = __func__, // test function + .test_i = i, // test case index in TESTS + .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], // response file + .rsp_line = TESTS[i].rsp_file_line, // start line of test case + .got = got, // result + .got_len = sizeof(got), // result length, in bytes + .exp = exp, // expected result + .exp_len = sizeof(got), // expected result length, in bytes }); } } @@ -12201,14 +12203,14 @@ static void test_sha3_256(void) { // check for expected result if (memcmp(got, exp, sizeof(got))) { fail(stderr, (failure_t) { - .test_fn = __func__, - .test_i = i, - .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], - .rsp_line = TESTS[i].rsp_file_line, - .got = got, - .got_len = sizeof(got), - .exp = exp, - .exp_len = sizeof(got), + .test_fn = __func__, // test function + .test_i = i, // test case index in TESTS + .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], // response file + .rsp_line = TESTS[i].rsp_file_line, // start line of test case + .got = got, // result + .got_len = sizeof(got), // result length, in bytes + .exp = exp, // expected result + .exp_len = sizeof(got), // expected result length, in bytes }); } } @@ -16795,14 +16797,14 @@ static void test_sha3_384(void) { // check for expected result if (memcmp(got, exp, sizeof(got))) { fail(stderr, (failure_t) { - .test_fn = __func__, - .test_i = i, - .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], - .rsp_line = TESTS[i].rsp_file_line, - .got = got, - .got_len = sizeof(got), - .exp = exp, - .exp_len = sizeof(got), + .test_fn = __func__, // test function + .test_i = i, // test case index in TESTS + .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], // response file + .rsp_line = TESTS[i].rsp_file_line, // start line of test case + .got = got, // result + .got_len = sizeof(got), // result length, in bytes + .exp = exp, // expected result + .exp_len = sizeof(got), // expected result length, in bytes }); } } @@ -20057,14 +20059,14 @@ static void test_sha3_512(void) { // check for expected result if (memcmp(got, exp, sizeof(got))) { fail(stderr, (failure_t) { - .test_fn = __func__, - .test_i = i, - .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], - .rsp_line = TESTS[i].rsp_file_line, - .got = got, - .got_len = sizeof(got), - .exp = exp, - .exp_len = sizeof(got), + .test_fn = __func__, // test function + .test_i = i, // test case index in TESTS + .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], // response file + .rsp_line = TESTS[i].rsp_file_line, // start line of test case + .got = got, // result + .got_len = sizeof(got), // result length, in bytes + .exp = exp, // expected result + .exp_len = sizeof(got), // expected result length, in bytes }); } } @@ -29786,19 +29788,19 @@ static void test_shake128(void) { // hash data into "got" uint8_t got[140] = { 0 }; - shake128_xof_once(DATA + TESTS[i].src_ofs, TESTS[i].src_len, got, exp_len); + shake128(DATA + TESTS[i].src_ofs, TESTS[i].src_len, got, exp_len); // check for expected result if (memcmp(got, exp, exp_len)) { fail(stderr, (failure_t) { - .test_fn = __func__, - .test_i = i, - .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], - .rsp_line = TESTS[i].rsp_file_line, - .got = got, - .got_len = exp_len, - .exp = exp, - .exp_len = exp_len, + .test_fn = __func__, // test function + .test_i = i, // test case index in TESTS + .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], // response file + .rsp_line = TESTS[i].rsp_file_line, // start line of test case + .got = got, // result + .got_len = exp_len, // result length, in bytes + .exp = exp, // expected result + .exp_len = exp_len, // expected result length, in bytes }); } } @@ -38886,19 +38888,19 @@ static void test_shake256(void) { // hash data into "got" uint8_t got[250] = { 0 }; - shake256_xof_once(DATA + TESTS[i].src_ofs, TESTS[i].src_len, got, exp_len); + shake256(DATA + TESTS[i].src_ofs, TESTS[i].src_len, got, exp_len); // check for expected result if (memcmp(got, exp, exp_len)) { fail(stderr, (failure_t) { - .test_fn = __func__, - .test_i = i, - .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], - .rsp_line = TESTS[i].rsp_file_line, - .got = got, - .got_len = exp_len, - .exp = exp, - .exp_len = exp_len, + .test_fn = __func__, // test function + .test_i = i, // test case index in TESTS + .rsp_file = RSP_FILES[TESTS[i].rsp_file_ofs], // response file + .rsp_line = TESTS[i].rsp_file_line, // start line of test case + .got = got, // result + .got_len = exp_len, // result length, in bytes + .exp = exp, // expected result + .exp_len = exp_len, // expected result length, in bytes }); } } -- cgit v1.2.3