From 47222de4b72295229e123480fc76f0ba5c9f9236 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 30 Sep 2023 13:52:56 -0400 Subject: [PATCH] Clear elevated warnings in ARIA and HIGHT Related to fixes from GH #1235 and GH #1234 --- datatest.cpp | 7 ------- hight.cpp | 16 ++++++++-------- modes.cpp | 1 - 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/datatest.cpp b/datatest.cpp index 1fc76f43..29eddfa5 100644 --- a/datatest.cpp +++ b/datatest.cpp @@ -819,13 +819,6 @@ void TestSymmetricCipherWithInplaceEncryption(TestData &v, const NameValuePairs } } - // Most block ciphers don't specify BlockPaddingScheme. Kalyna uses it - // in test vectors. 0 is NoPadding, 1 is ZerosPadding, 2 is PkcsPadding, - // 3 is OneAndZerosPadding, etc. Note: The machinery is wired such that - // paddingScheme is effectively latched. An old paddingScheme may be - // unintentionally used in a subsequent test. - int paddingScheme = pairs.GetIntValueWithDefault(Name::BlockPaddingScheme(), 0); - const std::string plainText = GetDecodedDatum(v, "Plaintext"); const std::string cipherText = GetDecodedDatum(v, "Ciphertext"); diff --git a/hight.cpp b/hight.cpp index b2aef6e8..c48e36f6 100644 --- a/hight.cpp +++ b/hight.cpp @@ -195,10 +195,10 @@ void HIGHT::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, b outBlock[5] = static_cast(m_xx[6] ^ xorBlock[5]); outBlock[7] = static_cast(m_xx[0] ^ xorBlock[7]); - outBlock[0] = static_cast(m_xx[1] + m_rkey[4] ^ xorBlock[0]); - outBlock[2] = static_cast(m_xx[3] ^ m_rkey[5] ^ xorBlock[2]); - outBlock[4] = static_cast(m_xx[5] + m_rkey[6] ^ xorBlock[4]); - outBlock[6] = static_cast(m_xx[7] ^ m_rkey[7] ^ xorBlock[6]); + outBlock[0] = static_cast((m_xx[1] + m_rkey[4]) ^ xorBlock[0]); + outBlock[2] = static_cast((m_xx[3] ^ m_rkey[5]) ^ xorBlock[2]); + outBlock[4] = static_cast((m_xx[5] + m_rkey[6]) ^ xorBlock[4]); + outBlock[6] = static_cast((m_xx[7] ^ m_rkey[7]) ^ xorBlock[6]); } else { @@ -275,10 +275,10 @@ void HIGHT::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, b outBlock[5] = static_cast(m_xx[5] ^ xorBlock[5]); outBlock[7] = static_cast(m_xx[7] ^ xorBlock[7]); - outBlock[0] = static_cast(m_xx[0] - m_rkey[0] ^ xorBlock[0]); - outBlock[2] = static_cast(m_xx[2] ^ m_rkey[1] ^ xorBlock[2]); - outBlock[4] = static_cast(m_xx[4] - m_rkey[2] ^ xorBlock[4]); - outBlock[6] = static_cast(m_xx[6] ^ m_rkey[3] ^ xorBlock[6]); + outBlock[0] = static_cast((m_xx[0] - m_rkey[0]) ^ xorBlock[0]); + outBlock[2] = static_cast((m_xx[2] ^ m_rkey[1]) ^ xorBlock[2]); + outBlock[4] = static_cast((m_xx[4] - m_rkey[2]) ^ xorBlock[4]); + outBlock[6] = static_cast((m_xx[6] ^ m_rkey[3]) ^ xorBlock[6]); } else { diff --git a/modes.cpp b/modes.cpp index 8e4428e3..21e17263 100644 --- a/modes.cpp +++ b/modes.cpp @@ -81,7 +81,6 @@ void CFB_ModePolicy::CipherResynchronize(const byte *iv, size_t length) void CFB_ModePolicy::SetFeedbackSize(unsigned int feedbackSize) { - CRYPTOPP_ASSERT(feedbackSize >= 0); CRYPTOPP_ASSERT(feedbackSize <= BlockSize()); if (feedbackSize > BlockSize()) throw InvalidArgument("CFB_Mode: invalid feedback size");