On Tue, Nov 22, 2022 at 4:32 PM Pedro Falcato <pedro.falc...@gmail.com> wrote: > + // Testing algorithm inspired by linux's > arch/x86/kernel/cpu/rdrand.c:x86_init_rdrand > + // as relicensed by the author, Jason Donenfeld, in the EDK2 mailing list. > + // As is, the algorithm samples rdrand $RDRAND_TEST_SAMPLES times and > expects > + // a different result $RDRAND_MIN_CHANGE times for reliable RDRAND usage.
You don't need to pepper my name all over the source. :) > + for (TestIteration = 0; TestIteration < RDRAND_TEST_SAMPLES; > TestIteration++) { > + UINT32 Sample; > + // > + // Note: We use a retry loop for rdrand. Normal users get this in > BaseRng.c > + // Any failure to get a random number will assume RDRAND does not work. > + // > + for (Idx = 0; Idx < RDRAND_RETRIES; Idx++) { > + if (AsmRdRand32 (&Sample)) { The linux code will use a 64bit value on 64bit machines. I suggest you do the same here -- use native word size. I think EFI calls this a "UINTN". Jason -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96564): https://edk2.groups.io/g/devel/message/96564 Mute This Topic: https://groups.io/mt/95197646/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-