aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorAtanas Filyanov <[email protected]>2017-09-14 10:48:31 +0200
committerAtanas Filyanov <[email protected]>2017-09-14 10:48:31 +0200
commit206091f9bea256e5259bc7dd84323bb0377985d1 (patch)
treeea9e45025f4f3b4da1ce864a1095c68f394aeb0a /src/lib
parent751a3d36bd6072a1e042c8c2c6662fc7ae7535be (diff)
Allow GCM tag size in the range 96..128 bits
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/modes/aead/gcm/gcm.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/modes/aead/gcm/gcm.cpp b/src/lib/modes/aead/gcm/gcm.cpp
index 4e28b1b48..828cc2c42 100644
--- a/src/lib/modes/aead/gcm/gcm.cpp
+++ b/src/lib/modes/aead/gcm/gcm.cpp
@@ -182,7 +182,8 @@ GCM_Mode::GCM_Mode(BlockCipher* cipher, size_t tag_size) :
m_ctr.reset(new CTR_BE(cipher, 4)); // CTR_BE takes ownership of cipher
- if(m_tag_size != 8 && m_tag_size != 12 && m_tag_size != GCM_BS)
+ /* We allow any of the values 128, 120, 112, 104, or 96 bits as a tag size */
+ if(m_tag_size < 12 || m_tag_size > 16)
throw Invalid_Argument(name() + ": Bad tag size " + std::to_string(m_tag_size));
}