The conventional and simple wisdom is to combine
/dev/urandom to create the amount of pseudo-random data that is needed.
But that is slow.
I found a faster method -
cryptsetup FAQ suggests to use its mechanism.
See 2.19 at:
But the issue with this method is that root privileges are required for the mapping by cryptsetup (dm-crypt).
So, I need a similar method which won't require root privileges.
But I don't know whether CTR is really preferred in this case over CBC.
Won't CTR break the pseudo-randomness of the data?
Another approach was to use
openssl rand - see post:
The manual page of
openssl rand is unclear (for me) regarding its method.
The random bytes are generated using the RAND_bytes(3) function, which provides a security level of 256 bits, provided it managed to seed itself successfully from a trusted operating system entropy source. Otherwise, the command will fail with a nonzero error code. For more details, see RAND_bytes(3), RAND(7), and EVP_RAND(7).
man RAND_bytes is nonexistent.
Among the last ones above, is there a strong preference in terms of the strength of the pseudo-randomness ?
- openssl enc -aes-256-ctr
- openssl enc -aes-256-cbc
- openssl rand