Skip to content

Commit

Permalink
minor cosmetic change
Browse files Browse the repository at this point in the history
  • Loading branch information
vsoftco committed Mar 26, 2020
1 parent 88693c2 commit 532d0cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions tests/test_kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,23 @@ int main(int argc, char **argv) {

print_system_info();

// Use system RNG in this program
OQS_randombytes_switch_algorithm(OQS_RAND_alg_system);

char *alg_name = argv[1];
if (!OQS_KEM_alg_is_enabled(alg_name)) {
printf("KEM algorithm %s not enabled!\n", alg_name);
return EXIT_FAILURE;
}

// Use system RNG in this program
OQS_randombytes_switch_algorithm(OQS_RAND_alg_system);

OQS_STATUS rc;
#if OQS_USE_PTHREADS_IN_TESTS
#define MAX_LEN_KEM_NAME_ 64
// don't run Classic McEliece or LEDAcryptKEM-LT52 in threads because of large stack usage
char not_thread_kems[][MAX_LEN_KEM_NAME_] = {"Classic-McEliece", "LEDAcryptKEM-LT52"};
char no_thread_kem_patterns[][MAX_LEN_KEM_NAME_] = {"Classic-McEliece", "LEDAcryptKEM-LT52"};
int test_in_thread = 1;
for (size_t i = 0 ; i < sizeof(not_thread_kems) / MAX_LEN_KEM_NAME_; ++i) {
if (strstr(alg_name, not_thread_kems[i]) != NULL) {
for (size_t i = 0 ; i < sizeof(no_thread_kem_patterns) / MAX_LEN_KEM_NAME_; ++i) {
if (strstr(alg_name, no_thread_kem_patterns[i]) != NULL) {
test_in_thread = 0;
break;
}
Expand Down
14 changes: 8 additions & 6 deletions tests/test_sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,23 @@ int main(int argc, char **argv) {

print_system_info();

// Use system RNG in this program
OQS_randombytes_switch_algorithm(OQS_RAND_alg_system);

char *alg_name = argv[1];
if (!OQS_SIG_alg_is_enabled(alg_name)) {
printf("Signature algorithm %s not enabled!\n", alg_name);
return EXIT_FAILURE;
}

// Use system RNG in this program
OQS_randombytes_switch_algorithm(OQS_RAND_alg_system);

OQS_STATUS rc;
#if OQS_USE_PTHREADS_IN_TESTS
#define MAX_LEN_SIG_NAME_ 64
// don't run Rainbow IIIc and Vc in threads because of large stack usage
char not_thread_sigs[][MAX_LEN_SIG_NAME_] = {"Rainbow-IIIc", "Rainbow-Vc"};
char no_thread_sig_patterns[][MAX_LEN_SIG_NAME_] = {"Rainbow-IIIc", "Rainbow-Vc"};
int test_in_thread = 1;
for (size_t i = 0 ; i < sizeof(not_thread_sigs) / MAX_LEN_SIG_NAME_; ++i) {
if (strstr(alg_name, not_thread_sigs[i]) != NULL) {
for (size_t i = 0 ; i < sizeof(no_thread_sig_patterns) / MAX_LEN_SIG_NAME_; ++i) {
if (strstr(alg_name, no_thread_sig_patterns[i]) != NULL) {
test_in_thread = 0;
break;
}
Expand Down

0 comments on commit 532d0cb

Please sign in to comment.