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.

68 lines
1.9 KiB

  1. #ifndef CRYPTOPP_RIJNDAEL_H
  2. #define CRYPTOPP_RIJNDAEL_H
  3. /** \file
  4. */
  5. #include "seckey.h"
  6. #include "secblock.h"
  7. NAMESPACE_BEGIN(CryptoPP)
  8. //! _
  9. struct Rijndael_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
  10. {
  11. CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return CRYPTOPP_RIJNDAEL_NAME;}
  12. };
  13. /// <a href="http://www.weidai.com/scan-mirror/cs.html#Rijndael">Rijndael</a>
  14. class CRYPTOPP_DLL Rijndael : public Rijndael_Info, public BlockCipherDocumentation
  15. {
  16. class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Rijndael_Info>
  17. {
  18. public:
  19. void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
  20. protected:
  21. static void FillEncTable();
  22. static void FillDecTable();
  23. // VS2005 workaround: have to put these on seperate lines, or error C2487 is triggered in DLL build
  24. static const byte Se[256];
  25. static const byte Sd[256];
  26. static const word32 rcon[];
  27. unsigned int m_rounds;
  28. FixedSizeAlignedSecBlock<word32, 4*15> m_key;
  29. };
  30. class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base
  31. {
  32. public:
  33. void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
  34. #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86
  35. size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
  36. #endif
  37. };
  38. class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base
  39. {
  40. public:
  41. void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
  42. #if CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE
  43. size_t AdvancedProcessBlocks(const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const;
  44. #endif
  45. };
  46. public:
  47. typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
  48. typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
  49. };
  50. typedef Rijndael::Encryption RijndaelEncryption;
  51. typedef Rijndael::Decryption RijndaelDecryption;
  52. NAMESPACE_END
  53. #endif