diff options
| author | Jeffrey Walton <noloader@gmail.com> | 2016-09-16 11:27:15 -0400 |
|---|---|---|
| committer | Jeffrey Walton <noloader@gmail.com> | 2016-09-16 11:27:15 -0400 |
| commit | 399a1546de71f41598c15edada28e7f0d616f541 (patch) | |
| tree | 530160789358a3303be180df2d8529c82782156b /blake2.cpp | |
| parent | fca5fbb36169a7522e6c533df9c322d47e3dc6bb (diff) | |
| download | cryptopp-git-399a1546de71f41598c15edada28e7f0d616f541.tar.gz | |
Add CRYPTOPP_ASSERT (Issue 277, CVE-2016-7420)
trap.h and CRYPTOPP_ASSERT has existed for over a year in Master. We deferred on the cut-over waiting for a minor version bump (5.7). We have to use it now due to CVE-2016-7420
Diffstat (limited to 'blake2.cpp')
| -rw-r--r-- | blake2.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -352,7 +352,7 @@ BLAKE2_Base<W, T_64bit>::BLAKE2_Base() : m_state(1), m_block(1), m_digestSize(DI template <class W, bool T_64bit>
BLAKE2_Base<W, T_64bit>::BLAKE2_Base(bool treeMode, unsigned int digestSize) : m_state(1), m_block(1), m_digestSize(digestSize), m_treeMode(treeMode)
{
- assert(digestSize <= DIGESTSIZE);
+ CRYPTOPP_ASSERT(digestSize <= DIGESTSIZE);
UncheckedSetKey(NULL, 0, g_nullNameValuePairs);
Restart();
@@ -363,10 +363,10 @@ BLAKE2_Base<W, T_64bit>::BLAKE2_Base(const byte *key, size_t keyLength, const by const byte* personalization, size_t personalizationLength, bool treeMode, unsigned int digestSize)
: m_state(1), m_block(1), m_digestSize(digestSize), m_treeMode(treeMode)
{
- assert(keyLength <= MAX_KEYLENGTH);
- assert(digestSize <= DIGESTSIZE);
- assert(saltLength <= SALTSIZE);
- assert(personalizationLength <= PERSONALIZATIONSIZE);
+ CRYPTOPP_ASSERT(keyLength <= MAX_KEYLENGTH);
+ CRYPTOPP_ASSERT(digestSize <= DIGESTSIZE);
+ CRYPTOPP_ASSERT(saltLength <= SALTSIZE);
+ CRYPTOPP_ASSERT(personalizationLength <= PERSONALIZATIONSIZE);
UncheckedSetKey(key, static_cast<unsigned int>(keyLength), MakeParameters(Name::DigestSize(),(int)digestSize)(Name::TreeMode(),treeMode, false)
(Name::Salt(), ConstByteArrayParameter(salt, saltLength))(Name::Personalization(), ConstByteArrayParameter(personalization, personalizationLength)));
@@ -439,7 +439,7 @@ void BLAKE2_Base<W, T_64bit>::Update(const byte *input, size_t length) // Copy tail bytes
if (input && length)
{
- assert(length <= BLOCKSIZE - state.length);
+ CRYPTOPP_ASSERT(length <= BLOCKSIZE - state.length);
memcpy_s(&state.buffer[state.length], length, input, length);
state.length += static_cast<unsigned int>(length);
}
@@ -3470,10 +3470,10 @@ static const int LANE_L64 = 0; static void BLAKE2_NEON_Compress32(const byte* input, BLAKE2_State<word32, false>& state)
{
- //assert(IsAlignedOn(input,GetAlignmentOf<uint8_t*>()));
- assert(IsAlignedOn(&state.h[0],GetAlignmentOf<uint32x4_t>()));
- assert(IsAlignedOn(&state.h[4],GetAlignmentOf<uint32x4_t>()));
- assert(IsAlignedOn(&state.t[0],GetAlignmentOf<uint32x4_t>()));
+ //CRYPTOPP_ASSERT(IsAlignedOn(input,GetAlignmentOf<uint8_t*>()));
+ CRYPTOPP_ASSERT(IsAlignedOn(&state.h[0],GetAlignmentOf<uint32x4_t>()));
+ CRYPTOPP_ASSERT(IsAlignedOn(&state.h[4],GetAlignmentOf<uint32x4_t>()));
+ CRYPTOPP_ASSERT(IsAlignedOn(&state.t[0],GetAlignmentOf<uint32x4_t>()));
CRYPTOPP_ALIGN_DATA(16) uint32_t m0[4], m1[4], m2[4], m3[4], m4[4], m5[4], m6[4], m7[4];
CRYPTOPP_ALIGN_DATA(16) uint32_t m8[4], m9[4], m10[4], m11[4], m12[4], m13[4], m14[4], m15[4];
@@ -3976,10 +3976,10 @@ static void BLAKE2_NEON_Compress32(const byte* input, BLAKE2_State<word32, false static void BLAKE2_NEON_Compress64(const byte* input, BLAKE2_State<word64, true>& state)
{
- //assert(IsAlignedOn(input,GetAlignmentOf<uint8_t*>()));
- assert(IsAlignedOn(&state.h[0],GetAlignmentOf<uint64x2_t>()));
- assert(IsAlignedOn(&state.h[4],GetAlignmentOf<uint64x2_t>()));
- assert(IsAlignedOn(&state.t[0],GetAlignmentOf<uint64x2_t>()));
+ //CRYPTOPP_ASSERT(IsAlignedOn(input,GetAlignmentOf<uint8_t*>()));
+ CRYPTOPP_ASSERT(IsAlignedOn(&state.h[0],GetAlignmentOf<uint64x2_t>()));
+ CRYPTOPP_ASSERT(IsAlignedOn(&state.h[4],GetAlignmentOf<uint64x2_t>()));
+ CRYPTOPP_ASSERT(IsAlignedOn(&state.t[0],GetAlignmentOf<uint64x2_t>()));
uint64x2_t m0m1,m2m3,m4m5,m6m7,m8m9,m10m11,m12m13,m14m15;
|
