Message authentication codes

AES-GMAC

The authentication-only mode of AES-GCM: a nonce-based MAC from GHASH and AES

standard Safe API Specified in a FIPS standard

About AES-GMAC

AES-GMAC is a message authentication code. It uses a 16–32-byte key, a 16-byte (128-bit) authentication tag and a 12-byte (96-bit) block. Its registry entry cites NIST SP 800-38D (GMAC). It is also known as gmac and aes-gmac-96. NextSSL lists it in the standard tier and exposes it through the safe API.

Overview

GMAC is the authentication-only special case of the Galois/Counter Mode defined in NIST SP 800-38D. It authenticates data without encrypting anything, using the same GHASH polynomial hash and AES-encrypted mask as AES-GCM.

GMAC derives a hash key H by encrypting the zero block with AES, evaluates the GHASH polynomial over the message and its length in GF(2^128) at point H, and XORs the result with the AES encryption of a counter block derived from the nonce. It is extremely fast where carry-less multiplication instructions are available, and parallelisable.

GMAC is used in IPsec (RFC 4543) and in MACsec where integrity without confidentiality is needed. NextSSL exposes AES-GMAC with 128-, 192- and 256-bit AES keys as determined by the key length supplied. In NextSSL it is tiered as standard. GMAC shares the GCM nonce rules, so standard 96-bit nonces are preferred.

History

2007–2007
  1. Specified in NIST SP 800-38D

Security notes

GMAC requires a unique nonce for every message under a key. Reusing a nonce allows an attacker to recover the hash key H and forge tags for arbitrary messages. Truncated tags weaken GHASH-based MACs more than most, so SP 800-38D permits short tags only with strict usage limits.

Typical uses

IPsec authentication-only (ENCR_NULL_AUTH_AES_GMAC)MACsec integrityHigh-speed authentication with AES hardware

Sizes

FieldBytesMeaning
key16 – 32Secret key
tag16Authentication tag
block12Block

Use it

from nextssl_demo import NextSSL

ns = NextSSL()              # safe API: safe and standard tiers
key = ns.random(16)
tag = ns.call("mac", "aes-gmac", None, key, b"message", 0)[0]
ok  = ns.check("mac_verify", "aes-gmac", None, key, b"message", tag)

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Frequently asked questions

What is AES-GMAC?

AES-GMAC is a MAC in the AES-GMAC family. GMAC is the authentication-only special case of the Galois/Counter Mode defined in NIST SP 800-38D. It is also known as gmac, aes-gmac-96.

What are the AES-GMAC sizes?

In NextSSL, AES-GMAC uses: key 16 to 32 bytes, tag 16 bytes, block 12 bytes.

Who designed AES-GMAC and when?

AES-GMAC belongs to the AES-GMAC family, first published in 2007 by David McGrew, John Viega. Its origin: NIST SP 800-38D.

Which standards define AES-GMAC?

AES-GMAC is referenced by NIST SP 800-38D (GMAC). It is specified in a FIPS standard.

Is AES-GMAC safe to use?

AES-GMAC is in the standard tier. Standardised and sound. Reachable from the safe API. It can be called from the safe API.