rdseed
Read Random Seed
Retrieves a random seed from hardware entropy source.
Details
Retrieves an entropy seed value from the CPU's hardware entropy source and stores it in the destination register. The CF flag is set to 1 if the seed was successfully obtained within the timeout period, or cleared to 0 on failure. No other flags are affected. This instruction requires the RDSEED extension and operates in protected and 64-bit modes only.
Pseudocode Operation
temp ← hardware_entropy_source();
if (entropy_success) {
dest ← temp;
CF ← 1;
} else {
CF ← 0;
}
Example
Encoding
Operands
-
dest
32-bit general-purpose register (e.g. EAX)
Reference (Intel® SDM)
Instruction Forms
| Opcode | Instruction | Op/En | 64/32-bit Mode | CPUID | Description |
|---|---|---|---|---|---|
| NFx 0F C7 /7 | RDSEED | M | V/V | Read a 16-bit NIST SP800-90B & C compliant random value and RDSEED r16 store in the destination register. | |
| NFx 0F C7 /7 | RDSEED | M | V/V | Read a 32-bit NIST SP800-90B & C compliant random value and RDSEED r32 store in the destination register. | |
| NFx REX.W + 0F C7 /7 | RDSEED | M | V/I | Read a 64-bit NIST SP800-90B & C compliant random value and RDSEED r64 store in the destination register. |
Description
Operation
IF HW_NRND_GEN.ready = 1 THEN CASE of operand size is 64: DEST[63:0] := HW_NRND_GEN.data; operand size is 32: DEST[31:0] := HW_NRND_GEN.data; operand size is 16: DEST[15:0] := HW_NRND_GEN.data; ESAC; CF := 1; ELSE CASE of operand size is 64: DEST[63:0] := 0; operand size is 32: DEST[31:0] := 0; operand size is 16: DEST[15:0] := 0; ESAC; CF := 0; FI; OF, SF, ZF, AF, PF := 0; RDSEED—Read Random SEED Vol. 2B 4-556
Flags Affected
The CF flag is set according to the result (see the “Operation” section above). The OF, SF, ZF, AF, and PF flags are set to 0. C/C++ Compiler Intrinsic Equivalent RDSEED int _rdseed16_step( unsigned short * ); RDSEED int _rdseed32_step( unsigned int * ); RDSEED int _rdseed64_step( unsigned __int64 *);