While searching for answers ,I understand that RFC AES-CMAC 4493 is suggested by NIST to overcome if payload is not aligned in 16 bytes.

I would like to know what drawbacks/insecure caused by AES-CMAC if length is not aligned in 16 bytes. Would the generated TAG value is easily tampered?

how and when the One-Key CBC MAC1 (OMAC1) is used? here what is the ONE-KEY stands for?( Normal CMAC Gen/Ver - Same single key is used for Generation and verification).

  • $\begingroup$ 1. please link to these claims 2. CMAC seems recommended in line 2, and now there are drawbacks? $\endgroup$ – Maarten Bodewes Jan 23 '18 at 14:36

I hope you mean drawback caused by AES CBC-MAC which is resolved in AES-CMAC.

AES_CBC MAC if used properly with ISO padding technique should not result into a tag collision.

So AES-CBC MAC should look something like this.


[Please look at the image in the above link] In AES-CBC MAC if the last block is not 16 byte alligned(considering AES as PRF) then padding must be done to the last block. Padding should be done based on ISO (100..00) For ISO 1 indicates the start of the padding. If the block is already 16 byte alligned then a dummy block (with ISO padding) should be concatenated . After this only the tag should be calculated.

Let's see the collision situation: last block say m is of 13 bytes. Hence as per ISO padding the block would become m||100 and then tag will be calculated. What if there is a block called m' which ends with 100 as the real data and if the dummy 16 byte block is not added then tag will be of same as with m||100. This means that there is a collision

As per security two different data should not result in the same MAC with the same Key. Hence it can become insecure.

To overcome this, there is a solution in AES_CMAC where there is no need to add a dummy block if the it is already block alligned to the PRF(in this case it is AES then 16 bytes alligned).

In AES CAMC there are three keys (K,K1 and K2). K1 and K2 are derived from K. For the subkeys (K1 and K2 ) generation, please see the section 2.3(Subkey Generation Algorithm) in the below link. https://tools.ietf.org/html/rfc4493

If the last block is not alligned (16 bytes in case AES PRF) then pad the last block as ISO padding . Encrypt it with AES and XOR the output with K1 . The tag is calculated on the XORed output with the same key K.

Please see the imagefor padded case in AES-CMACAES-CMAC last block not alligned to 16 bytes for AES PRF

If the last block is alligned (16 bytes in case AES as PRF) then XOR the output of the block with the K2. The tag is calculated on the XORed output with the same key K.

Please see the image for the non padded case.AES-CMAC for block alligned data

Note: referenced from Professor Don Boneh .

  • $\begingroup$ Thanks for your answers Vikash. Could you share the test vectors with payload not aligned on 16 bytes? so that i can test the CMAC implemented algorithm $\endgroup$ – danny Feb 5 '18 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.