File indexing completed on 2025-10-29 08:40:08
0001 
0002 
0003 
0004 
0005 
0006 #ifndef CRYPTOPP_WAKE_H
0007 #define CRYPTOPP_WAKE_H
0008 
0009 #include "seckey.h"
0010 #include "secblock.h"
0011 #include "strciphr.h"
0012 
0013 NAMESPACE_BEGIN(CryptoPP)
0014 
0015 
0016 
0017 
0018 template <class B = BigEndian>
0019 struct WAKE_OFB_Info : public FixedKeyLength<32>
0020 {
0021     CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";}
0022 };
0023 
0024 class CRYPTOPP_NO_VTABLE WAKE_Base
0025 {
0026 protected:
0027     word32 M(word32 x, word32 y);
0028     void GenKey(word32 k0, word32 k1, word32 k2, word32 k3);
0029 
0030     word32 t[257];
0031     word32 r3, r4, r5, r6;
0032 };
0033 
0034 
0035 
0036 
0037 template <class B = BigEndian>
0038 class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy<word32, 1, 64>, protected WAKE_Base
0039 {
0040 protected:
0041     void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
0042     
0043     void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
0044     bool CipherIsRandomAccess() const {return false;}
0045 };
0046 
0047 
0048 
0049 
0050 template <class B = BigEndian>
0051 struct WAKE_OFB : public WAKE_OFB_Info<B>, public SymmetricCipherDocumentation
0052 {
0053     typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, AdditiveCipherTemplate<> >,  WAKE_OFB_Info<B> > Encryption;
0054     typedef Encryption Decryption;
0055 };
0056 
0057 NAMESPACE_END
0058 
0059 #endif