From 9f335d719ebc27f58251559240de0077ec42c583 Mon Sep 17 00:00:00 2001 From: Pierre Lestringant <plt@amossys.fr> Date: Wed, 6 Apr 2016 15:51:17 +0200 Subject: [PATCH] Fix the Rijndael timing attack counter measure --- rijndael.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rijndael.cpp b/rijndael.cpp index f394960..92f9dea 100644 --- a/rijndael.cpp +++ b/rijndael.cpp @@ -391,7 +391,7 @@ void Rijndael::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock // timing attack countermeasure. see comments at top for more details const int cacheLineSize = GetCacheLineSize(); unsigned int i; - word32 u = 0; + volatile word32 u = 0; #if defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS) || defined(CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS) for (i=0; i<2048; i+=cacheLineSize) #else @@ -467,7 +467,7 @@ void Rijndael::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock // timing attack countermeasure. see comments at top for more details const int cacheLineSize = GetCacheLineSize(); unsigned int i; - word32 u = 0; + volatile word32 u = 0; #if defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS) || defined(CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS) for (i=0; i<2048; i+=cacheLineSize) #else