From d231866cf8695121e2f9813b8d02cbab7ece4485 Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Mon, 9 Mar 2020 22:40:52 +0100 Subject: [PATCH] Elligator tests: overlapping I/O --- tests/test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test.c b/tests/test.c index c2be3cf..f23ce22 100644 --- a/tests/test.c +++ b/tests/test.c @@ -864,6 +864,23 @@ static int p_elligator_direct_msb() return status; } +static int p_elligator_direct_overlap() +{ + int status = 0; + FOR (i, 0, 62) { + u8 overlapping[94]; + u8 seperate[32]; + RANDOM_INPUT(r, 32); + memcpy(overlapping + 31, r, 32); + crypto_elligator2_direct(overlapping + i, overlapping + 31); + crypto_elligator2_direct(seperate, r); + status |= memcmp(seperate, overlapping + i, 32); + } + printf("%s: elligator direct (overlapping i/o)\n", + status != 0 ? "FAILED" : "OK"); + return status; +} + #define TEST(name, nb_inputs) vector_test(name, #name, nb_inputs, \ nb_##name##_vectors, \ name##_vectors, \ @@ -927,6 +944,7 @@ int main(int argc, char *argv[]) status |= p_eddsa_incremental(); status |= p_aead(); status |= p_elligator_direct_msb(); + status |= p_elligator_direct_overlap(); printf("\n%s\n\n", status != 0 ? "SOME TESTS FAILED" : "All tests OK!"); return status; } -- 2.47.3