Skip to content

Commit

Permalink
Adjust number of KATs for McEliece
Browse files Browse the repository at this point in the history
  • Loading branch information
SWilson4 committed Oct 2, 2023
1 parent 0373266 commit cb7c3e8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/kat_kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit cb7c3e8

Please sign in to comment.