mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 17:54:21 +01:00
Follow Mbed TLS coding style
-Fix multiple for clauses -Remove redundant check
This commit is contained in:
parent
c3532c2339
commit
425137a0fa
@ -551,8 +551,6 @@ static void aes_sca_cm_data_randomize( uint8_t *tbl, uint8_t tbl_len )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fill start/final round control data
|
// Fill start/final round control data
|
||||||
if ( AES_SCA_CM_ROUNDS != 0 )
|
|
||||||
{
|
|
||||||
num = /* mbedtls_platform_random_in_range( tbl_len - 1 ) */rand() % 0xff;
|
num = /* mbedtls_platform_random_in_range( tbl_len - 1 ) */rand() % 0xff;
|
||||||
if ( ( num % 2 ) == 0 )
|
if ( ( num % 2 ) == 0 )
|
||||||
{
|
{
|
||||||
@ -564,7 +562,6 @@ static void aes_sca_cm_data_randomize( uint8_t *tbl, uint8_t tbl_len )
|
|||||||
tbl[tbl_len - 2] = 0x00;
|
tbl[tbl_len - 2] = 0x00;
|
||||||
tbl[tbl_len - 1] = 0x10;
|
tbl[tbl_len - 1] = 0x10;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif /* AES_SCA_CM_ROUNDS != 0 */
|
#endif /* AES_SCA_CM_ROUNDS != 0 */
|
||||||
|
|
||||||
// Fill real AES round data to the remaining places
|
// Fill real AES round data to the remaining places
|
||||||
@ -1019,7 +1016,8 @@ int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
|
|||||||
GET_UINT32_LE( aes_data_real.xy_values[i], input, ( i * 4 ) );
|
GET_UINT32_LE( aes_data_real.xy_values[i], input, ( i * 4 ) );
|
||||||
for( j = 0; j < start_fin_loops; j++ )
|
for( j = 0; j < start_fin_loops; j++ )
|
||||||
{
|
{
|
||||||
aes_data_ptr = aes_data_table[round_ctrl_table[ round_ctrl_table_len - 2 + j ] >> 4];
|
aes_data_ptr =
|
||||||
|
aes_data_table[round_ctrl_table[ round_ctrl_table_len - 2 + j ] >> 4];
|
||||||
aes_data_ptr->xy_values[i] ^= *aes_data_ptr->rk_ptr++;
|
aes_data_ptr->xy_values[i] ^= *aes_data_ptr->rk_ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1165,7 +1163,8 @@ int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx,
|
|||||||
GET_UINT32_LE( aes_data_real.xy_values[i], input, ( i * 4 ) );
|
GET_UINT32_LE( aes_data_real.xy_values[i], input, ( i * 4 ) );
|
||||||
for( j = 0; j < start_fin_loops; j++ )
|
for( j = 0; j < start_fin_loops; j++ )
|
||||||
{
|
{
|
||||||
aes_data_ptr = aes_data_table[round_ctrl_table[ round_ctrl_table_len - 2 + j ] >> 4];
|
aes_data_ptr =
|
||||||
|
aes_data_table[round_ctrl_table[ round_ctrl_table_len - 2 + j ] >> 4];
|
||||||
aes_data_ptr->xy_values[i] ^= *aes_data_ptr->rk_ptr++;
|
aes_data_ptr->xy_values[i] ^= *aes_data_ptr->rk_ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user