aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_stream.cpp
diff options
context:
space:
mode:
authorSimCog <[email protected]>2016-06-14 18:21:10 +0200
committerSimCog <[email protected]>2016-06-18 01:06:21 +0200
commit00337c4ea2af6b1727be0bdf9b719c98760a14fd (patch)
treeadc8b6f68311b2c9649bdb84766f22f99d2424db /src/tests/test_stream.cpp
parent6816c9e71e01432792a997ad9a5d561b9cd94a48 (diff)
Adding StreamCipher::seek interface, supporting seek in ChaCha, and also adding ChaCha8 support
Diffstat (limited to 'src/tests/test_stream.cpp')
-rw-r--r--src/tests/test_stream.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tests/test_stream.cpp b/src/tests/test_stream.cpp
index 232fdcdd9..d3d83c26c 100644
--- a/src/tests/test_stream.cpp
+++ b/src/tests/test_stream.cpp
@@ -18,7 +18,7 @@ class Stream_Cipher_Tests : public Text_Based_Test
{
public:
Stream_Cipher_Tests(): Text_Based_Test("stream",
- {"Key", "In", "Out"}, {"Nonce"}) {}
+ {"Key", "In", "Out"}, {"Nonce", "Seek"}) {}
Test::Result run_one_test(const std::string& algo, const VarMap& vars) override
{
@@ -26,6 +26,7 @@ class Stream_Cipher_Tests : public Text_Based_Test
const std::vector<uint8_t> input = get_req_bin(vars, "In");
const std::vector<uint8_t> expected = get_req_bin(vars, "Out");
const std::vector<uint8_t> nonce = get_opt_bin(vars, "Nonce");
+ const size_t seek = get_opt_sz(vars, "Seek", 0);
Test::Result result(algo);
@@ -53,6 +54,9 @@ class Stream_Cipher_Tests : public Text_Based_Test
if(nonce.size())
cipher->set_iv(nonce.data(), nonce.size());
+ if (seek != 0)
+ cipher->seek(seek);
+
std::vector<uint8_t> buf = input;
cipher->encrypt(buf);