Hi @lukaszadrapa
Thank you very much for your reply, I think the cause of the problem should be found, I did execute the same program for many times, maybe the MASTER_ECU_KEY was changed in the execution process, but the nxp demo program I use, the Key value is also the default value in the demo, is there any way to restore it?
What if the MASTER_ECU_KEY is actually modified? Can you tell me something that might lead to tampering, something I might not have noticed.
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
/* Output direction for the LEDs */
PINS_DRV_SetPinsDirection(GPIO_PORT, (1 << LED_RED) | (1 << LED_GREEN));
/* Set Output value of the LEDs */
PINS_DRV_ClearPins(GPIO_PORT, (1 << LED_RED) | (1 << LED_GREEN));
bool keyLoaded;
uint8_t key[16] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
/* Initialize CSEc driver */
CSEC_DRV_Init(&csec1_State);
/* Initialize Flash for CSEc operation */
initFlashForCsecOperation();
/* Load the MASTER_ECU key with a known value, which will be used as Authorization
* key (a secret key known by the application in order to configure other user keys) */
setAuthKey();
/* Load the selected key */
/* First load => counter == 1 */
keyLoaded = loadKey(CSEC_KEY_1, key, 1);
keyLoaded = loadKey(CSEC_KEY_11, key, 1);
keyLoaded = loadKey(CSEC_MASTER_ECU, key, 2);
keyLoaded = loadKey(CSEC_KEY_1, key, 2);
keyLoaded = loadKey(CSEC_KEY_11, key, 2);