Need card #196 · Relevance High · Status New

AMD RDRAND fails to generate zeroes – hardware RNG bug

Updated 9/26/2026, 22:05:29

Problem

On AMD Zen 2 CPUs, the RDRAND instruction can sometimes return only all‑1 values (‑1), causing applications that rely on hardware RNG to crash at startup; it may also be unable to produce 0, making the random numbers unreliable for security‑critical code. Users resort to work‑arounds such as XOFs or microcode/firmware updates.

Pain points

Questions to verify

Evidence

quote
This is not the first RNG bug on Zen 2, I recall after I first got mine that some application or other would quit immediately at startup because rdrand always returned -1, i.e. all 1s. It was fixed with a microcode update.Do we now learn that they fixed "always generate all 1s" with "never generate all 0s"??EDIT: I've been unable to reproduce the problem on my CPU, FWIW. It's a Ryzen 5 3600.EDIT2: OK, update, I can reproduce it with rdrand16, rdrand32 is fine but rdrand16 can never generate all 0s. So my CPU does have this problem!
quote
This is why I use, in security critical contents of my software (where the numbers have to be computationally infeasible to produce), a type of random number generator called an XOF (extendable-output function).It takes entropy from multiple different sources, makes it all input to the XOF, then the XOF uses cryptography to output a stream that has as much entropy as the combined entropy of all of its sources of randomness. So if an XOF, for example, takes 100 runs of rdrand16, along with the system time in microseconds and the number of milliseconds between receiving 100 packets over the network, the XOF will output a completely random stream without artifacts like never returning 0x0000, even if rdrand16 never outputs 0x0000.
quote
I remember setting up a new git CI build server many years ago, which at the time rather quickly started failing build pipelines in a nodejs css frontend build script, turns out there was something funky with the AMD processor's RDRAND. A motherboard BIOS flash update fixed it.

Disclaimer: this card is distilled by AI from community discussions as “pain point evidence”. It is a starting point for need analysis and validation, not a “validated market need”. AI has analytical limits; please open the original discussion above to manually verify before key decisions.