Crypto++
5.6.5
Free C++ class library of cryptographic schemes
|
Go to the documentation of this file.
32 {
return GetBlockCipher().AlgorithmName() + std::string(
"/GCM");}
34 {
return GetBlockCipher().MinKeyLength();}
36 {
return GetBlockCipher().MaxKeyLength();}
38 {
return GetBlockCipher().DefaultKeyLength();}
40 {
return GetBlockCipher().GetValidKeyLength(n);}
42 {
return GetBlockCipher().IsValidKeyLength(n);}
55 {
return (W64LIT(1)<<61)-1;}
57 {
return ((W64LIT(1)<<39)-256)/8;}
61 bool AuthenticationIsOnPlaintext()
const
63 unsigned int AuthenticationBlockSize()
const
64 {
return HASH_BLOCKSIZE;}
65 void SetKeyWithoutResync(
const byte *userKey,
size_t keylength,
const NameValuePairs ¶ms);
66 void Resync(
const byte *iv,
size_t len);
67 size_t AuthenticateBlocks(
const byte *data,
size_t len);
68 void AuthenticateLastHeaderBlock();
69 void AuthenticateLastConfidentialBlock();
70 void AuthenticateLastFooterBlock(
byte *mac,
size_t macSize);
76 const BlockCipher & GetBlockCipher()
const {
return const_cast<GCM_Base *
>(
this)->AccessBlockCipher();};
77 byte *HashBuffer() {
return m_buffer+REQUIRED_BLOCKSIZE;}
78 byte *HashKey() {
return m_buffer+2*REQUIRED_BLOCKSIZE;}
79 byte *MulTable() {
return m_buffer+3*REQUIRED_BLOCKSIZE;}
80 inline void ReverseHashBufferIfNeeded();
85 void IncrementCounterBy256();
89 static word16 s_reductionTable[256];
90 static volatile bool s_reductionTableInitialized;
91 enum {REQUIRED_BLOCKSIZE = 16, HASH_BLOCKSIZE = 16};
100 template <
class T_BlockCipher, GCM_TablesOption T_TablesOption,
bool T_IsEncryption>
104 static std::string StaticAlgorithmName()
105 {
return T_BlockCipher::StaticAlgorithmName() + std::string(
"/GCM");}
107 {
return T_IsEncryption;}
111 BlockCipher & AccessBlockCipher() {
return m_cipher;}
112 typename T_BlockCipher::Encryption m_cipher;
123 template <
class T_BlockCipher, GCM_TablesOption T_TablesOption=GCM_2K_Tables>
unsigned int MinIVLength() const
Provides the minimum size of an IV.
Class file for modes of operation.
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode.
Provides Encryption and Decryption typedefs used by derived classes to implement an authenticated enc...
bool IsForwardTransformation() const
Determines if the cipher is being operated in its forward direction.
unsigned int IVSize() const
Returns length of the IV accepted by this object.
@ UNIQUE_IV
The IV must be unique.
bool IsValidKeyLength(size_t n) const
Returns whether keylength is a valid key length.
GCM block cipher final implementation.
IV_Requirement
Secure IVs requirements as enumerated values.
lword MaxHeaderLength() const
Provides the maximum length of AAD that can be input.
size_t MinKeyLength() const
Returns smallest valid key length in bytes.
size_t GetValidKeyLength(size_t n) const
Base classes for working with authenticated encryption modes of encryption.
Base implementation for one direction (encryption or decryption) of a stream cipher or block cipher m...
GCM_TablesOption
GCM table size options.
unsigned int DigestSize() const
Provides the digest size of the hash.
std::string AlgorithmName() const
Provides the name of this algorithm.
GCM block cipher base implementation.
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
Crypto++ library namespace.
GCM block cipher mode of operation.
size_t DefaultKeyLength() const
Returns default (recommended) key length in bytes.
unsigned int MaxIVLength() const
Provides the maximum size of an IV.
Interface for one direction (encryption or decryption) of a block cipher.
@ GCM_64K_Tables
Use a table with 64K entries.
lword MaxMessageLength() const
Provides the maximum length of encrypted data.
Interface for retrieving values given their names.
size_t MaxKeyLength() const
Returns largest valid key length in bytes.
@ GCM_2K_Tables
Use a table with 2K entries.