ecp_curves: Adjusted input checking for ecp_mod_p255.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
Minos Galanakis 2023-05-23 17:31:01 +01:00
parent d6beda7af9
commit ec00b500b5

View file

@ -5432,9 +5432,7 @@ MBEDTLS_STATIC_TESTABLE
int mbedtls_ecp_mod_p255_raw(mbedtls_mpi_uint *X, size_t X_Limbs) int mbedtls_ecp_mod_p255_raw(mbedtls_mpi_uint *X, size_t X_Limbs)
{ {
if (X_Limbs > 2*P255_WIDTH) { if (X_Limbs != 2 * P255_WIDTH) {
X_Limbs = 2*P255_WIDTH;
} else if (X_Limbs < P255_WIDTH) {
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA; return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
} }