diff options
author | weidai <weidai11@users.noreply.github.com> | 2007-04-16 00:21:07 +0000 |
---|---|---|
committer | weidai <weidai11@users.noreply.github.com> | 2007-04-16 00:21:07 +0000 |
commit | 5cad605559f973f2ce7d5ede1e6b67151f8e1d51 (patch) | |
tree | 6cc6caeba741b13cbc0cf5498d1c957f97451bf3 /seal.cpp | |
parent | 199c7960213d94682913e72de0e3f6d04f575a8b (diff) | |
download | cryptopp-git-5cad605559f973f2ce7d5ede1e6b67151f8e1d51.tar.gz |
optimizations
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) { |