diff options
author | Jack Lloyd <[email protected]> | 2015-12-02 07:00:52 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-12-02 07:00:52 -0500 |
commit | df64cbd15097321c51582cf0a11af0f6121b0dd4 (patch) | |
tree | a58c64ade24244dd8cffe25542b6c666d7534893 /src/build-data/buildh.in | |
parent | e3db054e582c676e6f2752e216fa03fa408b3dff (diff) |
Avoid ever returning 0 from CPUID::cache_line_size
Take the value from build.h if we have no way of getting it dynamically.
Fixes an infinite loop in AES on non-x86 introduced in ebf2164a,
as otherwise it does for(size_t i = 0; i != ...; i += 0) {}
while iterating over the TE tables.
Diffstat (limited to 'src/build-data/buildh.in')
-rw-r--r-- | src/build-data/buildh.in | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index 49ef89146..8b950177f 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -184,6 +184,17 @@ #define BOTAN_TARGET_CPU_HAS_KNOWN_ENDIANNESS #endif +/* +* If no way of dynamically determining the cache line size for the +* system exists, this value is used as the default. Used by the side +* channel countermeasures rather than for alignment purposes, so it is +* better to be on the smaller side if the exact value cannot be +* determined. Typically 32 or 64 bytes on modern CPUs. +*/ +#if !defined(BOTAN_TARGET_CPU_DEFAULT_CACHE_LINE_SIZE) + #define BOTAN_TARGET_CPU_DEFAULT_CACHE_LINE_SIZE 32 +#endif + %{target_compiler_defines} #if defined(_MSC_VER) |