This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ESB aes-ccm MIC verify

Hi

We are verifying the encrypt value and MIC value using a crypto tool.

The result is different depending on the setting of the packet S0 field.

If the S0 field is set as below, the MIC value is checked correctly.

NRF->RADIO->PCNF0 = (1 << RADIO_PCNF0_S0LEN_Pos) | ...

But if i set the S0 field to 0, the MIC value is wrong.

NRF->RADIO->PCNF0 = (0 << RADIO_PCNF0_S0LEN_Pos) | ...

Is it possible to use aes-ccm only when the S0 field is set to 1?

Parents
  • Hi 

    The CCM module is designed with Bluetooth encryption in mind, and Bluetooth uses a 2-byte packet header that requires the S0 field to be set to 1. I will have to double check this with the hardware team, but I believe the MIC check will only work when the radio is configured in a Bluetooth compliant mode, which would explain why S0 has to be 1 byte long. 

    I will get this confirmed and get back to you. 

    Best regards
    Torbjørn

Reply
  • Hi 

    The CCM module is designed with Bluetooth encryption in mind, and Bluetooth uses a 2-byte packet header that requires the S0 field to be set to 1. I will have to double check this with the hardware team, but I believe the MIC check will only work when the radio is configured in a Bluetooth compliant mode, which would explain why S0 has to be 1 byte long. 

    I will get this confirmed and get back to you. 

    Best regards
    Torbjørn

Children
  • Hi

    The team confirmed that S0 has to be used in order for the CCM to work properly. 

    Best regards
    Torbjørn

  • clear_buffer[CCM_IN_HEADER_INDEX] = 0;
    clear_buffer[CCM_IN_LENGTH_INDEX] = (uint8_t)packet_length;
    clear_buffer[CCM_IN_RFU_INDEX] = 0;
    memcpy(&clear_buffer[CCM_IN_PAYLOAD_INDEX], packet, packet_length);
    NRF_CCM->INPTR = (uint32_t)clear_buffer;

     
    I understood  the above code , when the S0 field is set to 1, it is used as follows.

     AAD                  plain text

    | S0 | length | S1(RFU) | payload |



    How to use 'AAD' when S0 field is set to 0?

    AAD?                   plain text

    | X | length | S1(RFU) | payload |




  • Hi 

    What is "AAD" a reference to? 

    I can't find this acronym in our CCM documentation. 

    The problem with using the CCM when S0 is set to 0 is that the CCM module always assume that the S0 field is there, and if you are receiving data over the air without S0 included then the CCM module will process the data incorrectly. 

    Best regards
    Torbjørn

Related