Skip to content

Commit

Permalink
Mask other_param for 1.2
Browse files Browse the repository at this point in the history
Signed-off-by: Jiewen Yao <[email protected]>
  • Loading branch information
jyao1 committed Jan 25, 2024
1 parent afae7ad commit e814bc0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
9 changes: 7 additions & 2 deletions library/spdm_requester_lib/libspdm_req_negotiate_algorithms.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,11 @@ static libspdm_return_t libspdm_try_negotiate_algorithms(libspdm_context_t *spdm
spdm_context->local_context.algorithm.measurement_spec;
if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_12) {
spdm_request->other_params_support =
spdm_context->local_context.algorithm.other_params_support;
spdm_context->local_context.algorithm.other_params_support &
SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK;
if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
spdm_request->other_params_support =
spdm_context->local_context.algorithm.other_params_support;
spdm_request->mel_specification =
spdm_context->local_context.algorithm.mel_spec;
}
Expand Down Expand Up @@ -378,8 +381,10 @@ static libspdm_return_t libspdm_try_negotiate_algorithms(libspdm_context_t *spdm
spdm_response->measurement_specification_sel;
if (spdm_response->header.spdm_version >= SPDM_MESSAGE_VERSION_12) {
spdm_context->connection_info.algorithm.other_params_support =
spdm_response->other_params_selection;
spdm_response->other_params_selection & SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK;
if (spdm_response->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
spdm_context->connection_info.algorithm.other_params_support =
spdm_response->other_params_selection;
spdm_context->connection_info.algorithm.mel_spec =
spdm_response->mel_specification_sel;
}
Expand Down
16 changes: 11 additions & 5 deletions library/spdm_responder_lib/libspdm_rsp_algorithms.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,10 @@ libspdm_return_t libspdm_get_response_algorithms(libspdm_context_t *spdm_context
}
if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_12) {
spdm_context->connection_info.algorithm.other_params_support =
spdm_request->other_params_support;
spdm_request->other_params_support & SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK;
if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
spdm_context->connection_info.algorithm.other_params_support =
spdm_request->other_params_support;
spdm_context->connection_info.algorithm.mel_spec =
spdm_request->mel_specification;
}
Expand Down Expand Up @@ -732,14 +734,18 @@ libspdm_return_t libspdm_get_response_algorithms(libspdm_context_t *spdm_context
}
}
if (spdm_response->header.spdm_version >= SPDM_MESSAGE_VERSION_12) {
spdm_context->connection_info.algorithm.other_params_support =
(spdm_context->connection_info.algorithm.other_params_support &
SPDM_ALGORITHMS_MULTI_KEY_CONN) |
(spdm_response->other_params_selection & SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK);
if (spdm_response->header.spdm_version >= SPDM_MESSAGE_VERSION_13) {
spdm_context->connection_info.algorithm.other_params_support =
(spdm_context->connection_info.algorithm.other_params_support &
SPDM_ALGORITHMS_MULTI_KEY_CONN) |
(spdm_response->other_params_selection &
SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK);
spdm_context->connection_info.algorithm.mel_spec =
spdm_response->mel_specification_sel;
} else {
spdm_context->connection_info.algorithm.other_params_support =
(spdm_response->other_params_selection &
SPDM_ALGORITHMS_OPAQUE_DATA_FORMAT_MASK);
spdm_context->connection_info.algorithm.mel_spec = 0;
}
} else {
Expand Down

0 comments on commit e814bc0

Please sign in to comment.