Crypto++
8.2
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
¶ms);
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
39
FixedSizeSecBlock<word32, 8>
m_key;
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
:
57
typedef
BlockCipherFinal<ENCRYPTION, Enc>
Encryption
;
58
typedef
BlockCipherFinal<DECRYPTION, Dec>
Decryption
;
59
};
60
61
typedef
GOST::Encryption
GOSTEncryption
;
62
typedef
GOST::Decryption
GOSTDecryption
;
63
64
NAMESPACE_END
65
66
#endif
GOST
GOST block cipher.
Definition:
gost.h:24
secblock.h
Classes and functions for secure memory allocations.
FixedBlockSize
Inherited by algorithms with fixed block size.
Definition:
seckey.h:40
BlockCipherImpl
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition:
seckey.h:305
GOST_Info
GOST block cipher information.
Definition:
gost.h:16
FixedKeyLength
Inherited by keyed algorithms with fixed key length.
Definition:
seckey.h:124
BlockCipherDocumentation
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher.
Definition:
seckey.h:398
seckey.h
Classes and functions for implementing secret key algorithms.
BlockCipherFinal< ENCRYPTION, Enc >
FixedSizeSecBlock< word32, 8 >
CryptoPP
Crypto++ library namespace.
NameValuePairs
Interface for retrieving values given their names.
Definition:
cryptlib.h:293
Generated on Tue Feb 18 2020 04:05:19 for Crypto++ by
1.8.17