AnsweredAssumed Answered

Calculating CMAC for DESFire EV1

Question asked by David Cleal on Feb 28, 2019
Latest reply on Mar 13, 2019 by David Cleal

I'm working through the examples in AN0945. I'm stuck on table 41, trying to understand how to calculate AES CMACs.


In step one, it says 

...Calculate CMAC on “3D01000000100000010203040 50607080910111213141516” (cmd + file no + offset + length + data) as done in native mode.


I used my CMAC implementation to correctly calculate the CMAC on this as 7CC4A0C770A11F62762F397482F75E92, using the session key, which gives me some confidence that my CMAC implementation is correct. 


However, in step 5, it says

...Calculate CMAC on “00” (success code as in native)... and it says that the result should be 99FF486D1BCE3F24.


I assume this means I should get a 16 byte CMAC and these are the first eight? In any case, if I calculate the CMAC on "00" using the session key of 00112233F9B7C14CCCDDEEFF1E92CBD4, I get something completely different (I actually get 5C0821A202813197E29134F30CF3728D).


So, my question is, does the calculation actually work on just "00"? Is there some other difference between steps 1 and 5? For example, I don't believe that I should use the IV in the CMAC calculation, but perhaps I should?


Thanks in advance


- Dave