From 69dd8d4091fb731514554eb436671b3d452bf502 Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Sat, 16 Apr 2022 12:51:26 +0800 Subject: [PATCH] tls13:finished:add dummy frame work Signed-off-by: Jerry Yu --- library/ssl_tls13_server.c | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/library/ssl_tls13_server.c b/library/ssl_tls13_server.c index 769ed488a..7386d6376 100644 --- a/library/ssl_tls13_server.c +++ b/library/ssl_tls13_server.c @@ -1476,6 +1476,42 @@ static int ssl_tls13_write_certificate_verify( mbedtls_ssl_context *ssl ) } #endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */ +/* + * State Handler: MBEDTLS_SSL_SERVER_FINISHED + */ +int ssl_tls13_write_server_finished( mbedtls_ssl_context *ssl ) +{ + ((void) ssl); + return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ); +} + +/* + * State Handler: MBEDTLS_SSL_CLIENT_FINISHED + */ +int ssl_tls13_process_client_finished( mbedtls_ssl_context *ssl ) +{ + ((void) ssl); + return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ); +} + +/* + * State Handler: MBEDTLS_SSL_FLUSH_BUFFERS + */ +int ssl_tls13_flush_buffers( mbedtls_ssl_context *ssl ) +{ + ((void) ssl); + return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ); +} + +/* + * State Handler: MBEDTLS_SSL_HANDSHAKE_WRAPUP + */ +int ssl_tls13_handshake_wrapup( mbedtls_ssl_context *ssl ) +{ + ((void) ssl); + return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE ); +} + /* * TLS 1.3 State Machine -- server side */ @@ -1540,6 +1576,22 @@ int mbedtls_ssl_tls13_handshake_server_step( mbedtls_ssl_context *ssl ) break; #endif /* MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED */ + case MBEDTLS_SSL_SERVER_FINISHED: + ret = ssl_tls13_write_server_finished( ssl ); + break; + + case MBEDTLS_SSL_CLIENT_FINISHED: + ret = ssl_tls13_process_client_finished( ssl ); + break; + + case MBEDTLS_SSL_FLUSH_BUFFERS: + ret = ssl_tls13_flush_buffers( ssl ); + break; + + case MBEDTLS_SSL_HANDSHAKE_WRAPUP: + ret = ssl_tls13_handshake_wrapup( ssl ); + break; + default: MBEDTLS_SSL_DEBUG_MSG( 1, ( "invalid state %d", ssl->state ) ); return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );