From f36874a53519b03d78690872061e31c4ed860892 Mon Sep 17 00:00:00 2001 From: Raef Coles Date: Fri, 7 Oct 2022 13:39:22 +0100 Subject: [PATCH] Fix error type of lms_import_public_key Was returning an incorrect error when bad public key sizes were input Signed-off-by: Raef Coles --- library/lms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/lms.c b/library/lms.c index 06bae9dffd..a8411797d2 100644 --- a/library/lms.c +++ b/library/lms.c @@ -235,9 +235,9 @@ int mbedtls_lms_import_public_key( mbedtls_lms_public_t *ctx, mbedtls_lms_algorithm_type_t type; mbedtls_lmots_algorithm_type_t otstype; - if( key_size < MBEDTLS_LMS_PUBLIC_KEY_LEN(ctx->params.type) ) + if( key_size != MBEDTLS_LMS_PUBLIC_KEY_LEN(ctx->params.type) ) { - return( MBEDTLS_ERR_LMS_BUFFER_TOO_SMALL ); + return( MBEDTLS_ERR_LMS_BAD_INPUT_DATA ); } type = mbedtls_lms_network_bytes_to_unsigned_int( MBEDTLS_LMS_TYPE_LEN,