Message267982
On 09.06.2016 09:57, STINNER Victor wrote:
>
> STINNER Victor added the comment:
>
> I played with select() on Linux on a VM:
>
> * /dev/random: it works as expected
> * /dev/urandom: the device is already seen as readable even before the urandom entropy pool is initialized. It is not really surprising since, yes, read() does not block in practice
>
> To test Python before urandom is initialized, I used the init=/path/to/python trick in the boot loader.
It's best to look at the code for this in Linux:
http://lxr.free-electrons.com/source/drivers/char/random.c
getrandom() is implemented directly on top of the two
devices:
http://lxr.free-electrons.com/source/drivers/char/random.c#L1601
> By the way, I confirm that getrandom(GRND_NONBLOCK) fails with EAGAIN before urandom is initialized.
Right, and that's good, since it's better to let the application
control what to do than to simply block.
Here's a good reading on getrandom():
https://lwn.net/Articles/606141/ |
|
Date |
User |
Action |
Args |
2016-06-09 08:11:37 | lemburg | set | recipients:
+ lemburg, ncoghlan, vstinner, larry, christian.heimes, martin.panter, dstufft, Lukasa, Theodore Tso |
2016-06-09 08:11:37 | lemburg | link | issue27266 messages |
2016-06-09 08:11:37 | lemburg | create | |
|