mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 08:15:44 +01:00
Fix CI failure.
For ASanDbg tests of the earlier implementation of the mbedtls_platform_random_in_range(), there was no case where ‘shift’ value was zero. Such a case generated a bit shift of 32, which is treated as an error by ASanDbg. Increasing the ‘shift’ value by one ensures that it will always be non-zero. Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
This commit is contained in:
parent
057daa3b28
commit
26c33692b0
@ -269,8 +269,8 @@ void mbedtls_platform_random_delay( void )
|
|||||||
i++;
|
i++;
|
||||||
/* Dummy calculations to increase the time between iterations and
|
/* Dummy calculations to increase the time between iterations and
|
||||||
* make side channel attack more difficult by reducing predictability
|
* make side channel attack more difficult by reducing predictability
|
||||||
* of its behaviour */
|
* of its behaviour. */
|
||||||
shift = rn_2 & 0x07;
|
shift = ( rn_2 & 0x07 ) + 1;
|
||||||
if ( i % 2 )
|
if ( i % 2 )
|
||||||
rn_2 = ( rn_2 >> shift ) | ( rn_2 << ( 32 - shift ) );
|
rn_2 = ( rn_2 >> shift ) | ( rn_2 << ( 32 - shift ) );
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user