Nicola Corna has uploaded this change for review. ( https://review.coreboot.org/20980
Change subject: tint: Use the current time as random seed ......................................................................
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.
Change-Id: I2e482bbb9d33cdbbf3c15916458329f99fbc4450 Signed-off-by: Nicola Corna nicola@corna.info --- M payloads/external/tint/libpayload_tint.patch 1 file changed, 7 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/80/20980/1
diff --git a/payloads/external/tint/libpayload_tint.patch b/payloads/external/tint/libpayload_tint.patch index b5592dd..21b93a3 100644 --- a/payloads/external/tint/libpayload_tint.patch +++ b/payloads/external/tint/libpayload_tint.patch @@ -939,19 +939,22 @@
/* * Initialize random number generator -@@ -41,8 +43,11 @@ void rand_init () +@@ -41,8 +43,14 @@ void rand_init () #ifdef USE_RAND srand (time (NULL)); #else +#if 0 srandom (time (NULL)); #endif -+ srandom (123); ++ struct timeval tp; ++ ++ gettimeofday (&tp, NULL); ++ srandom (tp.tv_sec); +#endif }
/* -@@ -61,6 +66,7 @@ int rand_value (int range) +@@ -61,6 +69,7 @@ int rand_value (int range) * Convert an str to long. Returns TRUE if successful, * FALSE otherwise. */ @@ -959,7 +962,7 @@ bool str2int (int *i,const char *str) { char *endptr; -@@ -69,3 +75,4 @@ bool str2int (int *i,const char *str) +@@ -69,3 +78,4 @@ bool str2int (int *i,const char *str) return TRUE; }