From cb7c3e8e941e4be7a30e9c92fc11d317082bdf48 Mon Sep 17 00:00:00 2001 From: Spencer Wilson Date: Wed, 27 Sep 2023 11:20:25 -0400 Subject: [PATCH] Adjust number of KATs for McEliece --- tests/kat_kem.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/kat_kem.c b/tests/kat_kem.c index 2fa5106e87..45b55f5d28 100644 --- a/tests/kat_kem.c +++ b/tests/kat_kem.c @@ -37,6 +37,19 @@ static void fprintBstr(FILE *fp, const char *S, const uint8_t *A, size_t L) { fprintf(fp, "\n"); } +static int is_mceliece(const char *method_name) { + return ( !strcmp(method_name, OQS_KEM_alg_classic_mceliece_348864) + || !strcmp(method_name, OQS_KEM_alg_classic_mceliece_348864f) + || !strcmp(method_name, OQS_KEM_alg_classic_mceliece_460896) + || !strcmp(method_name, OQS_KEM_alg_classic_mceliece_460896f) + || !strcmp(method_name, OQS_KEM_alg_classic_mceliece_6688128) + || !strcmp(method_name, OQS_KEM_alg_classic_mceliece_6688128f) + || !strcmp(method_name, OQS_KEM_alg_classic_mceliece_6960119) + || !strcmp(method_name, OQS_KEM_alg_classic_mceliece_6960119f) + || !strcmp(method_name, OQS_KEM_alg_classic_mceliece_8192128) + || !strcmp(method_name, OQS_KEM_alg_classic_mceliece_8192128f) ); +} + static OQS_STATUS kem_kat(const char *method_name, bool all) { uint8_t entropy_input[48]; @@ -80,7 +93,8 @@ static OQS_STATUS kem_kat(const char *method_name, bool all) { goto err; } - max_count = all ? 100 : 1; + max_count = all ? ( is_mceliece(method_name) ? 10 : 100 ) : 1; + for (int count = 0; count < max_count; ++count) { fprintf(fh, "count = %d\n", count); OQS_randombytes(seed, 48);