[PATCH] getrandom: new applet

Etienne Champetier champetier.etienne at gmail.com
Thu Jun 30 08:05:00 UTC 2016


Hi Rob,

2016-06-29 23:00 GMT+02:00 Rob Landley <rob at landley.net>:
>
>
> On 06/28/2016 04:54 PM, Etienne Champetier wrote:
>> Hi Lauri,
>>
>> 2016-06-28 19:10 GMT+02:00 Lauri Kasanen <curaga at operamail.com>:
>>> On Tue, Jun 28, 2016, at 19:56, Etienne CHAMPETIER wrote:
>>>> first user of this applet will be LEDE (OpenWrt) to save an urandom seed
>>>> using getrandom() (so we are sure /dev/urandom pool is initialized)
>>>
>>> In LFS, the boot scripts use dd for this. Is there any need for an
>>> applet?
>>
>> On linux you have /dev/random which block, /dev/urandom which never block,
>> and the new getrandom() syscall which only block until proper initialisation.
>> To use getrandom() you need an applet.
>>
>> I could use /dev/random + dd but this can take a long time and slow
>> down other /dev/random consumer
>> (key generation on first boot)
>>
>> Here is the code I found for LFS
>> https://github.com/ojab/BLFS/blob/master/bootscripts/blfs/init.d/random#L32
>> they are using /dev/urandom really early in the boot process so it
>> might not be initialized yet
>> We are not sure we will go through stop() (hard reset)
>> Also getrandom() didn't exists at that time ...
>>
>> Basically the right tool for the job is now getrandom() so let's use it.
>
> timeout 3 dd bs=128 count=1 if=/dev/random of=blah.img

???
this will fail after 3 seconds and so what

>
> Rob


More information about the busybox mailing list