From 8d5190adfbebbfb4039ef6a9aa4872d0ea51d79f Mon Sep 17 00:00:00 2001 From: Duc Nguyen Date: Thu, 19 Oct 2023 22:48:43 -0400 Subject: [PATCH] Init --- src/sig_stfl/sig_stfl.c | 44 ++---- src/sig_stfl/sig_stfl.h | 8 +- src/sig_stfl/xmss/external/sign.c | 139 ------------------ src/sig_stfl/xmss/external/sign.h | 90 ------------ src/sig_stfl/xmss/sig_stfl_xmss.h | 94 ++++++++---- .../xmss/sig_stfl_xmss_secret_key_functions.c | 40 ++++- src/sig_stfl/xmss/sig_stfl_xmss_sha256_h10.c | 23 ++- src/sig_stfl/xmss/sig_stfl_xmss_sha256_h16.c | 23 ++- src/sig_stfl/xmss/sig_stfl_xmss_sha256_h20.c | 23 ++- src/sig_stfl/xmss/sig_stfl_xmss_sha512_h10.c | 23 ++- src/sig_stfl/xmss/sig_stfl_xmss_sha512_h16.c | 23 ++- src/sig_stfl/xmss/sig_stfl_xmss_sha512_h20.c | 23 ++- .../xmss/sig_stfl_xmss_shake128_h10.c | 23 ++- .../xmss/sig_stfl_xmss_shake128_h16.c | 23 ++- .../xmss/sig_stfl_xmss_shake128_h20.c | 23 ++- .../xmss/sig_stfl_xmss_shake256_h10.c | 23 ++- .../xmss/sig_stfl_xmss_shake256_h16.c | 23 ++- .../xmss/sig_stfl_xmss_shake256_h20.c | 23 ++- .../xmss/sig_stfl_xmssmt_sha256_h20_2.c | 23 ++- .../xmss/sig_stfl_xmssmt_sha256_h20_4.c | 23 ++- .../xmss/sig_stfl_xmssmt_sha256_h40_2.c | 23 ++- .../xmss/sig_stfl_xmssmt_sha256_h40_4.c | 23 ++- .../xmss/sig_stfl_xmssmt_sha256_h40_8.c | 23 ++- .../xmss/sig_stfl_xmssmt_sha256_h60_12.c | 23 ++- .../xmss/sig_stfl_xmssmt_sha256_h60_3.c | 23 ++- .../xmss/sig_stfl_xmssmt_sha256_h60_6.c | 23 ++- .../xmss/sig_stfl_xmssmt_shake128_h20_2.c | 23 ++- .../xmss/sig_stfl_xmssmt_shake128_h20_4.c | 23 ++- .../xmss/sig_stfl_xmssmt_shake128_h40_2.c | 23 ++- .../xmss/sig_stfl_xmssmt_shake128_h40_4.c | 23 ++- .../xmss/sig_stfl_xmssmt_shake128_h40_8.c | 23 ++- .../xmss/sig_stfl_xmssmt_shake128_h60_12.c | 23 ++- .../xmss/sig_stfl_xmssmt_shake128_h60_3.c | 23 ++- .../xmss/sig_stfl_xmssmt_shake128_h60_6.c | 23 ++- 34 files changed, 706 insertions(+), 353 deletions(-) delete mode 100644 src/sig_stfl/xmss/external/sign.c delete mode 100644 src/sig_stfl/xmss/external/sign.h diff --git a/src/sig_stfl/sig_stfl.c b/src/sig_stfl/sig_stfl.c index b434f54715..4d9894fd00 100644 --- a/src/sig_stfl/sig_stfl.c +++ b/src/sig_stfl/sig_stfl.c @@ -14,6 +14,7 @@ OQS_API const char *OQS_SIG_STFL_alg_identifier(size_t i) { const char *a[OQS_SIG_STFL_algs_length] = { + // XMSS OQS_SIG_STFL_alg_xmss_sha256_h10, OQS_SIG_STFL_alg_xmss_sha256_h16, OQS_SIG_STFL_alg_xmss_sha256_h20, @@ -42,6 +43,7 @@ OQS_API const char *OQS_SIG_STFL_alg_identifier(size_t i) { OQS_SIG_STFL_alg_xmssmt_shake128_h60_3, OQS_SIG_STFL_alg_xmssmt_shake128_h60_6, OQS_SIG_STFL_alg_xmssmt_shake128_h60_12, + // LMS OQS_SIG_STFL_alg_lms_sha256_n32_h5_w1, OQS_SIG_STFL_alg_lms_sha256_n32_h5_w2, OQS_SIG_STFL_alg_lms_sha256_n32_h5_w4, @@ -799,54 +801,38 @@ OQS_API OQS_SIG_STFL_SECRET_KEY *OQS_SIG_STFL_SECRET_KEY_new(const char *method_ } } -void OQS_SECRET_KEY_XMSS_free(OQS_SIG_STFL_SECRET_KEY *sk) { - if (sk == NULL) { - return; - } - - OQS_MEM_secure_free(sk->secret_key_data, sk->length_secret_key); - sk->secret_key_data = NULL; -} - OQS_API void OQS_SIG_STFL_SECRET_KEY_free(OQS_SIG_STFL_SECRET_KEY *sk) { - if (sk == NULL) { + if (sk == NULL || sk->free_key == NULL) { return; } /* Call object specific free */ - if (sk->free_key) { - sk->free_key(sk); - } + sk->free_key(sk); + + /* Free sk object */ OQS_MEM_secure_free(sk, sizeof(sk)); + sk = NULL; } OQS_API void OQS_SIG_STFL_SECRET_KEY_SET_store_cb(OQS_SIG_STFL_SECRET_KEY *sk, secure_store_sk store_cb, void *context) { - if (sk) { - if (sk->set_scrt_key_store_cb) { - sk->set_scrt_key_store_cb(sk, store_cb, context); - } + if (sk == NULL || sk->set_scrt_key_store_cb == NULL) { + return; } + sk->set_scrt_key_store_cb(sk, store_cb, context); } /* Convert secret key object to byte string */ OQS_API OQS_STATUS OQS_SECRET_KEY_STFL_serialize_key(const OQS_SIG_STFL_SECRET_KEY *sk, size_t *sk_len, uint8_t **sk_buf) { - if ((sk == NULL) || (sk_len == NULL) || (sk_buf == NULL)) { - return 0; - } - if (sk->serialize_key) { - return sk->serialize_key(sk, sk_len, sk_buf); - } else { - return 0; + if (sk == NULL || sk_len == NULL || sk_buf == NULL || sk->serialize_key == NULL) { + return OQS_ERROR; } + + return sk->serialize_key(sk, sk_len, sk_buf); } /* Insert secret key byte string in an Stateful secret key object */ OQS_API OQS_STATUS OQS_SECRET_KEY_STFL_deserialize_key(OQS_SIG_STFL_SECRET_KEY *sk, const size_t key_len, const uint8_t *sk_buf, void *context) { - if ((sk == NULL) || (sk_buf == NULL)) { - return OQS_ERROR; - } - - if (sk->deserialize_key == NULL) { + if (sk == NULL || sk_buf == NULL || sk->deserialize_key == NULL) { return OQS_ERROR; } diff --git a/src/sig_stfl/sig_stfl.h b/src/sig_stfl/sig_stfl.h index 33177e829e..5230a09da7 100644 --- a/src/sig_stfl/sig_stfl.h +++ b/src/sig_stfl/sig_stfl.h @@ -165,7 +165,7 @@ OQS_API int OQS_SIG_STFL_alg_is_enabled(const char *method_name); */ typedef struct OQS_SIG_STFL { - /** A local ordinal representing the LMS parameter of the signature scheme. */ + /** A local ordinal representing the OID parameter of the signature scheme. */ uint32_t oid; /** Printable string representing the name of the signature scheme. */ @@ -280,12 +280,12 @@ typedef struct OQS_SIG_STFL_SECRET_KEY { OQS_STATUS (*serialize_key)(const OQS_SIG_STFL_SECRET_KEY *sk, size_t *sk_len, uint8_t **sk_buf_ptr); /** - * set Secret Key to internal structure Function + * Secret Key to internal structure Function * * @param[in] sk OQS_SIG_STFL_SECRET_KEY object * @param[in] key_len length of the returned byte string - * @param[in] sk_buf The secret key data to populate key obj - * @param[in] context application specific data + * @param[in] sk_buf The secret key data to populate key object + * @param[in] context application specific data * @returns status of the operation populated with key material none-zero length. Caller * deletes the buffer. if sk_buf is NULL the function returns the length */ diff --git a/src/sig_stfl/xmss/external/sign.c b/src/sig_stfl/xmss/external/sign.c deleted file mode 100644 index 8bffc7f516..0000000000 --- a/src/sig_stfl/xmss/external/sign.c +++ /dev/null @@ -1,139 +0,0 @@ -/*============================================================================= - * Copyright (c) 2022 by SandboxAQ Inc - * Author: Duc Tri Nguyen (ductri.nguyen@sandboxaq.com) - * SPDX-License-Identifier: MIT -=============================================================================*/ -#include -#include - -#include "sign.h" -#include "sign_params.h" - -/************************************************* - * Name: XMSS_crypto_sign_keypair - * - * Description: Generates public and private key. - * - * Arguments: - uint8_t *pk: pointer to output public key (allocated - * array of CRYPTO_PUBLICKEYBYTES bytes) - * - uint8_t *sk: pointer to output private key (allocated - * array of CRYPTO_SECRETKEYBYTES bytes) - * - * Returns 0 (success), -1 otherwise - **************************************************/ -int crypto_sign_keypair(unsigned char *pk, unsigned char *sk) -{ - xmss_params params; - uint32_t oid; - int ret = 0; - - ret |= XMSS_STR_TO_OID(&oid, XMSS_OID); - if (ret) - { - return OQS_ERROR; - } - - ret |= XMSS_PARSE_OID(¶ms, oid); - if (ret) - { - return OQS_ERROR; - } - - // TODO: set OID directly here - ret |= XMSS_KEYPAIR(pk, sk, oid); - if (ret) - { - return OQS_ERROR; - } - - return OQS_SUCCESS; -} - -/************************************************* - * Name: XMSS_crypto_sign - * - * Description: Computes signature. - * - * Arguments: - uint8_t *sm: pointer to output signature (of length CRYPTO_BYTES) - * - uint64_t *smlen: pointer to output length of signature - * - uint8_t *m: pointer to message to be signed - * - uint64_t mlen: length of message - * - uint8_t *sk: pointer to bit-packed secret key - * - * Returns 0 (success), -1 otherwise - **************************************************/ -int crypto_sign(unsigned char *sm, unsigned long long *smlen, - const unsigned char *m, unsigned long long mlen, unsigned char *sk) -{ - int ret = XMSS_SIGN(sk, sm, smlen, m, mlen); - if (ret) - { - return OQS_ERROR; - } - - return OQS_SUCCESS; -} - -/************************************************* - * Name: XMSS_crypto_sign_open - * - * Description: Verify signed message. - * - * Arguments: - * - uint8_t *m: pointer to output message (allocated - * array with smlen bytes), can be equal to sm - * - uint64_t *mlen: pointer to output length of message - * - uint8_t *sm: pointer to signed message - * - uint64_t smlen: length of signed message - * - uint8_t *pk: pointer to bit-packed public key - * - * Returns 0 if signed message could be verified correctly and -1 otherwise - **************************************************/ -int crypto_sign_open(const unsigned char *m, unsigned long long mlen, - const unsigned char *sm, unsigned long long smlen, const unsigned char *pk) -{ - if (XMSS_SIGN_OPEN(m, mlen, sm, smlen, pk)) - { - return OQS_ERROR; - } - - return OQS_SUCCESS; -} - -/************************************************* - * Name: XMSS_crypto_remaining_signatures - * - * Description: Return number of remaining signatures - * - * Arguments: - uint64_t *remain: remaining signatures - * - uint8_t *sk: pointer to bit-packed private key - * - * Returns 0 (sucess), -1 otherwise - **************************************************/ -int crypto_remaining_signatures(unsigned long long *remain, const unsigned char *sk) -{ - if (XMSS_REMAINING_SIG(remain, sk)) - { - return OQS_ERROR; - } - return OQS_SUCCESS; -} - -/************************************************* - * Name: XMSS_crypto_total_signatures - * - * Description: Return number of total signatures - * - * Arguments: - uint64_t *max: maximum number of signatures - * - uint8_t *sk: pointer to bit-packed private key - * - * Returns 0 (sucess), -1 otherwise - **************************************************/ -int crypto_total_signatures(unsigned long long *max, const unsigned char *sk) -{ - if (XMSS_TOTAL_SIG(max, sk)) - { - return OQS_ERROR; - } - return OQS_SUCCESS; -} diff --git a/src/sig_stfl/xmss/external/sign.h b/src/sig_stfl/xmss/external/sign.h deleted file mode 100644 index df2c2fb7ca..0000000000 --- a/src/sig_stfl/xmss/external/sign.h +++ /dev/null @@ -1,90 +0,0 @@ -/*============================================================================= - * Copyright (c) 2022 by SandboxAQ Inc - * Author: Duc Tri Nguyen (ductri.nguyen@sandboxaq.com) - * SPDX-License-Identifier: MIT -=============================================================================*/ -#ifndef API_H -#define API_H - -#include -#include "namespace.h" -/************************************************* - * Name: XMSS_crypto_sign_keypair - * - * Description: Generates public and private key. - * - * Arguments: - uint8_t *pk: pointer to output public key (allocated - * array of CRYPTO_PUBLICKEYBYTES bytes) - * - uint8_t *sk: pointer to output private key (allocated - * array of CRYPTO_SECRETKEYBYTES bytes) - * - * Returns 0 (success), -1 otherwise - **************************************************/ -#define crypto_sign_keypair XMSS_NAMESPACE(crypto_sign_keypair) -int crypto_sign_keypair(unsigned char *pk, unsigned char *sk); - -/************************************************* - * Name: XMSS_crypto_sign - * - * Description: Computes signature. - * - * Arguments: - uint8_t *sm: pointer to output signature (of length CRYPTO_BYTES) - * - uint64_t *smlen: pointer to output length of signature - * - uint8_t *m: pointer to message to be signed - * - uint64_t mlen: length of message - * - uint8_t *sk: pointer to bit-packed secret key - * - * Returns 0 (success), -1 otherwise - **************************************************/ -#define crypto_sign XMSS_NAMESPACE(crypto_sign) -int crypto_sign(unsigned char *sm, unsigned long long *smlen, - const unsigned char *m, unsigned long long mlen, unsigned char *sk); - -/************************************************* - * Name: XMSS_crypto_sign_open - * - * Description: Verify signed message. - * - * Arguments: - * - uint8_t *m: pointer to output message (allocated - * array with smlen bytes), can be equal to sm - * - uint64_t *mlen: pointer to output length of message - * - uint8_t *sm: pointer to signed message - * - uint64_t smlen: length of signed message - * - uint8_t *pk: pointer to bit-packed public key - * - * Returns 0 if signed message could be verified correctly and -1 otherwise - **************************************************/ -#define crypto_sign_open XMSS_NAMESPACE(crypto_sign_open) -int crypto_sign_open(const unsigned char *m, unsigned long long mlen, - const unsigned char *sm, unsigned long long smlen, const unsigned char *pk); - -/************************************************* - * Name: XMSS_crypto_remaining_signatures - * - * Description: Return number of signatures left - * - * Arguments: - uint64_t *remain: remaining signatures - * - uint8_t *sk: pointer to bit-packed private key - * - * Returns 0 (sucess), -1 otherwise - **************************************************/ -#define crypto_remaining_signatures XMSS_NAMESPACE(crypto_remaining_signatures) -int crypto_remaining_signatures(unsigned long long *remain, const unsigned char *sk); - - -/************************************************* - * Name: XMSS_crypto_total_signatures - * - * Description: Return number of total signatures - * - * Arguments: - uint64_t *max: maximum number of signatures - * - uint8_t *sk: pointer to bit-packed private key - * - * Returns 0 (sucess), -1 otherwise - **************************************************/ -#define crypto_total_signatures XMSS_NAMESPACE(crypto_total_signatures) -int crypto_total_signatures(unsigned long long *max, const unsigned char *sk); - -#endif - diff --git a/src/sig_stfl/xmss/sig_stfl_xmss.h b/src/sig_stfl/xmss/sig_stfl_xmss.h index 54006043e1..7ffdb863e1 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss.h +++ b/src/sig_stfl/xmss/sig_stfl_xmss.h @@ -9,45 +9,46 @@ void OQS_SECRET_KEY_XMSS_free(OQS_SIG_STFL_SECRET_KEY *sk); /* - * | Algorithms | oid | sk | pk | sig | n | - * |-------------------------------|------|--------|-----|------|----| - * | XMSS-SHA2_10_256 | 0x01 | 1373 | 64 | 2500 | 32 | - * | XMSS-SHA2_16_256 | 0x02 | 2093 | 64 | 2692 | 32 | - * | XMSS-SHA2_20_256 | 0x03 | 2573 | 64 | 2820 | 32 | + * | Algorithms | oid | sk (b) | pk (b) | sig (b) | n | + * |-------------------------------|------|--------|--------|---------|----| + * | XMSS-SHA2_10_256 | 0x01 | 1373 | 64 | 2500 | 32 | + * | XMSS-SHA2_16_256 | 0x02 | 2093 | 64 | 2692 | 32 | + * | XMSS-SHA2_20_256 | 0x03 | 2573 | 64 | 2820 | 32 | * - * | XMSS-SHAKE_10_256 | 0x07 | 1373 | 64 | 2500 | 32 | - * | XMSS-SHAKE_16_256 | 0x08 | 2093 | 64 | 2692 | 32 | - * | XMSS-SHAKE_20_256 | 0x09 | 2573 | 64 | 2820 | 32 | + * | XMSS-SHAKE_10_256 | 0x07 | 1373 | 64 | 2500 | 32 | + * | XMSS-SHAKE_16_256 | 0x08 | 2093 | 64 | 2692 | 32 | + * | XMSS-SHAKE_20_256 | 0x09 | 2573 | 64 | 2820 | 32 | * - * | XMSS-SHA2_10_512 | 0x04 | 2653 | 128 | 9092 | 64 | - * | XMSS-SHA2_16_512 | 0x05 | 4045 | 128 | 9476 | 64 | - * | XMSS-SHA2_20_512 | 0x06 | 4973 | 128 | 9732 | 64 | + * | XMSS-SHA2_10_512 | 0x04 | 2653 | 128 | 9092 | 64 | + * | XMSS-SHA2_16_512 | 0x05 | 4045 | 128 | 9476 | 64 | + * | XMSS-SHA2_20_512 | 0x06 | 4973 | 128 | 9732 | 64 | * - * | XMSS-SHAKE_10_512 | 0x0a | 2653 | 128 | 9092 | 64 | - * | XMSS-SHAKE_16_512 | 0x0b | 4045 | 128 | 9476 | 64 | - * | XMSS-SHAKE_20_512 | 0x0c | 4973 | 128 | 9732 | 64 | + * | XMSS-SHAKE_10_512 | 0x0a | 2653 | 128 | 9092 | 64 | + * | XMSS-SHAKE_16_512 | 0x0b | 4045 | 128 | 9476 | 64 | + * | XMSS-SHAKE_20_512 | 0x0c | 4973 | 128 | 9732 | 64 | * - * | XMSSMT-SHA2_20/2_256 | 0x01 | 5998 | 64 | 4963 | 32 | - * | XMSSMT-SHA2_20/4_256 | 0x02 | 10938 | 64 | 9251 | 32 | - * | XMSSMT-SHA2_40/2_256 | 0x03 | 9600 | 64 | 5605 | 32 | - * | XMSSMT-SHA2_40/4_256 | 0x04 | 15252 | 64 | 9893 | 32 | - * | XMSSMT-SHA2_40/8_256 | 0x05 | 24516 | 64 | 18469 | 32 | - * | XMSSMT-SHA2_60/3_256 | 0x06 | 16629 | 64 | 8392 | 32 | - * | XMSSMT-SHA2_60/6_256 | 0x07 | 24507 | 64 | 14824 | 32 | - * | XMSSMT-SHA2_60/12_256 | 0x08 | 38095 | 64 | 27688 | 32 | + * | XMSSMT-SHA2_20/2_256 | 0x01 | 5998 | 64 | 4963 | 32 | + * | XMSSMT-SHA2_20/4_256 | 0x02 | 10938 | 64 | 9251 | 32 | + * | XMSSMT-SHA2_40/2_256 | 0x03 | 9600 | 64 | 5605 | 32 | + * | XMSSMT-SHA2_40/4_256 | 0x04 | 15252 | 64 | 9893 | 32 | + * | XMSSMT-SHA2_40/8_256 | 0x05 | 24516 | 64 | 18469 | 32 | + * | XMSSMT-SHA2_60/3_256 | 0x06 | 16629 | 64 | 8392 | 32 | + * | XMSSMT-SHA2_60/6_256 | 0x07 | 24507 | 64 | 14824 | 32 | + * | XMSSMT-SHA2_60/12_256 | 0x08 | 38095 | 64 | 27688 | 32 | * - * | XMSSMT-SHAKE_20/2_256 | 0x11 | 5998 | 64 | 4963 | 32 | - * | XMSSMT-SHAKE_20/4_256 | 0x12 | 10938 | 64 | 9251 | 32 | - * | XMSSMT-SHAKE_40/2_256 | 0x13 | 9600 | 64 | 5605 | 32 | - * | XMSSMT-SHAKE_40/4_256 | 0x14 | 15252 | 64 | 9893 | 32 | - * | XMSSMT-SHAKE_40/8_256 | 0x15 | 24516 | 64 | 18469 | 32 | - * | XMSSMT-SHAKE_60/3_256 | 0x16 | 16629 | 64 | 8392 | 32 | - * | XMSSMT-SHAKE_60/6_256 | 0x17 | 24507 | 64 | 14824 | 32 | - * | XMSSMT-SHAKE_60/12_256 | 0x18 | 38095 | 64 | 27688 | 32 | + * | XMSSMT-SHAKE_20/2_256 | 0x11 | 5998 | 64 | 4963 | 32 | + * | XMSSMT-SHAKE_20/4_256 | 0x12 | 10938 | 64 | 9251 | 32 | + * | XMSSMT-SHAKE_40/2_256 | 0x13 | 9600 | 64 | 5605 | 32 | + * | XMSSMT-SHAKE_40/4_256 | 0x14 | 15252 | 64 | 9893 | 32 | + * | XMSSMT-SHAKE_40/8_256 | 0x15 | 24516 | 64 | 18469 | 32 | + * | XMSSMT-SHAKE_60/3_256 | 0x16 | 16629 | 64 | 8392 | 32 | + * | XMSSMT-SHAKE_60/6_256 | 0x17 | 24507 | 64 | 14824 | 32 | + * | XMSSMT-SHAKE_60/12_256 | 0x18 | 38095 | 64 | 27688 | 32 | */ #ifdef OQS_ENABLE_SIG_STFL_xmss_sha256_h10 +#define OQS_SIG_STFL_alg_xmss_sha256_h10_oid 0x01 #define OQS_SIG_STFL_alg_xmss_sha256_h10_length_sk (1373 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha256_h10_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha256_h10_length_signature 2500 @@ -64,6 +65,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha256_h10_sigs_total(unsigned long lon #ifdef OQS_ENABLE_SIG_STFL_xmss_sha256_h16 +#define OQS_SIG_STFL_alg_xmss_sha256_h16_oid 0x02 #define OQS_SIG_STFL_alg_xmss_sha256_h16_length_sk (2093 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha256_h16_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha256_h16_length_signature 2692 @@ -80,6 +82,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha256_h16_sigs_total(unsigned long lon #ifdef OQS_ENABLE_SIG_STFL_xmss_sha256_h20 +#define OQS_SIG_STFL_alg_xmss_sha256_h20_oid 0x03 #define OQS_SIG_STFL_alg_xmss_sha256_h20_length_sk (2573 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha256_h20_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha256_h20_length_signature 2820 @@ -96,6 +99,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha256_h20_sigs_total(unsigned long lon #ifdef OQS_ENABLE_SIG_STFL_xmss_shake128_h10 +#define OQS_SIG_STFL_alg_xmss_shake128_h10_oid 0x07 #define OQS_SIG_STFL_alg_xmss_shake128_h10_length_sk (1373 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake128_h10_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake128_h10_length_signature 2500 @@ -112,6 +116,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake128_h10_sigs_total(unsigned long l #ifdef OQS_ENABLE_SIG_STFL_xmss_shake128_h16 +#define OQS_SIG_STFL_alg_xmss_shake128_h16_oid 0x08 #define OQS_SIG_STFL_alg_xmss_shake128_h16_length_sk (2093 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake128_h16_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake128_h16_length_signature 2692 @@ -128,6 +133,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake128_h16_sigs_total(unsigned long l #ifdef OQS_ENABLE_SIG_STFL_xmss_shake128_h20 +#define OQS_SIG_STFL_alg_xmss_shake128_h20_oid 0x09 #define OQS_SIG_STFL_alg_xmss_shake128_h20_length_sk (2573 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake128_h20_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake128_h20_length_signature 2820 @@ -144,6 +150,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake128_h20_sigs_total(unsigned long l #ifdef OQS_ENABLE_SIG_STFL_xmss_sha512_h10 +#define OQS_SIG_STFL_alg_xmss_sha512_h10_oid 0x04 #define OQS_SIG_STFL_alg_xmss_sha512_h10_length_sk (2653 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha512_h10_length_pk (128 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha512_h10_length_signature 9092 @@ -160,6 +167,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha512_h10_sigs_total(unsigned long lon #ifdef OQS_ENABLE_SIG_STFL_xmss_sha512_h16 +#define OQS_SIG_STFL_alg_xmss_sha512_h16_oid 0x05 #define OQS_SIG_STFL_alg_xmss_sha512_h16_length_sk (4045 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha512_h16_length_pk (128 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha512_h16_length_signature 9476 @@ -176,6 +184,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha512_h16_sigs_total(unsigned long lon #ifdef OQS_ENABLE_SIG_STFL_xmss_sha512_h20 +#define OQS_SIG_STFL_alg_xmss_sha512_h20_oid 0x06 #define OQS_SIG_STFL_alg_xmss_sha512_h20_length_sk (4973 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha512_h20_length_pk (128 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_sha512_h20_length_signature 9732 @@ -192,6 +201,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha512_h20_sigs_total(unsigned long lon #ifdef OQS_ENABLE_SIG_STFL_xmss_shake256_h10 +#define OQS_SIG_STFL_alg_xmss_shake256_h10_oid 0x0a #define OQS_SIG_STFL_alg_xmss_shake256_h10_length_sk (2653 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake256_h10_length_pk (128 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake256_h10_length_signature 9092 @@ -208,6 +218,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake256_h10_sigs_total(unsigned long l #ifdef OQS_ENABLE_SIG_STFL_xmss_shake256_h16 +#define OQS_SIG_STFL_alg_xmss_shake256_h16_oid 0x0b #define OQS_SIG_STFL_alg_xmss_shake256_h16_length_sk (4045 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake256_h16_length_pk (128 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake256_h16_length_signature 9476 @@ -224,6 +235,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake256_h16_sigs_total(unsigned long l #ifdef OQS_ENABLE_SIG_STFL_xmss_shake256_h20 +#define OQS_SIG_STFL_alg_xmss_shake256_h20_oid 0x0c #define OQS_SIG_STFL_alg_xmss_shake256_h20_length_sk (4973 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake256_h20_length_pk (128 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmss_shake256_h20_length_signature 9732 @@ -240,6 +252,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake256_h20_sigs_total(unsigned long l #ifdef OQS_ENABLE_SIG_STFL_xmssmt_sha256_h20_2 +#define OQS_SIG_STFL_alg_xmssmt_sha256_h20_2_oid 0x01 #define OQS_SIG_STFL_alg_xmssmt_sha256_h20_2_length_sk (5998 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h20_2_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h20_2_length_signature 4963 @@ -256,6 +269,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h20_2_sigs_total(unsigned long #ifdef OQS_ENABLE_SIG_STFL_xmssmt_sha256_h20_4 +#define OQS_SIG_STFL_alg_xmssmt_sha256_h20_4_oid 0x02 #define OQS_SIG_STFL_alg_xmssmt_sha256_h20_4_length_sk (10938 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h20_4_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h20_4_length_signature 9251 @@ -272,6 +286,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h20_4_sigs_total(unsigned long #ifdef OQS_ENABLE_SIG_STFL_xmssmt_sha256_h40_2 +#define OQS_SIG_STFL_alg_xmssmt_sha256_h40_2_oid 0x03 #define OQS_SIG_STFL_alg_xmssmt_sha256_h40_2_length_sk (9600 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h40_2_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h40_2_length_signature 5605 @@ -288,6 +303,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h40_2_sigs_total(unsigned long #ifdef OQS_ENABLE_SIG_STFL_xmssmt_sha256_h40_4 +#define OQS_SIG_STFL_alg_xmssmt_sha256_h40_4_oid 0x04 #define OQS_SIG_STFL_alg_xmssmt_sha256_h40_4_length_sk (15252 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h40_4_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h40_4_length_signature 9893 @@ -304,6 +320,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h40_4_sigs_total(unsigned long #ifdef OQS_ENABLE_SIG_STFL_xmssmt_sha256_h40_8 +#define OQS_SIG_STFL_alg_xmssmt_sha256_h40_8_oid 0x05 #define OQS_SIG_STFL_alg_xmssmt_sha256_h40_8_length_sk (24516 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h40_8_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h40_8_length_signature 18469 @@ -320,6 +337,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h40_8_sigs_total(unsigned long #ifdef OQS_ENABLE_SIG_STFL_xmssmt_sha256_h60_3 +#define OQS_SIG_STFL_alg_xmssmt_sha256_h60_3_oid 0x06 #define OQS_SIG_STFL_alg_xmssmt_sha256_h60_3_length_sk (16629 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h60_3_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h60_3_length_signature 8392 @@ -336,6 +354,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h60_3_sigs_total(unsigned long #ifdef OQS_ENABLE_SIG_STFL_xmssmt_sha256_h60_6 +#define OQS_SIG_STFL_alg_xmssmt_sha256_h60_6_oid 0x07 #define OQS_SIG_STFL_alg_xmssmt_sha256_h60_6_length_sk (24507 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h60_6_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h60_6_length_signature 14824 @@ -352,6 +371,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h60_6_sigs_total(unsigned long #ifdef OQS_ENABLE_SIG_STFL_xmssmt_sha256_h60_12 +#define OQS_SIG_STFL_alg_xmssmt_sha256_h60_12_oid 0x08 #define OQS_SIG_STFL_alg_xmssmt_sha256_h60_12_length_sk (38095 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h60_12_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_sha256_h60_12_length_signature 27688 @@ -368,6 +388,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h60_12_sigs_total(unsigned lon #ifdef OQS_ENABLE_SIG_STFL_xmssmt_shake128_h20_2 +#define OQS_SIG_STFL_alg_xmssmt_shake128_h20_2_oid 0x11 #define OQS_SIG_STFL_alg_xmssmt_shake128_h20_2_length_sk (5998 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h20_2_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h20_2_length_signature 4963 @@ -384,6 +405,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h20_2_sigs_total(unsigned lo #ifdef OQS_ENABLE_SIG_STFL_xmssmt_shake128_h20_4 +#define OQS_SIG_STFL_alg_xmssmt_shake128_h20_4_oid 0x12 #define OQS_SIG_STFL_alg_xmssmt_shake128_h20_4_length_sk (10938 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h20_4_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h20_4_length_signature 9251 @@ -400,6 +422,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h20_4_sigs_total(unsigned lo #ifdef OQS_ENABLE_SIG_STFL_xmssmt_shake128_h40_2 +#define OQS_SIG_STFL_alg_xmssmt_shake128_h40_2_oid 0x13 #define OQS_SIG_STFL_alg_xmssmt_shake128_h40_2_length_sk (9600 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h40_2_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h40_2_length_signature 5605 @@ -416,6 +439,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h40_2_sigs_total(unsigned lo #ifdef OQS_ENABLE_SIG_STFL_xmssmt_shake128_h40_4 +#define OQS_SIG_STFL_alg_xmssmt_shake128_h40_4_oid 0x14 #define OQS_SIG_STFL_alg_xmssmt_shake128_h40_4_length_sk (15252 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h40_4_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h40_4_length_signature 9893 @@ -432,6 +456,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h40_4_sigs_total(unsigned lo #ifdef OQS_ENABLE_SIG_STFL_xmssmt_shake128_h40_8 +#define OQS_SIG_STFL_alg_xmssmt_shake128_h40_8_oid 0x15 #define OQS_SIG_STFL_alg_xmssmt_shake128_h40_8_length_sk (24516 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h40_8_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h40_8_length_signature 18469 @@ -448,6 +473,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h40_8_sigs_total(unsigned lo #ifdef OQS_ENABLE_SIG_STFL_xmssmt_shake128_h60_3 +#define OQS_SIG_STFL_alg_xmssmt_shake128_h60_3_oid 0x16 #define OQS_SIG_STFL_alg_xmssmt_shake128_h60_3_length_sk (16629 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h60_3_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h60_3_length_signature 8392 @@ -464,6 +490,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h60_3_sigs_total(unsigned lo #ifdef OQS_ENABLE_SIG_STFL_xmssmt_shake128_h60_6 +#define OQS_SIG_STFL_alg_xmssmt_shake128_h60_6_oid 0x17 #define OQS_SIG_STFL_alg_xmssmt_shake128_h60_6_length_sk (24507 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h60_6_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h60_6_length_signature 14824 @@ -480,6 +507,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h60_6_sigs_total(unsigned lo #ifdef OQS_ENABLE_SIG_STFL_xmssmt_shake128_h60_12 +#define OQS_SIG_STFL_alg_xmssmt_shake128_h60_12_oid 0x18 #define OQS_SIG_STFL_alg_xmssmt_shake128_h60_12_length_sk (38095 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h60_12_length_pk (64 + XMSS_OID_LEN) #define OQS_SIG_STFL_alg_xmssmt_shake128_h60_12_length_signature 27688 @@ -503,4 +531,10 @@ OQS_STATUS OQS_SECRET_KEY_XMSS_serialize_key(const OQS_SIG_STFL_SECRET_KEY *sk, /* Deserialize XMSS byte string into an XMSS secret key data */ OQS_STATUS OQS_SECRET_KEY_XMSS_deserialize_key(OQS_SIG_STFL_SECRET_KEY *sk, const size_t sk_len, const uint8_t *sk_buf, void *context); +/* Store Secret Key Function, idealy written to secure device */ +void OQS_SECRET_KEY_XMSS_set_store_cb(OQS_SIG_STFL_SECRET_KEY *sk, secure_store_sk store_cb, void *context); + +/* Free Secret key object */ +void OQS_SECRET_KEY_XMSS_free(OQS_SIG_STFL_SECRET_KEY *sk); + #endif /* OQS_SIG_STFL_XMSS_H */ 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 4a47c938c3..34031f0e64 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 @@ -16,6 +16,11 @@ OQS_STATUS OQS_SECRET_KEY_XMSS_serialize_key(const OQS_SIG_STFL_SECRET_KEY *sk, return OQS_ERROR; } + // Lock the key if possible + if (sk->lock_key != NULL && sk->mutex != NULL) { + sk->lock_key(sk->mutex); + } + uint8_t *sk_buf = malloc(sk->length_secret_key * sizeof(uint8_t)); if (sk_buf == NULL) { return OQS_ERROR; @@ -27,6 +32,11 @@ OQS_STATUS OQS_SECRET_KEY_XMSS_serialize_key(const OQS_SIG_STFL_SECRET_KEY *sk, *sk_buf_ptr = sk_buf; *sk_len = sk->length_secret_key; + // Unlock the key if possible + if (sk->unlock_key != NULL && sk->mutex != NULL) { + sk->unlock_key(sk->mutex); + } + return OQS_SUCCESS; } @@ -36,13 +46,11 @@ OQS_STATUS OQS_SECRET_KEY_XMSS_deserialize_key(OQS_SIG_STFL_SECRET_KEY *sk, cons return OQS_ERROR; } - if (sk->secret_key_data != NULL) { - // Key data already present - // We dont want to trample over data - return OQS_ERROR; + // Lock the key if possible + if (sk->lock_key != NULL && sk->mutex != NULL) { + sk->lock_key(sk->mutex); } - // Assume key data is not present sk->secret_key_data = malloc(sk_len); if (sk->secret_key_data == NULL) { return OQS_ERROR; @@ -50,5 +58,27 @@ OQS_STATUS OQS_SECRET_KEY_XMSS_deserialize_key(OQS_SIG_STFL_SECRET_KEY *sk, cons memcpy(sk->secret_key_data, sk_buf, sk_len); + // Unlock the key if possible + if (sk->unlock_key != NULL && sk->mutex != NULL) { + sk->unlock_key(sk->mutex); + } + return OQS_SUCCESS; } + +void OQS_SECRET_KEY_XMSS_set_store_cb(OQS_SIG_STFL_SECRET_KEY *sk, secure_store_sk store_cb, void *context) { + if (sk == NULL || store_cb == NULL) { + return; + } + sk->secure_store_scrt_key = store_cb; + (void) context; +} + +void OQS_SECRET_KEY_XMSS_free(OQS_SIG_STFL_SECRET_KEY *sk) { + if (sk == NULL) { + return; + } + + OQS_MEM_secure_free(sk->secret_key_data, sk->length_secret_key); + sk->secret_key_data = NULL; +} \ No newline at end of file diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h10.c b/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h10.c index 20a8f87af0..8da9f50d28 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h10.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h10.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_sha256_h10_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_sha256_h10_oid; sig->method_name = "XMSS-SHA2_10_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -66,6 +67,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHA256_H10_new(void) { memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -77,8 +97,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha256_h10_keypair(XMSS_UNUSED_ATT uint return OQS_ERROR; } - const uint32_t xmss_sha256_h10_oid = 0x01; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_sha256_h10_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_sha256_h10_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h16.c b/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h16.c index d32ad7df05..28c0ff7b20 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h16.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h16.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_sha256_h16_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_sha256_h16_oid; sig->method_name = "XMSS-SHA2_16_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHA256_H16_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha256_h16_keypair(XMSS_UNUSED_ATT uint return OQS_ERROR; } - const uint32_t xmss_sha256_h16_oid = 0x02; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_sha256_h16_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_sha256_h16_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h20.c b/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h20.c index 9675fb1151..c3806b2049 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h20.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_sha256_h20.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_sha256_h20_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_sha256_h20_oid; sig->method_name = "XMSS-SHA2_20_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHA256_H20_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha256_h20_keypair(XMSS_UNUSED_ATT uint return OQS_ERROR; } - const uint32_t xmss_sha256_h20_oid = 0x03; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_sha256_h20_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_sha256_h20_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h10.c b/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h10.c index c4589175c6..e24a95b94e 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h10.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h10.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_sha512_h10_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_sha512_h10_oid; sig->method_name = "XMSS-SHA2_10_512"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHA512_H10_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha512_h10_keypair(XMSS_UNUSED_ATT uint return OQS_ERROR; } - const uint32_t xmss_sha512_h10_oid = 0x04; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_sha512_h10_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_sha512_h10_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h16.c b/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h16.c index bab2bda1f2..e62392a5ed 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h16.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h16.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_sha512_h16_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_sha512_h16_oid; sig->method_name = "XMSS-SHA2_16_512"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHA512_H16_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha512_h16_keypair(XMSS_UNUSED_ATT uint return OQS_ERROR; } - const uint32_t xmss_sha512_h16_oid = 0x05; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_sha512_h16_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_sha512_h16_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h20.c b/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h20.c index 5c931a35c4..0421336bec 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h20.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_sha512_h20.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_sha512_h20_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_sha512_h20_oid; sig->method_name = "XMSS-SHA2_20_512"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHA512_H20_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_sha512_h20_keypair(XMSS_UNUSED_ATT uint return OQS_ERROR; } - const uint32_t xmss_sha512_h20_oid = 0x06; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_sha512_h20_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_sha512_h20_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h10.c b/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h10.c index fde4331e66..1b6c00dbf1 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h10.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h10.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_shake128_h10_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_shake128_h10_oid; sig->method_name = "XMSS-SHAKE_10_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHAKE128_H10_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake128_h10_keypair(XMSS_UNUSED_ATT ui return OQS_ERROR; } - const uint32_t xmss_shake128_h10_oid = 0x07; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_shake128_h10_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_shake128_h10_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h16.c b/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h16.c index d1587260f3..123922c6c2 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h16.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h16.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_shake128_h16_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_shake128_h16_oid; sig->method_name = "XMSS-SHAKE_16_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHAKE128_H16_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake128_h16_keypair(XMSS_UNUSED_ATT ui return OQS_ERROR; } - const uint32_t xmss_shake128_h16_oid = 0x08; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_shake128_h16_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_shake128_h16_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h20.c b/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h20.c index c618ce8260..fd07e5e347 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h20.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_shake128_h20.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_shake128_h20_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_shake128_h20_oid; sig->method_name = "XMSS-SHAKE_20_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHAKE128_H20_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake128_h20_keypair(XMSS_UNUSED_ATT ui return OQS_ERROR; } - const uint32_t xmss_shake128_h20_oid = 0x09; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_shake128_h20_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_shake128_h20_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h10.c b/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h10.c index 84e5772280..39a18ebf48 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h10.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h10.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_shake256_h10_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_shake256_h10_oid; sig->method_name = "XMSS-SHAKE_10_512"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHAKE256_H10_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake256_h10_keypair(XMSS_UNUSED_ATT ui return OQS_ERROR; } - const uint32_t xmss_shake256_h10_oid = 0x0a; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_shake256_h10_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_shake256_h10_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h16.c b/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h16.c index 788eb8f1e7..b636cbf825 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h16.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h16.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_shake256_h16_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_shake256_h16_oid; sig->method_name = "XMSS-SHAKE_16_512"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHAKE256_H16_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake256_h16_keypair(XMSS_UNUSED_ATT ui return OQS_ERROR; } - const uint32_t xmss_shake256_h16_oid = 0x0b; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_shake256_h16_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_shake256_h16_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h20.c b/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h20.c index 7029f669f8..9be79bc37c 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h20.c +++ b/src/sig_stfl/xmss/sig_stfl_xmss_shake256_h20.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmss_shake256_h20_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmss_shake256_h20_oid; sig->method_name = "XMSS-SHAKE_20_512"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSS_SHAKE256_H20_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmss_shake256_h20_keypair(XMSS_UNUSED_ATT ui return OQS_ERROR; } - const uint32_t xmss_shake256_h20_oid = 0x0c; - if (xmss_keypair(public_key, secret_key->secret_key_data, xmss_shake256_h20_oid)) { + if (xmss_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmss_shake256_h20_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h20_2.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h20_2.c index c4862f728e..b438e16634 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h20_2.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h20_2.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_sha256_h20_2_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_sha256_h20_2_oid; sig->method_name = "XMSSMT-SHA2_20/2_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHA256_H20_2_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h20_2_keypair(XMSS_UNUSED_ATT return OQS_ERROR; } - const uint32_t xmssmt_sha256_h20_2_oid = 0x01; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_sha256_h20_2_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_sha256_h20_2_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h20_4.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h20_4.c index efa097b262..df7c527443 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h20_4.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h20_4.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_sha256_h20_4_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_sha256_h20_4_oid; sig->method_name = "XMSSMT-SHA2_20/4_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHA256_H20_4_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h20_4_keypair(XMSS_UNUSED_ATT return OQS_ERROR; } - const uint32_t xmssmt_sha256_h20_4_oid = 0x02; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_sha256_h20_4_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_sha256_h20_4_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_2.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_2.c index 04c8fd52fb..083d9224a1 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_2.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_2.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_sha256_h40_2_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_sha256_h40_2_oid; sig->method_name = "XMSSMT-SHA2_40/2_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHA256_H40_2_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h40_2_keypair(XMSS_UNUSED_ATT return OQS_ERROR; } - const uint32_t xmssmt_sha256_h40_2_oid = 0x03; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_sha256_h40_2_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_sha256_h40_2_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_4.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_4.c index dfa69325e8..fe1e77f4f7 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_4.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_4.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_sha256_h40_4_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_sha256_h40_4_oid; sig->method_name = "XMSSMT-SHA2_40/4_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHA256_H40_4_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h40_4_keypair(XMSS_UNUSED_ATT return OQS_ERROR; } - const uint32_t xmssmt_sha256_h40_4_oid = 0x04; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_sha256_h40_4_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_sha256_h40_4_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_8.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_8.c index 7b4640ed40..03c6fb1550 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_8.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h40_8.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_sha256_h40_8_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_sha256_h40_8_oid; sig->method_name = "XMSSMT-SHA2_40/8_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHA256_H40_8_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h40_8_keypair(XMSS_UNUSED_ATT return OQS_ERROR; } - const uint32_t xmssmt_sha256_h40_8_oid = 0x05; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_sha256_h40_8_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_sha256_h40_8_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_12.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_12.c index 84f0f589d3..925b61636a 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_12.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_12.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_sha256_h60_12_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_sha256_h60_12_oid; sig->method_name = "XMSSMT-SHA2_60/12_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHA256_H60_12_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h60_12_keypair(XMSS_UNUSED_ATT return OQS_ERROR; } - const uint32_t xmssmt_sha256_h60_12_oid = 0x08; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_sha256_h60_12_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_sha256_h60_12_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_3.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_3.c index c9616932eb..2d5b967662 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_3.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_3.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_sha256_h60_3_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_sha256_h60_3_oid; sig->method_name = "XMSSMT-SHA2_60/3_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHA256_H60_3_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h60_3_keypair(XMSS_UNUSED_ATT return OQS_ERROR; } - const uint32_t xmssmt_sha256_h60_3_oid = 0x06; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_sha256_h60_3_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_sha256_h60_3_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_6.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_6.c index 7ab46f56ad..f5305efd99 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_6.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_sha256_h60_6.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_sha256_h60_6_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_sha256_h60_6_oid; sig->method_name = "XMSSMT-SHA2_60/6_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHA256_H60_6_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_sha256_h60_6_keypair(XMSS_UNUSED_ATT return OQS_ERROR; } - const uint32_t xmssmt_sha256_h60_6_oid = 0x07; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_sha256_h60_6_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_sha256_h60_6_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h20_2.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h20_2.c index 19421bb2ae..fc0b799586 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h20_2.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h20_2.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_shake128_h20_2_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_shake128_h20_2_oid; sig->method_name = "XMSSMT-SHAKE_20/2_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHAKE128_H20_2_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h20_2_keypair(XMSS_UNUSED_AT return OQS_ERROR; } - const uint32_t xmssmt_shake128_h20_2_oid = 0x11; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_shake128_h20_2_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_shake128_h20_2_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h20_4.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h20_4.c index 1b51a87c76..7a9e5b3030 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h20_4.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h20_4.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_shake128_h20_4_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_shake128_h20_4_oid; sig->method_name = "XMSSMT-SHAKE_20/4_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHAKE128_H20_4_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h20_4_keypair(XMSS_UNUSED_AT return OQS_ERROR; } - const uint32_t xmssmt_shake128_h20_4_oid = 0x12; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_shake128_h20_4_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_shake128_h20_4_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_2.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_2.c index 8e3617fbd0..f38cfac983 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_2.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_2.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_shake128_h40_2_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_shake128_h40_2_oid; sig->method_name = "XMSSMT-SHAKE_40/2_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHAKE128_H40_2_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h40_2_keypair(XMSS_UNUSED_AT return OQS_ERROR; } - const uint32_t xmssmt_shake128_h40_2_oid = 0x13; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_shake128_h40_2_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_shake128_h40_2_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_4.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_4.c index 9a5f66ccef..c830136eac 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_4.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_4.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_shake128_h40_4_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_shake128_h40_4_oid; sig->method_name = "XMSSMT-SHAKE_40/4_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHAKE128_H40_4_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h40_4_keypair(XMSS_UNUSED_AT return OQS_ERROR; } - const uint32_t xmssmt_shake128_h40_4_oid = 0x14; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_shake128_h40_4_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_shake128_h40_4_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_8.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_8.c index 9b6fc160ed..bc2bf9a88e 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_8.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h40_8.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_shake128_h40_8_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_shake128_h40_8_oid; sig->method_name = "XMSSMT-SHAKE_40/8_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHAKE128_H40_8_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h40_8_keypair(XMSS_UNUSED_AT return OQS_ERROR; } - const uint32_t xmssmt_shake128_h40_8_oid = 0x15; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_shake128_h40_8_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_shake128_h40_8_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_12.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_12.c index dfad288f23..cdae7b5033 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_12.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_12.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_shake128_h60_12_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_shake128_h60_12_oid; sig->method_name = "XMSSMT-SHAKE_60/12_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHAKE128_H60_12_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h60_12_keypair(XMSS_UNUSED_A return OQS_ERROR; } - const uint32_t xmssmt_shake128_h60_12_oid = 0x18; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_shake128_h60_12_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_shake128_h60_12_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_3.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_3.c index acd7b70165..bdfa0e4562 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_3.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_3.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_shake128_h60_3_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_shake128_h60_3_oid; sig->method_name = "XMSSMT-SHAKE_60/3_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHAKE128_H60_3_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h60_3_keypair(XMSS_UNUSED_AT return OQS_ERROR; } - const uint32_t xmssmt_shake128_h60_3_oid = 0x16; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_shake128_h60_3_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_shake128_h60_3_oid)) { return OQS_ERROR; } diff --git a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_6.c b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_6.c index 889e831775..8dd8d1dab7 100644 --- a/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_6.c +++ b/src/sig_stfl/xmss/sig_stfl_xmssmt_shake128_h60_6.c @@ -24,6 +24,7 @@ OQS_SIG_STFL *OQS_SIG_STFL_alg_xmssmt_shake128_h60_6_new(void) { } memset(sig, 0, sizeof(OQS_SIG_STFL)); + sig->oid = OQS_SIG_STFL_alg_xmssmt_shake128_h60_6_oid; sig->method_name = "XMSSMT-SHAKE_60/6_256"; sig->alg_version = "https://datatracker.ietf.org/doc/html/rfc8391"; sig->euf_cma = true; @@ -65,6 +66,25 @@ OQS_SIG_STFL_SECRET_KEY *OQS_SECRET_KEY_XMSSMT_SHAKE128_H60_6_new(void) { } memset(sk->secret_key_data, 0, sk->length_secret_key); + // Point to associated OQS_SIG_STFL object + sk->sig = NULL; + + // Mutual exclusion struct + sk->mutex = NULL; + + // Set Secret Key locking function + sk->lock_key = NULL; + + // Set Secret Key unlocking / releasing function + sk->unlock_key = NULL; + + // Set Secret Key saving function + sk->secure_store_scrt_key = NULL; + + // Set Secret Key store callback function + sk->set_scrt_key_store_cb = OQS_SECRET_KEY_XMSS_set_store_cb; + + // Set Secret Key free function sk->free_key = OQS_SECRET_KEY_XMSS_free; return sk; @@ -76,8 +96,7 @@ OQS_API OQS_STATUS OQS_SIG_STFL_alg_xmssmt_shake128_h60_6_keypair(XMSS_UNUSED_AT return OQS_ERROR; } - const uint32_t xmssmt_shake128_h60_6_oid = 0x17; - if (xmssmt_keypair(public_key, secret_key->secret_key_data, xmssmt_shake128_h60_6_oid)) { + if (xmssmt_keypair(public_key, secret_key->secret_key_data, OQS_SIG_STFL_alg_xmssmt_shake128_h60_6_oid)) { return OQS_ERROR; }