aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/stream/chacha/chacha.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/stream/chacha/chacha.cpp')
-rw-r--r--src/lib/stream/chacha/chacha.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/stream/chacha/chacha.cpp b/src/lib/stream/chacha/chacha.cpp
index 0bbb47bcb..52e5eaaf4 100644
--- a/src/lib/stream/chacha/chacha.cpp
+++ b/src/lib/stream/chacha/chacha.cpp
@@ -116,6 +116,8 @@ void ChaCha::chacha_x4(uint8_t output[64*4], uint32_t input[16], size_t rounds)
*/
void ChaCha::cipher(const uint8_t in[], uint8_t out[], size_t length)
{
+ verify_key_set(m_state.empty() == false);
+
while(length >= m_buffer.size() - m_position)
{
xor_buf(out, in, &m_buffer[m_position], m_buffer.size() - m_position);