mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-27 00:15:45 +01:00
Fix compilation issue when DTLS and SSL_HW_RECORD_ACCEL are on
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
parent
72371b2022
commit
8758053e80
@ -1,5 +1,11 @@
|
|||||||
mbed TLS ChangeLog (Sorted per branch, date)
|
mbed TLS ChangeLog (Sorted per branch, date)
|
||||||
|
|
||||||
|
= mbed TLS x.x.x branch released xxxx-xx-xx
|
||||||
|
|
||||||
|
Bugfix
|
||||||
|
* Fix compilation failure when both MBEDTLS_SSL_PROTO_DTLS and
|
||||||
|
MBEDTLS_SSL_HW_RECORD_ACCEL are enabled.
|
||||||
|
|
||||||
= mbed TLS 2.7.14 branch released 2020-02-20
|
= mbed TLS 2.7.14 branch released 2020-02-20
|
||||||
|
|
||||||
Security
|
Security
|
||||||
|
@ -873,8 +873,6 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
|
|||||||
#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
|
#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
|
||||||
if( mbedtls_ssl_hw_record_init != NULL )
|
if( mbedtls_ssl_hw_record_init != NULL )
|
||||||
{
|
{
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "going for mbedtls_ssl_hw_record_init()" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 2, ( "going for mbedtls_ssl_hw_record_init()" ) );
|
||||||
|
|
||||||
if( ( ret = mbedtls_ssl_hw_record_init( ssl, key1, key2, transform->keylen,
|
if( ( ret = mbedtls_ssl_hw_record_init( ssl, key1, key2, transform->keylen,
|
||||||
@ -2700,15 +2698,18 @@ static void ssl_dtls_replay_reset( mbedtls_ssl_context *ssl );
|
|||||||
/*
|
/*
|
||||||
* Swap transform_out and out_ctr with the alternative ones
|
* Swap transform_out and out_ctr with the alternative ones
|
||||||
*/
|
*/
|
||||||
static void ssl_swap_epochs( mbedtls_ssl_context *ssl )
|
static int ssl_swap_epochs( mbedtls_ssl_context *ssl )
|
||||||
{
|
{
|
||||||
mbedtls_ssl_transform *tmp_transform;
|
mbedtls_ssl_transform *tmp_transform;
|
||||||
unsigned char tmp_out_ctr[8];
|
unsigned char tmp_out_ctr[8];
|
||||||
|
#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
|
||||||
|
int ret;
|
||||||
|
#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
|
||||||
|
|
||||||
if( ssl->transform_out == ssl->handshake->alt_transform_out )
|
if( ssl->transform_out == ssl->handshake->alt_transform_out )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "skip swap epochs" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3, ( "skip swap epochs" ) );
|
||||||
return;
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 3, ( "swap epochs" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 3, ( "swap epochs" ) );
|
||||||
@ -2742,7 +2743,9 @@ static void ssl_swap_epochs( mbedtls_ssl_context *ssl )
|
|||||||
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
|
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2754,6 +2757,8 @@ static void ssl_swap_epochs( mbedtls_ssl_context *ssl )
|
|||||||
*/
|
*/
|
||||||
int mbedtls_ssl_resend( mbedtls_ssl_context *ssl )
|
int mbedtls_ssl_resend( mbedtls_ssl_context *ssl )
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> mbedtls_ssl_resend" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> mbedtls_ssl_resend" ) );
|
||||||
|
|
||||||
if( ssl->handshake->retransmit_state != MBEDTLS_SSL_RETRANS_SENDING )
|
if( ssl->handshake->retransmit_state != MBEDTLS_SSL_RETRANS_SENDING )
|
||||||
@ -2761,14 +2766,14 @@ int mbedtls_ssl_resend( mbedtls_ssl_context *ssl )
|
|||||||
MBEDTLS_SSL_DEBUG_MSG( 2, ( "initialise resending" ) );
|
MBEDTLS_SSL_DEBUG_MSG( 2, ( "initialise resending" ) );
|
||||||
|
|
||||||
ssl->handshake->cur_msg = ssl->handshake->flight;
|
ssl->handshake->cur_msg = ssl->handshake->flight;
|
||||||
ssl_swap_epochs( ssl );
|
if( ( ret = ssl_swap_epochs( ssl ) ) != 0 )
|
||||||
|
return( ret );
|
||||||
|
|
||||||
ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_SENDING;
|
ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_SENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( ssl->handshake->cur_msg != NULL )
|
while( ssl->handshake->cur_msg != NULL )
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
mbedtls_ssl_flight_item *cur = ssl->handshake->cur_msg;
|
mbedtls_ssl_flight_item *cur = ssl->handshake->cur_msg;
|
||||||
|
|
||||||
/* Swap epochs before sending Finished: we can't do it after
|
/* Swap epochs before sending Finished: we can't do it after
|
||||||
@ -2777,7 +2782,8 @@ int mbedtls_ssl_resend( mbedtls_ssl_context *ssl )
|
|||||||
if( cur->type == MBEDTLS_SSL_MSG_HANDSHAKE &&
|
if( cur->type == MBEDTLS_SSL_MSG_HANDSHAKE &&
|
||||||
cur->p[0] == MBEDTLS_SSL_HS_FINISHED )
|
cur->p[0] == MBEDTLS_SSL_HS_FINISHED )
|
||||||
{
|
{
|
||||||
ssl_swap_epochs( ssl );
|
if( ( ret = ssl_swap_epochs( ssl ) ) != 0 )
|
||||||
|
return( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy( ssl->out_msg, cur->p, cur->len );
|
memcpy( ssl->out_msg, cur->p, cur->len );
|
||||||
|
Loading…
Reference in New Issue
Block a user