From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Pedro Falcato <pedro.falcato@gmail.com>
Cc: devel@edk2.groups.io,
Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Zhiguang Liu <zhiguang.liu@intel.com>
Subject: Re: [PATCH v2 1/1] MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID
Date: Tue, 22 Nov 2022 16:38:57 +0100 [thread overview]
Message-ID: <CAHmME9po1XGhLa6thJ3S_mR0mUwgmP0gASbrEZaj_3Q_+wvmhg@mail.gmail.com> (raw)
In-Reply-To: <20221122153212.570984-1-pedro.falcato@gmail.com>
On Tue, Nov 22, 2022 at 4:32 PM Pedro Falcato <pedro.falcato@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
next prev parent reply other threads:[~2022-11-22 15:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 15:32 [PATCH v2 1/1] MdePkg/BaseRngLib: Add a smoketest for RDRAND and check CPUID Pedro Falcato
2022-11-22 15:38 ` Jason A. Donenfeld [this message]
2022-11-22 15:56 ` Pedro Falcato
2022-11-22 16:54 ` [edk2-devel] " Michael D Kinney
2022-11-22 17:11 ` Jason A. Donenfeld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHmME9po1XGhLa6thJ3S_mR0mUwgmP0gASbrEZaj_3Q_+wvmhg@mail.gmail.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox