Home GnuPG

cipher: GCM: check that length of supplied tag is one of valid lengths
f2260e3a2e96Unpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

cipher: GCM: check that length of supplied tag is one of valid lengths

* cipher/cipher-gcm.c (is_tag_length_valid): New.
(_gcry_cipher_gcm_tag): Check that 'outbuflen' has valid tag length.
* tests/basic.c (_check_gcm_cipher): Add test-vectors with different
valid tag lengths and negative test vectors with invalid lengths.

NIST SP 800-38D allows following tag lengths:
128, 120, 112, 104, 96, 64 and 32 bits.

[v2: allow larger buffer when outputting tag. 128-bit tag is written

to target buffer in this case]
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Mar 27 2016, 10:17 AM
Parents
rC4a064e2a06fe: cipher: Fix memleaks in (self)tests.
Branches
Unknown
Tags
Unknown

Event Timeline

Jussi Kivilinna <jussi.kivilinna@iki.fi> committed rCf2260e3a2e96: cipher: GCM: check that length of supplied tag is one of valid lengths (authored by Jussi Kivilinna <jussi.kivilinna@iki.fi>).Mar 27 2016, 10:17 AM