Skip to content

Commit

Permalink
fix warnings [full tests]
Browse files Browse the repository at this point in the history
Signed-off-by: Basil Hess <[email protected]>
  • Loading branch information
bhess committed Nov 5, 2024
1 parent e785bb9 commit d8ffeea
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/vectors_sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ static int sig_ver_vector(const char *method_name,
ret = EXIT_SUCCESS;

cleanup:
OQS_SIG_free(sig);
return ret;

}
Expand Down Expand Up @@ -353,7 +354,8 @@ static int sig_gen_vector(const char *method_name,
ret = EXIT_SUCCESS;

cleanup:
free(signature);
OQS_MEM_insecure_free(signature);
OQS_SIG_free(sig);
return ret;
}
#endif
Expand Down Expand Up @@ -404,8 +406,7 @@ int main(int argc, char **argv) {
OQS_SIG *sig = OQS_SIG_new(alg_name);
if (sig == NULL) {
printf("[vectors_sig] %s was not enabled at compile-time.\n", alg_name);
rc = EXIT_FAILURE;
goto cleanup;
goto err;
}

if (!strcmp(test_name, "keyGen")) {
Expand All @@ -418,7 +419,6 @@ int main(int argc, char **argv) {
strlen(kg_pk) != 2 * sig->length_public_key ||
strlen(kg_sk) != 2 * sig->length_secret_key) {
printf("lengths bad\n");
rc = EXIT_FAILURE;
goto err;
}

Expand Down Expand Up @@ -448,20 +448,17 @@ int main(int argc, char **argv) {
if (randomized) {
prng_output_stream = argv[6];
if (strlen(prng_output_stream) % 2 != 0) {
rc = EXIT_FAILURE;
goto err;
}
prng_output_stream_bytes = malloc(strlen(prng_output_stream) / 2);
if (prng_output_stream_bytes == NULL) {
fprintf(stderr, "[vectors_sig] ERROR: malloc failed!\n");
rc = EXIT_FAILURE;
goto err;
}
}

if ( strlen(sigGen_msg) % 2 != 0 ||
strlen(sigGen_sig) != 2 * sig->length_signature) {
rc = EXIT_FAILURE;
goto err;
}

Expand All @@ -473,7 +470,6 @@ int main(int argc, char **argv) {

if ((sigGen_msg_bytes == NULL) || (sigGen_sig_bytes == NULL)) {
fprintf(stderr, "[vectors_sig] ERROR: malloc failed!\n");
rc = EXIT_FAILURE;
goto err;
}

Expand Down Expand Up @@ -534,13 +530,19 @@ int main(int argc, char **argv) {
goto cleanup;

err:
rc = OQS_ERROR;
rc = EXIT_FAILURE;
goto cleanup;

cleanup:
free(prng_output_stream_bytes);
free(kg_pk_bytes);
free(kg_sk_bytes);
free(sigVer_pk_bytes);
free(sigVer_msg_bytes);
free(sigVer_sig_bytes);
free(sigGen_sk_bytes);
free(sigGen_msg_bytes);
free(sigGen_sig_bytes);

if (rc != EXIT_SUCCESS) {
return EXIT_FAILURE;
Expand Down

0 comments on commit d8ffeea

Please sign in to comment.