aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/stream/chacha
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-11-14 09:57:58 -0500
committerJack Lloyd <[email protected]>2017-11-14 09:57:58 -0500
commit72a5d030625341cc372b5a7ced454dd6d309f3e5 (patch)
tree1ae06b31b2e9e760915a186ace3cee169be1b9fd /src/lib/stream/chacha
parent1091bd40435bd5e01cab27f488c03f0a7d2e38d7 (diff)
Support seeking in Salsa20
Add a test that StreamCipher::seek throws if not keyed.
Diffstat (limited to 'src/lib/stream/chacha')
-rw-r--r--src/lib/stream/chacha/chacha.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/lib/stream/chacha/chacha.cpp b/src/lib/stream/chacha/chacha.cpp
index 52e5eaaf4..0f1e082cf 100644
--- a/src/lib/stream/chacha/chacha.cpp
+++ b/src/lib/stream/chacha/chacha.cpp
@@ -222,10 +222,7 @@ std::string ChaCha::name() const
void ChaCha::seek(uint64_t offset)
{
- if (m_state.size() == 0 && m_buffer.size() == 0)
- {
- throw Invalid_State("You have to setup the stream cipher (key and iv)");
- }
+ verify_key_set(m_state.empty() == false);
// Find the block offset
uint64_t counter = offset / 64;