NTAG 424 DNA, CMAC calculation fails

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NTAG 424 DNA, CMAC calculation fails

926 Views
stephanej
Contributor I

Hello,

I'm working with the NTAG 424 DNA.
I'm trying to calculate the CMAC as described in the document "an507215 - AN12196 NTAG 424 DNA Features and hints", page 11, but I don't have the same result.
https://ntag.nxp.com/424?uid=04C767F2066180&ctr=000001&c=54A45B2C3A558765

KSDMFileRead: 00000000000000000000000000000000
AppKey      : 00000000000000000000000000000000
UID         : 04C767F2066180
SDMReadCtr  : 010000

SV2               : 3CC30001008004C767F2066180010000
KSesSDMFileReadMAC: 0EC94BE3E0664FAF2BE300DFB16E1B66

DynamicFileData   : ntag.nxp.com/424?uid=04C767F2066180&ctr=000001&c=
DynamicFileDataHex: 6E7461672E6E78702E636F6D2F3432343F7569643D3034433736374632303636313830266374723D30303030303126633D
CMAC (full) : A1DBED758F37BACEF0916F7602EC913C
CMAC        : DB7537CE9176EC3C


Whit is wrong in my calculation ???

Best Regards, Stéphane

0 Kudos
3 Replies

688 Views
Jonathan_Iglesias
NXP TechSupport
NXP TechSupport

Dear Stéphane Joly,

I wonder if you are following the procedure explained  in section 4.4.4.2  as you can see there is a "zero length input" MAC  please try to use this section as an example if you are still having issues please send me your procedure like a command log or something that tells me what are you following in order to get the answer. 

looking forward to your message.

Have a great day !
BR

Jonathan

0 Kudos

688 Views
stephanej
Contributor I

Hello Jonathan,

Here is my calculation with a zero input MAC:

url: https://ntag.nxp.com/424?uid=04C767F2066180&ctr=000001&c=54A45B2C3A558765
KSDMFileRead: 00000000000000000000000000000000
UID         : 04C767F2066180
SDMReadCtr  : 010000

SV2               : 3CC30001008004C767F2066180010000

MAC AES-128 of SV2, with key KSDMFileRead
KSesSDMFileReadMAC: 0EC94BE3E0664FAF2BE300DFB16E1B66 (MAC AES-128 of SV2, with key KSDMFileRead)

DynamicFileData   :
DynamicFileDataHex:
MAC AES-128 of "", with key KSessFileReadMAC

CMAC (full) : 110DCA70D1AE90BD910589BCD9D924CC
CMAC        : 0D70AEBD05BCD9CC

Still not equal to the CMAC in the URL.....

I made the calculation for table 5. and table 6. and I get good results, CMAC matches perfectly, no problem !!!

It's only for this simple example in figure 1. that I have problems.

0 Kudos

688 Views
Jonathan_Iglesias
NXP TechSupport
NXP TechSupport

My recommendation would be that you use as an example  the ones in the section  of examples  I am not sure if the one you want to replicate was used just for demonstration purposes, I will try to check with the team in charge of this documents.   please base your calculations on tables like 5 and 6

BR

Jonathan

0 Kudos