1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-28 00:21:48 +03:00

Compress byte reading macros in if statements

exchange MBEDTLS_BYTE_x in if statements with MBEDTLS_GET_UINT16_BE

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
This commit is contained in:
Joe Subbiani
2021-08-20 13:05:30 +01:00
parent 1f6c3aeb63
commit e4603eece9

View File

@ -1848,8 +1848,7 @@ read_record_header:
for( j = 0, p = buf + ciph_offset + 2; j < ciph_len; j += 2, p += 2 )
for( i = 0; ciphersuites[i] != 0; i++ )
{
if( p[0] != MBEDTLS_BYTE_1( ciphersuites[i] ) ||
p[1] != MBEDTLS_BYTE_0( ciphersuites[i] ))
if( MBEDTLS_GET_UINT16_BE(p, 0) != ciphersuites[i] )
continue;
got_common_suite = 1;
@ -1865,8 +1864,7 @@ read_record_header:
for( i = 0; ciphersuites[i] != 0; i++ )
for( j = 0, p = buf + ciph_offset + 2; j < ciph_len; j += 2, p += 2 )
{
if( p[0] != MBEDTLS_BYTE_1( ciphersuites[i] ) ||
p[1] != MBEDTLS_BYTE_0( ciphersuites[i] ))
if( MBEDTLS_GET_UINT16_BE(p, 0) != ciphersuites[i] )
continue;
got_common_suite = 1;