summaryrefslogtreecommitdiff
path: root/serpent.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-03-25 02:05:32 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-03-25 02:05:32 +0000
commitd1302bdf601282b27a681b121b2663841db92353 (patch)
tree1bd722986de9a92ae89a51cdbc25a36617db4a80 /serpent.cpp
parent4ed22328d6c493079eda8b860d1112381cf26d87 (diff)
downloadcryptopp-d1302bdf601282b27a681b121b2663841db92353.tar.gz
fix for possible bug on 64-bit platforms
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@52 57ff6487-cd31-0410-9ec3-f628ee90f5f0
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 bc0cb89..5cef12d 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);