Crypto++
5.6.4
Free C++ class library of cryptographic schemes
|
Go to the documentation of this file.
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(n);}
37 {
return GetBlockCipher().IsValidKeyLength(n);}
39 {
return GetBlockCipher().OptimalDataAlignment();}
49 {
return m_digestSize;}
53 {
return m_L<8 ? (W64LIT(1)<<(8*m_L))-1 : W64LIT(0)-1;}
56 void UncheckedSpecifyDataLengths(lword headerLength, lword messageLength, lword footerLength);
60 bool AuthenticationIsOnPlaintext()
const
62 unsigned int AuthenticationBlockSize()
const
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;
75 const BlockCipher & GetBlockCipher()
const {
return const_cast<CCM_Base *
>(
this)->AccessBlockCipher();};
76 byte *CBC_Buffer() {
return m_buffer+REQUIRED_BLOCKSIZE;}
78 enum {REQUIRED_BLOCKSIZE = 16};
79 int m_digestSize, m_L;
80 word64 m_messageLength, m_aadLength;
90 template <
class T_BlockCipher,
int T_DefaultDigestSize,
bool T_IsEncryption>
94 static std::string StaticAlgorithmName()
95 {
return T_BlockCipher::StaticAlgorithmName() + std::string(
"/CCM");}
97 {
return T_IsEncryption;}
100 BlockCipher & AccessBlockCipher() {
return m_cipher;}
101 int DefaultDigestSize()
const {
return T_DefaultDigestSize;}
102 typename T_BlockCipher::Encryption m_cipher;
113 template <
class T_BlockCipher,
int T_DefaultDigestSize = 16>
IV_Requirement IVRequirement() const
Minimal requirement for secure IVs.
bool NeedsPrespecifiedDataLengths() const
Determines if data lengths must be specified prior to inputting data.
size_t DefaultKeyLength() const
Returns default (recommended) key length in bytes.
Class file for modes of operation.
lword MaxMessageLength() const
Provides the maximum length of encrypted data.
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode.
unsigned int DigestSize() const
Provides the digest size of the hash.
Provides Encryption and Decryption typedefs used by derived classes to implement an authenticated enc...
size_t GetValidKeyLength(size_t n) const
unsigned int MaxIVLength() const
Provides the maximum size of an IV.
unsigned int OptimalDataAlignment() const
Provides input and output data alignment for optimal performance.
std::string AlgorithmName() const
Provides the name of this algorithm.
CCM block cipher base implementation.
size_t MaxKeyLength() const
Returns largest valid key length in bytes.
IV_Requirement
Secure IVs requirements as enumerated values.
size_t MinKeyLength() const
Returns smallest valid key length in bytes.
CCM block cipher mode of operation.
bool IsValidKeyLength(size_t n) const
Returns whether keylength is a valid key length.
CCM block cipher final implementation.
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...
bool IsForwardTransformation() const
Determines if the cipher is being operated in its forward direction.
unsigned int MinIVLength() const
Provides the minimum size of an IV.
Crypto++ library namespace.
Interface for one direction (encryption or decryption) of a block cipher.
lword MaxHeaderLength() const
Provides the maximum length of AAD that can be input.
Interface for retrieving values given their names.
unsigned int IVSize() const
Returns length of the IV accepted by this object.