1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-28 00:21:48 +03:00

Make ssl_set_ecdh_curves() a compile-time option

This commit is contained in:
Manuel Pégourié-Gonnard
2014-02-03 15:56:49 +01:00
parent 987bfb510b
commit 5de2580563
4 changed files with 34 additions and 7 deletions

View File

@ -2105,7 +2105,8 @@ static int ssl_write_server_key_exchange( ssl_context *ssl )
* ECPoint public;
* } ServerECDHParams;
*/
ecp_group_id grp_id;
#if defined(POLARSSL_SSL_SET_ECDH_CURVES)
unsigned int pref_idx, curv_idx, found;
/* Match our preference list against the agreed curves */
@ -2137,9 +2138,13 @@ static int ssl_write_server_key_exchange( ssl_context *ssl )
* ssl->ecdh_curve_list[pref_idx] will contain POLARSSL_ECP_DP_NONE and
* ecp_use_known_dp() will fail.
*/
grp_id = ssl->ecdh_curve_list[pref_idx];
#else
grp_id = ssl->handshake->curves[0]->grp_id;
#endif /* POLARSSL_SSL_SET_ECDH_CURVES */
if( ( ret = ecp_use_known_dp( &ssl->handshake->ecdh_ctx.grp,
ssl->ecdh_curve_list[pref_idx] ) ) != 0 )
grp_id ) ) != 0 )
{
SSL_DEBUG_RET( 1, "ecp_use_known_dp", ret );
return( ret );