1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-07 06:42:56 +03:00

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 <raef.coles@arm.com>
This commit is contained in:
Raef Coles
2022-10-07 13:39:22 +01:00
parent dc8fb79e09
commit f36874a535

View File

@@ -235,9 +235,9 @@ int mbedtls_lms_import_public_key( mbedtls_lms_public_t *ctx,
mbedtls_lms_algorithm_type_t type; mbedtls_lms_algorithm_type_t type;
mbedtls_lmots_algorithm_type_t otstype; 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, type = mbedtls_lms_network_bytes_to_unsigned_int( MBEDTLS_LMS_TYPE_LEN,