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.

44 lines
1.4 KiB

  1. #ifndef CRYPTOPP_SEAL_H
  2. #define CRYPTOPP_SEAL_H
  3. #include "strciphr.h"
  4. NAMESPACE_BEGIN(CryptoPP)
  5. //! _
  6. template <class B = BigEndian>
  7. struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV, 4>
  8. {
  9. static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";}
  10. };
  11. template <class B = BigEndian>
  12. class CRYPTOPP_NO_VTABLE SEAL_Policy : public AdditiveCipherConcretePolicy<word32, 256>, public SEAL_Info<B>
  13. {
  14. protected:
  15. void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
  16. void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
  17. void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length);
  18. bool CipherIsRandomAccess() const {return true;}
  19. void SeekToIteration(lword iterationCount);
  20. private:
  21. FixedSizeSecBlock<word32, 512> m_T;
  22. FixedSizeSecBlock<word32, 256> m_S;
  23. SecBlock<word32> m_R;
  24. word32 m_startCount, m_iterationsPerCount;
  25. word32 m_outsideCounter, m_insideCounter;
  26. };
  27. //! <a href="http://www.weidai.com/scan-mirror/cs.html#SEAL-3.0-BE">SEAL</a>
  28. template <class B = BigEndian>
  29. struct SEAL : public SEAL_Info<B>, public SymmetricCipherDocumentation
  30. {
  31. typedef SymmetricCipherFinal<ConcretePolicyHolder<SEAL_Policy<B>, AdditiveCipherTemplate<> >, SEAL_Info<B> > Encryption;
  32. typedef Encryption Decryption;
  33. };
  34. NAMESPACE_END
  35. #endif