Implement generate resumption master secret
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
db8c5faed7
commit
49d63f8c36
1 changed files with 33 additions and 0 deletions
|
@ -1507,9 +1507,42 @@ cleanup:
|
||||||
int mbedtls_ssl_tls13_generate_resumption_master_secret(
|
int mbedtls_ssl_tls13_generate_resumption_master_secret(
|
||||||
mbedtls_ssl_context *ssl )
|
mbedtls_ssl_context *ssl )
|
||||||
{
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
mbedtls_md_type_t md_type;
|
||||||
|
|
||||||
|
unsigned char transcript[MBEDTLS_MD_MAX_SIZE];
|
||||||
|
size_t transcript_len;
|
||||||
|
|
||||||
|
MBEDTLS_SSL_DEBUG_MSG( 2,
|
||||||
|
( "=> mbedtls_ssl_tls13_generate_resumption_master_secret" ) );
|
||||||
|
|
||||||
|
md_type = ssl->handshake->ciphersuite_info->mac;
|
||||||
|
|
||||||
|
ret = mbedtls_ssl_get_handshake_transcript( ssl, md_type,
|
||||||
|
transcript, sizeof( transcript ),
|
||||||
|
&transcript_len );
|
||||||
|
if( ret != 0 )
|
||||||
|
return( ret );
|
||||||
|
|
||||||
|
ret = mbedtls_ssl_tls13_derive_resumption_master_secret(
|
||||||
|
mbedtls_psa_translate_md( md_type ),
|
||||||
|
ssl->handshake->tls13_master_secrets.app,
|
||||||
|
transcript, transcript_len,
|
||||||
|
&ssl->session_negotiate->app_secrets );
|
||||||
|
if( ret != 0 )
|
||||||
|
return( ret );
|
||||||
|
|
||||||
/* Erase master secrets */
|
/* Erase master secrets */
|
||||||
mbedtls_platform_zeroize( &ssl->handshake->tls13_master_secrets,
|
mbedtls_platform_zeroize( &ssl->handshake->tls13_master_secrets,
|
||||||
sizeof( ssl->handshake->tls13_master_secrets ) );
|
sizeof( ssl->handshake->tls13_master_secrets ) );
|
||||||
|
|
||||||
|
MBEDTLS_SSL_DEBUG_BUF( 4, "Resumption master secret",
|
||||||
|
ssl->session_negotiate->app_secrets.resumption_master_secret,
|
||||||
|
mbedtls_md_get_size( mbedtls_md_info_from_type( md_type ) ) );
|
||||||
|
|
||||||
|
MBEDTLS_SSL_DEBUG_MSG( 2,
|
||||||
|
( "<= mbedtls_ssl_tls13_generate_resumption_master_secret" ) );
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue