Skip to content

Commit

Permalink
Added alg_version details as test output
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Gutiérrez <pablogf@uma.es>
  • Loading branch information
pablogf-uma committed Feb 21, 2025
1 parent bfcca80 commit ac440f4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 60 deletions.
61 changes: 1 addition & 60 deletions tests/test_kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,68 +149,9 @@ static OQS_STATUS kem_test_correctness(const char *method_name) {
goto err;
}

// Check KEM implementation
const char *implementation = NULL;

#if defined(OQS_ENABLE_LIBJADE_KEM_kyber_512_avx2)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_512) == 0) {
implementation = "src/kem/kyber/libjade_kyber512_avx2";
}
#elif defined(OQS_ENABLE_LIBJADE_KEM_kyber_512)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_512) == 0) {
implementation = "src/kem/kyber/libjade_kyber512_ref";
}
#elif defined(OQS_ENABLE_KEM_kyber_512_avx2)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_512) == 0) {
implementation = "src/kem/kyber/pqcrystals-kyber_kyber512_avx2";
}
#elif defined(OQS_ENABLE_KEM_kyber_512_aarch64)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_512) == 0) {
implementation = "src/kem/kyber/oldpqclean_kyber512_aarch64";
}
#endif

#if defined(OQS_ENABLE_LIBJADE_KEM_kyber_768_avx2)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_768) == 0) {
implementation = "src/kem/kyber/libjade_kyber768_avx2";
}
#elif defined(OQS_ENABLE_LIBJADE_KEM_kyber_768)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_768) == 0) {
implementation = "src/kem/kyber/libjade_kyber768_ref";
}
#elif defined(OQS_ENABLE_KEM_kyber_768_avx2)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_768) == 0) {
implementation = "src/kem/kyber/pqcrystals-kyber_kyber768_avx2";
}
#elif defined(OQS_ENABLE_KEM_kyber_768)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_768) == 0) {
implementation = "src/kem/kyber/pqcrystals-kyber_kyber768_ref";
}
#elif defined(OQS_ENABLE_KEM_kyber_768_aarch64)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_768) == 0) {
implementation = "src/kem/kyber/oldpqclean_kyber768_aarch64";
}
#endif

#if defined(OQS_ENABLE_KEM_kyber_1024_avx2)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_1024) == 0) {
implementation = "src/kem/kyber/pqcrystals-kyber_kyber1024_avx2";
}
#elif defined(OQS_ENABLE_KEM_kyber_1024_aarch64)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_1024) == 0) {
implementation = "src/kem/kyber/oldpqclean_kyber1024_aarch64";
}
#elif defined(OQS_ENABLE_KEM_kyber_1024)
if (strcasecmp(method_name, OQS_KEM_alg_kyber_1024) == 0) {
implementation = "src/kem/kyber/pqcrystals-kyber_kyber1024_ref";
}
#else
implementation = "Unknown";
#endif

printf("================================================================================\n");
printf("Sample computation for KEM %s\n", kem->method_name);
printf("Implementation source: %s\n", implementation);
printf("Version source: %s\n", kem->alg_version);
printf("================================================================================\n");

public_key = OQS_MEM_malloc(kem->length_public_key + 2 * sizeof(magic_t));
Expand Down
3 changes: 3 additions & 0 deletions tests/test_kem_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static OQS_STATUS kem_test_correctness(const char *method_name, KEM_OPS op) {
case KEM_KEYGEN:
printf("================================================================================\n");
printf("Executing keygen for KEM %s\n", kem->method_name);
printf("Version source: %s\n", kem->alg_version);
printf("================================================================================\n");

public_key = OQS_MEM_malloc(kem->length_public_key);
Expand Down Expand Up @@ -78,6 +79,7 @@ static OQS_STATUS kem_test_correctness(const char *method_name, KEM_OPS op) {
case KEM_ENCAPS:
printf("================================================================================\n");
printf("Executing encaps for KEM %s\n", kem->method_name);
printf("Version source: %s\n", kem->alg_version);
printf("================================================================================\n");

public_key = OQS_MEM_malloc(kem->length_public_key);
Expand Down Expand Up @@ -113,6 +115,7 @@ static OQS_STATUS kem_test_correctness(const char *method_name, KEM_OPS op) {
case KEM_DECAPS:
printf("================================================================================\n");
printf("Executing decaps for KEM %s\n", kem->method_name);
printf("Version source: %s\n", kem->alg_version);
printf("================================================================================\n");

public_key = OQS_MEM_malloc(kem->length_public_key);
Expand Down
1 change: 1 addition & 0 deletions tests/test_sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ static OQS_STATUS sig_test_correctness(const char *method_name) {

printf("================================================================================\n");
printf("Sample computation for signature %s\n", sig->method_name);
printf("Version source: %s\n", sig->alg_version);
printf("================================================================================\n");

public_key = OQS_MEM_malloc(sig->length_public_key + 2 * sizeof(magic_t));
Expand Down
3 changes: 3 additions & 0 deletions tests/test_sig_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static OQS_STATUS sig_test_correctness(const char *method_name, SIG_OPS op) {
case SIG_KEYGEN:
printf("================================================================================\n");
printf("Executing keygen for SIGALG %s\n", sig->method_name);
printf("Version source: %s\n", sig->alg_version);
printf("================================================================================\n");

public_key = OQS_MEM_malloc(sig->length_public_key);
Expand All @@ -65,6 +66,7 @@ static OQS_STATUS sig_test_correctness(const char *method_name, SIG_OPS op) {
case SIG_SIGN:
printf("================================================================================\n");
printf("Executing sign for SIGALG %s\n", sig->method_name);
printf("Version source: %s\n", sig->alg_version);
printf("================================================================================\n");

public_key = OQS_MEM_malloc(sig->length_public_key);
Expand Down Expand Up @@ -102,6 +104,7 @@ static OQS_STATUS sig_test_correctness(const char *method_name, SIG_OPS op) {
case SIG_VERIFY:
printf("================================================================================\n");
printf("Executing verify for SIGALG %s\n", sig->method_name);
printf("Version source: %s\n", sig->alg_version);
printf("================================================================================\n");

public_key = OQS_MEM_malloc(sig->length_public_key);
Expand Down
1 change: 1 addition & 0 deletions tests/test_sig_stfl.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ static OQS_STATUS sig_stfl_test_correctness(const char *method_name, const char

printf("================================================================================\n");
printf("Sample computation for stateful signature %s\n", sig->method_name);
printf("Version source: %s\n", sig->alg_version);
printf("================================================================================\n");

secret_key = OQS_SIG_STFL_SECRET_KEY_new(sig->method_name);
Expand Down

0 comments on commit ac440f4

Please sign in to comment.