aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-07-27 13:29:32 +0000
committerlloyd <[email protected]>2010-07-27 13:29:32 +0000
commitafa1f82524d11574f19a713b16fe2809b4665db4 (patch)
tree76837831edbca7c02a60e6cfe8469886e03a4c58 /src
parent0cbb71fc33ac56c584bdd4574082a974e79d67f1 (diff)
Add support in CPUID for detecting PCMULUDQ and MOVBE instructions.
Rename CPUID::has_aes_intel to has_aes_ni.
Diffstat (limited to 'src')
-rw-r--r--src/engine/aes_isa_eng/aes_isa_engine.cpp2
-rw-r--r--src/utils/cpuid.h22
2 files changed, 19 insertions, 5 deletions
diff --git a/src/engine/aes_isa_eng/aes_isa_engine.cpp b/src/engine/aes_isa_eng/aes_isa_engine.cpp
index 682dfe6b1..7f541d583 100644
--- a/src/engine/aes_isa_eng/aes_isa_engine.cpp
+++ b/src/engine/aes_isa_eng/aes_isa_engine.cpp
@@ -19,7 +19,7 @@ AES_ISA_Engine::find_block_cipher(const SCAN_Name& request,
Algorithm_Factory&) const
{
#if defined(BOTAN_HAS_AES_INTEL)
- if(CPUID::has_aes_intel())
+ if(CPUID::has_aes_ni())
{
if(request.algo_name() == "AES-128")
return new AES_128_Intel;
diff --git a/src/utils/cpuid.h b/src/utils/cpuid.h
index 6339a0117..6cb4092bb 100644
--- a/src/utils/cpuid.h
+++ b/src/utils/cpuid.h
@@ -65,10 +65,22 @@ class BOTAN_DLL CPUID
{ return x86_processor_flags_has(CPUID_AVX_BIT); }
/**
- * Check if the processor supports Intel's AES instructions
+ * Check if the processor supports AES-NI
*/
- static bool has_aes_intel()
- { return x86_processor_flags_has(CPUID_INTEL_AES_BIT); }
+ static bool has_aes_ni()
+ { return x86_processor_flags_has(CPUID_AESNI_BIT); }
+
+ /**
+ * Check if the processor supports PCMULUDQ
+ */
+ static bool has_pcmuludq()
+ { return x86_processor_flags_has(CPUID_PCMUL_BIT); }
+
+ /**
+ * Check if the processor supports MOVBE
+ */
+ static bool has_movbe()
+ { return x86_processor_flags_has(CPUID_MOVBE_BIT); }
/**
* Check if the processor supports AltiVec/VMX
@@ -78,10 +90,12 @@ class BOTAN_DLL CPUID
enum CPUID_bits {
CPUID_RDTSC_BIT = 4,
CPUID_SSE2_BIT = 26,
+ CPUID_PCMUL_BIT = 33,
CPUID_SSSE3_BIT = 41,
CPUID_SSE41_BIT = 51,
CPUID_SSE42_BIT = 52,
- CPUID_INTEL_AES_BIT = 57,
+ CPUID_MOVBE_BIT = 54,
+ CPUID_AESNI_BIT = 57,
CPUID_AVX_BIT = 60
};