Merge pull request #2440 from andresag01/mbedtls-2.7-iotssl-2544-deprecate-record-accel

Backport 2.7: Fix compilation failure when MBEDTLS_SSL_HW_RECORD_ACCEL is enabled
This commit is contained in:
Manuel Pégourié-Gonnard 2020-03-16 10:37:32 +01:00 committed by GitHub
commit eb22ad2ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 8 deletions

View File

@ -1,5 +1,11 @@
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
Security

View File

@ -873,8 +873,6 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
if( mbedtls_ssl_hw_record_init != NULL )
{
int ret = 0;
MBEDTLS_SSL_DEBUG_MSG( 2, ( "going for mbedtls_ssl_hw_record_init()" ) );
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
*/
static void ssl_swap_epochs( mbedtls_ssl_context *ssl )
static int ssl_swap_epochs( mbedtls_ssl_context *ssl )
{
mbedtls_ssl_transform *tmp_transform;
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 )
{
MBEDTLS_SSL_DEBUG_MSG( 3, ( "skip swap epochs" ) );
return;
return( 0 );
}
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 );
}
}
#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 ret;
MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> mbedtls_ssl_resend" ) );
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" ) );
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;
}
while( ssl->handshake->cur_msg != NULL )
{
int ret;
mbedtls_ssl_flight_item *cur = ssl->handshake->cur_msg;
/* 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 &&
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 );

View File

@ -1114,6 +1114,12 @@ component_build_armcc () {
armc6_build_test "--target=aarch64-arm-none-eabi -march=armv8.2-a"
}
component_build_ssl_hw_record_accel() {
msg "build: default config with MBEDTLS_SSL_HW_RECORD_ACCEL enabled"
scripts/config.pl set MBEDTLS_SSL_HW_RECORD_ACCEL
make CFLAGS='-Werror -O1'
}
component_test_allow_sha1 () {
msg "build: allow SHA1 in certificates by default"
scripts/config.pl set MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES