freebl_cpuid incorrectly used for querying Extended Features
Categories
(NSS :: Libraries, defect, P1)
Tracking
(Not tracked)
People
(Reporter: kjacobs, Assigned: kjacobs)
Details
Attachments
(1 file)
freebl_cpuid
is used with EAX=7 to query Extended Features. This requires ECX to be set to 0, which is not done. Instead, we query an invalid sub-leaf and fail to detect AVX2.
Assignee | ||
Comment 1•5 years ago
|
||
While trying to benchmark the recent HACL* AVX2 code, I noticed that it was not being called on two machines (that both support AVX2), instead using only the AVX version.
In order to query for Extended Features (cpuid with EAX=7), we also need to set ECX to 0: https://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-vol-2a-manual.html. The current code fails to do this, resulting in flags that show no support.
Initially, I wrote a separate freebl_cpuid_ex
function that accepted a value for ECX as a separate input argument. However, some definitions of freebl_cpuid
already zero ECX, so making this consistent is the simplest way to get the desired behavior.
With this patch, the two test machines (MacOS and Linux x64) correctly use the AVX2 ChaCha20Poly1305 code.
Assignee | ||
Comment 2•5 years ago
|
||
Description
•