-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix crypto test failures #5775
Conversation
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>
330f8d9
to
2979709
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
RetEcx = 0; | ||
switch (Index) { | ||
case 1: | ||
RetEcx |= BIT30; /* RdRand */ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.