Comments, constants and whitespace
parent
abc92b2e74
commit
bbc6ea5355
|
|
@ -74,8 +74,7 @@ void AuthenticatedSymmetricCipherBase::Resynchronize(const byte *iv, int length)
|
||||||
|
|
||||||
void AuthenticatedSymmetricCipherBase::Update(const byte *input, size_t length)
|
void AuthenticatedSymmetricCipherBase::Update(const byte *input, size_t length)
|
||||||
{
|
{
|
||||||
if (length == 0)
|
if (length == 0) {return;}
|
||||||
return;
|
|
||||||
|
|
||||||
switch (m_state)
|
switch (m_state)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,14 @@ protected:
|
||||||
virtual void AuthenticateLastConfidentialBlock() {}
|
virtual void AuthenticateLastConfidentialBlock() {}
|
||||||
virtual void AuthenticateLastFooterBlock(byte *mac, size_t macSize) =0;
|
virtual void AuthenticateLastFooterBlock(byte *mac, size_t macSize) =0;
|
||||||
|
|
||||||
|
// State_AuthUntransformed: authentication is applied to plain text (Authenticate-then-Encrypt)
|
||||||
|
// State_AuthTransformed: authentication is applied to cipher text (Encrypt-then-Authenticate)
|
||||||
enum State {State_Start, State_KeySet, State_IVSet, State_AuthUntransformed, State_AuthTransformed, State_AuthFooter};
|
enum State {State_Start, State_KeySet, State_IVSet, State_AuthUntransformed, State_AuthTransformed, State_AuthFooter};
|
||||||
State m_state;
|
|
||||||
unsigned int m_bufferedDataLength;
|
|
||||||
lword m_totalHeaderLength, m_totalMessageLength, m_totalFooterLength;
|
|
||||||
AlignedSecByteBlock m_buffer;
|
AlignedSecByteBlock m_buffer;
|
||||||
|
lword m_totalHeaderLength, m_totalMessageLength, m_totalFooterLength;
|
||||||
|
unsigned int m_bufferedDataLength;
|
||||||
|
State m_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
|
||||||
1
ccm.cpp
1
ccm.cpp
|
|
@ -11,7 +11,6 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||||
void CCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms)
|
void CCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms)
|
||||||
{
|
{
|
||||||
BlockCipher &blockCipher = AccessBlockCipher();
|
BlockCipher &blockCipher = AccessBlockCipher();
|
||||||
|
|
||||||
blockCipher.SetKey(userKey, keylength, params);
|
blockCipher.SetKey(userKey, keylength, params);
|
||||||
|
|
||||||
if (blockCipher.BlockSize() != REQUIRED_BLOCKSIZE)
|
if (blockCipher.BlockSize() != REQUIRED_BLOCKSIZE)
|
||||||
|
|
|
||||||
|
|
@ -913,7 +913,7 @@ public:
|
||||||
//! <pre> if (m_cipher.IsLastBlockSpecial())
|
//! <pre> if (m_cipher.IsLastBlockSpecial())
|
||||||
//! {
|
//! {
|
||||||
//! size_t reserve = 2*m_cipher.MandatoryBlockSize();
|
//! size_t reserve = 2*m_cipher.MandatoryBlockSize();
|
||||||
//! space = HelpCreatePutSpace(*AttachedTransformation(), DEFAULT_CHANNEL, length, length+reserve);
|
//! space = HelpCreatePutSpace(*AttachedTransformation(), DEFAULT_CHANNEL, length+reserve);
|
||||||
//! length = m_cipher.ProcessLastBlock(space, length+reserve, inString, length);
|
//! length = m_cipher.ProcessLastBlock(space, length+reserve, inString, length);
|
||||||
//! AttachedTransformation()->Put(space, length);
|
//! AttachedTransformation()->Put(space, length);
|
||||||
//! return;
|
//! return;
|
||||||
|
|
|
||||||
2
eax.cpp
2
eax.cpp
|
|
@ -36,7 +36,7 @@ void EAX_Base::AuthenticateLastHeaderBlock()
|
||||||
{
|
{
|
||||||
CRYPTOPP_ASSERT(m_bufferedDataLength == 0);
|
CRYPTOPP_ASSERT(m_bufferedDataLength == 0);
|
||||||
MessageAuthenticationCode &mac = AccessMAC();
|
MessageAuthenticationCode &mac = AccessMAC();
|
||||||
unsigned int blockSize = mac.TagSize();
|
const unsigned int blockSize = mac.TagSize();
|
||||||
|
|
||||||
mac.Final(m_buffer);
|
mac.Final(m_buffer);
|
||||||
xorbuf(m_buffer+blockSize, m_buffer, blockSize);
|
xorbuf(m_buffer+blockSize, m_buffer, blockSize);
|
||||||
|
|
|
||||||
|
|
@ -690,7 +690,7 @@ void StreamTransformationFilter::LastPut(const byte *inString, size_t length)
|
||||||
if (m_cipher.IsLastBlockSpecial())
|
if (m_cipher.IsLastBlockSpecial())
|
||||||
{
|
{
|
||||||
size_t reserve = 2*m_cipher.MandatoryBlockSize();
|
size_t reserve = 2*m_cipher.MandatoryBlockSize();
|
||||||
space = HelpCreatePutSpace(*AttachedTransformation(), DEFAULT_CHANNEL, length, length+reserve);
|
space = HelpCreatePutSpace(*AttachedTransformation(), DEFAULT_CHANNEL, length+reserve);
|
||||||
length = m_cipher.ProcessLastBlock(space, length+reserve, inString, length);
|
length = m_cipher.ProcessLastBlock(space, length+reserve, inString, length);
|
||||||
AttachedTransformation()->Put(space, length);
|
AttachedTransformation()->Put(space, length);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue