After reviewing the Intel Digital Random Number Generator (DRNG) Software Implementation Guide, I have a few questions about what happens to the internal state of the generator when RDRAND is invoked. Unfortunately the answers don't seem to be in the guide.
According to the guide, inside the DRNG there are four 128-bit buffers that serve random bits for
RDRANDto drain.RDRANDitself will provide either 16, 32, or 64 bits of random data depending on the width of the destination register:rdrand ax ; put 16 random bits in ax rdrand eax ; put 32 random bits in eax rdrand rax ; put 64 random bits in raxWill the use of larger destination registers empty those 128-bit buffers more quickly? For example, if I need only 2 bits of randomness, should I go through the trouble of using a 16 bit register over a 64 bit register? Will that make any difference on the throughput of the DRNG? I'd like to avoid consuming more randomness than is necessary.
The guide says the carry flag will be set after
RDRANDexecutes:CF = 1 Destination register valid. Non-zero random value available at time of execution. Result placed in register. CF = 0 Destination register all zeros. Random value not available at time of execution. May be retried.What does "not available" mean? Can random data be unavailable because
RDRANDinvocations exhausted those 128-bit buffers too quickly? Or does unavailable mean the DRNG is failing its health checks and cannot generate any new data? Basically, I'm trying to understand if CF=0 can occur just because the buffers happen to be (transiently) empty whenRDRANDis invoked.
Note: I have reviewed the answers to this question on throughput and latency of RDRAND, but I'm seeking different information.
Thanks!