Sync with Upstream master
parent
5e6e6c4eaa
commit
5f3a3f29e8
|
|
@ -50,7 +50,7 @@ void AuthenticatedSymmetricCipherBase::SetKey(const byte *userKey, size_t keylen
|
||||||
m_bufferedDataLength = 0;
|
m_bufferedDataLength = 0;
|
||||||
m_state = State_Start;
|
m_state = State_Start;
|
||||||
|
|
||||||
SetKeyWithoutResync(userKey, keylength, params);
|
this->SetKeyWithoutResync(userKey, keylength, params);
|
||||||
m_state = State_KeySet;
|
m_state = State_KeySet;
|
||||||
|
|
||||||
size_t length;
|
size_t length;
|
||||||
|
|
|
||||||
16
gcm.cpp
16
gcm.cpp
|
|
@ -119,7 +119,7 @@ void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const
|
||||||
// https://github.com/weidai11/cryptopp/issues/408.
|
// https://github.com/weidai11/cryptopp/issues/408.
|
||||||
const unsigned int blockSize = blockCipher.BlockSize();
|
const unsigned int blockSize = blockCipher.BlockSize();
|
||||||
CRYPTOPP_ASSERT(blockSize == REQUIRED_BLOCKSIZE);
|
CRYPTOPP_ASSERT(blockSize == REQUIRED_BLOCKSIZE);
|
||||||
if (blockSize != REQUIRED_BLOCKSIZE)
|
if (blockCipher.BlockSize() != REQUIRED_BLOCKSIZE)
|
||||||
throw InvalidArgument(AlgorithmName() + ": block size of underlying block cipher is not 16");
|
throw InvalidArgument(AlgorithmName() + ": block size of underlying block cipher is not 16");
|
||||||
|
|
||||||
int tableSize, i, j, k;
|
int tableSize, i, j, k;
|
||||||
|
|
@ -129,7 +129,8 @@ void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const
|
||||||
{
|
{
|
||||||
// Avoid "parameter not used" error and suppress Coverity finding
|
// Avoid "parameter not used" error and suppress Coverity finding
|
||||||
(void)params.GetIntValue(Name::TableSize(), tableSize);
|
(void)params.GetIntValue(Name::TableSize(), tableSize);
|
||||||
tableSize = s_cltableSizeInBlocks * REQUIRED_BLOCKSIZE;
|
tableSize = s_cltableSizeInBlocks * blockSize;
|
||||||
|
CRYPTOPP_ASSERT(tableSize > blockSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#elif CRYPTOPP_ARM_PMULL_AVAILABLE
|
#elif CRYPTOPP_ARM_PMULL_AVAILABLE
|
||||||
|
|
@ -137,7 +138,8 @@ void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const
|
||||||
{
|
{
|
||||||
// Avoid "parameter not used" error and suppress Coverity finding
|
// Avoid "parameter not used" error and suppress Coverity finding
|
||||||
(void)params.GetIntValue(Name::TableSize(), tableSize);
|
(void)params.GetIntValue(Name::TableSize(), tableSize);
|
||||||
tableSize = s_cltableSizeInBlocks * REQUIRED_BLOCKSIZE;
|
tableSize = s_cltableSizeInBlocks * blockSize;
|
||||||
|
CRYPTOPP_ASSERT(tableSize > blockSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -147,13 +149,13 @@ void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const
|
||||||
else
|
else
|
||||||
tableSize = (GetTablesOption() == GCM_64K_Tables) ? 64*1024 : 2*1024;
|
tableSize = (GetTablesOption() == GCM_64K_Tables) ? 64*1024 : 2*1024;
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1400)
|
//#if defined(_MSC_VER) && (_MSC_VER < 1400)
|
||||||
// VC 2003 workaround: compiler generates bad code for 64K tables
|
// VC 2003 workaround: compiler generates bad code for 64K tables
|
||||||
tableSize = 2*1024;
|
//tableSize = 2*1024;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
m_buffer.resize(3*REQUIRED_BLOCKSIZE + tableSize);
|
m_buffer.resize(3*blockSize + tableSize);
|
||||||
byte *mulTable = MulTable();
|
byte *mulTable = MulTable();
|
||||||
byte *hashKey = HashKey();
|
byte *hashKey = HashKey();
|
||||||
memset(hashKey, 0, blockSize);
|
memset(hashKey, 0, blockSize);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue