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.

40 lines
1.3 KiB

  1. #ifndef CRYPTOPP_SOSEMANUK_H
  2. #define CRYPTOPP_SOSEMANUK_H
  3. #include "strciphr.h"
  4. NAMESPACE_BEGIN(CryptoPP)
  5. //! algorithm info
  6. struct SosemanukInfo : public VariableKeyLength<16, 1, 32, 1, SimpleKeyingInterface::UNIQUE_IV, 16>
  7. {
  8. static const char * StaticAlgorithmName() {return "Sosemanuk";}
  9. };
  10. //! _
  11. class SosemanukPolicy : public AdditiveCipherConcretePolicy<word32, 20>, public SosemanukInfo
  12. {
  13. protected:
  14. void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
  15. void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
  16. void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
  17. bool CipherIsRandomAccess() const {return false;}
  18. #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64
  19. unsigned int GetAlignment() const;
  20. unsigned int GetOptimalBlockSize() const;
  21. #endif
  22. FixedSizeSecBlock<word32, 25*4> m_key;
  23. FixedSizeAlignedSecBlock<word32, 12> m_state;
  24. };
  25. //! <a href="http://www.cryptolounge.org/wiki/Sosemanuk">Sosemanuk</a>
  26. struct Sosemanuk : public SosemanukInfo, public SymmetricCipherDocumentation
  27. {
  28. typedef SymmetricCipherFinal<ConcretePolicyHolder<SosemanukPolicy, AdditiveCipherTemplate<> >, SosemanukInfo> Encryption;
  29. typedef Encryption Decryption;
  30. };
  31. NAMESPACE_END
  32. #endif