From ba782bbc4b631fc28532b4883b83523600244de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 8 Jul 2014 13:31:34 +0200 Subject: [PATCH] Save some space in ECP curve tables --- library/ecp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/library/ecp.c b/library/ecp.c index e002e3b5f..afa795525 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -131,7 +131,7 @@ typedef enum * Curves are listed in order: largest curves first, and for a given size, * fastest curves first. This provides the default order for the SSL module. */ -static const ecp_curve_info ecp_supported_curves[POLARSSL_ECP_DP_MAX] = +static const ecp_curve_info ecp_supported_curves[] = { #if defined(POLARSSL_ECP_DP_SECP521R1_ENABLED) { POLARSSL_ECP_DP_SECP521R1, 25, 521, "secp521r1" }, @@ -169,7 +169,10 @@ static const ecp_curve_info ecp_supported_curves[POLARSSL_ECP_DP_MAX] = { POLARSSL_ECP_DP_NONE, 0, 0, NULL }, }; -static ecp_group_id ecp_supported_grp_id[POLARSSL_ECP_DP_MAX]; +#define ECP_NB_CURVES sizeof( ecp_supported_curves ) / \ + sizeof( ecp_supported_curves[0] ) + +static ecp_group_id ecp_supported_grp_id[ECP_NB_CURVES]; /* * List of supported curves and associated info