LoRaWAN Multicast-Frame Payload size (TTN/TTI)

Even if it’s utterly absurd use SF12 with 51 bytes I would like to understand what is the problem in the chain NS-Gateway-End Node.

When i Schedule less than 29 bytes TTI send on my end-nodes that data:

Cattura1

Cattura2

MIC (TTI) : “BRVf6g==” (base64) —> 0xEA5F1505 (hex)

My end-nodes when receive that packet save MIC(TTI) inside “expectedCmac” variable than calculate the MIC from the MAC payload and save the result inside “compCmac”. Finally check if “expectedCmac” is equal to “compCmac”, if it’s not there is a problem on message integrity.

Here is my code (this section inside LoRaMAC.c was written by Semtech):


SecureElementStatus_t SecureElementVerifyAesCmac( uint8_t* buffer, uint16_t size, uint32_t expectedCmac,
                                                  KeyIdentifier_t keyID )
{
    if( buffer == NULL )
    {
        return SECURE_ELEMENT_ERROR_NPE;
    }

    SecureElementStatus_t retval = SECURE_ELEMENT_ERROR;
    uint32_t compCmac = 0;
    retval = ComputeCmac( NULL, buffer, size, keyID, &compCmac );
    if( retval != SECURE_ELEMENT_SUCCESS )
    {
        return retval;
    }

    if( expectedCmac != compCmac )
    {
        retval = SECURE_ELEMENT_FAIL_CMAC;
    }

    return retval;
}

When I send less than 29 bytes or less expectedCmac = compCmac = 0xEA5F1505 that corrisponds with MIC encoded by TTN.

When I schedule 51 bytes these are the results:

Cattura3

Cattura4

MIC (TTI) : “g2XPbA==”(base64) —> 0x6CCF6583 (hex)
expectedCmac = 0x280D2AC compCmac = 0x14BA7C0D

Why is it so ?