mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 08:44:22 +01:00
Replace instances of byte reading macros with PUT
Instances of a group of byte reading macros which are equivilant to MBEDTLS_PUT_UINTx_yz Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
This commit is contained in:
parent
ad1115a3fd
commit
6627fb284a
@ -164,10 +164,7 @@ static void chacha20_block( const uint32_t initial_state[16],
|
|||||||
{
|
{
|
||||||
size_t offset = i * 4U;
|
size_t offset = i * 4U;
|
||||||
|
|
||||||
keystream[offset ] = MBEDTLS_BYTE_0( working_state[i] );
|
MBEDTLS_PUT_UINT32_LE(working_state[i], keystream, offset);
|
||||||
keystream[offset + 1U] = MBEDTLS_BYTE_1( working_state[i] );
|
|
||||||
keystream[offset + 2U] = MBEDTLS_BYTE_2( working_state[i] );
|
|
||||||
keystream[offset + 3U] = MBEDTLS_BYTE_3( working_state[i] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mbedtls_platform_zeroize( working_state, sizeof( working_state ) );
|
mbedtls_platform_zeroize( working_state, sizeof( working_state ) );
|
||||||
|
@ -263,22 +263,8 @@ int mbedtls_chachapoly_finish( mbedtls_chachapoly_context *ctx,
|
|||||||
/* The lengths of the AAD and ciphertext are processed by
|
/* The lengths of the AAD and ciphertext are processed by
|
||||||
* Poly1305 as the final 128-bit block, encoded as little-endian integers.
|
* Poly1305 as the final 128-bit block, encoded as little-endian integers.
|
||||||
*/
|
*/
|
||||||
len_block[ 0] = MBEDTLS_BYTE_0( ctx->aad_len );
|
MBEDTLS_PUT_UINT64_LE(ctx->aad_len, len_block, 0);
|
||||||
len_block[ 1] = MBEDTLS_BYTE_1( ctx->aad_len );
|
MBEDTLS_PUT_UINT64_LE(ctx->ciphertext_len, len_block, 8);
|
||||||
len_block[ 2] = MBEDTLS_BYTE_2( ctx->aad_len );
|
|
||||||
len_block[ 3] = MBEDTLS_BYTE_3( ctx->aad_len );
|
|
||||||
len_block[ 4] = MBEDTLS_BYTE_4( ctx->aad_len );
|
|
||||||
len_block[ 5] = MBEDTLS_BYTE_5( ctx->aad_len );
|
|
||||||
len_block[ 6] = MBEDTLS_BYTE_6( ctx->aad_len );
|
|
||||||
len_block[ 7] = MBEDTLS_BYTE_7( ctx->aad_len );
|
|
||||||
len_block[ 8] = MBEDTLS_BYTE_0( ctx->ciphertext_len );
|
|
||||||
len_block[ 9] = MBEDTLS_BYTE_1( ctx->ciphertext_len );
|
|
||||||
len_block[10] = MBEDTLS_BYTE_2( ctx->ciphertext_len );
|
|
||||||
len_block[11] = MBEDTLS_BYTE_3( ctx->ciphertext_len );
|
|
||||||
len_block[12] = MBEDTLS_BYTE_4( ctx->ciphertext_len );
|
|
||||||
len_block[13] = MBEDTLS_BYTE_5( ctx->ciphertext_len );
|
|
||||||
len_block[14] = MBEDTLS_BYTE_6( ctx->ciphertext_len );
|
|
||||||
len_block[15] = MBEDTLS_BYTE_7( ctx->ciphertext_len );
|
|
||||||
|
|
||||||
ret = mbedtls_poly1305_update( &ctx->poly1305_ctx, len_block, 16U );
|
ret = mbedtls_poly1305_update( &ctx->poly1305_ctx, len_block, 16U );
|
||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
|
@ -166,10 +166,7 @@ int mbedtls_ssl_cookie_write( void *p_ctx,
|
|||||||
t = ctx->serial++;
|
t = ctx->serial++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(*p)[0] = MBEDTLS_BYTE_3( t );
|
MBEDTLS_PUT_UINT32_BE(t, *p, 0);
|
||||||
(*p)[1] = MBEDTLS_BYTE_2( t );
|
|
||||||
(*p)[2] = MBEDTLS_BYTE_1( t );
|
|
||||||
(*p)[3] = MBEDTLS_BYTE_0( t );
|
|
||||||
*p += 4;
|
*p += 4;
|
||||||
|
|
||||||
#if defined(MBEDTLS_THREADING_C)
|
#if defined(MBEDTLS_THREADING_C)
|
||||||
|
Loading…
Reference in New Issue
Block a user