One-key MAC


One-key MAC is a message authentication code constructed from a block cipher much like the CBC-MAC algorithm.
Officially there are two OMAC algorithms which are both essentially the same except for a small tweak.
OMAC1 is equivalent to CMAC, which became an NIST recommendation in May 2005.
It is free for all uses: it is not covered by any patents.
In cryptography, CMAC is a block cipher-based message authentication code algorithm. It may be used to provide assurance of the authenticity and, hence, the integrity of binary data. This mode of operation fixes security deficiencies of CBC-MAC.
The core of the CMAC algorithm is a variation of CBC-MAC that Black and Rogaway proposed and analyzed under the name XCBC and submitted to NIST. The XCBC algorithm efficiently addresses the security deficiencies of CBC-MAC, but requires three keys. Iwata and Kurosawa proposed an improvement of XCBC and named the resulting algorithm One-Key CBC-MAC in their papers. They later submitted OMAC1, a refinement of OMAC, and additional security analysis. The OMAC algorithm reduces the amount of key material required for XCBC. CMAC is equivalent to OMAC1.
To generate an ℓ-bit CMAC tag of a message using a b-bit block cipher and a secret key, one first generates two b-bit sub-keys using the following algorithm. Let ≪ denote the standard left-shift operator and ⊕ denote bit-wise exclusive or:
  1. Calculate a temporary value k0 = Ek.
  2. If msb = 0, then k1 = k0 ≪ 1, else k1 = ⊕ C; where C is a certain constant that depends only on b.
  3. If, then, else.
  4. Return keys for the MAC generation process.
As a small example, suppose,, and. Then and.
The CMAC tag generation process is as follows:
  1. Divide message into b-bit blocks, where m1,..., mn−1 are complete blocks.
  2. If mn is a complete block then else.
  3. Let.
  4. For, calculate.
  5. Output.
The verification process is as follows:
  1. Use the above algorithm to generate the tag.
  2. Check that the generated tag is equal to the received tag.

    Implementations