aboutsummaryrefslogtreecommitdiffstats
path: root/src/aead/gcm/gcm.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-04-10 16:18:53 +0000
committerlloyd <[email protected]>2013-04-10 16:18:53 +0000
commit57ffb9560793ba9f3feeb2345ba196e86119ca9f (patch)
treed7e44463d7bcc37d43a345cb6006a675c296c32f /src/aead/gcm/gcm.h
parent13190fc5b073faf75303bc297ac7dbbfd300d75a (diff)
Add AEAD_Mode::output_length
Diffstat (limited to 'src/aead/gcm/gcm.h')
-rw-r--r--src/aead/gcm/gcm.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/aead/gcm/gcm.h b/src/aead/gcm/gcm.h
index bc7eaae20..f36aafc5f 100644
--- a/src/aead/gcm/gcm.h
+++ b/src/aead/gcm/gcm.h
@@ -68,6 +68,9 @@ class BOTAN_DLL GCM_Encryption : public GCM_Mode
GCM_Encryption(BlockCipher* cipher, size_t tag_size = 16) :
GCM_Mode(cipher, tag_size) {}
+ size_t output_length(size_t input_length) const override
+ { return input_length + tag_size(); }
+
size_t minimum_final_size() const override { return 0; }
void update(secure_vector<byte>& blocks, size_t offset) override;
@@ -88,6 +91,12 @@ class BOTAN_DLL GCM_Decryption : public GCM_Mode
GCM_Decryption(BlockCipher* cipher, size_t tag_size = 16) :
GCM_Mode(cipher, tag_size) {}
+ size_t output_length(size_t input_length) const override
+ {
+ BOTAN_ASSERT(input_length > tag_size(), "Sufficient input");
+ return input_length - tag_size();
+ }
+
size_t minimum_final_size() const override { return tag_size(); }
void update(secure_vector<byte>& blocks, size_t offset) override;