1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Tidy up grouped MBEDTLS_BYTE_x macros

exchange groups of the byte reading macros with MBEDTLS_PUT_UINTxyz
and then shift the pointer afterwards. Easier to read as you can
see how big the data is that you are putting in, and in the case of
UINT32 AND UINT64 it saves some vertical space.

Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
This commit is contained in:
Joe Subbiani
2021-08-23 11:35:25 +01:00
parent 24647c5cd2
commit a651e6f762
5 changed files with 16 additions and 26 deletions

View File

@ -152,11 +152,8 @@ static int block_cipher_df( unsigned char *output,
* (Total is padded to a multiple of 16-bytes with zeroes)
*/
p = buf + MBEDTLS_CTR_DRBG_BLOCKSIZE;
*p++ = MBEDTLS_BYTE_3( data_len );
*p++ = MBEDTLS_BYTE_2( data_len );
*p++ = MBEDTLS_BYTE_1( data_len );
*p++ = MBEDTLS_BYTE_0( data_len );
p += 3;
MBEDTLS_PUT_UINT32_BE( data_len, p, 0);
p += 4 + 3;
*p++ = MBEDTLS_CTR_DRBG_SEEDLEN;
memcpy( p, data, data_len );
p[data_len] = 0x80;