summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Corna <nicola@corna.info>2017-08-13 19:38:41 +0200
committerPatrick Georgi <pgeorgi@google.com>2017-09-06 11:53:57 +0000
commit33f1273f9f1e41c1c7f42732dd9430e40476abc3 (patch)
treef9dd41638f23e196aec4b4ddf9a83515bea8cbe1
parente41b0d09bac11d21d88077c95b0a689bd72f65ab (diff)
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 <nicola@corna.info> Reviewed-on: https://review.coreboot.org/20980 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
-rw-r--r--payloads/external/tint/libpayload_tint.patch23
1 files changed, 5 insertions, 18 deletions
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 <libpayload.h>
+#include <curses.h>
-+#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;
}