diff options
author | Jack Lloyd <[email protected]> | 2018-08-05 18:57:54 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-05 19:19:58 -0400 |
commit | df169024a36b5f72eaa40fef5f9fc6ca17261035 (patch) | |
tree | b1b0d624414c550f88d9989beb21093f4461b3be /src/lib/modes/aead/aead.h | |
parent | f3ecd15b216a8a890308089ddb1dec1bc4ff0c75 (diff) |
Fix crashes when modes were used unkeyed.
Fix crashes in OCB, GCM and CFB when called without a key being set.
Diffstat (limited to 'src/lib/modes/aead/aead.h')
-rw-r--r-- | src/lib/modes/aead/aead.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/modes/aead/aead.h b/src/lib/modes/aead/aead.h index 4d4b60ce1..92957fb24 100644 --- a/src/lib/modes/aead/aead.h +++ b/src/lib/modes/aead/aead.h @@ -61,6 +61,13 @@ class BOTAN_PUBLIC_API(2,0) AEAD_Mode : public Cipher_Mode virtual void set_associated_data(const uint8_t ad[], size_t ad_len) = 0; /** + * Most AEADs require the key to be set prior to setting the AD + * A few allow the AD to be set even before the cipher is keyed. + * Such ciphers would return false from this function. + */ + virtual bool associated_data_requires_key() const { return true; } + + /** * Set associated data that is not included in the ciphertext but * that should be authenticated. Must be called after set_key and * before start. |