mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-24 15:40:03 +00:00
Add auth mode check
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
2883219edb
commit
def7ae4404
@ -1012,6 +1012,30 @@ static int ssl_conf_check(const mbedtls_ssl_context *ssl)
|
|||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
return( ret );
|
return( ret );
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||||
|
/* RFC 8446 section 4.4.3
|
||||||
|
*
|
||||||
|
* If the verification fails, the receiver MUST terminate the handshake with
|
||||||
|
* a "decrypt_error" alert.
|
||||||
|
*
|
||||||
|
* If the client is configured as TLS 1.3 only with optional verify, return
|
||||||
|
* bad config.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if( mbedtls_ssl_conf_tls13_ephemeral_enabled(
|
||||||
|
(mbedtls_ssl_context *)ssl ) &&
|
||||||
|
ssl->conf->endpoint == MBEDTLS_SSL_IS_CLIENT &&
|
||||||
|
ssl->conf->max_tls_version == MBEDTLS_SSL_VERSION_TLS1_3 &&
|
||||||
|
ssl->conf->min_tls_version == MBEDTLS_SSL_VERSION_TLS1_3 &&
|
||||||
|
ssl->conf->authmode == MBEDTLS_SSL_VERIFY_OPTIONAL )
|
||||||
|
{
|
||||||
|
MBEDTLS_SSL_DEBUG_MSG(
|
||||||
|
1, ( "Optional verfiy auth mode "
|
||||||
|
"is not available for TLS 1.3 client" ) );
|
||||||
|
return( MBEDTLS_ERR_SSL_BAD_CONFIG );
|
||||||
|
}
|
||||||
|
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
|
||||||
|
|
||||||
/* Space for further checks */
|
/* Space for further checks */
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user