diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_ocb.cpp | 11 | ||||
-rw-r--r-- | src/tests/test_octetstring.cpp | 10 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/tests/test_ocb.cpp b/src/tests/test_ocb.cpp index 07f216f96..490a52f4f 100644 --- a/src/tests/test_ocb.cpp +++ b/src/tests/test_ocb.cpp @@ -69,9 +69,9 @@ class OCB_Wide_Test_Block_Cipher final : public Botan::BlockCipher for(size_t i = 0; i != m_bs; ++i) out[i] = in[i] ^ m_key[i]; - const uint8_t bottom_carry = in[m_bs-1] & 0x01; + uint8_t carry = in[m_bs-1] & 0x01; - if(bottom_carry) + if(carry) { if(m_bs == 16 || m_bs == 24) { @@ -91,13 +91,14 @@ class OCB_Wide_Test_Block_Cipher final : public Botan::BlockCipher throw Test_Error("Bad OCB test block size"); } - uint8_t carry = bottom_carry << 7; + carry <<= 7; for(size_t i = 0; i != m_bs; ++i) { - uint8_t temp = out[i]; + const uint8_t temp = out[i]; out[i] = (temp >> 1) | carry; - carry = (temp & 0x1) << 7; + carry = (temp & 0x1); + carry <<= 7; } blocks--; diff --git a/src/tests/test_octetstring.cpp b/src/tests/test_octetstring.cpp index 1010b5464..b9692559e 100644 --- a/src/tests/test_octetstring.cpp +++ b/src/tests/test_octetstring.cpp @@ -99,11 +99,13 @@ Test::Result test_equality() { Test::Result result("OctetString"); - Botan::OctetString os1("0000000000000000"); - Botan::OctetString os2("FFFFFFFFFFFFFFFF"); + const Botan::OctetString os1("0000000000000000"); + const Botan::OctetString os1_copy = os1; + const Botan::OctetString os2("FFFFFFFFFFFFFFFF"); + const Botan::OctetString os2_copy = os2; - result.confirm("OctetString equality operations works as expected", os1 == os1); - result.confirm("OctetString equality operations works as expected", os2 == os2); + result.confirm("OctetString equality operations works as expected", os1 == os1_copy); + result.confirm("OctetString equality operations works as expected", os2 == os2_copy); result.confirm("OctetString equality operations works as expected", os1 != os2); return result; |