Skip to content

Commit 48c7b74

Browse files
mxu9jyao1
authored andcommitted
Only Device TX direction KEY/IV are generated by CXL_GETKEY if capable
Signed-off-by: Min Xu <[email protected]>
1 parent 4b8b8d2 commit 48c7b74

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

teeio-validator/library/cxl_ide_test_lib/test_case/ide_km_common.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ static bool cxl_ide_generate_key(const void *pci_doe_context,
7070
memset(key_buffer->key, direction == CXL_IDE_KM_KEY_DIRECTION_RX ? TEEIO_TEST_FIXED_RX_KEY_BYTE_VALUE : TEEIO_TEST_FIXED_TX_KEY_BYTE_VALUE, sizeof(key_buffer->key));
7171
*cxl_ide_km_iv = CXL_IDE_KM_KEY_IV_DEFAULT;
7272
} else {
73-
if(key_iv_gen_capable) {
73+
74+
// According to CXL Spec 3.1 Section 11.4.5, if iv_generation_capable and key_generation_capable are supported,
75+
// key/iv for Device TX direction is recommended to be generated by sending CXL_GETKEY to device (which will then
76+
// generate the key/iv in device side).
77+
if(key_iv_gen_capable && direction == CXL_IDE_KM_KEY_DIRECTION_TX) {
7478
TEEIO_DEBUG((TEEIO_DEBUG_INFO, "Generate key/iv in device with cxl_ide_km_get_key.\n"));
7579
memset(key_buffer->iv, 0, sizeof(key_buffer->iv));
7680
status = cxl_ide_km_get_key(pci_doe_context, spdm_context, session_id,

0 commit comments

Comments
 (0)