diff --git a/include/polarssl/ssl_ciphersuites.h b/include/polarssl/ssl_ciphersuites.h index cfc047433..62a41ec47 100644 --- a/include/polarssl/ssl_ciphersuites.h +++ b/include/polarssl/ssl_ciphersuites.h @@ -171,7 +171,6 @@ typedef enum { typedef struct _ssl_ciphersuite_t ssl_ciphersuite_t; #define POLARSSL_CIPHERSUITE_WEAK 0x01 /*key_exchange ) { + case POLARSSL_KEY_EXCHANGE_RSA: case POLARSSL_KEY_EXCHANGE_DHE_RSA: case POLARSSL_KEY_EXCHANGE_ECDHE_RSA: + case POLARSSL_KEY_EXCHANGE_RSA_PSK: return( POLARSSL_PK_RSA ); case POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA: @@ -988,4 +990,17 @@ pk_type_t ssl_get_ciphersuite_sig_pk_alg( const ssl_ciphersuite_t *info ) } } +int ssl_ciphersuite_uses_ec( const ssl_ciphersuite_t *info ) +{ + switch( info->key_exchange ) + { + case POLARSSL_KEY_EXCHANGE_ECDHE_RSA: + case POLARSSL_KEY_EXCHANGE_ECDHE_ECDSA: + return( 1 ); + + default: + return( 0 ); + } +} + #endif diff --git a/library/ssl_srv.c b/library/ssl_srv.c index 0ef342392..8931382d4 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -1294,7 +1294,7 @@ static int ssl_parse_client_hello( ssl_context *ssl ) continue; #if defined(POLARSSL_ECDH_C) || defined(POLARSSL_ECDSA_C) - if( ( ciphersuite_info->flags & POLARSSL_CIPHERSUITE_EC ) && + if( ssl_ciphersuite_uses_ec( ciphersuite_info ) && ssl->handshake->ec_curve == 0 ) continue; #endif @@ -1592,8 +1592,8 @@ static int ssl_write_server_hello( ssl_context *ssl ) *p++ = (unsigned char)( ssl->session_negotiate->ciphersuite ); *p++ = (unsigned char)( ssl->session_negotiate->compression ); - SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: 0x%04X", - ssl->session_negotiate->ciphersuite ) ); + SSL_DEBUG_MSG( 3, ( "server hello, chosen ciphersuite: %s", + ssl_get_ciphersuite_name( ssl->session_negotiate->ciphersuite ) ) ); SSL_DEBUG_MSG( 3, ( "server hello, compress alg.: 0x%02X", ssl->session_negotiate->compression ) );