3 ms·
Linux random/urandom is supposed to prevent short-reads for exactly this reason. Oh great, yet another way that Linux developers are going to write broken code
by cperciva 13y ago
Linux random/urandom is supposed to prevent short-reads for exactly this reason.
Oh great, yet another way that Linux developers are going to write broken code because they think the whole unix world behaves like Linux...
- fulafel 13y agoThe random/urandom devices do originate from Linux, other implementations should be careful about not making incompatible changes.
- tptacek 13y agoSo then what you should do is write a "libpcap for randomness" that uses the best-practices method of getting randomness from the OS CSPRNG. On Linux it'll be just a couple lines; on BSD it'll be a few more lines for the "atomicio" equivalent read, and on WINAPI it'd set up and call CryptGenRandom. There's value in having a uniform interface to all the different OS CSPRNGs. What I'm saying isn't valuable is duplicative effort to build additional CSPRNG logic in the app layer. As we keep seeing, these app-layer CSPRNGs are additional single points of failure; they don't add defensive depth.
- tedunangst 13y agoHow is OpenSSL RAND_bytes not that uniform interface?
- tptacek 13y agoOpenSSL provides its own CSPRNG. When that CSPRNG breaks, as it has in the past, no amount of careful validation of the OS CSPRNG helps you. The OpenSSL CSPRNG is thus a second single point of failure.