Hash Lab

Keyed cryptographic (MAC)

CMAC

Cipher-based Message Authentication Code. Standardized by NIST in SP 800-38B (2005, recommendation), drawing from OMAC1 by Iwata and Kurosawa. CMAC is the canonical block-cipher-based MAC: take any secure block cipher (almost always AES), and CMAC turns it into a secure variable-length MAC.

How it works

At its core CMAC is CBC-MAC with the last block handled specially. Two subkeys K1 and K2 are derived from the main key by encrypting zero and doubling in GF(2128). The message is processed in CBC mode; before the final block, XOR with K1 (if the last block is full) or pad+XOR with K2(if not). The last encryption’s output is the tag.

At a glance

OutputBlock size of cipher (usually 128 bits for AES)
Block cipherAES (CMAC-AES); also Triple-DES historically
StandardsNIST SP 800-38B; RFC 4493 (AES-CMAC)
StatusRecommended for block-cipher-based MAC use

vs HMAC vs Poly1305

Where it shows up

OMAC1 = CMAC

The exact construction NIST standardized is OMAC1, by Iwata and Kurosawa (2003). NIST renamed it CMAC. References to OMAC and CMAC in modern literature mean the same algorithm.

References

Quick quiz

Test yourself on cmac

10 multiple-choice questions. Pick an answer for each, then submit to see explanations.

  1. Q1.Which NIST publication standardizes CMAC?

  2. Q2.CMAC is built on:

  3. Q3.CMAC = OMAC1; OMAC was by:

  4. Q4.Underlying mode of CMAC:

  5. Q5.Common output size of AES-CMAC:

  6. Q6.Which RFC specifies AES-CMAC?

  7. Q7.CMAC vs HMAC main appeal:

  8. Q8.How are K1 and K2 derived?

  9. Q9.Which Wi-Fi standard uses AES-CMAC?

  10. Q10.vs Poly1305 for MAC use:

0 of 10 answered