diff options
author | Jack Lloyd <[email protected]> | 2018-08-17 17:09:26 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-17 17:09:26 -0400 |
commit | 18af8859a5c007c6df47181be0fabf2913204979 (patch) | |
tree | cafd241b6ec165eed109acd1086920f0e2f9cf92 /src/tests/test_aead.cpp | |
parent | cc96212bc6168fac918f071730bffbef7c0059c5 (diff) |
Fix an EAX bug in reset()
It failed to reset any data that had been fed into CMAC so far,
so a sequence with
eax->set_key(key);
eax->start(nonce);
eax->process(discarded_bits);
eax->reset();
eax->start(second_nonce);
eax->process(second_msg);
would produce incorrect results
Diffstat (limited to 'src/tests/test_aead.cpp')
-rw-r--r-- | src/tests/test_aead.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/tests/test_aead.cpp b/src/tests/test_aead.cpp index ce9c3e095..992278c0f 100644 --- a/src/tests/test_aead.cpp +++ b/src/tests/test_aead.cpp @@ -1,5 +1,5 @@ /* -* (C) 2014,2015,2016 Jack Lloyd +* (C) 2014,2015,2016,2018 Jack Lloyd * (C) 2016 Daniel Neus, Rohde & Schwarz Cybersecurity * * Botan is released under the Simplified BSD License (see license.txt) @@ -44,9 +44,8 @@ class AEAD_Tests final : public Text_Based_Test [&]() { enc->set_associated_data(ad.data(), ad.size()); }); } - // First some tests for reset() to make sure it resets what we need it to - // set garbage values - enc->set_key(mutate_vec(key)); + // Ensure that test resets AD and message state + enc->set_key(key); enc->set_ad(mutate_vec(ad)); enc->start(mutate_vec(nonce)); @@ -57,7 +56,6 @@ class AEAD_Tests final : public Text_Based_Test enc->reset(); // now try to encrypt with correct values - enc->set_key(key); enc->set_ad(ad); enc->start(nonce); @@ -178,7 +176,7 @@ class AEAD_Tests final : public Text_Based_Test // First some tests for reset() to make sure it resets what we need it to // set garbage values - dec->set_key(mutate_vec(key)); + dec->set_key(key); dec->set_ad(mutate_vec(ad)); dec->start(mutate_vec(nonce)); @@ -192,7 +190,6 @@ class AEAD_Tests final : public Text_Based_Test try { // now try to decrypt with correct values - dec->set_key(key); dec->set_ad(ad); dec->start(nonce); |