Fix TLS alert codes

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2021-06-28 21:58:56 +01:00
parent 78c601b529
commit dd5f624f32
3 changed files with 8 additions and 2 deletions

View file

@ -0,0 +1,6 @@
Bugfix
* Fix the alert raised when a client requests an invalid
* fragment length, as per RFC6066 section 4. We now alert with
* MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER. Similarly, raise
* MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR for an invalid finished
* message, as per RFC5247 section 7.2.2.

View file

@ -1525,7 +1525,7 @@ static int ssl_parse_max_fragment_length_ext( mbedtls_ssl_context *ssl,
mbedtls_ssl_send_alert_message(
ssl,
MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_HANDSHAKE_FAILURE );
MBEDTLS_SSL_ALERT_MSG_ILLEGAL_PARAMETER );
return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO );
}

View file

@ -3610,7 +3610,7 @@ int mbedtls_ssl_parse_finished( mbedtls_ssl_context *ssl )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "bad finished message" ) );
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR );
MBEDTLS_SSL_ALERT_MSG_DECRYPT_ERROR );
return( MBEDTLS_ERR_SSL_BAD_HS_FINISHED );
}