Skip to content

Commit 716ddb2

Browse files
committed
Report 3110
1 parent c6c0ad9 commit 716ddb2

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

test/wh_test_she.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,44 @@ int whTest_SheClientConfig(whClientConfig* config)
405405
WH_TEST_PRINT("SHE LOAD KEY UID checks SUCCESS\n");
406406
}
407407

408+
/* _LoadKey M3 CMAC auth (report 3110): a corrupted M3 with valid M1/M2 must
409+
* be rejected; reloading with the restored M3 at the same counter then
410+
* succeeds, proving the rejected load left the slot untouched. */
411+
{
412+
uint8_t savedM3;
413+
414+
if ((ret = wh_She_GenerateLoadableKey(
415+
SHE_TEST_VECTOR_KEY_ID, WH_SHE_MASTER_ECU_KEY_ID, 2, 0, sheUid,
416+
vectorRawKey, vectorMasterEcuKey, messageOne, messageTwo,
417+
messageThree, messageFour, messageFive)) != 0) {
418+
WH_ERROR_PRINT("Failed to generate M3-test M1/M2/M3 %d\n", ret);
419+
goto exit;
420+
}
421+
422+
savedM3 = messageThree[0];
423+
messageThree[0] ^= 0xFF;
424+
ret = wh_Client_SheLoadKey(client, messageOne, messageTwo, messageThree,
425+
outMessageFour, outMessageFive);
426+
if (ret != WH_SHE_ERC_KEY_UPDATE_ERROR) {
427+
WH_ERROR_PRINT("SHE LOAD KEY corrupt M3: expected "
428+
"KEY_UPDATE_ERROR, got %d\n",
429+
ret);
430+
ret = WH_ERROR_ABORTED;
431+
goto exit;
432+
}
433+
434+
messageThree[0] = savedM3;
435+
if ((ret = wh_Client_SheLoadKey(client, messageOne, messageTwo,
436+
messageThree, outMessageFour,
437+
outMessageFive)) != 0) {
438+
WH_ERROR_PRINT("SHE LOAD KEY restored M3: expected success, "
439+
"got %d\n",
440+
ret);
441+
goto exit;
442+
}
443+
WH_TEST_PRINT("SHE LOAD KEY M3 CMAC auth SUCCESS\n");
444+
}
445+
408446
if ((ret = wh_Client_SheInitRnd(client)) != 0) {
409447
WH_ERROR_PRINT("Failed to wh_Client_SheInitRnd %d\n", ret);
410448
goto exit;

0 commit comments

Comments
 (0)