From 17704afa2bb77b0bbcee2e3df9abfcda662ee64a Mon Sep 17 00:00:00 2001 From: weidai Date: Sun, 15 Apr 2007 22:59:12 +0000 Subject: move MD2, MD4, MD5, PanamaHash, WAKE_CFB into the namespace 'Weak' git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@284 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- wake.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'wake.cpp') diff --git a/wake.cpp b/wake.cpp index 2ada966..504c2d3 100644 --- a/wake.cpp +++ b/wake.cpp @@ -7,8 +7,8 @@ NAMESPACE_BEGIN(CryptoPP) void WAKE_TestInstantiations() { - WAKE_CFB<>::Encryption x1; - WAKE_CFB<>::Decryption x3; + Weak::WAKE_CFB<>::Encryption x1; + Weak::WAKE_CFB<>::Decryption x3; WAKE_OFB<>::Encryption x2; WAKE_OFB<>::Decryption x4; } @@ -85,16 +85,21 @@ void WAKE_Policy::Iterate(byte *output, const byte *input, CipherDir dir, siz template void WAKE_Policy::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) { - KeystreamOutput keystreamOperation(operation, output, input); - - while (iterationCount--) - { - keystreamOperation(r6); - r3 = M(r3, r6); - r4 = M(r4, r3); - r5 = M(r5, r4); - r6 = M(r6, r5); +#define WAKE_OUTPUT(x)\ + while (iterationCount--)\ + {\ + CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 0, r6);\ + r3 = M(r3, r6);\ + r4 = M(r4, r3);\ + r5 = M(r5, r4);\ + r6 = M(r6, r5);\ + output += 4;\ + if (x == XOR_KEYSTREAM)\ + input += 4;\ } + + typedef word32 WordType; + CRYPTOPP_KEYSTREAM_OUTPUT_SWITCH(WAKE_OUTPUT, 0); } /* template -- cgit v1.2.1