Merge pull request #2439 from andresag01/mbedtls-2.16-iotssl-2544-deprecate-record-accel

Backport 2.16: 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:24 +01:00 committed by GitHub
commit acfa36890c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 8 deletions

View file

@ -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.16.5 branch released 2020-02-20 = mbed TLS 2.16.5 branch released 2020-02-20
Security Security

View file

@ -1004,8 +1004,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,
@ -2885,15 +2883,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" ) );
@ -2920,7 +2921,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 );
} }
/* /*
@ -2957,7 +2960,8 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
ssl->handshake->cur_msg = ssl->handshake->flight; ssl->handshake->cur_msg = ssl->handshake->flight;
ssl->handshake->cur_msg_p = ssl->handshake->flight->p + 12; ssl->handshake->cur_msg_p = ssl->handshake->flight->p + 12;
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;
} }
@ -2980,7 +2984,8 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
if( is_finished && ssl->handshake->cur_msg_p == ( cur->p + 12 ) ) if( is_finished && ssl->handshake->cur_msg_p == ( cur->p + 12 ) )
{ {
MBEDTLS_SSL_DEBUG_MSG( 2, ( "swap epochs to send finished message" ) ); MBEDTLS_SSL_DEBUG_MSG( 2, ( "swap epochs to send finished message" ) );
ssl_swap_epochs( ssl ); if( ( ret = ssl_swap_epochs( ssl ) ) != 0 )
return( ret );
} }
ret = ssl_get_remaining_payload_in_datagram( ssl ); ret = ssl_get_remaining_payload_in_datagram( ssl );
@ -3017,7 +3022,10 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
if( ( max_frag_len < 12 ) || ( max_frag_len == 12 && hs_len != 0 ) ) if( ( max_frag_len < 12 ) || ( max_frag_len == 12 && hs_len != 0 ) )
{ {
if( is_finished ) if( is_finished )
ssl_swap_epochs( ssl ); {
if( ( ret = ssl_swap_epochs( ssl ) ) != 0 )
return( ret );
}
if( ( ret = mbedtls_ssl_flush_output( ssl ) ) != 0 ) if( ( ret = mbedtls_ssl_flush_output( ssl ) ) != 0 )
return( ret ); return( ret );

View file

@ -1283,6 +1283,12 @@ component_build_armcc () {
armc6_build_test "--target=aarch64-arm-none-eabi -march=armv8.2-a" 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 () { component_test_allow_sha1 () {
msg "build: allow SHA1 in certificates by default" msg "build: allow SHA1 in certificates by default"
scripts/config.pl set MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES scripts/config.pl set MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES