diff options
author | Jack Lloyd <[email protected]> | 2017-02-02 22:43:38 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-02-02 22:43:38 -0500 |
commit | 23a96ca126ebfddb2259386f12a00a8e783226ed (patch) | |
tree | 03b8bb5224a2ae7de2c0a94e54bd28631717ddf8 /src/lib/stream/chacha/chacha.h | |
parent | ae8d2bd859120839ee08bc35daebda7ef4971ea6 (diff) |
Support zero-length IV in ChaCha
Equivalent to an 8 byte all-zero IV, same handling as Salsa.
Diffstat (limited to 'src/lib/stream/chacha/chacha.h')
-rw-r--r-- | src/lib/stream/chacha/chacha.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/stream/chacha/chacha.h b/src/lib/stream/chacha/chacha.h index 876b9ca33..64a387ec5 100644 --- a/src/lib/stream/chacha/chacha.h +++ b/src/lib/stream/chacha/chacha.h @@ -33,8 +33,11 @@ class BOTAN_DLL ChaCha final : public StreamCipher void set_iv(const uint8_t iv[], size_t iv_len) override; - bool valid_iv_length(size_t iv_len) const override - { return (iv_len == 8 || iv_len == 12); } + /* + * ChaCha accepts 0, 8, or 12 byte IVs. The default IV is a 8 zero bytes. + * An IV of length 0 is treated the same as the default zero IV. + */ + bool valid_iv_length(size_t iv_len) const override; Key_Length_Specification key_spec() const override { |