Add dummy stages for `client_hello_process`
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
diff --git a/library/ssl_tls13_client.c b/library/ssl_tls13_client.c
index d619d80..46c071b 100644
--- a/library/ssl_tls13_client.c
+++ b/library/ssl_tls13_client.c
@@ -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 @@
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 */