Give a constant a name in test function

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard 2020-07-16 10:00:48 +02:00
parent 913a204a33
commit 4adc04a8a3

View file

@ -3475,6 +3475,7 @@ void ssl_decrypt_non_etm_cbc( int cipher_type, int hash_id, int trunc_hmac,
unsigned char add_data[13]; unsigned char add_data[13];
unsigned char mac[MBEDTLS_MD_MAX_SIZE]; unsigned char mac[MBEDTLS_MD_MAX_SIZE];
int exp_ret; int exp_ret;
const unsigned char pad_max_len = 255; /* Per the standard */
mbedtls_ssl_init( &ssl ); mbedtls_ssl_init( &ssl );
mbedtls_ssl_transform_init( &t0 ); mbedtls_ssl_transform_init( &t0 );
@ -3492,7 +3493,7 @@ void ssl_decrypt_non_etm_cbc( int cipher_type, int hash_id, int trunc_hmac,
if( padlen == block_size ) if( padlen == block_size )
padlen = 0; padlen = 0;
if( pad_long ) if( pad_long )
padlen += block_size * ( ( 255 - padlen ) / block_size ); padlen += block_size * ( ( pad_max_len - padlen ) / block_size );
/* Prepare a buffer for record data */ /* Prepare a buffer for record data */
buflen = block_size buflen = block_size
@ -3606,7 +3607,7 @@ void ssl_decrypt_non_etm_cbc( int cipher_type, int hash_id, int trunc_hmac,
* (Start the loop with correct padding, just to double-check that record * (Start the loop with correct padding, just to double-check that record
* saving did work, and that we're overwriting the correct bytes.) * saving did work, and that we're overwriting the correct bytes.)
*/ */
for( i = padlen; i <= 255; i++ ) for( i = padlen; i <= pad_max_len; i++ )
{ {
test_set_step( i ); test_set_step( i );