From fa24f9d6ea4be3aa5f91a0e9c5a13753022a6fd0 Mon Sep 17 00:00:00 2001 From: Raef Coles Date: Fri, 2 Sep 2022 17:46:52 +0100 Subject: [PATCH] Minor fixes to LMS and LMOTS macros Update some names, use the correct macro in certain places. Signed-off-by: Raef Coles --- library/lmots.c | 2 +- library/lmots.h | 4 ++-- library/lms.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/lmots.c b/library/lmots.c index fe01bf672..8e56696e5 100644 --- a/library/lmots.c +++ b/library/lmots.c @@ -194,7 +194,7 @@ static int create_digit_array_with_checksum( const mbedtls_lmots_parameters_t *p goto exit; status = psa_hash_finish( &op, out, - MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT(params->type), + MBEDTLS_LMOTS_N_HASH_LEN(params->type), &output_hash_len ); ret = mbedtls_lms_error_from_psa( status ); if( ret != 0 ) diff --git a/library/lmots.h b/library/lmots.h index 03e44af00..56d23f855 100644 --- a/library/lmots.h +++ b/library/lmots.h @@ -104,7 +104,7 @@ typedef struct { */ typedef struct { mbedtls_lmots_parameters_t MBEDTLS_PRIVATE(params); - unsigned char MBEDTLS_PRIVATE(public_key)[32]; + unsigned char MBEDTLS_PRIVATE(public_key)[MBEDTLS_LMOTS_N_HASH_LEN_MAX]; unsigned char MBEDTLS_PRIVATE(have_public_key); /*!< Whether the context contains a public key. Boolean values only. */ } mbedtls_lmots_public_t; @@ -129,7 +129,7 @@ typedef struct { */ typedef struct { mbedtls_lmots_parameters_t MBEDTLS_PRIVATE(params); - unsigned char MBEDTLS_PRIVATE(private_key)[MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT_MAX][32]; + unsigned char MBEDTLS_PRIVATE(private_key)[MBEDTLS_LMOTS_P_SIG_DIGIT_COUNT_MAX][MBEDTLS_LMOTS_N_HASH_LEN_MAX]; unsigned char MBEDTLS_PRIVATE(have_private_key); /*!< Whether the context contains a private key. Boolean values only. */ } mbedtls_lmots_private_t; diff --git a/library/lms.c b/library/lms.c index e0f5946ef..26c48efa3 100644 --- a/library/lms.c +++ b/library/lms.c @@ -205,7 +205,7 @@ static int create_merkle_internal_value( const mbedtls_lms_parameters_t *params, if( ret != 0 ) goto exit; - status = psa_hash_update( &op, D_INTERNAL_CONSTANT_BYTES, D_CONST_LEN ); + status = psa_hash_update( &op, D_INTR_CONSTANT_BYTES, D_CONST_LEN ); ret = mbedtls_lms_error_from_psa( status ); if( ret != 0 ) goto exit;