CMAC
The block-cipher MAC standardised by NIST in SP 800-38B, usually instantiated with AES
Overview
CMAC is a message authentication code built from a block cipher. It is the NIST-approved fix for CBC-MAC's problems with variable-length messages and is widely used with AES in payment, smart-card, automotive and network protocols.
CMAC processes the message like CBC-MAC: each block is XORed into a running value and encrypted. Before the final block is processed, one of two subkeys K1 or K2, derived by multiplying the encryption of zero by x or x² in GF(2^128), is XORed in. Which subkey is used depends on whether the last block is complete or padded, so padding cannot be exploited to forge tags.
The construction is OMAC1 by Tetsu Iwata and Kaoru Kurosawa, standardised in SP 800-38B in 2005. NextSSL includes AES-CMAC (RFC 4493) and AES-CMAC-PRF-128 (RFC 4615), a pseudo-random function variant that accepts keys of any length for use in IKEv2 key derivation. CMAC is also the MAC inside AES-SIV. It needs only the AES encryption direction.
History
2005–2006Specified in NIST SP 800-38B
Specified in RFC 4493
Specified in RFC 4615
Security notes
AES-CMAC is secure up to about 2^64 blocks under one key, after which birthday-bound forgeries become possible. Tags should be compared in constant time, and keys must not be reused for other purposes such as encryption.
Typical uses
Variants in NextSSL
2| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| AES-CMAC aes-cmac |
standard FIPS | key 16–32 · tag 16 | RFC 4493, NIST SP 800-38B | safe |
| AES-CMAC-PRF-128 aes-cmac-prf-128 |
standard | key 1–268435456 · tag 16 | RFC 4615 | safe |
Frequently asked questions
Which CMAC variants does NextSSL include?
NextSSL registers 2 CMAC variants: aes-cmac, aes-cmac-prf-128.
Families with similar names
Other message authentication codes
All 30Related
The Advanced Encryption Standard: the world's default 128-bit block cipher
HMAC_DRBGNIST SP 800-90A deterministic random bit generator built on HMAC
CBC-MAC and DES-MACThe original block-cipher MAC: secure only for fixed-length messages
HMACThe standard way to build a MAC from a cryptographic hash (RFC 2104, FIPS 198-1)
PMACRogaway's fully parallelisable block-cipher MAC