From 340005492c5aa0f93437159fa0bcf18e2c06e2a4 Mon Sep 17 00:00:00 2001 From: Wenxing Hou Date: Tue, 9 Jul 2024 11:08:54 +0800 Subject: [PATCH] Fix mel and measurement MACRO Fix the issue: #2755 Signed-off-by: Wenxing Hou --- os_stub/spdm_device_secret_lib_sample/lib.c | 4 ++-- unit_test/test_spdm_requester/test_spdm_requester.c | 10 ++++++++-- unit_test/test_spdm_responder/test_spdm_responder.c | 10 ++++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/os_stub/spdm_device_secret_lib_sample/lib.c b/os_stub/spdm_device_secret_lib_sample/lib.c index 816943cfe74..962f2c2c31d 100644 --- a/os_stub/spdm_device_secret_lib_sample/lib.c +++ b/os_stub/spdm_device_secret_lib_sample/lib.c @@ -86,11 +86,11 @@ uint8_t m_libspdm_rsa4096_req_e[] = LIBSPDM_RSA4096_REQ_E; uint8_t m_libspdm_rsa4096_req_d[] = LIBSPDM_RSA4096_REQ_D; #endif /* (LIBSPDM_RSA_SSA_SUPPORT) || (LIBSPDM_RSA_PSS_SUPPORT) */ -#if LIBSPDM_ENABLE_CAPABILITY_MEL_CAP +#if (LIBSPDM_ENABLE_CAPABILITY_MEL_CAP) || (LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP) uint8_t m_libspdm_mel[LIBSPDM_MAX_MEASUREMENT_EXTENSION_LOG_SIZE]; -#endif /* LIBSPDM_ENABLE_CAPABILITY_MEL_CAP */ +#endif /* (LIBSPDM_ENABLE_CAPABILITY_MEL_CAP) || (LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP) */ bool libspdm_get_responder_private_key_from_raw_data(uint32_t base_asym_algo, void **context) { diff --git a/unit_test/test_spdm_requester/test_spdm_requester.c b/unit_test/test_spdm_requester/test_spdm_requester.c index c89e5859d60..96c6e15485a 100644 --- a/unit_test/test_spdm_requester/test_spdm_requester.c +++ b/unit_test/test_spdm_requester/test_spdm_requester.c @@ -27,9 +27,12 @@ int libspdm_requester_challenge_test_main(void); #if LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP int libspdm_requester_get_measurements_test_main(void); int libspdm_requester_get_measurements_error_test_main(void); -int libspdm_requester_get_measurement_extension_log_test_main(void); #endif /* LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP*/ +#if LIBSPDM_ENABLE_CAPABILITY_MEL_CAP +int libspdm_requester_get_measurement_extension_log_test_main(void); +#endif /*LIBSPDM_ENABLE_CAPABILITY_MEL_CAP*/ + #if LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP int libspdm_requester_key_exchange_test_main(void); int libspdm_requester_key_exchange_error_test_main(void); @@ -128,10 +131,13 @@ int main(void) if (libspdm_requester_get_measurements_error_test_main() != 0) { return_value = 1; } + #endif /* LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP */ + + #if LIBSPDM_ENABLE_CAPABILITY_MEL_CAP if (libspdm_requester_get_measurement_extension_log_test_main() != 0) { return_value = 1; } - #endif /* LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP */ + #endif /*LIBSPDM_ENABLE_CAPABILITY_MEL_CAP*/ #if LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP if (libspdm_requester_key_exchange_test_main() != 0) { diff --git a/unit_test/test_spdm_responder/test_spdm_responder.c b/unit_test/test_spdm_responder/test_spdm_responder.c index 82b707f37df..e7f3a14fbe8 100644 --- a/unit_test/test_spdm_responder/test_spdm_responder.c +++ b/unit_test/test_spdm_responder/test_spdm_responder.c @@ -22,9 +22,12 @@ int libspdm_responder_challenge_auth_test_main(void); #if LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP int libspdm_responder_measurements_test_main(void); -int libspdm_responder_measurement_extension_log_test_main(void); #endif /* LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP*/ +#if LIBSPDM_ENABLE_CAPABILITY_MEL_CAP +int libspdm_responder_measurement_extension_log_test_main(void); +#endif /*LIBSPDM_ENABLE_CAPABILITY_MEL_CAP*/ + #if LIBSPDM_RESPOND_IF_READY_SUPPORT #if (LIBSPDM_ENABLE_CAPABILITY_CERT_CAP || LIBSPDM_ENABLE_CAPABILITY_CHAL_CAP || \ LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP || LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP || \ @@ -118,10 +121,13 @@ int main(void) if (libspdm_responder_measurements_test_main() != 0) { return_value = 1; } + #endif /* LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP*/ + + #if LIBSPDM_ENABLE_CAPABILITY_MEL_CAP if (libspdm_responder_measurement_extension_log_test_main() != 0) { return_value = 1; } - #endif /* LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP*/ + #endif /*LIBSPDM_ENABLE_CAPABILITY_MEL_CAP*/ #if LIBSPDM_RESPOND_IF_READY_SUPPORT #if (LIBSPDM_ENABLE_CAPABILITY_CERT_CAP || LIBSPDM_ENABLE_CAPABILITY_CHAL_CAP || \