summaryrefslogtreecommitdiff
path: root/serpent.cpp
diff options
context:
space:
mode:
authorweidai <weidai11@users.noreply.github.com>2003-03-25 02:05:32 +0000
committerweidai <weidai11@users.noreply.github.com>2003-03-25 02:05:32 +0000
commita7d2ffa2b3d5148f28ef1232d11b2b2ad5068d77 (patch)
tree1bd722986de9a92ae89a51cdbc25a36617db4a80 /serpent.cpp
parentcafc368766d46e27038d7e87a53c57db342ae697 (diff)
downloadcryptopp-git-a7d2ffa2b3d5148f28ef1232d11b2b2ad5068d77.tar.gz
fix for possible bug on 64-bit platforms
Diffstat (limited to 'serpent.cpp')
-rw-r--r--serpent.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/serpent.cpp b/serpent.cpp
index bc0cb891..5cef12d0 100644
--- a/serpent.cpp
+++ b/serpent.cpp
@@ -428,13 +428,12 @@ void Serpent::Base::UncheckedSetKey(CipherDir direction, const byte *userKey, un
word32 *k = m_key;
GetUserKey(LITTLE_ENDIAN_ORDER, k, 8, userKey, keylen);
- word32 i,a,b,c,d,e;
-
if (keylen < 32)
k[keylen/4] |= word32(1) << ((keylen%4)*8);
k += 8;
word32 t = k[-1];
+ signed int i;
for (i = 0; i < 132; ++i)
k[i] = t = rotlFixed(k[i-8] ^ k[i-5] ^ k[i-3] ^ t ^ 0x9e3779b9 ^ i, 11);
k -= 20;
@@ -451,6 +450,7 @@ void Serpent::Base::UncheckedSetKey(CipherDir direction, const byte *userKey, un
k[(8-r)*4 + 6] = c; \
k[(8-r)*4 + 7] = d;} \
+ word32 a,b,c,d,e;
for (i=0; i<4; i++)
{
afterS2(LK); afterS2(S3); afterS3(SK);