Handling of CMAC operations for application spread over two read partition (more than 512 KB)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Handling of CMAC operations for application spread over two read partition (more than 512 KB)

1,575件の閲覧回数
LatureR
Contributor III

Hello NXP team,

We are using mac generation and verification mechanism using CSEc using pointer method for secure boot functionality. 

As mentioned in below snap from S32K reference manual, We can use maximum size of data limited to be no more than one read partition, or less if the starting address is not the start of the read partition.

 

LatureR_0-1633498621421.jpeg

In our case we are using S32k148, so maximum CMAC can be calculated on 512KB program flash block.

For our project, application area is from 0x50000 – 0x11FFFF which is spread over two read partitions.

In this case we are facing the issue of CMAC calculation over application area. Please suggest the way to perform MAC operation in this case. Please provide sample code if possible. 

We tried to check application note AN4235 but it's not clear so requesting you provide support. 

0 件の賞賛
返信
2 返答(返信)

1,564件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

the secure boot itself can cover up to 512KB (i.e. one partition). The start address for secure boot is always 0x0 and it cannot be changed.

If you need to cover also rest of the flash, it is necessary to create a chain of trust: code (typically a bootloader) starting at 0x0 which is protected by secure boot should calculate and compare CMAC over next required areas. If these areas are spread over more partitions, it is necessary to calculate more CMACs. Based on the result, the code can execute CMD_BOOT_OK or CMD_BOOT_FAILURE command, so the application can or cannot use boot protected keys.

AN4235 was written for MPC5646C, you should follow this one (examples included):

https://www.nxp.com/webapp/Download?colCode=AN5401&location=null

https://www.nxp.com/webapp/Download?colCode=AN5401SW&location=null

Regards,
Lukas

0 件の賞賛
返信

1,188件の閲覧回数
baichuan
Contributor II

Hi,

1. We have encountered a difficult problem, when I use CSEC_DRV_GenerateMACAddrMode(the size is 64k bytes and start address is 0x10000.) to calculate CMAC value in bootloader,the board will reset and rigister RCM_SRS[LOCKUP] = 1, I want to know why it occurs and how to solve this problem?

const uint8_t *flash_pointer = (uint8_t *)(0x10000);

uint32_t aplLenth = 64 * 1024 * 8;

uint8_t cmacValue[16];

stat = CSEC_DRV_GenerateMACAddrMode(CSEC_KEY_11, flash_pointer, aplLenth, cmacValue);

2. if I try to use chain of trust to verify apl, Where should CMAC be stored? if this is possible to Use CSEC_DRV_VerifyMACAddrMode to verify? because of the APL image occupies 2 read partitions, Whether or not we should generate two CMAC

 

board: S32K146

partition: bootloader:0x00000-0x10000 ,apl:0x10000-0xFFFFF

csec repository: SDK_S32K1xx_15

 

0 件の賞賛
返信