File indexing completed on 2025-01-18 09:55:03
0001
0002
0003
0004
0005
0006 #ifndef CRYPTOPP_GOST_H
0007 #define CRYPTOPP_GOST_H
0008
0009 #include "seckey.h"
0010 #include "secblock.h"
0011
0012 NAMESPACE_BEGIN(CryptoPP)
0013
0014
0015
0016 struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32>
0017 {
0018 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "GOST";}
0019 };
0020
0021
0022
0023
0024 class GOST : public GOST_Info, public BlockCipherDocumentation
0025 {
0026
0027 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<GOST_Info>
0028 {
0029 public:
0030 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms);
0031
0032 protected:
0033 static void PrecalculateSTable();
0034
0035 static const byte sBox[8][16];
0036 static volatile bool sTableCalculated;
0037 static word32 sTable[4][256];
0038
0039 FixedSizeSecBlock<word32, 8> m_key;
0040 };
0041
0042
0043 class CRYPTOPP_NO_VTABLE Enc : public Base
0044 {
0045 public:
0046 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0047 };
0048
0049
0050 class CRYPTOPP_NO_VTABLE Dec : public Base
0051 {
0052 public:
0053 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0054 };
0055
0056 public:
0057 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
0058 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
0059 };
0060
0061 typedef GOST::Encryption GOSTEncryption;
0062 typedef GOST::Decryption GOSTDecryption;
0063
0064 NAMESPACE_END
0065
0066 #endif