Correct style.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2023-02-08 12:52:18 +01:00
parent aa426e023c
commit b3b220cbf8
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3
3 changed files with 57 additions and 60 deletions

View file

@ -178,8 +178,9 @@ void mbedtls_sha3_multi( int family, data_t *in, data_t *hash )
mbedtls_sha3_init(&ctx);
mbedtls_sha3_starts(&ctx, family);
for( size_t l = 0; l < in->len; l += block_size )
for (size_t l = 0; l < in->len; l += block_size) {
TEST_ASSERT(mbedtls_sha3_update(&ctx, in->x + l, MIN(in->len - l, block_size)) == 0);
}
TEST_ASSERT(mbedtls_sha3_finish(&ctx, output, hash->len) == 0);
@ -216,16 +217,14 @@ void sha3_streaming( int type, data_t *input )
* then 3-byte chunks, and so on...
* At each test ensure that the same hash is generated.
*/
for( chunk_size = 1; chunk_size < input->len; chunk_size++ )
{
for (chunk_size = 1; chunk_size < input->len; chunk_size++) {
size_t i;
size_t remaining = input->len;
mbedtls_sha3_init(&ctx);
TEST_ASSERT(mbedtls_sha3_starts(&ctx, type) == 0);
for ( i = 0; i < input->len; i += chunk_size )
{
for (i = 0; i < input->len; i += chunk_size) {
size_t len = remaining >= chunk_size ? chunk_size : remaining;
TEST_ASSERT(mbedtls_sha3_update(&ctx, input->x + i, len) == 0);
remaining -= len;
@ -251,16 +250,14 @@ void sha3_reuse( data_t *input1, data_t *hash1,
mbedtls_sha3_id type1, type2;
mbedtls_sha3_init(&ctx);
switch( hash1->len )
{
switch (hash1->len) {
case 28: type1 = MBEDTLS_SHA3_224; break;
case 32: type1 = MBEDTLS_SHA3_256; break;
case 48: type1 = MBEDTLS_SHA3_384; break;
case 64: type1 = MBEDTLS_SHA3_512; break;
default: TEST_ASSERT(!"hash1->len validity"); break;
}
switch( hash2->len )
{
switch (hash2->len) {
case 28: type2 = MBEDTLS_SHA3_224; break;
case 32: type2 = MBEDTLS_SHA3_256; break;
case 48: type2 = MBEDTLS_SHA3_384; break;