AnsweredAssumed Answered

Typo on CRC32 value of Keyblob example?

Question asked by Javier Soriano on Dec 12, 2016
Latest reply on Dec 21, 2016 by Javier Soriano

Hello, 

 

I am following the example code from the file: K82P121M150SF5RM.pdf for the Freedom K82f board. 

 

In page 174, there is an example on what the keyblob should look like before and after AES-128 encryption. 

 

I do not see however, an explanation on how the CRC32 checksum is calculated. I have tried using the fsl_crc code, but it gives me different checksum values. 

 

Unlikely but possible: The description says the en address is 0x68ffffff, but the memdump says the value is 0x68fffffb. But I am not sure about this, since the lower part of the end address is supposed to correspond to other flags.

 

Some questions:

- Must the keyblob always be aes-128 encrypted?

- Is it mandatory to use an encrypted keyblob to use the OTFAD?

- Is there already an AES-128 implementation included somewhere on the SDK?

 

An extract of my code, basically copied from the crc example on the SDK:

 

static void InitCrc32(CRC_Type *base, uint32_t seed)

{   

crc_config_t config;   

config.polynomial = 0x04C11DB7U;   

config.seed = seed;   

config.reflectIn = true;   

config.reflectOut = true;   

config.complementChecksum = true;   

config.crcBits = kCrcBits32;   

config.crcResult = kCrcFinalChecksum;   

CRC_Init(base, &config);

}

 

static uint32_t calc_crc32(uint8_t* data, size_t len)

{   

uint32_t checksum32;   

CRC_Type *base = CRC0;   

InitCrc32(base, 0xFFFFFFFFU);   

CRC_WriteData(base, data, len);   

checksum32 = CRC_Get32bitResult(base);   

return checksum32;

}

 

 

crc32 = calc_crc32((uint8_t*)data, 0x20);

 

Any pointers will be greatly appreciated.

 

Javier

Outcomes