mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-05-03 00:46:27 +00:00
Minor style and formatting fixes.
This change corrects some minor style violations, mostly for spacing around parentheses.
This commit is contained in:
parent
b6897f67a4
commit
e6e7968c3a
|
@ -47,10 +47,10 @@
|
||||||
#endif /* MBEDTLS_SELF_TEST */
|
#endif /* MBEDTLS_SELF_TEST */
|
||||||
|
|
||||||
#define BYTES_TO_U32_LE( data, offset ) \
|
#define BYTES_TO_U32_LE( data, offset ) \
|
||||||
( (uint32_t)data[offset] | \
|
( (uint32_t) data[offset] \
|
||||||
(uint32_t)( (uint32_t)data[(offset) + 1] << 8 ) | \
|
| (uint32_t) ( (uint32_t) data[( offset ) + 1] << 8 ) \
|
||||||
(uint32_t)( (uint32_t)data[(offset) + 2] << 16 ) | \
|
| (uint32_t) ( (uint32_t) data[( offset ) + 2] << 16 ) \
|
||||||
(uint32_t)( (uint32_t)data[(offset) + 3] << 24 ) \
|
| (uint32_t) ( (uint32_t) data[( offset ) + 3] << 24 ) \
|
||||||
)
|
)
|
||||||
|
|
||||||
#define ROTL32( value, amount ) ( (uint32_t) ( value << amount ) | ( value >> ( 32 - amount ) ) )
|
#define ROTL32( value, amount ) ( (uint32_t) ( value << amount ) | ( value >> ( 32 - amount ) ) )
|
||||||
|
@ -351,7 +351,7 @@ int mbedtls_chacha20_update( mbedtls_chacha20_context *ctx,
|
||||||
ctx->initial_state[CHACHA20_CTR_INDEX]++;
|
ctx->initial_state[CHACHA20_CTR_INDEX]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !MBEDTLS_CHACHA20_ALT */
|
#endif /* !MBEDTLS_CHACHA20_ALT */
|
||||||
|
@ -380,7 +380,7 @@ int mbedtls_chacha20_crypt( const unsigned char key[32],
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
mbedtls_chacha20_free( &ctx );
|
mbedtls_chacha20_free( &ctx );
|
||||||
return result;
|
return( result );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_SELF_TEST)
|
#if defined(MBEDTLS_SELF_TEST)
|
||||||
|
|
|
@ -46,10 +46,10 @@
|
||||||
#define POLY1305_BLOCK_SIZE_BYTES ( 16U )
|
#define POLY1305_BLOCK_SIZE_BYTES ( 16U )
|
||||||
|
|
||||||
#define BYTES_TO_U32_LE( data, offset ) \
|
#define BYTES_TO_U32_LE( data, offset ) \
|
||||||
( (uint32_t)data[offset] | \
|
( (uint32_t) data[offset] \
|
||||||
(uint32_t)( (uint32_t)data[(offset) + 1] << 8 ) | \
|
| (uint32_t) ( (uint32_t) data[( offset ) + 1] << 8 ) \
|
||||||
(uint32_t)( (uint32_t)data[(offset) + 2] << 16 ) | \
|
| (uint32_t) ( (uint32_t) data[( offset ) + 2] << 16 ) \
|
||||||
(uint32_t)( (uint32_t)data[(offset) + 3] << 24 ) \
|
| (uint32_t) ( (uint32_t) data[( offset ) + 3] << 24 ) \
|
||||||
)
|
)
|
||||||
|
|
||||||
/* Implementation that should never be optimized out by the compiler */
|
/* Implementation that should never be optimized out by the compiler */
|
||||||
|
@ -222,22 +222,22 @@ static void mbedtls_poly1305_compute_mac( const mbedtls_poly1305_context *ctx,
|
||||||
acc3 += ctx->s[3] + (uint32_t) ( d >> 32U );
|
acc3 += ctx->s[3] + (uint32_t) ( d >> 32U );
|
||||||
|
|
||||||
/* Compute MAC (128 least significant bits of the accumulator) */
|
/* Compute MAC (128 least significant bits of the accumulator) */
|
||||||
mac[0] = (uint8_t)acc0;
|
mac[0] = (unsigned char) acc0;
|
||||||
mac[1] = (uint8_t)( acc0 >> 8 );
|
mac[1] = (unsigned char) ( acc0 >> 8 );
|
||||||
mac[2] = (uint8_t)( acc0 >> 16 );
|
mac[2] = (unsigned char) ( acc0 >> 16 );
|
||||||
mac[3] = (uint8_t)( acc0 >> 24 );
|
mac[3] = (unsigned char) ( acc0 >> 24 );
|
||||||
mac[4] = (uint8_t)acc1;
|
mac[4] = (unsigned char) acc1;
|
||||||
mac[5] = (uint8_t)( acc1 >> 8 );
|
mac[5] = (unsigned char) ( acc1 >> 8 );
|
||||||
mac[6] = (uint8_t)( acc1 >> 16 );
|
mac[6] = (unsigned char) ( acc1 >> 16 );
|
||||||
mac[7] = (uint8_t)( acc1 >> 24 );
|
mac[7] = (unsigned char) ( acc1 >> 24 );
|
||||||
mac[8] = (uint8_t)acc2;
|
mac[8] = (unsigned char) acc2;
|
||||||
mac[9] = (uint8_t)( acc2 >> 8 );
|
mac[9] = (unsigned char) ( acc2 >> 8 );
|
||||||
mac[10] = (uint8_t)( acc2 >> 16 );
|
mac[10] = (unsigned char) ( acc2 >> 16 );
|
||||||
mac[11] = (uint8_t)( acc2 >> 24 );
|
mac[11] = (unsigned char) ( acc2 >> 24 );
|
||||||
mac[12] = (uint8_t)acc3;
|
mac[12] = (unsigned char) acc3;
|
||||||
mac[13] = (uint8_t)( acc3 >> 8 );
|
mac[13] = (unsigned char) ( acc3 >> 8 );
|
||||||
mac[14] = (uint8_t)( acc3 >> 16 );
|
mac[14] = (unsigned char) ( acc3 >> 16 );
|
||||||
mac[15] = (uint8_t)( acc3 >> 24 );
|
mac[15] = (unsigned char) ( acc3 >> 24 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbedtls_poly1305_init( mbedtls_poly1305_context *ctx )
|
void mbedtls_poly1305_init( mbedtls_poly1305_context *ctx )
|
||||||
|
@ -281,7 +281,7 @@ int mbedtls_poly1305_setkey( mbedtls_poly1305_context *ctx,
|
||||||
ctx->acc[2] = 0U;
|
ctx->acc[2] = 0U;
|
||||||
ctx->acc[3] = 0U;
|
ctx->acc[3] = 0U;
|
||||||
|
|
||||||
return 0;
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_poly1305_update( mbedtls_poly1305_context *ctx,
|
int mbedtls_poly1305_update( mbedtls_poly1305_context *ctx,
|
||||||
|
@ -484,7 +484,7 @@ static const unsigned char test_mac[2][16] =
|
||||||
|
|
||||||
int mbedtls_poly1305_self_test( int verbose )
|
int mbedtls_poly1305_self_test( int verbose )
|
||||||
{
|
{
|
||||||
uint8_t mac[16];
|
unsigned char mac[16];
|
||||||
size_t i;
|
size_t i;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue