Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix crypto test failures #5775

Merged
merged 2 commits into from
Jun 14, 2024
Merged

Conversation

kraxel
Copy link
Member

@kraxel kraxel commented Jun 14, 2024

  • CryptoPkg/Test: call ProcessLibraryConstructorList
  • MdePkg/X86UnitTestHost: set rdrand cpuid bit

Needed to properly initialize BaseRngLib.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Set the rdrand feature bit when faking cpuid for host test cases.
Needed to make the CryptoPkg test cases work.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
@kraxel kraxel marked this pull request as ready for review June 14, 2024 11:50
Copy link
Contributor

@liyi77 liyi77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@liyi77 liyi77 added the push Auto push patch series in PR if all checks pass label Jun 14, 2024
@mergify mergify bot merged commit 5e77629 into tianocore:master Jun 14, 2024
126 checks passed
RetEcx = 0;
switch (Index) {
case 1:
RetEcx |= BIT30; /* RdRand */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is right fix to hardcode the value.

I recommend calling CPUID to get real value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merging #5714 the situation was exactly the same, the host test simply assumed rdrand support is there without actually checking. So, yes, it's not ideal, but it also is not worse than it used to be.

Note that proper rdrand checking needs more than just calling CPUID to figure the real value, the test cases also need an update to either skip tests or fallback to another RNG source in case rdrand is not there.

Given that rdrand is roughly a one decade old (2012+ for intel, 2015+ for amd) and using rdrand without checking apparently was not much of an problem before I'm not convinced this would be worth the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants