Comments, constants and whitespace

pull/484/merge
Jeffrey Walton 2017-09-30 06:19:28 -04:00
parent abc92b2e74
commit bbc6ea5355
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
6 changed files with 10 additions and 9 deletions

View File

@ -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)
{ {

View File

@ -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

View File

@ -11,7 +11,6 @@ NAMESPACE_BEGIN(CryptoPP)
void CCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params) void CCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs &params)
{ {
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)

View File

@ -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;

View File

@ -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);

View File

@ -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;