From b9d7dfc61fbf0ce393ff8a6c0227ab949751adb2 Mon Sep 17 00:00:00 2001 From: Wenxing Hou Date: Thu, 1 Feb 2024 09:46:18 +0800 Subject: [PATCH] Fix hardcode when set LIBSPDM_DATA_LOCAL_SUPPORTED_SLOT_MASK Fix the issue: #333 Signed-off-by: Wenxing Hou --- spdm_emu/spdm_requester_emu/spdm_requester_spdm.c | 5 ++++- spdm_emu/spdm_responder_emu/spdm_responder_spdm.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/spdm_emu/spdm_requester_emu/spdm_requester_spdm.c b/spdm_emu/spdm_requester_emu/spdm_requester_spdm.c index 3ca44d2b..f1fc1b76 100644 --- a/spdm_emu/spdm_requester_emu/spdm_requester_spdm.c +++ b/spdm_emu/spdm_requester_emu/spdm_requester_spdm.c @@ -547,7 +547,10 @@ void *spdm_client_init(void) libspdm_zero_mem(¶meter, sizeof(parameter)); parameter.location = LIBSPDM_DATA_LOCATION_LOCAL; - data8 = 0x3F; + data8 = 0; + for (index = 0; index < m_use_slot_count; index++) { + data8 |= (1 << index); + } libspdm_set_data(spdm_context, LIBSPDM_DATA_LOCAL_SUPPORTED_SLOT_MASK, ¶meter, &data8, sizeof(data8)); diff --git a/spdm_emu/spdm_responder_emu/spdm_responder_spdm.c b/spdm_emu/spdm_responder_emu/spdm_responder_spdm.c index ba677770..aa114698 100644 --- a/spdm_emu/spdm_responder_emu/spdm_responder_spdm.c +++ b/spdm_emu/spdm_responder_emu/spdm_responder_spdm.c @@ -520,7 +520,10 @@ void spdm_server_connection_state_callback( libspdm_zero_mem(¶meter, sizeof(parameter)); parameter.location = LIBSPDM_DATA_LOCATION_LOCAL; - data8 = 0x3F; + data8 = 0; + for (index = 0; index < m_use_slot_count; index++) { + data8 |= (1 << index); + } libspdm_set_data(spdm_context, LIBSPDM_DATA_LOCAL_SUPPORTED_SLOT_MASK, ¶meter, &data8, sizeof(data8));