1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Add dummy stages for client_hello_process

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
Jerry Yu
2021-08-18 16:38:40 +08:00
parent a13c7e739c
commit 65dd2ccfe6
5 changed files with 160 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include "ssl_misc.h"
#include <mbedtls/debug.h>
/* Main entry point; orchestrates the other functions */
static int ssl_client_hello_process( mbedtls_ssl_context* ssl );
int mbedtls_ssl_handshake_client_step_tls1_3( mbedtls_ssl_context *ssl )
@ -66,20 +67,73 @@ int mbedtls_ssl_handshake_client_step_tls1_3( mbedtls_ssl_context *ssl )
return( ret );
}
static int ssl_client_hello_prepare( mbedtls_ssl_context* ssl );
static int ssl_client_hello_write_partial( mbedtls_ssl_context* ssl,
unsigned char* buf, size_t buflen,
size_t* len_without_binders,
size_t* len_with_binders );
static int ssl_client_hello_postprocess( mbedtls_ssl_context* ssl );
static int ssl_client_hello_process( mbedtls_ssl_context* ssl )
{
int ret = 0;
unsigned char *buf;
size_t buf_len, msg_len;
size_t len_without_binders = 0;
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> write client hello" ) );
MBEDTLS_SSL_PROC_CHK( ssl_client_hello_prepare, ( ssl ) );
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_start_handshake_msg, ( ssl,
MBEDTLS_SSL_HS_CLIENT_HELLO, &buf, &buf_len ) );
MBEDTLS_SSL_PROC_CHK( ssl_client_hello_write_partial, ( ssl, buf, buf_len,
&len_without_binders,
&msg_len ) );
mbedtls_ssl_add_hs_hdr_to_checksum( ssl, MBEDTLS_SSL_HS_CLIENT_HELLO,
msg_len );
ssl->handshake->update_checksum( ssl, buf, len_without_binders );
MBEDTLS_SSL_PROC_CHK( ssl_client_hello_postprocess, ( ssl ) );
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_finish_handshake_msg, ( ssl, buf_len, msg_len ) );
mbedtls_ssl_handshake_set_state( ssl, MBEDTLS_SSL_SERVER_HELLO );
cleanup:
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= write client hello" ) );
/* client_hello_process haven't finished */
ret=MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE;
return ret;
}
static int ssl_client_hello_prepare( mbedtls_ssl_context* ssl )
{
((void) ssl);
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
}
static int ssl_client_hello_write_partial( mbedtls_ssl_context* ssl,
unsigned char* buf, size_t buflen,
size_t* len_without_binders,
size_t* len_with_binders )
{
((void) ssl);
((void) buf);
((void) buflen);
((void) len_without_binders);
((void) len_with_binders);
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
}
static int ssl_client_hello_postprocess( mbedtls_ssl_context* ssl )
{
((void) ssl);
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE );
}
#endif /* MBEDTLS_SSL_CLI_C */
#endif /* MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL */