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

Aarch64 CPU id: fix for privilege instruction detection #8311

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions wolfcrypt/src/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
#elif defined(HAVE_CPUID_AARCH64)

#define CPUID_AARCH64_FEAT_AES ((word64)1 << 4)
#define CPUID_AARCH64_FEAT_PMULL ((word64)1 << 5)
#define CPUID_AARCH64_FEAT_AES_PMULL ((word64)1 << 5)
#define CPUID_AARCH64_FEAT_SHA256 ((word64)1 << 12)
#define CPUID_AARCH64_FEAT_SHA256_512 ((word64)1 << 13)
#define CPUID_AARCH64_FEAT_RDM ((word64)1 << 28)
Expand All @@ -131,8 +131,10 @@

if (features & CPUID_AARCH64_FEAT_AES)
cpuid_flags |= CPUID_AES;
if (features & CPUID_AARCH64_FEAT_PMULL)
if (features & CPUID_AARCH64_FEAT_AES_PMULL) {
cpuid_flags |= CPUID_AES;
cpuid_flags |= CPUID_PMULL;
}
if (features & CPUID_AARCH64_FEAT_SHA256)
cpuid_flags |= CPUID_SHA256;
if (features & CPUID_AARCH64_FEAT_SHA256_512)
Expand Down Expand Up @@ -279,7 +281,6 @@
void cpuid_set_flags(void)
{
if (!cpuid_check) {

#ifndef WOLFSSL_ARMASM_NO_HW_CRYPTO
cpuid_flags |= CPUID_AES;
cpuid_flags |= CPUID_PMULL;
Expand All @@ -300,6 +301,7 @@
#ifdef WOLFSSL_ARMASM_CRYPTO_SM4
cpuid_flags |= CPUID_SM4;
#endif

cpuid_check = 1;
}
}
Expand Down
Loading