diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2010-06-18 01:52:34 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2010-06-18 01:52:34 +0000 |
commit | 7cfef38e643e3371dd0e194526433665e8afe265 (patch) | |
tree | 4eed69d5867429e79628ab0c386092e5eb9ec1d7 /twofish.cpp | |
parent | 32ca65cd301bf4ff0159b028d87b0caa51962690 (diff) | |
download | cryptopp-7cfef38e643e3371dd0e194526433665e8afe265.tar.gz |
avoid SecBlock of arrays
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@485 57ff6487-cd31-0410-9ec3-f628ee90f5f0
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 e78258d..064f16c 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); \ |