Crypto++
|
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_OFB_Info : public FixedKeyLength<32> 00013 { 00014 static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";} 00015 }; 00016 00017 class CRYPTOPP_NO_VTABLE WAKE_Base 00018 { 00019 protected: 00020 word32 M(word32 x, word32 y); 00021 void GenKey(word32 k0, word32 k1, word32 k2, word32 k3); 00022 00023 word32 t[257]; 00024 word32 r3, r4, r5, r6; 00025 }; 00026 00027 template <class B = BigEndian> 00028 class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy<word32, 1, 64>, protected WAKE_Base 00029 { 00030 protected: 00031 void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); 00032 // OFB 00033 void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount); 00034 bool CipherIsRandomAccess() const {return false;} 00035 }; 00036 00037 //! WAKE-OFB 00038 template <class B = BigEndian> 00039 struct WAKE_OFB : public WAKE_OFB_Info<B>, public SymmetricCipherDocumentation 00040 { 00041 typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, AdditiveCipherTemplate<> >, WAKE_OFB_Info<B> > Encryption; 00042 typedef Encryption Decryption; 00043 }; 00044 00045 /* 00046 template <class B = BigEndian> 00047 class WAKE_ROFB_Policy : public WAKE_Policy<B> 00048 { 00049 protected: 00050 void Iterate(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount); 00051 }; 00052 00053 template <class B = BigEndian> 00054 struct WAKE_ROFB : public WAKE_Info<B> 00055 { 00056 typedef SymmetricCipherTemplate<ConcretePolicyHolder<AdditiveCipherTemplate<>, WAKE_ROFB_Policy<B> > > Encryption; 00057 typedef Encryption Decryption; 00058 }; 00059 */ 00060 00061 NAMESPACE_END 00062 00063 #endif