diff options
-rw-r--r-- | doc/examples/cpuid.cpp | 1 | ||||
-rw-r--r-- | src/utils/cpuid.h | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/doc/examples/cpuid.cpp b/doc/examples/cpuid.cpp index 6d4cc7593..bd81e417b 100644 --- a/doc/examples/cpuid.cpp +++ b/doc/examples/cpuid.cpp @@ -42,5 +42,6 @@ int main() print_if_feature("RDTSC", CPUID::has_rdtsc()); print_if_feature("PCMUL", CPUID::has_pcmuludq()); print_if_feature("AES-NI", CPUID::has_aes_ni()); + print_if_feature("RDRND", CPUID::has_rdrand()); print_if_feature("MOVBE", CPUID::has_movbe()); } diff --git a/src/utils/cpuid.h b/src/utils/cpuid.h index 863ba5b63..ad85ac4fe 100644 --- a/src/utils/cpuid.h +++ b/src/utils/cpuid.h @@ -83,6 +83,12 @@ class BOTAN_DLL CPUID { return x86_processor_flags_has(CPUID_MOVBE_BIT); } /** + * Check if the processor supports RDRAND + */ + static bool has_rdrand() + { return x86_processor_flags_has(CPUID_RDRAND_BIT); } + + /** * Check if the processor supports AltiVec/VMX */ static bool has_altivec() { return altivec_capable; } @@ -96,7 +102,8 @@ class BOTAN_DLL CPUID CPUID_SSE42_BIT = 52, CPUID_MOVBE_BIT = 54, CPUID_AESNI_BIT = 57, - CPUID_AVX_BIT = 60 + CPUID_AVX_BIT = 60, + CPUID_RDRAND_BIT = 61 }; static bool x86_processor_flags_has(u64bit bit) |