summaryrefslogtreecommitdiff
path: root/strciphr.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-11-04 14:21:54 -0500
committerJeffrey Walton <noloader@gmail.com>2018-11-04 14:21:54 -0500
commit40fa6873f9581146d377b4acd379d04fcd0eaa0a (patch)
treeb04c2444d8c20c72612fa9007999fd738f832e17 /strciphr.cpp
parentf7c0fab5b2d90b384f9a3002f8e780dd4fe29906 (diff)
downloadcryptopp-git-40fa6873f9581146d377b4acd379d04fcd0eaa0a.tar.gz
Add ability to Seek64 in test framework (GH #732)
Also see https://github.com/randombit/botan/pull/1728
Diffstat (limited to 'strciphr.cpp')
-rw-r--r--strciphr.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/strciphr.cpp b/strciphr.cpp
index 194f6f1d..1ccb0670 100644
--- a/strciphr.cpp
+++ b/strciphr.cpp
@@ -76,8 +76,6 @@ void AdditiveCipherTemplate<S>::ProcessData(byte *outString, const byte *inStrin
length -= len; m_leftOver -= len;
inString = PtrAdd(inString, len);
outString = PtrAdd(outString, len);
-
- if (!length) {return;}
}
PolicyInterface &policy = this->AccessPolicy();
@@ -93,8 +91,6 @@ void AdditiveCipherTemplate<S>::ProcessData(byte *outString, const byte *inStrin
inString = PtrAdd(inString, iterations * bytesPerIteration);
outString = PtrAdd(outString, iterations * bytesPerIteration);
length -= iterations * bytesPerIteration;
-
- if (!length) {return;}
}
size_t bufferByteSize = m_buffer.size();
@@ -134,7 +130,7 @@ template <class BASE>
void AdditiveCipherTemplate<BASE>::Seek(lword position)
{
PolicyInterface &policy = this->AccessPolicy();
- unsigned int bytesPerIteration = policy.GetBytesPerIteration();
+ word32 bytesPerIteration = policy.GetBytesPerIteration();
policy.SeekToIteration(position / bytesPerIteration);
position %= bytesPerIteration;
@@ -142,7 +138,7 @@ void AdditiveCipherTemplate<BASE>::Seek(lword position)
if (position > 0)
{
policy.WriteKeystream(PtrSub(KeystreamBufferEnd(), bytesPerIteration), 1);
- m_leftOver = bytesPerIteration - (unsigned int)position;
+ m_leftOver = bytesPerIteration - static_cast<word32>(position);
}
else
m_leftOver = 0;
@@ -179,7 +175,7 @@ void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString
CRYPTOPP_ASSERT(length % this->MandatoryBlockSize() == 0);
PolicyInterface &policy = this->AccessPolicy();
- unsigned int bytesPerIteration = policy.GetBytesPerIteration();
+ word32 bytesPerIteration = policy.GetBytesPerIteration();
byte *reg = policy.GetRegisterBegin();
if (m_leftOver)
@@ -190,8 +186,6 @@ void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString
m_leftOver -= len; length -= len;
inString = PtrAdd(inString, len);
outString = PtrAdd(outString, len);
-
- if (!length) {return;}
}
// TODO: Figure out what is happening on ARM A-32. x86, Aarch64 and PowerPC are OK.
@@ -204,8 +198,8 @@ void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString
// Also see https://github.com/weidai11/cryptopp/issues/683.
//
// UPDATE: It appears the issue is related to alignment checks. When we made
- // the alignment check result volatile GCC and Clang stopped
- // short-circuiting the transform, which is what we wanted. I suspect
+ // the alignment check result volatile GCC and Clang stopped short-
+ // circuiting the transform, which is what we wanted. I suspect
// there's a little more to the issue, but we can enable the block again.
const unsigned int alignment = policy.GetAlignment();