summaryrefslogtreecommitdiff
path: root/twofish.cpp
diff options
context:
space:
mode:
authorweidai <weidai11@users.noreply.github.com>2010-06-18 01:52:34 +0000
committerweidai <weidai11@users.noreply.github.com>2010-06-18 01:52:34 +0000
commit03cfaa0e4614c6cc66ffd7c473a853597fd79919 (patch)
tree4eed69d5867429e79628ab0c386092e5eb9ec1d7 /twofish.cpp
parent8af9520702f19e037458d3059ee0fafef2643875 (diff)
downloadcryptopp-git-03cfaa0e4614c6cc66ffd7c473a853597fd79919.tar.gz
avoid SecBlock of arrays
Diffstat (limited to 'twofish.cpp')
-rw-r--r--twofish.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/twofish.cpp b/twofish.cpp
index e78258d3..064f16c4 100644
--- a/twofish.cpp
+++ b/twofish.cpp
@@ -72,15 +72,15 @@ void Twofish::Base::UncheckedSetKey(const byte *userKey, unsigned int keylength,
for (i=0; i<256; i++)
{
word32 t = h0(i, svec, len);
- m_s[0][i] = mds[0][GETBYTE(t, 0)];
- m_s[1][i] = mds[1][GETBYTE(t, 1)];
- m_s[2][i] = mds[2][GETBYTE(t, 2)];
- m_s[3][i] = mds[3][GETBYTE(t, 3)];
+ m_s[0*256+i] = mds[0][GETBYTE(t, 0)];
+ m_s[1*256+i] = mds[1][GETBYTE(t, 1)];
+ m_s[2*256+i] = mds[2][GETBYTE(t, 2)];
+ m_s[3*256+i] = mds[3][GETBYTE(t, 3)];
}
}
-#define G1(x) (m_s[0][GETBYTE(x,0)] ^ m_s[1][GETBYTE(x,1)] ^ m_s[2][GETBYTE(x,2)] ^ m_s[3][GETBYTE(x,3)])
-#define G2(x) (m_s[0][GETBYTE(x,3)] ^ m_s[1][GETBYTE(x,0)] ^ m_s[2][GETBYTE(x,1)] ^ m_s[3][GETBYTE(x,2)])
+#define G1(x) (m_s[0*256+GETBYTE(x,0)] ^ m_s[1*256+GETBYTE(x,1)] ^ m_s[2*256+GETBYTE(x,2)] ^ m_s[3*256+GETBYTE(x,3)])
+#define G2(x) (m_s[0*256+GETBYTE(x,3)] ^ m_s[1*256+GETBYTE(x,0)] ^ m_s[2*256+GETBYTE(x,1)] ^ m_s[3*256+GETBYTE(x,2)])
#define ENCROUND(n, a, b, c, d) \
x = G1 (a); y = G2 (b); \