From 074e4f508bbc9d13f16f188329c1959ae52f22e8 Mon Sep 17 00:00:00 2001 From: Norman Ashley Date: Sat, 21 Oct 2023 01:41:46 -0400 Subject: [PATCH] Set secure store callback for KAT tests --- tests/kat_sig_stfl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/kat_sig_stfl.c b/tests/kat_sig_stfl.c index 9fdbeefe11..da32da9e58 100644 --- a/tests/kat_sig_stfl.c +++ b/tests/kat_sig_stfl.c @@ -145,6 +145,7 @@ OQS_STATUS sig_stfl_kat(const char *method_name, const char *katfile) { unsigned long long sigs_remain = 0; unsigned long long sigs_maximum = 0; OQS_STATUS rc, ret = OQS_ERROR; + char *context = NULL; sig = OQS_SIG_STFL_new(method_name); if (sig == NULL) { @@ -165,7 +166,8 @@ OQS_STATUS sig_stfl_kat(const char *method_name, const char *katfile) { // Grab the pk and sk from KAT file public_key = malloc(sig->length_public_key); secret_key = OQS_SIG_STFL_SECRET_KEY_new(sig->method_name); - OQS_SIG_STFL_SECRET_KEY_SET_store_cb(secret_key, do_nothing_save, NULL); + context = strdup(method_name); + OQS_SIG_STFL_SECRET_KEY_SET_store_cb(secret_key, do_nothing_save, (void *)context); signature = calloc(sig->length_signature, sizeof(uint8_t)); signature_kat = calloc(sig->length_signature, sizeof(uint8_t)); @@ -286,6 +288,7 @@ OQS_STATUS sig_stfl_kat(const char *method_name, const char *katfile) { OQS_MEM_insecure_free(signature_kat); OQS_MEM_insecure_free(msg); OQS_MEM_insecure_free(msg_rand); + OQS_MEM_insecure_free(context); OQS_SIG_STFL_free(sig); fclose(fp_rsp); return ret;