NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: odd /dev/random behavior with dd ?



> Hi, 'dd' seems to behave different if the 'if' is /dev/random
> than if it is anything else, e.g. /dev/zero:
> 
> # sh
> # dd if=/dev/zero of=zero.out bs=65536 count=1
> 1+0 records in
> 1+0 records out
> 65536 bytes transferred in 0.001 secs (65536000 bytes/sec)

rnd(4) says:

     Applications should read from /dev/urandom, or the sysctl(7) variable
     kern.arandom, when they need randomly generated data, e.g. key material
     for cryptography or seeds for simulations.  (The sysctl(7) variable
     kern.arandom is limited to 256 bytes per read, but is otherwise
     equivalent to reading from /dev/urandom and always works even in a
     chroot(8) environment without requiring a populated /dev tree and without
     opening a file descriptor, so kern.arandom may be preferable to use in
     libraries.)

I guess the behaviour of kern.arandom is also enforced for
/dev/random.  "Whoever needs more than 256 bits to seed their
crypto algorithm?"

/dev/urandom does not, and as long as the rnd subsystem is
initialized, it should be equivalent to /dev/random if I
understand correctly.

Regards,

- Håvard


Home | Main Index | Thread Index | Old Index