Add comment for mbedtls_platform_random_delay()

Signed-off-by: Piotr Nowicki <piotr.nowicki@arm.com>
This commit is contained in:
Piotr Nowicki 2020-06-03 15:59:59 +02:00
parent 478b05c34c
commit b06ec05dc0

View file

@ -190,6 +190,9 @@ void mbedtls_platform_random_delay( void )
do do
{ {
i++; 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; shift = rn_2 & 0x07;
if ( i % 2 ) if ( i % 2 )
rn_2 = (uint32_t)( rn_2 >> shift | rn_2 << ( 32 - shift ) ); rn_2 = (uint32_t)( rn_2 >> shift | rn_2 << ( 32 - shift ) );