From 33f1273f9f1e41c1c7f42732dd9430e40476abc3 Mon Sep 17 00:00:00 2001 From: Nicola Corna Date: Sun, 13 Aug 2017 19:38:41 +0200 Subject: tint: Use the current time as random seed Previously the random seed was fixed, which led to the same sequence of blocks for each run. Now that libpayload has time(), no change is needed in the function rand_init() of tint. Change-Id: I2e482bbb9d33cdbbf3c15916458329f99fbc4450 Signed-off-by: Nicola Corna Reviewed-on: https://review.coreboot.org/20980 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Patrick Georgi --- payloads/external/tint/libpayload_tint.patch | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'payloads/external/tint') diff --git a/payloads/external/tint/libpayload_tint.patch b/payloads/external/tint/libpayload_tint.patch index b5592dd72c..7c8a05801a 100644 --- a/payloads/external/tint/libpayload_tint.patch +++ b/payloads/external/tint/libpayload_tint.patch @@ -1,16 +1,15 @@ diff -rupN tint-0.03b/config.h tint/config.h --- tint-0.03b/config.h 2001-12-08 00:03:24.000000000 +0100 +++ tint/config.h 2016-05-27 14:47:15.797402090 +0200 -@@ -29,7 +29,16 @@ +@@ -29,7 +29,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include +#include -+#define random(x) rand(x) -+#define srandom(x) srand(x) -+#define curs_set(x) + ++#define curs_set(x) ++#define USE_RAND + /* Score file */ +#if 0 @@ -939,19 +938,7 @@ diff -rupN tint-0.03b/utils.c tint/utils.c /* * Initialize random number generator -@@ -41,8 +43,11 @@ void rand_init () - #ifdef USE_RAND - srand (time (NULL)); - #else -+#if 0 - srandom (time (NULL)); - #endif -+ srandom (123); -+#endif - } - - /* -@@ -61,6 +66,7 @@ int rand_value (int range) +@@ -61,6 +63,7 @@ int rand_value (int range) * Convert an str to long. Returns TRUE if successful, * FALSE otherwise. */ @@ -959,7 +946,7 @@ diff -rupN tint-0.03b/utils.c tint/utils.c bool str2int (int *i,const char *str) { char *endptr; -@@ -69,3 +75,4 @@ bool str2int (int *i,const char *str) +@@ -69,3 +72,4 @@ bool str2int (int *i,const char *str) return TRUE; } -- cgit v1.2.3