From 41b0818bcb6f359655054650cf79c33eebd98f46 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Tue, 4 Jul 2023 12:14:21 +0200 Subject: [PATCH] ecp: rearrange code in ecp_read_key() Signed-off-by: Valerio Setti --- library/ecp.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/library/ecp.c b/library/ecp.c index 4e28b73a9d..3229c8dd9e 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -3277,18 +3277,15 @@ int mbedtls_ecp_read_key(mbedtls_ecp_group_id grp_id, mbedtls_ecp_keypair *key, ECP_CURVE448_KEY_SIZE * 8 - 1, 1) ); } - MBEDTLS_MPI_CHK(mbedtls_ecp_check_privkey(&key->grp, &key->d)); } - #endif #if defined(MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED) if (mbedtls_ecp_get_type(&key->grp) == MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS) { MBEDTLS_MPI_CHK(mbedtls_mpi_read_binary(&key->d, buf, buflen)); - - MBEDTLS_MPI_CHK(mbedtls_ecp_check_privkey(&key->grp, &key->d)); } - #endif + MBEDTLS_MPI_CHK(mbedtls_ecp_check_privkey(&key->grp, &key->d)); + cleanup: if (ret != 0) {