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>
diff --git a/library/platform_util.c b/library/platform_util.c
index 3fa9437..5e938f9 100644
--- a/library/platform_util.c
+++ b/library/platform_util.c
@@ -269,8 +269,8 @@
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