diff options
author | Jack Lloyd <[email protected]> | 2015-11-29 02:45:49 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-11-29 02:45:49 -0500 |
commit | ebf2164a972517ee405428d9d0641fe296aba745 (patch) | |
tree | b60831471a37219902d5d6a165b03700f550a402 /src/lib/utils/cpuid.h | |
parent | 0bc108a29fd2e7ff6fe992ea8e6c56a5cde27e34 (diff) |
Improve side channel attack resistance of table based AES impl
Diffstat (limited to 'src/lib/utils/cpuid.h')
-rw-r--r-- | src/lib/utils/cpuid.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/lib/utils/cpuid.h b/src/lib/utils/cpuid.h index 36c301c2f..3781b6f8e 100644 --- a/src/lib/utils/cpuid.h +++ b/src/lib/utils/cpuid.h @@ -27,12 +27,27 @@ class BOTAN_DLL CPUID /** * Return a best guess of the cache line size */ - static size_t cache_line_size() { initialize(); return g_cache_line_size; } + static size_t cache_line_size() + { + if(!g_initialized) + { + initialize(); + } + return g_cache_line_size; + } /** * Check if the processor supports AltiVec/VMX */ - static bool has_altivec() { initialize(); return g_altivec_capable; } + static bool has_altivec() + { + if(!g_initialized) + { + initialize(); + } + + return g_altivec_capable; + } /** * Check if the processor supports RDTSC |