From e7cbe8ed85bb1a0660ced1dee4b34c8cd2bfb9e3 Mon Sep 17 00:00:00 2001 From: Duc Nguyen Date: Fri, 8 Sep 2023 16:18:06 -0400 Subject: [PATCH] add a check so we don't overwrite data --- src/sig_stfl/xmss/sig_stfl_xmss_secret_key_functions.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_secret_key_functions.c b/src/sig_stfl/xmss/sig_stfl_xmss_secret_key_functions.c index d4dfb4fd1c..de7c6fac54 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_secret_key_functions.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_secret_key_functions.c @@ -30,6 +30,12 @@ OQS_STATUS OQS_SECRET_KEY_XMSS_deserialize_key(OQS_SIG_STFL_SECRET_KEY *sk, cons return OQS_ERROR; } + if (sk->secret_key_data) { + // Key data already present + // We dont want to trample over data + return OQS_ERROR; + } + memcpy(sk->secret_key_data, sk_buf, sk_len); return OQS_SUCCESS;