From 1f5e6abfb93a2d49552aed373e6265b01e627d5b Mon Sep 17 00:00:00 2001 From: Alexander K Date: Wed, 7 Aug 2019 20:40:46 +0300 Subject: [PATCH 1/4] Remove extra mbedtls_ecp_group_free() call since the grp is free at the top of the function. --- library/ecp_curves.c | 1 - 1 file changed, 1 deletion(-) diff --git a/library/ecp_curves.c b/library/ecp_curves.c index 282481d05..4335f2d60 100644 --- a/library/ecp_curves.c +++ b/library/ecp_curves.c @@ -836,7 +836,6 @@ int mbedtls_ecp_group_load( mbedtls_ecp_group *grp, mbedtls_ecp_group_id id ) #endif /* MBEDTLS_ECP_DP_CURVE448_ENABLED */ default: - mbedtls_ecp_group_free( grp ); return( MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE ); } } From 79a11fa0d635a56dff7b2359962e7c164fded166 Mon Sep 17 00:00:00 2001 From: Alexander K Date: Fri, 16 Aug 2019 16:10:34 +0300 Subject: [PATCH 2/4] Explicitly nullify grp->id instead of freeing. --- library/ecp_curves.c | 1 + 1 file changed, 1 insertion(+) diff --git a/library/ecp_curves.c b/library/ecp_curves.c index 4335f2d60..400f208a0 100644 --- a/library/ecp_curves.c +++ b/library/ecp_curves.c @@ -836,6 +836,7 @@ int mbedtls_ecp_group_load( mbedtls_ecp_group *grp, mbedtls_ecp_group_id id ) #endif /* MBEDTLS_ECP_DP_CURVE448_ENABLED */ default: + grp->id = id; return( MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE ); } } From 77233ec411c1642c79c81ccaf8b665063faba540 Mon Sep 17 00:00:00 2001 From: Alexander K Date: Thu, 5 Sep 2019 21:37:39 +0300 Subject: [PATCH 3/4] Fix misprint --- library/ecp_curves.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/ecp_curves.c b/library/ecp_curves.c index 400f208a0..941ac69e1 100644 --- a/library/ecp_curves.c +++ b/library/ecp_curves.c @@ -836,7 +836,7 @@ int mbedtls_ecp_group_load( mbedtls_ecp_group *grp, mbedtls_ecp_group_id id ) #endif /* MBEDTLS_ECP_DP_CURVE448_ENABLED */ default: - grp->id = id; + grp->id = 0; return( MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE ); } } From 56a74cdcc9dfcf0f4355ecdc10538496c6719f9d Mon Sep 17 00:00:00 2001 From: Alexander K Date: Tue, 10 Sep 2019 17:58:20 +0300 Subject: [PATCH 4/4] Replace 0 by MBEDTLS_ECP_DP_NONE to avoid IAR compiler complains --- library/ecp_curves.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/ecp_curves.c b/library/ecp_curves.c index 941ac69e1..dcc70739d 100644 --- a/library/ecp_curves.c +++ b/library/ecp_curves.c @@ -836,7 +836,7 @@ int mbedtls_ecp_group_load( mbedtls_ecp_group *grp, mbedtls_ecp_group_id id ) #endif /* MBEDTLS_ECP_DP_CURVE448_ENABLED */ default: - grp->id = 0; + grp->id = MBEDTLS_ECP_DP_NONE; return( MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE ); } }