This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

AES CCM encryption by S132 timeslot API

Hi,

I have tested AES-CCM of nRF52832 with reference to the following answered questions.

devzone.nordicsemi.com/.../

devzone.nordicsemi.com/.../

devzone.nordicsemi.com/.../

I have confirmed that the NIST example would produce correct results.(Example1 and Example2 in NIST documents)

Reference : NIST Special Publication 800-38C;
Test environment : Java + BouncyCastle(bcprov-jdk15on-158.jar);
Test Input
  ・Key      :01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01;
  ・Nonce    :00 00 00 00 00 02 02 02 02 02 02 02 02;
  ・MACLength:4byte Fix;
  ・AssociatedDataString:empty;
  ・PlainText:00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ; 
OutputData  :0d af 4b 8e 52 50 3a 6e 91 f4 d8 34 26 9b 4e 74;
MIC   :d5 6e b7 75

However, when I encrypted AES-CCM of nRF52832,the MIC did not match the expected results.The result is as follows.(Data structure for unencrypted packet is specified by LENGTH / PAYLOAD.)

Reference : nRF52832 Product Specification v1.3, 29 CCM - AES CCM mode encryption;  
Test envirionment : Nordic nRF52832 DK board and nRF5 SDK v13.1.0;  
Test Input
  ・Key      :01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 (KEY);
  ・Nonce    :00 00 00 00 00 02 02 02 02 02 02 02 02 (PKTCTR:5byte, IV:8byte);
  ・MACLength:4byte Fix;
  ・AssociatedDataString:"There are no registers to set associated data structure.";
  ・PlainText:00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f;
 Output  Data  :0d af 4b 8e 52 50 3a 6e 91 f4 d8 34 26 9b 4e 74;
 MIC   :6d da 11 ad;

The encrypted data matched, but the MIC is wrong.

How to get a correct MIC result by AES CCM mode encryption of nRF52832 correct? Is it unnecessary to set AssociatedDataString ?

Thank you in advance.

Related