MAC family

CMAC

The block-cipher MAC standardised by NIST in SP 800-38B, usually instantiated with AES

standard 2 variants NIST SP 800-38B; RFC 4493

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–2006
  1. Specified in NIST SP 800-38B

  2. Specified in RFC 4493

  3. 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

Authentication on devices with an AES core but no hashPayment and smart-card protocolsAutomotive message authentication (AUTOSAR SecOC)IKEv2 PRF (AES-CMAC-PRF-128)

Variants in NextSSL

2
AlgorithmTierSizes (bytes)StandardsAPI
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.