00001
00002
00003
00004
00005
00006 #ifndef CRYPTOPP_GOST_H
00007 #define CRYPTOPP_GOST_H
00008
00009 #include "seckey.h"
00010 #include "secblock.h"
00011
00012 NAMESPACE_BEGIN(CryptoPP)
00013
00014
00015 struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32>
00016 {
00017 static const char *StaticAlgorithmName() {return "GOST";}
00018 };
00019
00020
00021 class GOST : public GOST_Info, public BlockCipherDocumentation
00022 {
00023 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<GOST_Info>
00024 {
00025 public:
00026 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms);
00027
00028 protected:
00029 static void PrecalculateSTable();
00030
00031 static const byte sBox[8][16];
00032 static volatile bool sTableCalculated;
00033 static word32 sTable[4][256];
00034
00035 FixedSizeSecBlock<word32, 8> key;
00036 };
00037
00038 class CRYPTOPP_NO_VTABLE Enc : public Base
00039 {
00040 public:
00041 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00042 };
00043
00044 class CRYPTOPP_NO_VTABLE Dec : public Base
00045 {
00046 public:
00047 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00048 };
00049
00050 public:
00051 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
00052 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
00053 };
00054
00055 typedef GOST::Encryption GOSTEncryption;
00056 typedef GOST::Decryption GOSTDecryption;
00057
00058 NAMESPACE_END
00059
00060 #endif