Team Fortress 2 Source Code as on 22/4/2020
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.

48 lines
1.2 KiB

  1. // camellia.h - written and placed in the public domain by Wei Dai
  2. //! \file camellia.h
  3. //! \brief Classes for the Cameliia block cipher
  4. #ifndef CRYPTOPP_CAMELLIA_H
  5. #define CRYPTOPP_CAMELLIA_H
  6. #include "config.h"
  7. #include "seckey.h"
  8. #include "secblock.h"
  9. NAMESPACE_BEGIN(CryptoPP)
  10. //! _
  11. struct Camellia_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
  12. {
  13. static const char *StaticAlgorithmName() {return "Camellia";}
  14. };
  15. /// <a href="http://www.weidai.com/scan-mirror/cs.html#Camellia">Camellia</a>
  16. class Camellia : public Camellia_Info, public BlockCipherDocumentation
  17. {
  18. class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Camellia_Info>
  19. {
  20. public:
  21. void UncheckedSetKey(const byte *key, unsigned int keylen, const NameValuePairs &params);
  22. void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
  23. protected:
  24. static const byte s1[256];
  25. static const word32 SP[4][256];
  26. unsigned int m_rounds;
  27. SecBlock<word32> m_key;
  28. };
  29. public:
  30. typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
  31. typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
  32. };
  33. typedef Camellia::Encryption CamelliaEncryption;
  34. typedef Camellia::Decryption CamelliaDecryption;
  35. NAMESPACE_END
  36. #endif