Crypto++  5.6.5
Free C++ class library of cryptographic schemes
wake.h
Go to the documentation of this file.
1 // wake.h - written and placed in the public domain by Wei Dai
2 
3 //! \file wake.h
4 //! \brief Classes for WAKE stream cipher
5 
6 #ifndef CRYPTOPP_WAKE_H
7 #define CRYPTOPP_WAKE_H
8 
9 #include "seckey.h"
10 #include "secblock.h"
11 #include "strciphr.h"
12 
13 NAMESPACE_BEGIN(CryptoPP)
14 
15 //! \class WAKE_OFB_Info
16 //! \brief WAKE stream cipher information
17 //! \tparam B Endianess of the stream cipher
18 //! \since Crypto++ 1.0
19 template <class B = BigEndian>
20 struct WAKE_OFB_Info : public FixedKeyLength<32>
21 {
22  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";}
23 };
24 
25 class CRYPTOPP_NO_VTABLE WAKE_Base
26 {
27 protected:
28  word32 M(word32 x, word32 y);
29  void GenKey(word32 k0, word32 k1, word32 k2, word32 k3);
30 
31  word32 t[257];
32  word32 r3, r4, r5, r6;
33 };
34 
35 //! \class WAKE_Policy
36 //! \brief WAKE stream cipher operation
37 //! \tparam B Endianess of the stream cipher
38 //! \since Crypto++ 1.0
39 template <class B = BigEndian>
40 class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy<word32, 1, 64>, protected WAKE_Base
41 {
42 protected:
43  void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
44  // OFB
45  void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
46  bool CipherIsRandomAccess() const {return false;}
47 };
48 
49 //! \class WAKE_OFB
50 //! \brief WAKE stream cipher
51 //! \tparam B Endianess of the stream cipher
52 //! \since Crypto++ 1.0
53 template <class B = BigEndian>
55 {
57  typedef Encryption Decryption;
58 };
59 
60 /*
61 template <class B = BigEndian>
62 class WAKE_ROFB_Policy : public WAKE_Policy<B>
63 {
64 protected:
65  void Iterate(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount);
66 };
67 
68 template <class B = BigEndian>
69 struct WAKE_ROFB : public WAKE_Info<B>
70 {
71  typedef SymmetricCipherTemplate<ConcretePolicyHolder<AdditiveCipherTemplate<>, WAKE_ROFB_Policy<B> > > Encryption;
72  typedef Encryption Decryption;
73 };
74 */
75 
76 NAMESPACE_END
77 
78 #endif
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:127
Base class for additive stream ciphers.
Definition: strciphr.h:186
Converts an enumeration to a type suitable for use as a template parameter.
Definition: cryptlib.h:116
WAKE stream cipher.
Definition: wake.h:54
byte order is little-endian
Definition: cryptlib.h:126
Classes and functions for secure memory allocations.
Definition: wake.h:25
Classes and functions for implementing secret key algorithms.
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode...
Definition: cryptlib.h:1103
virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount)=0
Operates the keystream.
WAKE stream cipher operation.
Definition: wake.h:40
Classes for implementing stream ciphers.
Provides Encryption and Decryption typedefs used by derived classes to implement a symmetric cipher...
Definition: seckey.h:424
WAKE stream cipher information.
Definition: wake.h:20
KeystreamOperation
Keystream operation flags.
Definition: strciphr.h:90
Crypto++ library namespace.
SymmetricCipher implementation.
Definition: strciphr.h:584
Base class for additive stream ciphers with SymmetricCipher interface.
Definition: strciphr.h:267
Interface for retrieving values given their names.
Definition: cryptlib.h:279