diff options
author | weidai <weidai11@users.noreply.github.com> | 2010-06-18 01:52:34 +0000 |
---|---|---|
committer | weidai <weidai11@users.noreply.github.com> | 2010-06-18 01:52:34 +0000 |
commit | 03cfaa0e4614c6cc66ffd7c473a853597fd79919 (patch) | |
tree | 4eed69d5867429e79628ab0c386092e5eb9ec1d7 /twofish.cpp | |
parent | 8af9520702f19e037458d3059ee0fafef2643875 (diff) | |
download | cryptopp-git-03cfaa0e4614c6cc66ffd7c473a853597fd79919.tar.gz |
avoid SecBlock of arrays
Diffstat (limited to 'twofish.cpp')
-rw-r--r-- | twofish.cpp | 12 |
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); \ |