From deea52fd3b8059dc61d503d4a125d85cb4e2cc81 Mon Sep 17 00:00:00 2001 From: weidai Date: Thu, 17 Oct 2002 16:32:28 +0000 Subject: bug fixes and KAT for X9.17 RNG --- modes.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'modes.cpp') 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; } } -- cgit v1.2.1