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>
diff --git a/library/ssl_msg.c b/library/ssl_msg.c
index 28c57dc..b8ecdfe 100644
--- a/library/ssl_msg.c
+++ b/library/ssl_msg.c
@@ -493,9 +493,8 @@
padlen = 40;
memcpy( header, ctr, 8 );
- header[ 8] = (unsigned char) type;
- header[ 9] = MBEDTLS_BYTE_1( len );
- header[10] = MBEDTLS_BYTE_0( len );
+ header[8] = (unsigned char) type;
+ header[9] = MBEDTLS_PUT_UINT16_BE( len, header, 9);
memset( padding, 0x36, padlen );
mbedtls_md_starts( md_ctx );