Crypto++  8.8
Free C++ class library of cryptographic schemes
gost.h
Go to the documentation of this file.
1 // gost.h - originally written and placed in the public domain by Wei Dai
2 
3 /// \file gost.h
4 /// \brief Classes for the GIST block cipher
5 
6 #ifndef CRYPTOPP_GOST_H
7 #define CRYPTOPP_GOST_H
8 
9 #include "seckey.h"
10 #include "secblock.h"
11 
12 NAMESPACE_BEGIN(CryptoPP)
13 
14 /// \brief GOST block cipher information
15 /// \since Crypto++ 2.1
16 struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32>
17 {
18  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "GOST";}
19 };
20 
21 /// \brief GOST block cipher
22 /// \sa <a href="http://www.cryptopp.com/wiki/GOST">GOST</a>
23 /// \since Crypto++ 2.1
24 class GOST : public GOST_Info, public BlockCipherDocumentation
25 {
26  /// \brief GOST block cipher default operation
27  class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<GOST_Info>
28  {
29  public:
30  void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs &params);
31 
32  protected:
33  static void PrecalculateSTable();
34 
35  static const byte sBox[8][16];
36  static volatile bool sTableCalculated;
37  static word32 sTable[4][256];
38 
40  };
41 
42  /// \brief GOST block cipher encryption operation
43  class CRYPTOPP_NO_VTABLE Enc : public Base
44  {
45  public:
46  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
47  };
48 
49  /// \brief GOST block cipher decryption operation
50  class CRYPTOPP_NO_VTABLE Dec : public Base
51  {
52  public:
53  void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
54  };
55 
56 public:
59 };
60 
63 
64 NAMESPACE_END
65 
66 #endif
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:306
Inherited by algorithms with fixed block size.
Definition: seckey.h:41
Inherited by keyed algorithms with fixed key length.
Definition: seckey.h:125
GOST block cipher.
Definition: gost.h:25
Interface for retrieving values given their names.
Definition: cryptlib.h:327
unsigned int word32
32-bit unsigned datatype
Definition: config_int.h:72
Crypto++ library namespace.
Classes and functions for secure memory allocations.
Classes and functions for implementing secret key algorithms.
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher.
Definition: seckey.h:399
GOST block cipher information.
Definition: gost.h:17