mirror of
https://abf.rosa.ru/djam/cryptopp.git
synced 2025-02-23 16:02:47 +00:00
43 lines
1.6 KiB
Diff
43 lines
1.6 KiB
Diff
From 50e5c14c18671726d23479b5e0cadc4224100259 Mon Sep 17 00:00:00 2001
|
|
From: Jeffrey Walton <noloader@gmail.com>
|
|
Date: Thu, 7 Apr 2016 19:20:33 -0400
|
|
Subject: [PATCH] Improve constant propagation of fix for Issue 146
|
|
|
|
---
|
|
rijndael.cpp | 12 ++++++++----
|
|
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/rijndael.cpp b/rijndael.cpp
|
|
index 92f9dea..ab9f70a 100644
|
|
--- a/rijndael.cpp
|
|
+++ b/rijndael.cpp
|
|
@@ -388,10 +388,12 @@ void Rijndael::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock
|
|
t3 = rk[7];
|
|
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();
|
|
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)
|
|
for (i=0; i<2048; i+=cacheLineSize)
|
|
#else
|
|
@@ -464,10 +466,12 @@ void Rijndael::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock
|
|
t3 = rk[7];
|
|
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();
|
|
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)
|
|
for (i=0; i<2048; i+=cacheLineSize)
|
|
#else
|