From e25de4a78b6d860f1f740d9b130ed7536bdae949 Mon Sep 17 00:00:00 2001 From: weidai Date: Tue, 4 Feb 2003 00:40:24 +0000 Subject: [PATCH] Seek() bug fix --- modes.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modes.cpp b/modes.cpp index a517c719..e573d3ce 100644 --- a/modes.cpp +++ b/modes.cpp @@ -63,9 +63,9 @@ void CipherModeBase::SetIV(const byte *iv) void CTR_ModePolicy::SeekToIteration(dword iterationCount) { int carry=0; - for (int i=BlockSize()-1; i>=0 && (iterationCount || carry); i--) + for (int i=BlockSize()-1; i>=0; i--) { - unsigned int sum = m_counterArray[i] + byte(iterationCount) + carry; + unsigned int sum = m_register[i] + byte(iterationCount) + carry; m_counterArray[i] = (byte) sum; carry = sum >> 8; iterationCount >>= 8;