mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-29 22:20:30 +00:00
Some extra code defined out
This commit is contained in:
parent
c852a68b96
commit
9659dae046
@ -1362,19 +1362,19 @@ static int ssl_parse_server_key_exchange( ssl_context *ssl )
|
|||||||
{
|
{
|
||||||
params_len = p - ( ssl->in_msg + 4 );
|
params_len = p - ( ssl->in_msg + 4 );
|
||||||
|
|
||||||
#if defined(POLARSSL_SSL_PROTO_TLS1_2)
|
|
||||||
/*
|
/*
|
||||||
* Handle the digitally-signed structure
|
* Handle the digitally-signed structure
|
||||||
*/
|
*/
|
||||||
if( ssl_parse_signature_algorithm( ssl, &p, end,
|
#if defined(POLARSSL_SSL_PROTO_TLS1_2)
|
||||||
&md_alg, &pk_alg ) != 0 )
|
if( ssl->minor_ver == SSL_MINOR_VERSION_3 )
|
||||||
{
|
{
|
||||||
SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
if( ssl_parse_signature_algorithm( ssl, &p, end,
|
||||||
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
&md_alg, &pk_alg ) != 0 )
|
||||||
}
|
{
|
||||||
|
SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
||||||
|
return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE );
|
||||||
|
}
|
||||||
|
|
||||||
if( pk_alg != POLARSSL_PK_NONE )
|
|
||||||
{
|
|
||||||
if( pk_alg != ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info ) )
|
if( pk_alg != ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info ) )
|
||||||
{
|
{
|
||||||
SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) );
|
||||||
@ -1383,13 +1383,22 @@ static int ssl_parse_server_key_exchange( ssl_context *ssl )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(POLARSSL_SSL_PROTO_SSL3) || defined(POLARSSL_SSL_PROTO_TLS1) || \
|
||||||
|
defined(POLARSSL_SSL_PROTO_TLS1_1)
|
||||||
|
if( ssl->minor_ver < SSL_MINOR_VERSION_3 )
|
||||||
{
|
{
|
||||||
pk_alg = ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info );
|
pk_alg = ssl_get_ciphersuite_sig_pk_alg( ciphersuite_info );
|
||||||
}
|
|
||||||
|
|
||||||
/* Default hash for ECDSA is SHA-1 */
|
/* Default hash for ECDSA is SHA-1 */
|
||||||
if( pk_alg == POLARSSL_PK_ECDSA && md_alg == POLARSSL_MD_NONE )
|
if( pk_alg == POLARSSL_PK_ECDSA && md_alg == POLARSSL_MD_NONE )
|
||||||
md_alg = POLARSSL_MD_SHA1;
|
md_alg = POLARSSL_MD_SHA1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
SSL_DEBUG_MSG( 1, ( "should never happen" ) );
|
||||||
|
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read signature
|
* Read signature
|
||||||
@ -1443,6 +1452,8 @@ static int ssl_parse_server_key_exchange( ssl_context *ssl )
|
|||||||
else
|
else
|
||||||
#endif /* POLARSSL_SSL_PROTO_SSL3 || POLARSSL_SSL_PROTO_TLS1 || \
|
#endif /* POLARSSL_SSL_PROTO_SSL3 || POLARSSL_SSL_PROTO_TLS1 || \
|
||||||
POLARSSL_SSL_PROTO_TLS1_1 */
|
POLARSSL_SSL_PROTO_TLS1_1 */
|
||||||
|
#if defined(POLARSSL_SSL_PROTO_TLS1) || defined(POLARSSL_SSL_PROTO_TLS1_1) || \
|
||||||
|
defined(POLARSSL_SSL_PROTO_TLS1_2)
|
||||||
if( md_alg != POLARSSL_MD_NONE )
|
if( md_alg != POLARSSL_MD_NONE )
|
||||||
{
|
{
|
||||||
md_context_t ctx;
|
md_context_t ctx;
|
||||||
@ -1470,6 +1481,8 @@ static int ssl_parse_server_key_exchange( ssl_context *ssl )
|
|||||||
md_free_ctx( &ctx );
|
md_free_ctx( &ctx );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif /* POLARSSL_SSL_PROTO_TLS1 || POLARSSL_SSL_PROTO_TLS1_1 || \
|
||||||
|
POLARSSL_SSL_PROTO_TLS1_2 */
|
||||||
{
|
{
|
||||||
SSL_DEBUG_MSG( 1, ( "should never happen" ) );
|
SSL_DEBUG_MSG( 1, ( "should never happen" ) );
|
||||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||||
|
@ -2027,6 +2027,8 @@ static int ssl_write_server_key_exchange( ssl_context *ssl )
|
|||||||
else
|
else
|
||||||
#endif /* POLARSSL_SSL_PROTO_SSL3 || POLARSSL_SSL_PROTO_TLS1 || \
|
#endif /* POLARSSL_SSL_PROTO_SSL3 || POLARSSL_SSL_PROTO_TLS1 || \
|
||||||
POLARSSL_SSL_PROTO_TLS1_1 */
|
POLARSSL_SSL_PROTO_TLS1_1 */
|
||||||
|
#if defined(POLARSSL_SSL_PROTO_TLS1) || defined(POLARSSL_SSL_PROTO_TLS1_1) || \
|
||||||
|
defined(POLARSSL_SSL_PROTO_TLS1_2)
|
||||||
if( md_alg != POLARSSL_MD_NONE )
|
if( md_alg != POLARSSL_MD_NONE )
|
||||||
{
|
{
|
||||||
md_context_t ctx;
|
md_context_t ctx;
|
||||||
@ -2060,6 +2062,8 @@ static int ssl_write_server_key_exchange( ssl_context *ssl )
|
|||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif /* POLARSSL_SSL_PROTO_TLS1 || POLARSSL_SSL_PROTO_TLS1_1 || \
|
||||||
|
POLARSSL_SSL_PROTO_TLS1_2 */
|
||||||
{
|
{
|
||||||
SSL_DEBUG_MSG( 1, ( "should never happen" ) );
|
SSL_DEBUG_MSG( 1, ( "should never happen" ) );
|
||||||
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user