[cryptography] Intel RNG

James Cloos cloos at jhcloos.com
Sat Jun 18 04:44:26 EDT 2011


>>>>> "PG" == Peter Gutmann <pgut001 at cs.auckland.ac.nz> writes:

PG> I'd like to get the encoded form to implement it as '__asm _emit
PG> 0x0F __asm _emit 0xC7 __asm _emit <something>' (in the case of MSVC).

(I knew I should have added that info, too. ☹)

On page 580 of the pdf (named page B-21) it says that RDRAND is group 9,
the Mod 7,6 is 11B and bits 5,4,3 of the ModR/M byte are 110.

I take that to mean the the ModR/M byte is 11110bbb where bbb encodes
the register, so 0F C7 F0 would be RDRAND eax.  That would be prefixed
with a REX.B prefix to specify 32-bit registers R8-R15 and with a REX.W
prefix to specify any of the 64-bit registers.  Based on p B-10 of that
pdf, the Exx registers are ordered eAX, eCX, eDX, eBX, eSP, eBP, eSI, eDI.

The REX.B prefix is 0x41 and REX.W is 0x48.  I think that means that
41 0F C7 F1 would randomize 32-bit R9 and 48 0F C7 F2 (64-bit) rdx.

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6



More information about the cryptography mailing list