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 9231d5f919
commit 6b897c930c
12 changed files with 326 additions and 329 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] = ( rec->data_len >> 8 ) & 0xFF;
cur[1] = ( rec->data_len >> 0 ) & 0xFF;
cur[0] = MBEDTLS_CHAR_1( rec->data_len );
cur[1] = MBEDTLS_CHAR_0( rec->data_len );
cur += 2;
}
else
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
{
cur[0] = ( rec->data_len >> 8 ) & 0xFF;
cur[1] = ( rec->data_len >> 0 ) & 0xFF;
cur[0] = MBEDTLS_CHAR_1( rec->data_len );
cur[1] = MBEDTLS_CHAR_0( rec->data_len );
cur += 2;
}
@ -2759,8 +2759,8 @@ int mbedtls_ssl_write_handshake_msg( 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