mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-09-01 07:49:57 +00: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 <[email protected]>
This commit is contained in:
@@ -269,8 +269,8 @@ void mbedtls_platform_random_delay( void )
|
||||
i++;
|
||||
/* Dummy calculations to increase the time between iterations and
|
||||
* make side channel attack more difficult by reducing predictability
|
||||
* of its behaviour */
|
||||
shift = rn_2 & 0x07;
|
||||
* of its behaviour. */
|
||||
shift = ( rn_2 & 0x07 ) + 1;
|
||||
if ( i % 2 )
|
||||
rn_2 = ( rn_2 >> shift ) | ( rn_2 << ( 32 - shift ) );
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user