From 70854b8eec58b63963aca9b01cce898fee7f3677 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Mon, 31 Aug 2020 09:30:29 +1000 Subject: [PATCH] Allow the CPU Id flags to be programmatically set --- wolfcrypt/src/cpuid.c | 15 +++++++++++++++ wolfssl/wolfcrypt/cpuid.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/wolfcrypt/src/cpuid.c b/wolfcrypt/src/cpuid.c index cc360a3c1..09b265122 100644 --- a/wolfcrypt/src/cpuid.c +++ b/wolfcrypt/src/cpuid.c @@ -108,4 +108,19 @@ cpuid_set_flags(); return cpuid_flags; } + + void cpuid_select_flags(word32 flags) + { + cpuid_flags = flags; + } + + void cpuid_set_flag(word32 flag) + { + cpuid_flags |= flag; + } + + void cpuid_clear_flag(word32 flag) + { + cpuid_flags &= ~flag; + } #endif diff --git a/wolfssl/wolfcrypt/cpuid.h b/wolfssl/wolfcrypt/cpuid.h index 912a01085..c0ca22882 100644 --- a/wolfssl/wolfcrypt/cpuid.h +++ b/wolfssl/wolfcrypt/cpuid.h @@ -54,6 +54,11 @@ void cpuid_set_flags(void); word32 cpuid_get_flags(void); + + /* Public APIs to modify flags. */ + WOLFSSL_API void cpuid_select_flags(word32 flags); + WOLFSSL_API void cpuid_set_flag(word32 flag); + WOLFSSL_API void cpuid_clear_flag(word32 flag); #endif #ifdef __cplusplus