MAC family

CBC-MAC and DES-MAC

The original block-cipher MAC: secure only for fixed-length messages

legacy 2 variants ANSI X9.9; FIPS 113 (withdrawn); ISO/IEC 9797-1

Overview

CBC-MAC computes a tag by encrypting a message in CBC mode with a zero IV and keeping the last ciphertext block. It is one of the oldest MAC constructions, standardised for DES as DES-MAC in ANSI X9.9 and FIPS 113.

CBC-MAC XORs each message block into the previous cipher output and encrypts the result. When all messages have the same fixed length, this is a secure pseudo-random function. When lengths vary, an attacker who knows the tags of two messages can construct a third valid message-tag pair by splicing, because the tag of one message is the chaining value for the next. This led to the development of CMAC, which fixes the problem with subkey masking.

NextSSL includes generic CBC-MAC as described in ISO/IEC 9797-1 algorithm 1 and DES-MAC from the withdrawn FIPS 113, both for legacy interoperability. Some protocols prepend the length or use a separately derived final key, as EMAC and ISO/IEC 9797-1 algorithm 2 do, to make CBC-MAC safe for variable lengths. CCM mode uses CBC-MAC internally, with the length encoded in the first block.

History

1985–2001
  1. Specified in FIPS 113

  2. Specified in NIST SP 800-38A

Security notes

Plain CBC-MAC is forgeable for variable-length messages and must not be used unless the length is fixed and authenticated. DES-MAC additionally relies on 56-bit DES and is broken by exhaustive key search. Use CMAC or HMAC instead.

Typical uses

Verifying legacy banking and ANSI X9.9 MACsTeaching why CMAC exists

Variants in NextSSL

2
AlgorithmTierSizes (bytes)StandardsAPI
CBC-MAC
cbc-mac
legacy key 16–32 · tag 16 · block 16 ISO/IEC 9797-1 (algorithm 1), NIST SP 800-38A (CBC) root
DES-MAC
des-mac
broken key 8 · tag 8 · block 8 FIPS 113 (withdrawn), ANSI X9.9 root

Frequently asked questions

Which CBC-MAC and DES-MAC variants does NextSSL include?

NextSSL registers 2 CBC-MAC and DES-MAC variants: cbc-mac, des-mac.