From bdb7f70774080637dddbab4758608a40f3746662 Mon Sep 17 00:00:00 2001 From: Jiewen Yao Date: Mon, 20 Nov 2023 15:38:06 +0800 Subject: [PATCH] 1.3 add mutli_key_conn set/get data. Signed-off-by: Jiewen Yao --- include/library/spdm_common_lib.h | 3 ++ .../libspdm_com_context_data.c | 35 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/library/spdm_common_lib.h b/include/library/spdm_common_lib.h index cb83cc6854c..3a056f4c42c 100644 --- a/include/library/spdm_common_lib.h +++ b/include/library/spdm_common_lib.h @@ -137,6 +137,9 @@ typedef enum { LIBSPDM_DATA_SEQUENCE_NUMBER_ENDIAN, LIBSPDM_DATA_SESSION_SEQUENCE_NUMBER_ENDIAN, + LIBSPDM_DATA_MULTI_KEY_CONN_REQ, + LIBSPDM_DATA_MULTI_KEY_CONN_RSP, + /* MAX */ LIBSPDM_DATA_MAX } libspdm_data_type_t; diff --git a/library/spdm_common_lib/libspdm_com_context_data.c b/library/spdm_common_lib/libspdm_com_context_data.c index 086bd2a5205..4b09b54b9e7 100644 --- a/library/spdm_common_lib/libspdm_com_context_data.c +++ b/library/spdm_common_lib/libspdm_com_context_data.c @@ -705,6 +705,25 @@ libspdm_return_t libspdm_set_data(void *spdm_context, libspdm_data_type_t data_t return LIBSPDM_STATUS_INVALID_PARAMETER; } context->sequence_number_endian = *(uint8_t *)data; + break; + case LIBSPDM_DATA_MULTI_KEY_CONN_REQ: + if (parameter->location != LIBSPDM_DATA_LOCATION_CONNECTION) { + return LIBSPDM_STATUS_INVALID_PARAMETER; + } + if (data_size != sizeof(bool)) { + return LIBSPDM_STATUS_INVALID_PARAMETER; + } + context->connection_info.multi_key_conn_req = *(bool *)data; + break; + case LIBSPDM_DATA_MULTI_KEY_CONN_RSP: + if (parameter->location != LIBSPDM_DATA_LOCATION_CONNECTION) { + return LIBSPDM_STATUS_INVALID_PARAMETER; + } + if (data_size != sizeof(bool)) { + return LIBSPDM_STATUS_INVALID_PARAMETER; + } + context->connection_info.multi_key_conn_rsp = *(bool *)data; + break; default: return LIBSPDM_STATUS_UNSUPPORTED_CAP; break; @@ -994,9 +1013,25 @@ libspdm_return_t libspdm_get_data(void *spdm_context, libspdm_data_type_t data_t case LIBSPDM_DATA_SEQUENCE_NUMBER_ENDIAN: target_data_size = sizeof(uint8_t); target_data = &context->sequence_number_endian; + break; case LIBSPDM_DATA_SESSION_SEQUENCE_NUMBER_ENDIAN: target_data_size = sizeof(uint8_t); target_data = &secured_context->sequence_number_endian; + break; + case LIBSPDM_DATA_MULTI_KEY_CONN_REQ: + if (parameter->location != LIBSPDM_DATA_LOCATION_CONNECTION) { + return LIBSPDM_STATUS_INVALID_PARAMETER; + } + target_data_size = sizeof(bool); + target_data = &context->connection_info.multi_key_conn_req; + break; + case LIBSPDM_DATA_MULTI_KEY_CONN_RSP: + if (parameter->location != LIBSPDM_DATA_LOCATION_CONNECTION) { + return LIBSPDM_STATUS_INVALID_PARAMETER; + } + target_data_size = sizeof(bool); + target_data = &context->connection_info.multi_key_conn_rsp; + break; default: return LIBSPDM_STATUS_UNSUPPORTED_CAP; break;