summaryrefslogtreecommitdiff
path: root/modes.cpp
diff options
context:
space:
mode:
authorweidai <weidai11@users.noreply.github.com>2002-10-17 16:32:28 +0000
committerweidai <weidai11@users.noreply.github.com>2002-10-17 16:32:28 +0000
commitdeea52fd3b8059dc61d503d4a125d85cb4e2cc81 (patch)
treee508ea100a61e22b1f3d56c3aa2b4479e93da51e /modes.cpp
parent0e0049180df954f341fa056797c92916950c3e58 (diff)
downloadcryptopp-git-deea52fd3b8059dc61d503d4a125d85cb4e2cc81.tar.gz
bug fixes and KAT for X9.17 RNG
Diffstat (limited to 'modes.cpp')
-rw-r--r--modes.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/modes.cpp b/modes.cpp
index 1b5f8538..a517c719 100644
--- a/modes.cpp
+++ b/modes.cpp
@@ -144,11 +144,11 @@ void BlockOrientedCipherModeBase::ProcessData(byte *outString, const byte *inStr
unsigned int s = BlockSize();
assert(length % s == 0);
unsigned int alignment = m_cipher->BlockAlignment();
- bool requireAlignedInput = RequireAlignedInput();
+ bool inputAlignmentOk = !RequireAlignedInput() || IsAlignedOn(inString, alignment);
if (IsAlignedOn(outString, alignment))
{
- if (!requireAlignedInput || IsAlignedOn(inString, alignment))
+ if (inputAlignmentOk)
ProcessBlocks(outString, inString, length / s);
else
{
@@ -160,7 +160,7 @@ void BlockOrientedCipherModeBase::ProcessData(byte *outString, const byte *inStr
{
while (length)
{
- if (!requireAlignedInput || IsAlignedOn(inString, alignment))
+ if (inputAlignmentOk)
ProcessBlocks(m_buffer, inString, 1);
else
{
@@ -168,6 +168,8 @@ void BlockOrientedCipherModeBase::ProcessData(byte *outString, const byte *inStr
ProcessBlocks(m_buffer, m_buffer, 1);
}
memcpy(outString, m_buffer, s);
+ inString += s;
+ outString += s;
length -= s;
}
}