|
@@ -55,6 +55,12 @@ static unsigned long linux_ticks_per_sec(void)
|
55
|
55
|
* linux doesn't provide an easy access to jiffies so implement it by measuring
|
56
|
56
|
* the time since the first call to this function.
|
57
|
57
|
*
|
|
58
|
+ * Since this function is used to seed the (non-cryptographic) random
|
|
59
|
+ * number generator, we round the start time down to the nearest whole
|
|
60
|
+ * second. This minimises the chances of generating identical RNG
|
|
61
|
+ * sequences (and hence identical TCP port numbers, etc) on
|
|
62
|
+ * consecutive invocations of iPXE.
|
|
63
|
+ *
|
58
|
64
|
* @ret ticks Current time, in ticks
|
59
|
65
|
*/
|
60
|
66
|
static unsigned long linux_currticks(void)
|
|
@@ -71,7 +77,7 @@ static unsigned long linux_currticks(void)
|
71
|
77
|
linux_gettimeofday(&now, NULL);
|
72
|
78
|
|
73
|
79
|
unsigned long ticks = (now.tv_sec - start.tv_sec) * linux_ticks_per_sec();
|
74
|
|
- ticks += (now.tv_usec - start.tv_usec) / (long)(1000000 / linux_ticks_per_sec());
|
|
80
|
+ ticks += now.tv_usec / (long)(1000000 / linux_ticks_per_sec());
|
75
|
81
|
|
76
|
82
|
return ticks;
|
77
|
83
|
}
|