LWN.net Logo

The search for truly random numbers in the kernel

The search for truly random numbers in the kernel

Posted Sep 20, 2013 18:22 UTC (Fri) by ikm (subscriber, #493)
Parent article: The search for truly random numbers in the kernel

> on a number of architectures, the TSC does not exist and get_cycles() returns zero

In this case, one small source of entropy which could be used is the caller's instruction pointer (i.e. the address where get_cycles() should return to). Since the order in which get_cycles() is called due to hardware interrupts is unpredictable in most cases, this would certainly be better than always feeding zeroes.

Another option is mixing in the current top of stack pointer (be it the kernel or the userspace one), depending on the architecture implementation.

While giving this any entropy credit would be wrong, the randomness it provides can be useful.


(Log in to post comments)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds