Skip to content

Commit

Permalink
Fix error when do PCIE-IDE KeyRefresh
Browse files Browse the repository at this point in the history
Signed-off-by: Min Xu <[email protected]>
  • Loading branch information
mxu9 authored and jyao1 committed Oct 30, 2024
1 parent e15113e commit d0e6124
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion teeio-validator/library/pcie_ide_lib/pcie_ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ bool pcie_ide_alloc_slot_ids(ide_common_test_port_context_t* port_context, uint8
key_iv_slot_usage_map = (1 << keyset.pr/3) | key_iv_slot_usage_map;
}

TEEIO_DEBUG((TEEIO_DEBUG_INFO, "key/iv slot usage: key_iv_slot_usage_map=%08x\n", key_iv_slot_usage_map));
TEEIO_DEBUG((TEEIO_DEBUG_INFO, "key/iv slot usage: key_iv_slot_usage_map=%02x\n", key_iv_slot_usage_map));
for(i = 0; i < num_key_iv_slots / 3; i++) {
uint8_t key_iv_slot = (key_iv_slot_usage_map >> i) & 0x1;
// 0 indicates the slots are free, 1 indicates the slots are occupied.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ bool ide_km_key_prog(

// program key in root port kcbar registers
pcie_construct_rp_keys(key_buffer.key, sizeof(key_buffer.key), keys.bytes, sizeof(keys.bytes));
slot_id = k_set[ks].slot_id[direction][substream];
slot_id = k_set->slot_id[direction][substream];
cfg_rootport_ide_keys(kcbar_ptr, rp_stream_index, direction, ks, substream, slot_id, &keys, &iv);
TEEIO_DEBUG((TEEIO_DEBUG_INFO, "rp key_prog %s|%s|%s - @key/iv slot[%02x]\n", k_set_names[ks], direction_names[direction], substream_names[substream], slot_id));
pcie_dump_key_iv_in_rp(direction == PCIE_IDE_STREAM_RX ? "TX" : "RX", (uint8_t *)keys.bytes, sizeof(keys.bytes), (uint8_t *)iv.bytes, sizeof(iv.bytes));
Expand Down Expand Up @@ -459,10 +459,6 @@ bool ide_key_switch_to(void* doe_context, void* spdm_context,
// step 2: program keys in rp/dev in RX/TX direction

// Before programming keys, we shall find empty key/iv slot
if(!pcie_ide_alloc_slot_ids(upper_port, rp_stream_index, k_set)) {
return false;
}

while(true) {
if(pcie_ide_alloc_slot_ids(upper_port, rp_stream_index, k_set)) {
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ bool pcie_ide_test_full_keyrefresh_run(void *test_context)
res = ide_key_switch_to(doe_context, spdm_context, &session_id,
upper_port->mapped_kcbar_addr, stream_id,
group_context->k_set, group_context->rp_stream_index,
0, group_context->top->type, upper_port, lower_port, 0, false);
0, group_context->top->type, upper_port, lower_port, mKeySet, false);
if(!res) {
break;
}
Expand Down

0 comments on commit d0e6124

Please sign in to comment.