Hi Lucas,
I followed your advise and it did not work.
I mean I still can not load KEY_1, NOW YOU JUST CHANGE THE NAME OF POINTER TO THE FUNCTION. THAT SHOIULD NOT MATTER.
I did what you did however the result is the same :
I can successfully load the ECU_MASTER_KEY_VALUE of zeros but it fails in loading KEY_1.
I used several boards to do this, the RESET_PARTS_TO_FACTORY_RESET does not work even with
ECU_MASTER_KEY_VALUE of zeros . so each time I need to do this on a new PCB.
This a mystery, here is the modified code based on your suggestion:
* CSEc_keys.h
*
* Created on: Oct 19, 2016
* Author: B55457
*/
#ifndef CSEC_KEYS_H_
#define CSEC_KEYS_H_
uint32_t BLANK_KEY_VALUE[4] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; //When key value is not written it is all FFs
//uint32_t MASTER_ECU_KEY_VALUE[4] = {0xD275F12C, 0xA863A7B5, 0xF933DF92, 0x6498FB4D}; //MASTER_ECU_KEY
//uint32_t MASTER_ECU_KEY_VALUE[4] = {0x43414e44, 0x69566120, 0x4d535452, 0x204b4559}; //MASTER_ECU_KEY_GM
uint32_t MASTER_ECU_KEY_VALUE[4] = {0, 0, 0, 0};
uint32_t KEY_1_VALUE[4] = {0, 0, 0, 0};
uint32_t BOOT_MAC_KEY_VALUE[4] = {0x12340000, 0x00000000, 0x00000000, 0x00005678}; //BOOT_MAC_KEY
//uint32_t KEY_1_VALUE[4] = {0x2FF8B03C, 0x5C540546, 0x5A9C94BD, 0x2D863279}; //KEY_1
uint32_t KEY_11_VALUE[4] = {0x85852FF8, 0xE7860C89, 0xB3AB9D63, 0xB8D6288F}; //KEY_11
uint32_t RAM_KEY_VALUE[4] = {0x68B674CB, 0x8198A250, 0x3A285100, 0xF4DDC40A}; //RAM_KEY
//uint32_t ZERO_KEY_VALUE[4] = {0x00000000, 0x00000000, 0x00000000, 0x00000000};
#endif /* CSEC_KEYS_H_ */
/* Load KEY_1 */
calculate_M1_to_M5(M1, M2, M3, M4, M5, MASTER_ECU_KEY_VALUE/*ZERO_KEY_VALUE*/, KEY_1_VALUE/*ZERO_KEY_VALUE*/, MASTER_ECU_KEY, KEY_1, 1, 0); /* Calculate M1 to M5 in Software, Authorizing Key = Master ECU Key */
csec_error = LOAD_KEY(M4_out, M5_out, M1, M2, M3, KEY_1); /* Load the key using M1 to M3, returns M4 and M5 */
result = compare_results(M4, M4_out); /* Compare M4 generated by SW with the M4_out returned by CSEc */
Thanks,
Koorosh Hajiani