diff options
author | Jack Lloyd <[email protected]> | 2018-08-08 13:05:13 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-08 13:05:13 -0400 |
commit | 9eb10b06036840822c03aec900a1e64f90e77181 (patch) | |
tree | 3f0eb3ec3739d8779d08ac51894a2e714390d038 /src/lib/stream/chacha | |
parent | dfbc940e4dbc032b925e4ff54429a18e4923bbd2 (diff) |
Add StreamCipher::default_iv_length
Diffstat (limited to 'src/lib/stream/chacha')
-rw-r--r-- | src/lib/stream/chacha/chacha.cpp | 2 | ||||
-rw-r--r-- | src/lib/stream/chacha/chacha.h | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/stream/chacha/chacha.cpp b/src/lib/stream/chacha/chacha.cpp index 7ccc4293b..fac9a5a36 100644 --- a/src/lib/stream/chacha/chacha.cpp +++ b/src/lib/stream/chacha/chacha.cpp @@ -310,7 +310,7 @@ void ChaCha::seek(uint64_t offset) verify_key_set(m_state.empty() == false); // Find the block offset - uint64_t counter = offset / 64; + const uint64_t counter = offset / 64; uint8_t out[8]; diff --git a/src/lib/stream/chacha/chacha.h b/src/lib/stream/chacha/chacha.h index a4f3e3b75..d0e131315 100644 --- a/src/lib/stream/chacha/chacha.h +++ b/src/lib/stream/chacha/chacha.h @@ -34,11 +34,15 @@ class BOTAN_PUBLIC_API(2,0) ChaCha final : public StreamCipher void set_iv(const uint8_t iv[], size_t iv_len) override; /* - * ChaCha accepts 0, 8, or 12 byte IVs. The default IV is a 8 zero bytes. + * ChaCha accepts 0, 8, 12 or 24 byte IVs. + * The default IV is a 8 zero bytes. * An IV of length 0 is treated the same as the default zero IV. + * An IV of length 24 selects XChaCha mode */ bool valid_iv_length(size_t iv_len) const override; + size_t default_iv_length() const override { return 24; } + Key_Length_Specification key_spec() const override { return Key_Length_Specification(16, 32, 16); |