Change some naming style issues and remove useless code

Signed-off-by: XiaokangQian <xiaokang.qian@arm.com>
This commit is contained in:
XiaokangQian 2021-11-03 05:56:49 +00:00
parent 1aef02ee20
commit 8903bd97b0
4 changed files with 23 additions and 43 deletions

View File

@ -775,20 +775,6 @@ struct mbedtls_ssl_handshake_params
#endif /* MBEDTLS_SSL_CLI_C */
/* Incoming CertificateVerify */
struct
{
unsigned char verify_buffer[ 64 + 33 + 1 + MBEDTLS_MD_MAX_SIZE ];
size_t verify_buffer_len;
} certificate_verify_in;
/* Outgoing CertificateVerify */
struct
{
unsigned char handshake_hash[ MBEDTLS_MD_MAX_SIZE ];
size_t handshake_hash_len;
} certificate_verify_out;
} state_local;
/* End of state-local variables. */
@ -1236,11 +1222,8 @@ static inline int mbedtls_ssl_write_handshake_msg( mbedtls_ssl_context *ssl )
int mbedtls_ssl_write_record( mbedtls_ssl_context *ssl, uint8_t force_flush );
int mbedtls_ssl_flush_output( mbedtls_ssl_context *ssl );
int mbedtls_ssl_read_certificate_process(mbedtls_ssl_context *ssl);
int mbedtls_ssl_write_certificate_process(mbedtls_ssl_context *ssl);
int mbedtls_ssl_tls13_finished_in_process( mbedtls_ssl_context *ssl );
int mbedtls_ssl_tls13_finished_out_process( mbedtls_ssl_context *ssl );
int mbedtls_ssl_tls13_process_finished_in( mbedtls_ssl_context *ssl );
int mbedtls_ssl_tls13_process_finished_out( mbedtls_ssl_context *ssl );
int mbedtls_ssl_parse_certificate( mbedtls_ssl_context *ssl );
int mbedtls_ssl_write_certificate( mbedtls_ssl_context *ssl );

View File

@ -1605,7 +1605,7 @@ static int ssl_tls1_3_process_certificate_verify( mbedtls_ssl_context *ssl )
*/
static int ssl_tls1_3_process_server_finished( mbedtls_ssl_context *ssl )
{
return ( mbedtls_ssl_tls13_finished_in_process( ssl ) );
return ( mbedtls_ssl_tls13_process_finished_in( ssl ) );
}
/*

View File

@ -851,20 +851,17 @@ cleanup:
* Overview
*/
/* Main entry point: orchestrates the other functions */
int mbedtls_ssl_tls13_finished_in_process( mbedtls_ssl_context* ssl );
static int ssl_tls13_finished_in_preprocess( mbedtls_ssl_context* ssl );
static int ssl_tls13_finished_in_postprocess( mbedtls_ssl_context* ssl );
static int ssl_tls13_finished_in_parse( mbedtls_ssl_context* ssl,
const unsigned char* buf,
size_t buflen );
static int ssl_tls13_preprocess_finished_in( mbedtls_ssl_context *ssl );
static int ssl_tls13_postprocess_finished_in( mbedtls_ssl_context *ssl );
static int ssl_tls13_parse_finished_in( mbedtls_ssl_context *ssl,
const unsigned char *buf,
size_t buflen );
/*
* Implementation
*/
int mbedtls_ssl_tls13_finished_in_process( mbedtls_ssl_context* ssl )
int mbedtls_ssl_tls13_process_finished_in( mbedtls_ssl_context *ssl )
{
int ret = 0;
unsigned char *buf;
@ -873,15 +870,15 @@ int mbedtls_ssl_tls13_finished_in_process( mbedtls_ssl_context* ssl )
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> parse server finished_in_process" ) );
/* Preprocessing step: Compute handshake digest */
MBEDTLS_SSL_PROC_CHK( ssl_tls13_finished_in_preprocess( ssl ) );
MBEDTLS_SSL_PROC_CHK( ssl_tls13_preprocess_finished_in( ssl ) );
MBEDTLS_SSL_PROC_CHK( mbedtls_ssl_tls1_3_fetch_handshake_msg( ssl,
MBEDTLS_SSL_HS_FINISHED,
&buf, &buflen ) );
MBEDTLS_SSL_PROC_CHK( ssl_tls13_finished_in_parse( ssl, buf, buflen ) );
MBEDTLS_SSL_PROC_CHK( ssl_tls13_parse_finished_in( ssl, buf, buflen ) );
mbedtls_ssl_tls1_3_add_hs_msg_to_checksum(
ssl, MBEDTLS_SSL_HS_FINISHED, buf, buflen );
MBEDTLS_SSL_PROC_CHK( ssl_tls13_finished_in_postprocess( ssl ) );
MBEDTLS_SSL_PROC_CHK( ssl_tls13_postprocess_finished_in( ssl ) );
cleanup:
@ -889,7 +886,7 @@ cleanup:
return( ret );
}
static int ssl_tls13_finished_in_preprocess( mbedtls_ssl_context* ssl )
static int ssl_tls13_preprocess_finished_in( mbedtls_ssl_context *ssl )
{
int ret;
@ -907,9 +904,9 @@ static int ssl_tls13_finished_in_preprocess( mbedtls_ssl_context* ssl )
return( 0 );
}
static int ssl_tls13_finished_in_parse( mbedtls_ssl_context* ssl,
const unsigned char* buf,
size_t buflen )
static int ssl_tls13_parse_finished_in( mbedtls_ssl_context *ssl,
const unsigned char *buf,
size_t buflen )
{
/* Structural validation */
if( buflen != ssl->handshake->state_local.finished_in.digest_len )
@ -941,7 +938,7 @@ static int ssl_tls13_finished_in_parse( mbedtls_ssl_context* ssl,
return( 0 );
}
static int ssl_tls13_finished_in_postprocess_cli( mbedtls_ssl_context *ssl )
static int ssl_tls13_postprocess_finished_in_cli( mbedtls_ssl_context *ssl )
{
int ret = 0;
mbedtls_ssl_key_set traffic_keys;
@ -1001,12 +998,12 @@ cleanup:
return( ret );
}
static int ssl_tls13_finished_in_postprocess( mbedtls_ssl_context* ssl )
static int ssl_tls13_postprocess_finished_in( mbedtls_ssl_context* ssl )
{
if( ssl->conf->endpoint == MBEDTLS_SSL_IS_CLIENT )
{
return( ssl_tls13_finished_in_postprocess_cli( ssl ) );
return( ssl_tls13_postprocess_finished_in_cli( ssl ) );
}
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );

View File

@ -626,9 +626,9 @@ int mbedtls_ssl_tls1_3_generate_application_keys(
* \returns A negative error code on failure.
*/
int mbedtls_ssl_tls1_3_calculate_expected_finished( mbedtls_ssl_context *ssl,
unsigned char *dst,
size_t dst_len,
size_t *actual_len,
int from );
unsigned char *dst,
size_t dst_len,
size_t *actual_len,
int from );
#endif /* MBEDTLS_SSL_TLS1_3_KEYS_H */