summaryrefslogtreecommitdiff
path: root/chacha.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-11-04 15:35:34 -0500
committerJeffrey Walton <noloader@gmail.com>2018-11-04 15:35:34 -0500
commit6cc763939e6089584c1a8e939d390e2a82619887 (patch)
tree9b532fb5e24705fbbbf55f343ea87440a4513c28 /chacha.cpp
parent29be6ed97a86380dc1cb472afcdf2cc9b5706509 (diff)
downloadcryptopp-git-6cc763939e6089584c1a8e939d390e2a82619887.tar.gz
Skip unneeded wrap check in SIMD book keeping (GH #732)
Diffstat (limited to 'chacha.cpp')
-rw-r--r--chacha.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/chacha.cpp b/chacha.cpp
index 6dac12a1..6a5f50f2 100644
--- a/chacha.cpp
+++ b/chacha.cpp
@@ -171,9 +171,10 @@ void ChaCha_Policy::OperateKeystream(KeystreamOperation operation,
const bool xorInput = (operation & INPUT_NULL) != INPUT_NULL;
ChaCha_OperateKeystream_SSE2(m_state, xorInput ? input : NULLPTR, output, m_rounds);
+ // MultiBlockSafe avoids overflow on the counter words
m_state[12] += 4;
- if (m_state[12] < 4)
- m_state[13]++;
+ //if (m_state[12] < 4)
+ // m_state[13]++;
input += (!!xorInput)*4*BYTES_PER_ITERATION;
output += 4*BYTES_PER_ITERATION;
@@ -190,9 +191,10 @@ void ChaCha_Policy::OperateKeystream(KeystreamOperation operation,
const bool xorInput = (operation & INPUT_NULL) != INPUT_NULL;
ChaCha_OperateKeystream_NEON(m_state, xorInput ? input : NULLPTR, output, m_rounds);
+ // MultiBlockSafe avoids overflow on the counter words
m_state[12] += 4;
- if (m_state[12] < 4)
- m_state[13]++;
+ //if (m_state[12] < 4)
+ // m_state[13]++;
input += (!!xorInput)*4*BYTES_PER_ITERATION;
output += 4*BYTES_PER_ITERATION;
@@ -209,9 +211,10 @@ void ChaCha_Policy::OperateKeystream(KeystreamOperation operation,
const bool xorInput = (operation & INPUT_NULL) != INPUT_NULL;
ChaCha_OperateKeystream_POWER8(m_state, xorInput ? input : NULLPTR, output, m_rounds);
+ // MultiBlockSafe avoids overflow on the counter words
m_state[12] += 4;
- if (m_state[12] < 4)
- m_state[13]++;
+ //if (m_state[12] < 4)
+ // m_state[13]++;
input += (!!xorInput)*4*BYTES_PER_ITERATION;
output += 4*BYTES_PER_ITERATION;