Closed justuswilhelm closed 7 years ago
Shouldn't we generate randomness completely in userlevel? Seems crazy to rely on read to generate random numbers.
@justuswilhelm: Thanks, great catch.
@tbarbette: Read up on /dev/urandom — it's usually the right answer https://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/
We should probably have a cryptographic random number generator at userlevel, but for this purpose (initializing the non-cryptographic click_random()
generator to a less-than-totally-predictable value) a single read from /dev/urandom is fine.
@kohler: Thanks so much!
@kohler what method would you recommend for this userlevel replacement? Does the following seems good :
We may want a per-cpu seed to avoid false sharing. Or we may want to use a hardware generator (eg. through DPDK support for Intel QuickAssist). So it seems like it should be a user-configurable "method".
This could also be followed for other features based on system calls, such as the click_jiffies (UserJiffies would rely on a Timer to update a jiffie count).
Advantage is that it is fully configurable, disadvantage is that all Click userlevel configurations would always have the same set of Elements in their config such as UserCryptoMP;UserJiffiesMP;...
This will resolve issues with slow random sources (e.g., in virtual machines)