diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-04-16 00:21:07 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2007-04-16 00:21:07 +0000 |
commit | 62538e2cf788783be55bd43b262c6a8a565176b7 (patch) | |
tree | 6cc6caeba741b13cbc0cf5498d1c957f97451bf3 /seal.cpp | |
parent | 5a439a5b05aadca7502541c3d0e487f4365c57d3 (diff) | |
download | cryptopp-62538e2cf788783be55bd43b262c6a8a565176b7.tar.gz |
optimizations
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@301 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'seal.cpp')
-rw-r--r-- | seal.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -71,7 +71,7 @@ void SEAL_Policy<B>::CipherSetKey(const NameValuePairs ¶ms, const byte *key, template <class B> void SEAL_Policy<B>::CipherResynchronize(byte *keystreamBuffer, const byte *IV) { - m_outsideCounter = IV ? UnalignedGetWord<word32>(BIG_ENDIAN_ORDER, IV) : 0; + m_outsideCounter = IV ? GetWord<word32>(false, BIG_ENDIAN_ORDER, IV) : 0; m_startCount = m_outsideCounter; m_insideCounter = 0; } @@ -86,7 +86,6 @@ void SEAL_Policy<B>::SeekToIteration(lword iterationCount) template <class B> void SEAL_Policy<B>::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) { - KeystreamOutput<B> keystreamOutput(operation, output, input); word32 a, b, c, d, n1, n2, n3, n4; unsigned int p, q; @@ -175,10 +174,13 @@ void SEAL_Policy<B>::OperateKeystream(KeystreamOperation operation, byte *output d = rotrFixed(d, 9U); a += Ttab(q); - keystreamOutput (b + m_S[4*i+0]) - (c ^ m_S[4*i+1]) - (d + m_S[4*i+2]) - (a ^ m_S[4*i+3]); +#define SEAL_OUTPUT(x) \ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 0, b + m_S[4*i+0]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 1, c ^ m_S[4*i+1]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 2, d + m_S[4*i+2]);\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 3, a ^ m_S[4*i+3]); + + CRYPTOPP_KEYSTREAM_OUTPUT_SWITCH(SEAL_OUTPUT, 4*4); if (i & 1) { |