From b06ec05dc0258788e6e03528e3d1b0fe1981a220 Mon Sep 17 00:00:00 2001 From: Piotr Nowicki Date: Wed, 3 Jun 2020 15:59:59 +0200 Subject: [PATCH] Add comment for mbedtls_platform_random_delay() Signed-off-by: Piotr Nowicki --- library/platform_util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/platform_util.c b/library/platform_util.c index 3869f30a5..19958fa11 100644 --- a/library/platform_util.c +++ b/library/platform_util.c @@ -190,6 +190,9 @@ void mbedtls_platform_random_delay( void ) do { 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; if ( i % 2 ) rn_2 = (uint32_t)( rn_2 >> shift | rn_2 << ( 32 - shift ) );