Store TLS curve ID instead of information structure
This will reduce the number of grp ID <-> tls ID <-> curve info structs
conversions once a single EC can be hardcoded through its TLS ID.
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
index e743eff..83d24b2 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -321,8 +321,8 @@
if( info->grp_id != *gid )
continue;
- if( ssl->handshake->curve_info == NULL )
- ssl->handshake->curve_info = info;
+ if( ssl->handshake->curve_tls_id == 0 )
+ ssl->handshake->curve_tls_id = tls_id;
}
*curve_ids++ = info->grp_id;
@@ -968,7 +968,7 @@
#if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C)
if( mbedtls_ssl_ciphersuite_uses_ec( suite_info ) &&
- ssl->handshake->curve_info == NULL )
+ ssl->handshake->curve_tls_id == 0 )
{
MBEDTLS_SSL_DEBUG_MSG( 3, ( "ciphersuite mismatch: "
"no common elliptic curve" ) );
@@ -3327,7 +3327,8 @@
* ECPoint public;
* } ServerECDHParams;
*/
- const mbedtls_ecp_curve_info *curve = ssl->handshake->curve_info;
+ const mbedtls_ecp_curve_info *curve =
+ mbedtls_ecp_curve_info_from_tls_id( ssl->handshake->curve_tls_id );
int ret;
size_t len = 0;