From b101cb6111c4f0789cf0686be32c68bec6673681 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Fri, 6 May 2022 18:43:58 +0200 Subject: [PATCH] Since the group is unloaded for all curves, it is better to initialize the group also for all curves. Signed-off-by: Pol Henarejos --- library/ecp_curves.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/ecp_curves.c b/library/ecp_curves.c index 8bc80cd4e6..51956cd5b7 100644 --- a/library/ecp_curves.c +++ b/library/ecp_curves.c @@ -4712,7 +4712,6 @@ static int ecp_use_curve448( mbedtls_ecp_group *grp ) mbedtls_mpi_free( &grp->G.Y ); /* N = 2^446 - 13818066809895115352007386748515426880336692474882178609894547503885 */ - MBEDTLS_MPI_CHK( mbedtls_mpi_lset( &grp->N, 0 ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_set_bit( &grp->N, 446, 1 ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_read_binary( &Ns, curve448_part_of_n, sizeof( curve448_part_of_n ) ) ); @@ -4738,6 +4737,8 @@ int mbedtls_ecp_group_load( mbedtls_ecp_group *grp, mbedtls_ecp_group_id id ) ECP_VALIDATE_RET( grp != NULL ); mbedtls_ecp_group_free( grp ); + mbedtls_ecp_group_init( grp ); + grp->id = id; switch( id )