23 : m_digestSize(0), m_L(0), m_messageLength(0), m_aadLength(0) {}
27 {
return GetBlockCipher().AlgorithmName() + std::string(
"/CCM");}
29 {
return GetBlockCipher().MinKeyLength();}
31 {
return GetBlockCipher().MaxKeyLength();}
33 {
return GetBlockCipher().DefaultKeyLength();}
35 {
return GetBlockCipher().GetValidKeyLength(keylength);}
37 {
return GetBlockCipher().IsValidKeyLength(keylength);}
39 {
return GetBlockCipher().OptimalDataAlignment();}
49 {
return m_digestSize;}
56 void UncheckedSpecifyDataLengths(
lword headerLength,
lword messageLength,
lword footerLength);
63 {
return GetBlockCipher().BlockSize();}
64 void SetKeyWithoutResync(
const byte *userKey,
size_t keylength,
const NameValuePairs ¶ms);
65 void Resync(
const byte *iv,
size_t len);
66 size_t AuthenticateBlocks(
const byte *
data,
size_t len);
67 void AuthenticateLastHeaderBlock();
68 void AuthenticateLastConfidentialBlock();
69 void AuthenticateLastFooterBlock(
byte *mac,
size_t macSize);
73 virtual int DefaultDigestSize()
const =0;
78 enum {REQUIRED_BLOCKSIZE = 16};
79 int m_digestSize,
m_L;
90 template <
class T_BlockCipher,
int T_DefaultDigestSize,
bool T_IsEncryption>
95 {
return T_BlockCipher::StaticAlgorithmName() + std::string(
"/CCM");}
97 {
return T_IsEncryption;}
113 template <
class T_BlockCipher,
int T_DefaultDigestSize = 16>
std::string AlgorithmName() const
Provides the name of this algorithm.
unsigned int AuthenticationBlockSize() const
bool AuthenticationIsOnPlaintext() const
unsigned int MinIVLength() const
Provides the minimum size of an IV.
SymmetricCipher & AccessSymmetricCipher()
Class file for modes of operation.
unsigned int MaxIVLength() const
Provides the maximum size of an IV.
BlockCipher & AccessBlockCipher()
#define NAMESPACE_BEGIN(x)
CCM block cipher mode of operation.
T_BlockCipher::Encryption m_cipher
Provides Encryption and Decryption typedefs used by derived classes to implement an authenticated enc...
int DefaultDigestSize() const
CCM_Final< T_BlockCipher, T_DefaultDigestSize, true > Encryption
CTR_Mode_ExternalCipher::Encryption m_ctr
Interface for one direction (encryption or decryption) of a block cipher.
unsigned int IVSize() const
Returns length of the IV accepted by this object.
bool IsValidKeyLength(size_t keylength) const
Returns whether keylength is a valid key length.
size_t DefaultKeyLength() const
Returns default key length.
bool NeedsPrespecifiedDataLengths() const
Determines if data lengths must be specified prior to inputting data.
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode...
Base implementation for one direction (encryption or decryption) of a stream cipher or block cipher m...
size_t MinKeyLength() const
Returns smallest valid key length.
unsigned long long word64
size_t MaxKeyLength() const
Returns largest valid key length.
CCM block cipher base implementation.
size_t GetValidKeyLength(size_t keylength) const
Returns a valid key length for the algorithm.
#define CRYPTOPP_NO_VTABLE
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
lword MaxHeaderLength() const
Provides the maximum length of AAD that can be input.
IV_Requirement
Secure IVs requirements as enumerated values.
lword MaxMessageLength() const
Provides the maximum length of encrypted data.
const BlockCipher & GetBlockCipher() const
unsigned int OptimalDataAlignment() const
Provides input and output data alignment for optimal performance.
CCM_Final< T_BlockCipher, T_DefaultDigestSize, false > Decryption
Base classes for working with authenticated encryption modes of encryption.
static std::string StaticAlgorithmName()
unsigned int DigestSize() const
Provides the digest size of the hash.
CCM block cipher final implementation.
bool IsForwardTransformation() const
Determines if the cipher is being operated in its forward direction.
Interface for retrieving values given their names.