|
1 |
| -// strciphr.cpp - originally written and placed in the public domain by Wei Dai |
2 |
| - |
3 |
| -// TODO: Figure out what is happening in ProcessData. The issue surfaced |
4 |
| -// for CFB_CipherTemplate<BASE>::ProcessData when we cut-in Cryptogams |
5 |
| -// AES ARMv7 asm. Then again in AdditiveCipherTemplate<S>::ProcessData |
6 |
| -// for CTR mode with HIGHT, which is a 64-bit block cipher. In both cases, |
7 |
| -// inString == outString leads to incorrect results. We think it relates |
8 |
| -// to aliasing violations because inString == outString. |
9 |
| -// |
10 |
| -// Also see https://github.com/weidai11/cryptopp/issues/683, |
11 |
| -// https://github.com/weidai11/cryptopp/issues/1010 and |
12 |
| -// https://github.com/weidai11/cryptopp/issues/1088. |
| 1 | +// strciphr.cpp - originally written and placed in the public domain by Wei Dai. |
13 | 2 |
|
14 | 3 | #include "pch.h"
|
15 | 4 |
|
@@ -76,17 +65,6 @@ void AdditiveCipherTemplate<S>::GenerateBlock(byte *outString, size_t length)
|
76 | 65 | }
|
77 | 66 | }
|
78 | 67 |
|
79 |
| -// TODO: Figure out what is happening in ProcessData. The issue surfaced |
80 |
| -// for CFB_CipherTemplate<BASE>::ProcessData when we cut-in Cryptogams |
81 |
| -// AES ARMv7 asm. Then again in AdditiveCipherTemplate<S>::ProcessData |
82 |
| -// for CTR mode with HIGHT, which is a 64-bit block cipher. In both cases, |
83 |
| -// inString == outString leads to incorrect results. We think it relates |
84 |
| -// to aliasing violations because inString == outString. |
85 |
| -// |
86 |
| -// Also see https://github.com/weidai11/cryptopp/issues/683, |
87 |
| -// https://github.com/weidai11/cryptopp/issues/1010 and |
88 |
| -// https://github.com/weidai11/cryptopp/issues/1088. |
89 |
| - |
90 | 68 | template <class S>
|
91 | 69 | void AdditiveCipherTemplate<S>::ProcessData(byte *outString, const byte *inString, size_t length)
|
92 | 70 | {
|
@@ -121,10 +99,6 @@ void AdditiveCipherTemplate<S>::ProcessData(byte *outString, const byte *inStrin
|
121 | 99 | KeystreamOperation operation = KeystreamOperation(flags);
|
122 | 100 | policy.OperateKeystream(operation, outString, inString, iterations);
|
123 | 101 |
|
124 |
| - // Try to tame the optimizer. This is GH #683, #1010, and #1088. |
125 |
| - volatile byte* unused = const_cast<volatile byte*>(outString); |
126 |
| - CRYPTOPP_UNUSED(unused); |
127 |
| - |
128 | 102 | inString = PtrAdd(inString, iterations * bytesPerIteration);
|
129 | 103 | outString = PtrAdd(outString, iterations * bytesPerIteration);
|
130 | 104 | length -= iterations * bytesPerIteration;
|
@@ -206,17 +180,6 @@ void CFB_CipherTemplate<BASE>::Resynchronize(const byte *iv, int length)
|
206 | 180 | m_leftOver = policy.GetBytesPerIteration();
|
207 | 181 | }
|
208 | 182 |
|
209 |
| -// TODO: Figure out what is happening in ProcessData. The issue surfaced |
210 |
| -// for CFB_CipherTemplate<BASE>::ProcessData when we cut-in Cryptogams |
211 |
| -// AES ARMv7 asm. Then again in AdditiveCipherTemplate<S>::ProcessData |
212 |
| -// for CTR mode with HIGHT, which is a 64-bit block cipher. In both cases, |
213 |
| -// inString == outString leads to incorrect results. We think it relates |
214 |
| -// to aliasing violations because inString == outString. |
215 |
| -// |
216 |
| -// Also see https://github.com/weidai11/cryptopp/issues/683, |
217 |
| -// https://github.com/weidai11/cryptopp/issues/1010 and |
218 |
| -// https://github.com/weidai11/cryptopp/issues/1088. |
219 |
| - |
220 | 183 | template <class BASE>
|
221 | 184 | void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString, size_t length)
|
222 | 185 | {
|
@@ -249,10 +212,6 @@ void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString
|
249 | 212 | CipherDir cipherDir = GetCipherDir(*this);
|
250 | 213 | policy.Iterate(outString, inString, cipherDir, length / bytesPerIteration);
|
251 | 214 |
|
252 |
| - // Try to tame the optimizer. This is GH #683, #1010, and #1088. |
253 |
| - volatile byte* unused = const_cast<volatile byte*>(outString); |
254 |
| - CRYPTOPP_UNUSED(unused); |
255 |
| - |
256 | 215 | const size_t remainder = length % bytesPerIteration;
|
257 | 216 | inString = PtrAdd(inString, length - remainder);
|
258 | 217 | outString = PtrAdd(outString, length - remainder);
|
|
0 commit comments