I'm currently trying to teach myself some non-Windowsland operating systems, and I figured Ubuntu Server 16.04 would be the best place to start. Having "mastered" LVM, I'm trying to familiarize myself with cryptsetup and LUKS.
I'm beginning to get it, but the one thing I'm perplexed by is...
...to what end are the random numbers generated by the --use-urandom or --use-random options used for?
In the context of a cryptsetup command, for example:
$ sudo cryptsetup luksFormat --cipher=aes-xts-plain64 --key-size=512 --hash=sha256 --use-random /dev/sdb1 --key-file=/crypto/keyfile
I have done some reading here that using /dev/random (which is what I assume --use-random pulls its random number entropy from) can sometimes take a long time as the system generates more entropy, and so in certain instances it's recommended to use --use-urandom (which correspondingly pulls from /dev/urandom, which as I understand it is wholly pseudorandom) since the system won't get stuck waiting for the entropy pool to "refill."
I don't FULLY understand cryptography, but I'm guessing that this option is used just the once, setting the initial state of the whole encryption scheme, and then we're good. If that's the case, I have no problem waiting for a good and chaotic bed of encryption to protect my data - but if I have to deal with that with every read and write to the disk... that could get old fast.
Am I right? Is this just a one-time thing? Or, by setting --use-random in my command there, am I dooming myself to long LUKS opens and closes, reads and writes, etc?
/dev/urandom
isn't wholly pseudorandom. See https://unix.stackexchange.com/questions/324209/when-to-use-dev-random-vs-dev-urandom, https://www.2uo.de/myths-about-urandom/ – muru Jun 22 '17 at 05:48