On Tue, Nov 22, 2022 at 4:56 PM Pedro Falcato <pedro.falc...@gmail.com> wrote: > > On Tue, Nov 22, 2022 at 3:39 PM Jason A. Donenfeld <ja...@zx2c4.com> wrote: >> >> 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. :) > > > I just wanted to properly credit you :) If you're not okay with it I can > remove it in a v3.
Yes, please remove. >> > + 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". > > > Hmm, do you reckon it makes a difference? Yes, it does. Please account for this. Use an ifdef or something if you need. It's not very hard. Jason -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96575): https://edk2.groups.io/g/devel/message/96575 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] -=-=-=-=-=-=-=-=-=-=-=-