From 699aebecb95df22a846ef6566b149c2d4e5c847c Mon Sep 17 00:00:00 2001 From: Shelly Liberman Date: Mon, 14 Dec 2020 18:30:53 +0200 Subject: [PATCH] fix flow control check Signed-off-by: Shelly Liberman --- library/platform_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/platform_util.c b/library/platform_util.c index c808750c6..88987d807 100644 --- a/library/platform_util.c +++ b/library/platform_util.c @@ -334,7 +334,7 @@ uint32_t mbedtls_platform_random_uint32( void ) void mbedtls_platform_random_buf( uint8_t *buf, size_t len ) { - volatile size_t flow_control = 0; + volatile size_t flow_control = 0, flow_control_check = len; uint16_t val; while( len > 1 ) @@ -351,7 +351,7 @@ void mbedtls_platform_random_buf( uint8_t *buf, size_t len ) flow_control ++; } - if ( flow_control == len ) + if ( flow_control == flow_control_check ) { return; }