summaryrefslogtreecommitdiff
path: root/seal.cpp
diff options
context:
space:
mode:
authorweidai <weidai11@users.noreply.github.com>2007-04-16 00:21:07 +0000
committerweidai <weidai11@users.noreply.github.com>2007-04-16 00:21:07 +0000
commit5cad605559f973f2ce7d5ede1e6b67151f8e1d51 (patch)
tree6cc6caeba741b13cbc0cf5498d1c957f97451bf3 /seal.cpp
parent199c7960213d94682913e72de0e3f6d04f575a8b (diff)
downloadcryptopp-git-5cad605559f973f2ce7d5ede1e6b67151f8e1d51.tar.gz
optimizations
Diffstat (limited to 'seal.cpp')
-rw-r--r--seal.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/seal.cpp b/seal.cpp
index f240b50a..196965f8 100644
--- a/seal.cpp
+++ b/seal.cpp
@@ -71,7 +71,7 @@ void SEAL_Policy<B>::CipherSetKey(const NameValuePairs &params, 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)
{