Skip to content

Commit

Permalink
Fix MEAS algorithm negotiate
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaohanjlll <[email protected]>
  • Loading branch information
Xiaohanjlll committed Jan 30, 2024
1 parent 9d562f4 commit 47d7fed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -409,6 +409,11 @@ static libspdm_return_t libspdm_try_negotiate_algorithms(libspdm_context_t *spdm
status = LIBSPDM_STATUS_NEGOTIATION_FAIL;
goto receive_done;
}
} else {
if (spdm_context->connection_info.algorithm.measurement_spec != 0) {
status = LIBSPDM_STATUS_INVALID_MSG_FIELD;
goto receive_done;
}
}

if (libspdm_is_capabilities_flag_supported(
Expand Down
18 changes: 12 additions & 6 deletions library/spdm_responder_lib/libspdm_rsp_algorithms.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright Notice:
* Copyright 2021-2022 DMTF. All rights reserved.
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/

Expand Down Expand Up @@ -563,11 +563,17 @@ libspdm_return_t libspdm_get_response_algorithms(libspdm_context_t *spdm_context
}
}

spdm_response->measurement_specification_sel = (uint8_t)libspdm_prioritize_algorithm(
measurement_spec_priority_table,
LIBSPDM_ARRAY_SIZE(measurement_spec_priority_table),
spdm_context->local_context.algorithm.measurement_spec,
spdm_context->connection_info.algorithm.measurement_spec);
if (libspdm_is_capabilities_flag_supported(
spdm_context, false, 0,
SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) {
spdm_response->measurement_specification_sel = (uint8_t)libspdm_prioritize_algorithm(
measurement_spec_priority_table,
LIBSPDM_ARRAY_SIZE(measurement_spec_priority_table),
spdm_context->local_context.algorithm.measurement_spec,
spdm_context->connection_info.algorithm.measurement_spec);
} else {
spdm_response->measurement_specification_sel = 0;
}

spdm_response->measurement_hash_algo = libspdm_prioritize_algorithm(
measurement_hash_priority_table,
Expand Down

0 comments on commit 47d7fed

Please sign in to comment.