Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.6 KiB

  1. #ifndef CRYPTOPP_WAKE_H
  2. #define CRYPTOPP_WAKE_H
  3. #include "seckey.h"
  4. #include "secblock.h"
  5. #include "strciphr.h"
  6. NAMESPACE_BEGIN(CryptoPP)
  7. //! _
  8. template <class B = BigEndian>
  9. struct WAKE_OFB_Info : public FixedKeyLength<32>
  10. {
  11. static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";}
  12. };
  13. class CRYPTOPP_NO_VTABLE WAKE_Base
  14. {
  15. protected:
  16. word32 M(word32 x, word32 y);
  17. void GenKey(word32 k0, word32 k1, word32 k2, word32 k3);
  18. word32 t[257];
  19. word32 r3, r4, r5, r6;
  20. };
  21. template <class B = BigEndian>
  22. class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy<word32, 1, 64>, protected WAKE_Base
  23. {
  24. protected:
  25. void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
  26. // OFB
  27. void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
  28. bool CipherIsRandomAccess() const {return false;}
  29. };
  30. //! WAKE-OFB
  31. template <class B = BigEndian>
  32. struct WAKE_OFB : public WAKE_OFB_Info<B>, public SymmetricCipherDocumentation
  33. {
  34. typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, AdditiveCipherTemplate<> >, WAKE_OFB_Info<B> > Encryption;
  35. typedef Encryption Decryption;
  36. };
  37. /*
  38. template <class B = BigEndian>
  39. class WAKE_ROFB_Policy : public WAKE_Policy<B>
  40. {
  41. protected:
  42. void Iterate(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount);
  43. };
  44. template <class B = BigEndian>
  45. struct WAKE_ROFB : public WAKE_Info<B>
  46. {
  47. typedef SymmetricCipherTemplate<ConcretePolicyHolder<AdditiveCipherTemplate<>, WAKE_ROFB_Policy<B> > > Encryption;
  48. typedef Encryption Decryption;
  49. };
  50. */
  51. NAMESPACE_END
  52. #endif