1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +03:00

Add Character byte reading macros

These cast to an unsigned char rather than a uint8_t
like with MBEDTLS_BYTE_x
These save alot of space and will improve maintence by
replacing the appropriate code with MBEDTLS_CHAR_x

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
This commit is contained in:
Joe Subbiani
2021-07-08 14:59:52 +01:00
parent 6a50631497
commit cd84d76e9b
12 changed files with 328 additions and 330 deletions

View File

@ -454,15 +454,15 @@ static void ssl_extract_add_data_from_record( unsigned char* add_data,
*cur = rec->cid_len;
cur++;
cur[0] = ( ad_len_field >> 8 ) & 0xFF;
cur[1] = ( ad_len_field >> 0 ) & 0xFF;
cur[0] = MBEDTLS_CHAR_1( ad_len_field );
cur[1] = MBEDTLS_CHAR_0( ad_len_field );
cur += 2;
}
else
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
{
cur[0] = ( ad_len_field >> 8 ) & 0xFF;
cur[1] = ( ad_len_field >> 0 ) & 0xFF;
cur[0] = MBEDTLS_CHAR_1( ad_len_field );
cur[1] = MBEDTLS_CHAR_0( ad_len_field );
cur += 2;
}
@ -2481,8 +2481,8 @@ int mbedtls_ssl_write_handshake_msg_ext( mbedtls_ssl_context *ssl,
/* Write message_seq and update it, except for HelloRequest */
if( hs_type != MBEDTLS_SSL_HS_HELLO_REQUEST )
{
ssl->out_msg[4] = ( ssl->handshake->out_msg_seq >> 8 ) & 0xFF;
ssl->out_msg[5] = ( ssl->handshake->out_msg_seq ) & 0xFF;
ssl->out_msg[4] = MBEDTLS_CHAR_1( ssl->handshake->out_msg_seq );
ssl->out_msg[5] = MBEDTLS_CHAR_0( ssl->handshake->out_msg_seq );
++( ssl->handshake->out_msg_seq );
}
else