aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_stream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/test_stream.cpp')
-rw-r--r--src/tests/test_stream.cpp15
1 files changed, 14 insertions, 1 deletions
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);
}