Improve constant propagation of fix for Issue 146
parent
ab393851ec
commit
50e5c14c18
12
rijndael.cpp
12
rijndael.cpp
|
|
@ -388,10 +388,12 @@ void Rijndael::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock
|
||||||
t3 = rk[7];
|
t3 = rk[7];
|
||||||
rk += 8;
|
rk += 8;
|
||||||
|
|
||||||
// timing attack countermeasure. see comments at top for more details
|
// timing attack countermeasure. see comments at top for more details.
|
||||||
|
// also see http://github.com/weidai11/cryptopp/issues/146
|
||||||
const int cacheLineSize = GetCacheLineSize();
|
const int cacheLineSize = GetCacheLineSize();
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
volatile word32 u = 0;
|
volatile word32 _u = 0;
|
||||||
|
word32 u = _u;
|
||||||
#if defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS) || defined(CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS)
|
#if defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS) || defined(CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS)
|
||||||
for (i=0; i<2048; i+=cacheLineSize)
|
for (i=0; i<2048; i+=cacheLineSize)
|
||||||
#else
|
#else
|
||||||
|
|
@ -464,10 +466,12 @@ void Rijndael::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock
|
||||||
t3 = rk[7];
|
t3 = rk[7];
|
||||||
rk += 8;
|
rk += 8;
|
||||||
|
|
||||||
// timing attack countermeasure. see comments at top for more details
|
// timing attack countermeasure. see comments at top for more details.
|
||||||
|
// also see http://github.com/weidai11/cryptopp/issues/146
|
||||||
const int cacheLineSize = GetCacheLineSize();
|
const int cacheLineSize = GetCacheLineSize();
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
volatile word32 u = 0;
|
volatile word32 _u = 0;
|
||||||
|
word32 u = _u;
|
||||||
#if defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS) || defined(CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS)
|
#if defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS) || defined(CRYPTOPP_ALLOW_RIJNDAEL_UNALIGNED_DATA_ACCESS)
|
||||||
for (i=0; i<2048; i+=cacheLineSize)
|
for (i=0; i<2048; i+=cacheLineSize)
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue