wake.h

00001 #ifndef CRYPTOPP_WAKE_H
00002 #define CRYPTOPP_WAKE_H
00003 
00004 #include "seckey.h"
00005 #include "secblock.h"
00006 #include "strciphr.h"
00007 
00008 NAMESPACE_BEGIN(CryptoPP)
00009 
00010 //! _
00011 template <class B = BigEndian>
00012 struct WAKE_CFB_Info : public FixedKeyLength<32>
00013 {
00014         static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-CFB-LE" : "WAKE-CFB-BE";}
00015 };
00016 
00017 //! _
00018 template <class B = BigEndian>
00019 struct WAKE_OFB_Info : public FixedKeyLength<32>
00020 {
00021         static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";}
00022 };
00023 
00024 class CRYPTOPP_NO_VTABLE WAKE_Base
00025 {
00026 protected:
00027         word32 M(word32 x, word32 y);
00028         void GenKey(word32 k0, word32 k1, word32 k2, word32 k3);
00029 
00030         word32 t[257];
00031         word32 r3, r4, r5, r6;
00032 };
00033 
00034 template <class B = BigEndian>
00035 class CRYPTOPP_NO_VTABLE WAKE_Policy
00036                                 : public CFB_CipherConcretePolicy<word32, 1>
00037                                 , public AdditiveCipherConcretePolicy<word32, 1, 64>
00038                                 , protected WAKE_Base
00039 {
00040 protected:
00041         void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
00042         // CFB
00043         byte * GetRegisterBegin() {return (byte *)&r6;}
00044         void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount);
00045         // OFB
00046         void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
00047         bool IsRandomAccess() const {return false;}
00048 };
00049 
00050 //! <a href="http://www.weidai.com/scan-mirror/cs.html#WAKE-CFB-BE">WAKE-CFB-BE</a>
00051 template <class B = BigEndian>
00052 struct WAKE_CFB : public WAKE_CFB_Info<B>, public SymmetricCipherDocumentation
00053 {
00054         typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, CFB_EncryptionTemplate<> >,  WAKE_CFB_Info<B> > Encryption;
00055         typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, CFB_DecryptionTemplate<> >,  WAKE_CFB_Info<B> > Decryption;
00056 };
00057 
00058 //! WAKE-OFB
00059 template <class B = BigEndian>
00060 struct WAKE_OFB : public WAKE_OFB_Info<B>, public SymmetricCipherDocumentation
00061 {
00062         typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, AdditiveCipherTemplate<> >,  WAKE_OFB_Info<B> > Encryption;
00063         typedef Encryption Decryption;
00064 };
00065 
00066 /*
00067 template <class B = BigEndian>
00068 class WAKE_ROFB_Policy : public WAKE_Policy<B>
00069 {
00070 protected:
00071         void Iterate(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount);
00072 };
00073 
00074 template <class B = BigEndian>
00075 struct WAKE_ROFB : public WAKE_Info<B>
00076 {
00077         typedef SymmetricCipherTemplate<ConcretePolicyHolder<AdditiveCipherTemplate<>, WAKE_ROFB_Policy<B> > > Encryption;
00078         typedef Encryption Decryption;
00079 };
00080 */
00081 
00082 NAMESPACE_END
00083 
00084 #endif

Generated on Sat Dec 23 02:07:11 2006 for Crypto++ by  doxygen 1.5.1-p1