From 1e96b46b032aa27d9388e395c3591b8c33005b4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?=
 <manuel.pegourie-gonnard@arm.com>
Date: Tue, 19 Nov 2019 11:49:05 +0100
Subject: [PATCH] Disable use of HRNG in SCA-hardened mem-functions

This is a temporary work-around for an integration issue.

A future task will re-integrate randomness into these functions are their
entire point is to be randomized; this is really just temporary.
---
 library/platform_util.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/library/platform_util.c b/library/platform_util.c
index db46fe99e..1a0fefae6 100644
--- a/library/platform_util.c
+++ b/library/platform_util.c
@@ -142,7 +142,10 @@ int mbedtls_platform_memcmp( const void *buf1, const void *buf2, size_t num )
 
 uint32_t mbedtls_platform_random_in_range( size_t num )
 {
-#if !defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
+    /* Temporary force the dummy version - drawing directly from the HRNG
+     * seems to be causing issues, avoid doing that until we understood the
+     * issue, and perhaps we'll need to draw from a DRBG instead. */
+#if 1 || !defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
     (void) num;
     return 0;
 #else