mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-25 17:15:42 +01:00
Improve documentation and add more uses of MBEDTLS_PUT
minor changes, such as improving the documentation for the byte reading macros, and using MBEDTLS_PUT_UINT16_xy in place of byte reading macro combinations Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
This commit is contained in:
parent
896f4eeaf7
commit
d3a3f21ad5
@ -221,8 +221,7 @@ static int ccm_auth_crypt( mbedtls_ccm_context *ctx, int mode, size_t length,
|
||||
src = add;
|
||||
|
||||
memset( b, 0, 16 );
|
||||
b[0] = MBEDTLS_BYTE_1( add_len );
|
||||
b[1] = MBEDTLS_BYTE_0( add_len );
|
||||
MBEDTLS_PUT_UINT16_BE( add_len, b, 0 );
|
||||
|
||||
use_len = len_left < 16 - 2 ? len_left : 16 - 2;
|
||||
memcpy( b + 2, src, use_len );
|
||||
|
@ -61,9 +61,8 @@
|
||||
|
||||
/** Byte Reading Macros
|
||||
*
|
||||
* Obtain the most significant byte of x using 0xff
|
||||
* Using MBEDTLS_BYTE_a will shift a*8 bits
|
||||
* to retrieve the next byte of information
|
||||
* Given a multi-byte integer \p x, MBEDTLS_BYTE_n retrieves the n-th
|
||||
* byte from x, where byte 0 is the least significant byte.
|
||||
*/
|
||||
#define MBEDTLS_BYTE_0( x ) ( (uint8_t) ( ( x ) & 0xff ) )
|
||||
#define MBEDTLS_BYTE_1( x ) ( (uint8_t) ( ( ( x ) >> 8 ) & 0xff ) )
|
||||
|
@ -1160,8 +1160,7 @@ int mbedtls_ecp_tls_write_group( const mbedtls_ecp_group *grp, size_t *olen,
|
||||
/*
|
||||
* Next two bytes are the namedcurve value
|
||||
*/
|
||||
buf[0] = MBEDTLS_BYTE_1( curve_info->tls_id );
|
||||
buf[1] = MBEDTLS_BYTE_0( curve_info->tls_id );
|
||||
MBEDTLS_PUT_UINT16_BE( curve_info->tls_id, buf, 0 );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -794,7 +794,7 @@ static int ssl_write_use_srtp_ext( mbedtls_ssl_context *ssl,
|
||||
*p++ = MBEDTLS_BYTE_0( MBEDTLS_TLS_EXT_USE_SRTP );
|
||||
|
||||
|
||||
*p++ = MBEDTLS_BYTE_1( ext_len & 0xFF00 );
|
||||
*p++ = MBEDTLS_BYTE_1( ext_len );
|
||||
*p++ = MBEDTLS_BYTE_0( ext_len );
|
||||
|
||||
/* protection profile length: 2*(ssl->conf->dtls_srtp_profile_list_len) */
|
||||
|
Loading…
Reference in New Issue
Block a user