aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/stream/ctr/ctr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/stream/ctr/ctr.cpp')
-rw-r--r--src/lib/stream/ctr/ctr.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/lib/stream/ctr/ctr.cpp b/src/lib/stream/ctr/ctr.cpp
index 261646344..6a7d81729 100644
--- a/src/lib/stream/ctr/ctr.cpp
+++ b/src/lib/stream/ctr/ctr.cpp
@@ -44,6 +44,26 @@ void CTR_BE::clear()
m_pad_pos = 0;
}
+size_t CTR_BE::default_iv_length() const
+ {
+ return m_block_size;
+ }
+
+bool CTR_BE::valid_iv_length(size_t iv_len) const
+ {
+ return (iv_len <= m_block_size);
+ }
+
+Key_Length_Specification CTR_BE::key_spec() const
+ {
+ return m_cipher->key_spec();
+ }
+
+CTR_BE* CTR_BE::clone() const
+ {
+ return new CTR_BE(m_cipher->clone(), m_ctr_size);
+ }
+
void CTR_BE::key_schedule(const uint8_t key[], size_t key_len)
{
m_cipher->set_key(key, key_len);
@@ -106,7 +126,7 @@ void CTR_BE::set_iv(const uint8_t iv[], size_t iv_len)
if(!valid_iv_length(iv_len))
throw Invalid_IV_Length(name(), iv_len);
- m_iv.resize(m_cipher->block_size());
+ m_iv.resize(m_block_size);
zeroise(m_iv);
buffer_insert(m_iv, 0, iv, iv_len);