Validate consistency of certificate hash type and length in session

This commit is contained in:
Hanno Becker 2019-06-06 14:54:55 +01:00
parent fd5dc8ae07
commit 2326d20361

View File

@ -9498,6 +9498,13 @@ static int ssl_session_load( mbedtls_ssl_session *session,
if( session->peer_cert_digest_len != 0 )
{
const mbedtls_md_info_t *md_info =
mbedtls_md_info_from_type( session->peer_cert_digest_type );
if( md_info == NULL )
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
if( session->peer_cert_digest_len != mbedtls_md_get_size( md_info ) )
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
if( session->peer_cert_digest_len > (size_t)( end - p ) )
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );