AnsweredAssumed Answered

CSE services in MPC5777c

Question asked by TONG ZHOU on Dec 17, 2018
Latest reply on Dec 18, 2018 by TONG ZHOU

CSE services debug in mpc5777c:

Problem1: authentication for master ECU key

1, after set authkey(master ecu key), then check if the written key is the known key. Referring to manual of mpc5777c, compare UIDmac what is generated by get UID command with the mac calculated over the concatenation of a 128-bit input challenge value, UID(120bit), and CSE_SR[24:31] as the manual said. But the result of verify mac command indicated that is mismatched. source code for example:

for (i = 0; i < 16; i++)
{
verif[i] = get_id_challenge[i];}   //fill msg content 0~15 byte with challange value;
for (i = 0; i < 15; i++)
{
verif[16 + i] = UID[i];} //fill msg content 16~30 byte with UID generated by get UID command;
verif[31] = sreg; //fill msg content 31 byte with sreg generated by get UID command correspond to cse_sr[24]~cse_sr[31]
stat = CSE_DRV_LoadPlainKey(g_authIdKey);
if (stat != CSE_NO_ERR)
return stat;
stat = CSE_DRV_VerifyMAC(CSE_RAM_KEY, verif,256,UID_MAC, 128U);

to authenticate the g_authIdKey is the designed key, i called a load key command, the result indicated the g_authIdKey is what i have designed, wihch has been written into CSE, so eliminate the fault of g_authIdKey otherwise load new key will not success.

 

Problem2: erase all user key process

 

as you konwn, DbgAuth command need an authentication input, what is described as using the DEBUG_CHAL command output and the UID, so i want be sure that the input is simply the concatenation of random challenge generated by DEBUG_CHAL command and UID.

source code for example:

stat = CSE_DRV_DbgChal(challenge);
if (stat != CSE_NO_ERR)
return stat;

for (i = 0; i < 16; i++)
{
authPlain[i] = challenge[i];} //fill authPlain text with random challenge value generated by get DEBUG_CHAL ;
for (i = 0; i < 15; i++)
{
authPlain[i + 16] = uid[i];}   //fill authPlain text with UID value what is generated by get UID command;

stat = CSE_DRV_GenerateMAC(CSE_RAM_KEY, authPlain, 248U, auth);
if (stat != CSE_NO_ERR)
return stat;

stat = CSE_DRV_DbgAuth(auth);

 

I will appreciate anyone for answering the above questions.

 

 

Outcomes