diff options
author | Jack Lloyd <[email protected]> | 2016-10-27 20:07:32 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-10-27 20:07:32 -0400 |
commit | 4e6785ff23305c05870074fd0420624cda8b99db (patch) | |
tree | 6a89b685dd7da752dfe9510a3804823a9279a345 /src/tests/test_stream.cpp | |
parent | 5c31f9843c29ef0548daf0a019c4caad1465e3ba (diff) |
Small pushes on test coverage
No real way to test what/if `clear` does, but at least we know it
runs and doesn't crash which is an improvement over the status quo.
Diffstat (limited to 'src/tests/test_stream.cpp')
-rw-r--r-- | src/tests/test_stream.cpp | 15 |
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); } |