aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-09-13 14:04:03 -0400
committerJack Lloyd <[email protected]>2017-09-13 14:04:03 -0400
commit6cae09878e467aa0898863953e4b02f57439fef5 (patch)
tree60b8a8c4ef48fea0084c1bc30666f47c6cb018b8
parent5651315cd6fc35f9380f99a9f571d9c0b044a4ee (diff)
parentce8963a9a1b30fc183da7991119e18eb79c49938 (diff)
Merge GH #1209 Support 96-bit tags in GCM
-rw-r--r--src/lib/modes/aead/gcm/gcm.cpp2
-rw-r--r--src/tests/data/aead/gcm.vec48
2 files changed, 49 insertions, 1 deletions
diff --git a/src/lib/modes/aead/gcm/gcm.cpp b/src/lib/modes/aead/gcm/gcm.cpp
index f9ffdee97..4e28b1b48 100644
--- a/src/lib/modes/aead/gcm/gcm.cpp
+++ b/src/lib/modes/aead/gcm/gcm.cpp
@@ -182,7 +182,7 @@ 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 != GCM_BS)
+ if(m_tag_size != 8 && m_tag_size != 12 && m_tag_size != GCM_BS)
throw Invalid_Argument(name() + ": Bad tag size " + std::to_string(m_tag_size));
}
diff --git a/src/tests/data/aead/gcm.vec b/src/tests/data/aead/gcm.vec
index 65a75873e..5d4e7b10d 100644
--- a/src/tests/data/aead/gcm.vec
+++ b/src/tests/data/aead/gcm.vec
@@ -64,6 +64,23 @@ Out = A833DCC2EC04BEF5ED9E7E7FB08D61244CD795C21FEE194E7AAF7D9BD66B324F39FFC46
+[AES-128/GCM(12)]
+# Nist | Test Case 5 with 12 byte tag
+Key = FEFFE9928665731C6D6A8F9467308308
+Nonce = CAFEBABEFACEDBAD
+In = D9313225F88406E5A55909C5AFF5269A86A7A9531534F7DA2E4C303D8A318A721C3C0C95956809532FCF0E2449A6B525B16AEDF5AA0DE657BA637B39
+AD = FEEDFACEDEADBEEFFEEDFACEDEADBEEFABADDAD2
+Out = 61353B4C2806934A777FF51FA22A4755699B2A714FCDC6F83766E5F97B6C742373806900E49F24B22B097544D4896B424989B5E1EBAC0F07C23F45983612D2E79E3B0785561BE14A
+
+# Nist | Test Case 6 with 12 byte tag
+Key = FEFFE9928665731C6D6A8F9467308308
+Nonce = 9313225DF88406E555909C5AFF5269AA6A7A9538534F7DA1E4C303D2A318A728C3C0C95156809539FCF0E2429A6B525416AEDBF5A0DE6A57A637B39B
+In = D9313225F88406E5A55909C5AFF5269A86A7A9531534F7DA2E4C303D8A318A721C3C0C95956809532FCF0E2449A6B525B16AEDF5AA0DE657BA637B39
+AD = FEEDFACEDEADBEEFFEEDFACEDEADBEEFABADDAD2
+Out = 8CE24998625615B603A033ACA13FB894BE9112A5C3A211A8BA262A3CCA7E2CA701E4A9A4FBA43C90CCDCB281D48C7C6FD62875D2ACA417034C34AEE5619CC5AEFFFE0BFA462AF43C
+
+
+
[AES-192/GCM]
# Nist | Test Case 7
Key = 000000000000000000000000000000000000000000000000
@@ -104,6 +121,22 @@ In = d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c9
AD = feedfacedeadbeeffeedfacedeadbeefabaddad2
Out = d27e88681ce3243c4830165a8fdcf9ff1de9a1d8e6b447ef6ef7b79828666e4581e79012af34ddd9e2f037589b292db3e67c036745fa22e7e9b7373bdcf566ff291c25bbb8568fc3d376a6d9
+
+[AES-192/GCM(12)]
+# Nist | Test Case 10 with 12 byte tag
+Key = feffe9928665731c6d6a8f9467308308feffe9928665731c
+Nonce = cafebabefacedbaddecaf888
+In = d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
+AD = feedfacedeadbeeffeedfacedeadbeefabaddad2
+Out = 3980ca0b3c00e841eb06fac4872a2757859e1ceaa6efd984628593b40ca1e19c7d773d00c144c525ac619d18c84a3f4718e2448b2fe324d9ccda27102519498e80f1478f37ba55bd
+
+# Nist | Test Case 11 with 12 byte tag
+Key = feffe9928665731c6d6a8f9467308308feffe9928665731c
+Nonce = cafebabefacedbad
+In = d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
+AD = feedfacedeadbeeffeedfacedeadbeefabaddad2
+Out = 0f10f599ae14a154ed24b36e25324db8c566632ef2bbb34f8347280fc4507057fddc29df9a471f75c66541d4d4dad1c9e93a19a58e8b473fa0f062f765dcc57fcf623a24094fcca4
+
[AES-256/GCM]
# Nist | Test Case 13
Key = 0000000000000000000000000000000000000000000000000000000000000000
@@ -144,6 +177,21 @@ In = d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c9
AD = feedfacedeadbeeffeedfacedeadbeefabaddad2
Out = 5a8def2f0c9e53f1f75d7853659e2a20eeb2b22aafde6419a058ab4f6f746bf40fc0c3b780f244452da3ebf1c5d82cdea2418997200ef82e44ae7e3fa44a8266ee1c8eb0c8b5d4cf5ae9f19a
+[AES-256/GCM(12)]
+# Nist | Test Case 16 with 12 byte tag
+Key = feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308
+Nonce = cafebabefacedbaddecaf888
+In = d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
+AD = feedfacedeadbeeffeedfacedeadbeefabaddad2
+Out = 522dc1f099567d07f47f37a32a84427d643a8cdcbfe5c0c97598a2bd2555d1aa8cb08e48590dbb3da7b08b1056828838c5f61e6393ba7a0abcc9f66276fc6ece0f4e1768cddf8853
+
+# Nist | Test Case 17 with 12 byte tag
+Key = feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308
+Nonce = cafebabefacedbad
+In = d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39
+AD = feedfacedeadbeeffeedfacedeadbeefabaddad2
+Out = c3762df1ca787d32ae47c13bf19844cbaf1ae14d0b976afac52ff7d79bba9de0feb582d33934a4f0954cc2363bc73f7862ac430e64abe499f47c9b1f3a337dbf46a792c45e454913
+
[AES-128/GCM(8)]
Key = 00000000000000000000000000000000
Nonce = 000000000000000000000000