Crypto++  5.6.3
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 //! _
16 template <class B = BigEndian>
17 struct WAKE_OFB_Info : public FixedKeyLength<32>
18 {
19  static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";}
20 };
21 
22 class CRYPTOPP_NO_VTABLE WAKE_Base
23 {
24 protected:
25  word32 M(word32 x, word32 y);
26  void GenKey(word32 k0, word32 k1, word32 k2, word32 k3);
27 
28  word32 t[257];
29  word32 r3, r4, r5, r6;
30 };
31 
32 template <class B = BigEndian>
33 class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy<word32, 1, 64>, protected WAKE_Base
34 {
35 protected:
36  void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
37  // OFB
38  void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
39  bool CipherIsRandomAccess() const {return false;}
40 };
41 
42 //! WAKE-OFB
43 template <class B = BigEndian>
45 {
47  typedef Encryption Decryption;
48 };
49 
50 /*
51 template <class B = BigEndian>
52 class WAKE_ROFB_Policy : public WAKE_Policy<B>
53 {
54 protected:
55  void Iterate(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount);
56 };
57 
58 template <class B = BigEndian>
59 struct WAKE_ROFB : public WAKE_Info<B>
60 {
61  typedef SymmetricCipherTemplate<ConcretePolicyHolder<AdditiveCipherTemplate<>, WAKE_ROFB_Policy<B> > > Encryption;
62  typedef Encryption Decryption;
63 };
64 */
65 
66 NAMESPACE_END
67 
68 #endif
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:117
Converts a typename to an enumerated value.
Definition: cryptlib.h:115
WAKE-OFB.
Definition: wake.h:44
byte order is little-endian
Definition: cryptlib.h:125
Classes and functions for secure memory allocations.
Definition: wake.h:22
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:1089
Provides Encryption and Decryption typedefs used by derived classes to implement a symmetric cipher...
Definition: seckey.h:412
Crypto++ library namespace.
Interface for retrieving values given their names.
Definition: cryptlib.h:277