27 {
return GetBlockCipher().AlgorithmName() + std::string(
"/GCM");}
29 {
return GetBlockCipher().MinKeyLength();}
31 {
return GetBlockCipher().MaxKeyLength();}
33 {
return GetBlockCipher().DefaultKeyLength();}
35 {
return GetBlockCipher().GetValidKeyLength(n);}
37 {
return GetBlockCipher().IsValidKeyLength(n);}
50 {
return (W64LIT(1)<<61)-1;}
52 {
return ((W64LIT(1)<<39)-256)/8;}
56 bool AuthenticationIsOnPlaintext()
const 58 unsigned int AuthenticationBlockSize()
const 59 {
return HASH_BLOCKSIZE;}
60 void SetKeyWithoutResync(
const byte *userKey,
size_t keylength,
const NameValuePairs ¶ms);
61 void Resync(
const byte *iv,
size_t len);
62 size_t AuthenticateBlocks(
const byte *data,
size_t len);
63 void AuthenticateLastHeaderBlock();
64 void AuthenticateLastConfidentialBlock();
65 void AuthenticateLastFooterBlock(byte *mac,
size_t macSize);
71 const BlockCipher & GetBlockCipher()
const {
return const_cast<GCM_Base *
>(
this)->AccessBlockCipher();};
72 byte *HashBuffer() {
return m_buffer+REQUIRED_BLOCKSIZE;}
73 byte *HashKey() {
return m_buffer+2*REQUIRED_BLOCKSIZE;}
74 byte *MulTable() {
return m_buffer+3*REQUIRED_BLOCKSIZE;}
75 inline void ReverseHashBufferIfNeeded();
80 void IncrementCounterBy256();
84 static word16 s_reductionTable[256];
85 static volatile bool s_reductionTableInitialized;
86 enum {REQUIRED_BLOCKSIZE = 16, HASH_BLOCKSIZE = 16};
97 template <
class T_BlockCipher, GCM_TablesOption T_TablesOption,
bool T_IsEncryption>
101 static std::string StaticAlgorithmName()
102 {
return T_BlockCipher::StaticAlgorithmName() + std::string(
"/GCM");}
104 {
return T_IsEncryption;}
108 BlockCipher & AccessBlockCipher() {
return m_cipher;}
109 typename T_BlockCipher::Encryption m_cipher;
118 template <
class T_BlockCipher, GCM_TablesOption T_TablesOption=GCM_2K_Tables>
CCM block cipher mode of operation.
unsigned int MaxIVLength() const
returns maximal length of IVs accepted by this object
unsigned int MinIVLength() const
returns minimal length of IVs accepted by this object
Class file for modes of operation.
lword MaxHeaderLength() const
the maximum length of AAD that can be input before the encrypted data
size_t MinKeyLength() const
Returns smallest valid key length in bytes.
Provides Encryption and Decryption typedefs used by derived classes to implement an authenticated enc...
Interface for one direction (encryption or decryption) of a block cipher.
unsigned int DigestSize() const
Provides the digest size of the hash.
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode...
The GCM mode of operation.
size_t MaxKeyLength() const
Returns largest valid key length in bytes.
size_t DefaultKeyLength() const
Returns default (recommended) key length in bytes.
bool IsForwardTransformation() const
Determines if the cipher is being operated in its forward direction.
lword MaxMessageLength() const
the maximum length of encrypted data
size_t GetValidKeyLength(size_t n) const
IV_Requirement
Provides IV requirements as an enumerated value.
GCM_TablesOption
Use either 2K or 64K size tables.
std::string AlgorithmName() const
Provides the name of this algorithm.
IV_Requirement IVRequirement() const
returns the minimal requirement for secure IVs
Crypto++ library namespace.
Class specific methods used to operate the cipher.
unsigned int IVSize() const
Returns length of the IV accepted by this object.
bool IsValidKeyLength(size_t n) const
Returns whether keylength is a valid key length.
Base classes for working with authenticated encryption modes of encryption.
Interface for retrieving values given their names.