diff options
-rw-r--r-- | src/tests/test_block.cpp | 2 | ||||
-rw-r--r-- | src/tests/test_stream.cpp | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/tests/test_block.cpp b/src/tests/test_block.cpp index acbe6702b..82ab0618d 100644 --- a/src/tests/test_block.cpp +++ b/src/tests/test_block.cpp @@ -64,6 +64,8 @@ class Block_Cipher_Tests : public Text_Based_Test buf = expected; cipher->decrypt(buf); + cipher->clear(); + result.test_eq(provider, "decrypt", buf, input); } diff --git a/src/tests/test_stream.cpp b/src/tests/test_stream.cpp index 6097fd3e8..d53777593 100644 --- a/src/tests/test_stream.cpp +++ b/src/tests/test_stream.cpp @@ -1,5 +1,5 @@ /* -* (C) 2014,2015 Jack Lloyd +* (C) 2014,2015,2016 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -57,7 +57,18 @@ class Stream_Cipher_Tests : public Text_Based_Test cipher->set_key(key); if(nonce.size()) + { cipher->set_iv(nonce.data(), nonce.size()); + } + else + { + /* + * If no nonce was set then implicitly the cipher is using a + * null/empty nonce. Call set_iv with such a nonce to make sure + * set_iv accepts it. + */ + cipher->set_iv(nullptr, 0); + } if (seek != 0) cipher->seek(seek); @@ -65,6 +76,8 @@ class Stream_Cipher_Tests : public Text_Based_Test std::vector<uint8_t> buf = input; cipher->encrypt(buf); + cipher->clear(); + result.test_eq(provider, "encrypt", buf, expected); } |