From 69fb6c7fd8f5f591b38bb134567ea0786182b0ca Mon Sep 17 00:00:00 2001 From: weidai Date: Mon, 17 Jul 2006 14:48:59 +0000 Subject: AES timing attack countermeasures git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@226 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- config.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'config.h') diff --git a/config.h b/config.h index 4517ea8..f031510 100644 --- a/config.h +++ b/config.h @@ -48,6 +48,9 @@ #define PREFER_BERKELEY_STYLE_SOCKETS // #define PREFER_WINDOWS_STYLE_SOCKETS +// set the name of Rijndael cipher, was "Rijndael" before version 5.3 +#define CRYPTOPP_RIJNDAEL_NAME "AES" + // ***************** Important Settings Again ******************** // But the defaults should be ok. @@ -155,6 +158,20 @@ const unsigned int WORD_BITS = WORD_SIZE * 8; #define FAST_ROTATE #endif +#ifndef CRYPTOPP_L1_CACHE_LINE_SIZE + // This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks. + // L1 cache line size is 32 on Pentium III and earlier + #define CRYPTOPP_L1_CACHE_LINE_SIZE 32 +#endif + +#ifndef CRYPTOPP_L1_CACHE_ALIGN + #ifdef _MSC_VER + #define CRYPTOPP_L1_CACHE_ALIGN(x) __declspec(align(CRYPTOPP_L1_CACHE_LINE_SIZE)) x + #elif defined(__GNUC__) + #define CRYPTOPP_L1_CACHE_ALIGN(x) x __attribute__((aligned(CRYPTOPP_L1_CACHE_LINE_SIZE))) + #endif +#endif + NAMESPACE_END // VC60 workaround: it doesn't allow typename in some places -- cgit v1.2.1