diff --git a/unit_test/test_size/test_size_of_spdm_requester/spdm_requester_init.c b/unit_test/test_size/test_size_of_spdm_requester/spdm_requester_init.c index 65f80320e96..a5b2237cd33 100644 --- a/unit_test/test_size/test_size_of_spdm_requester/spdm_requester_init.c +++ b/unit_test/test_size/test_size_of_spdm_requester/spdm_requester_init.c @@ -23,11 +23,11 @@ libspdm_return_t spdm_requester_receive_message(void *spdm_context, return LIBSPDM_STATUS_SUCCESS; } -uint8_t m_scratch_buffer[LIBSPDM_SCRATCH_BUFFER_SIZE]; +static uint8_t m_scratch_buffer[LIBSPDM_SCRATCH_BUFFER_SIZE]; -bool m_send_receive_buffer_acquired = false; -uint8_t m_send_receive_buffer[LIBSPDM_MAX_SENDER_RECEIVER_BUFFER_SIZE]; -size_t m_send_receive_buffer_size; +static bool m_send_receive_buffer_acquired = false; +static uint8_t m_send_receive_buffer[LIBSPDM_MAX_SENDER_RECEIVER_BUFFER_SIZE]; +static size_t m_send_receive_buffer_size; libspdm_return_t spdm_device_acquire_sender_buffer ( void *context, void **msg_buf_ptr) diff --git a/unit_test/test_spdm_requester/encap_certificate.c b/unit_test/test_spdm_requester/encap_certificate.c index 08b4ea61f67..d97ac1839d9 100644 --- a/unit_test/test_spdm_requester/encap_certificate.c +++ b/unit_test/test_spdm_requester/encap_certificate.c @@ -23,13 +23,13 @@ spdm_get_certificate_request_t m_spdm_get_certificate_request1 = { 0, LIBSPDM_MAX_CERT_CHAIN_BLOCK_LEN }; -size_t m_spdm_get_certificate_request1_size = +static size_t m_spdm_get_certificate_request1_size = sizeof(m_spdm_get_certificate_request1); spdm_get_certificate_request_t m_spdm_get_certificate_request3 = { {SPDM_MESSAGE_VERSION_11, SPDM_GET_CERTIFICATE, 0, 0}, 0, 0 }; -size_t m_spdm_get_certificate_request3_size = +static size_t m_spdm_get_certificate_request3_size = sizeof(m_spdm_get_certificate_request3); spdm_get_certificate_request_t m_spdm_get_certificate_request4 = { @@ -37,7 +37,7 @@ spdm_get_certificate_request_t m_spdm_get_certificate_request4 = { 0, LIBSPDM_MAX_CERT_CHAIN_BLOCK_LEN }; -size_t m_spdm_get_certificate_request4_size = +static size_t m_spdm_get_certificate_request4_size = sizeof(m_spdm_get_certificate_request4); /** diff --git a/unit_test/test_spdm_requester/encap_challenge_auth.c b/unit_test/test_spdm_requester/encap_challenge_auth.c index b49cb206b4e..b576667a272 100644 --- a/unit_test/test_spdm_requester/encap_challenge_auth.c +++ b/unit_test/test_spdm_requester/encap_challenge_auth.c @@ -14,25 +14,25 @@ spdm_challenge_request_t m_spdm_challenge_request1 = { {SPDM_MESSAGE_VERSION_11, SPDM_CHALLENGE, 0, SPDM_CHALLENGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH}, }; -size_t m_spdm_challenge_request1_size = sizeof(m_spdm_challenge_request1); +static size_t m_spdm_challenge_request1_size = sizeof(m_spdm_challenge_request1); spdm_challenge_request_t m_spdm_challenge_request3 = { {SPDM_MESSAGE_VERSION_11, SPDM_CHALLENGE, SPDM_MAX_SLOT_COUNT, SPDM_CHALLENGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH}, }; -size_t m_spdm_challenge_request3_size = sizeof(m_spdm_challenge_request3); +static size_t m_spdm_challenge_request3_size = sizeof(m_spdm_challenge_request3); spdm_challenge_request_t m_spdm_challenge_request4 = { {SPDM_MESSAGE_VERSION_11, SPDM_CHALLENGE, 0xFF, SPDM_CHALLENGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH}, }; -size_t m_spdm_challenge_request4_size = sizeof(m_spdm_challenge_request4); +static size_t m_spdm_challenge_request4_size = sizeof(m_spdm_challenge_request4); spdm_challenge_request_t m_spdm_challenge_request5 = { {SPDM_MESSAGE_VERSION_13, SPDM_CHALLENGE, 0, SPDM_CHALLENGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH}, }; -size_t m_spdm_challenge_request5_size = sizeof(m_spdm_challenge_request5); +static size_t m_spdm_challenge_request5_size = sizeof(m_spdm_challenge_request5); extern size_t libspdm_secret_lib_challenge_opaque_data_size; diff --git a/unit_test/test_spdm_requester/encap_digests.c b/unit_test/test_spdm_requester/encap_digests.c index 8c4100642d0..110132b6d33 100644 --- a/unit_test/test_spdm_requester/encap_digests.c +++ b/unit_test/test_spdm_requester/encap_digests.c @@ -15,7 +15,7 @@ spdm_get_digest_request_t m_spdm_get_digests_request1 = { SPDM_GET_DIGESTS, }, }; -size_t m_spdm_get_digests_request1_size = sizeof(m_spdm_get_digests_request1); +static size_t m_spdm_get_digests_request1_size = sizeof(m_spdm_get_digests_request1); spdm_get_digest_request_t m_spdm_get_digests_request2 = { @@ -24,7 +24,7 @@ spdm_get_digest_request_t m_spdm_get_digests_request2 = { SPDM_GET_DIGESTS, }, }; -size_t m_spdm_get_digests_request2_size = sizeof(m_spdm_get_digests_request2); +static size_t m_spdm_get_digests_request2_size = sizeof(m_spdm_get_digests_request2); static uint8_t m_local_certificate_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; diff --git a/unit_test/test_spdm_requester/encap_key_update.c b/unit_test/test_spdm_requester/encap_key_update.c index 4fba3b3b4a7..383b22dab05 100644 --- a/unit_test/test_spdm_requester/encap_key_update.c +++ b/unit_test/test_spdm_requester/encap_key_update.c @@ -13,60 +13,60 @@ spdm_key_update_request_t m_spdm_key_update_request1 = { {SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_KEY, 0x3} }; -size_t m_spdm_key_update_request1_size = sizeof(m_spdm_key_update_request1); +static size_t m_spdm_key_update_request1_size = sizeof(m_spdm_key_update_request1); spdm_key_update_request_t m_spdm_key_update_request2 = { {SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_KEY, 0x3} }; -size_t m_spdm_key_update_request2_size = LIBSPDM_MAX_SPDM_MSG_SIZE; +static size_t m_spdm_key_update_request2_size = LIBSPDM_MAX_SPDM_MSG_SIZE; spdm_key_update_request_t m_spdm_key_update_request3 = { {SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_ALL_KEYS, 0x71} }; -size_t m_spdm_key_update_request3_size = sizeof(m_spdm_key_update_request3); +static size_t m_spdm_key_update_request3_size = sizeof(m_spdm_key_update_request3); spdm_key_update_request_t m_spdm_key_update_request4 = { {SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_ALL_KEYS, 0x71} }; -size_t m_spdm_key_update_request4_size = LIBSPDM_MAX_SPDM_MSG_SIZE; +static size_t m_spdm_key_update_request4_size = LIBSPDM_MAX_SPDM_MSG_SIZE; spdm_key_update_request_t m_spdm_key_update_request5 = { {SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_VERIFY_NEW_KEY, 0x4A} }; -size_t m_spdm_key_update_request5_size = sizeof(m_spdm_key_update_request5); +static size_t m_spdm_key_update_request5_size = sizeof(m_spdm_key_update_request5); spdm_key_update_request_t m_spdm_key_update_request6 = { {SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_VERIFY_NEW_KEY, 0x4A} }; -size_t m_spdm_key_update_request6_size = LIBSPDM_MAX_SPDM_MSG_SIZE; +static size_t m_spdm_key_update_request6_size = LIBSPDM_MAX_SPDM_MSG_SIZE; spdm_key_update_request_t m_spdm_key_update_request7 = { {SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_KEY, 0x92} }; -size_t m_spdm_key_update_request7_size = sizeof(m_spdm_key_update_request7); +static size_t m_spdm_key_update_request7_size = sizeof(m_spdm_key_update_request7); spdm_key_update_request_t m_spdm_key_update_request8 = { {SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_ALL_KEYS, 0x13} }; -size_t m_spdm_key_update_request8_size = sizeof(m_spdm_key_update_request8); +static size_t m_spdm_key_update_request8_size = sizeof(m_spdm_key_update_request8); spdm_key_update_request_t m_spdm_key_update_request9 = { {SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_VERIFY_NEW_KEY, 0x22} }; -size_t m_spdm_key_update_request9_size = sizeof(m_spdm_key_update_request9); +static size_t m_spdm_key_update_request9_size = sizeof(m_spdm_key_update_request9); spdm_key_update_request_t m_spdm_key_update_request10 = { {SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, 0xFF, 0x12} }; -size_t m_spdm_key_update_request10_size = sizeof(m_spdm_key_update_request10); +static size_t m_spdm_key_update_request10_size = sizeof(m_spdm_key_update_request10); static void spdm_set_standard_key_update_test_state( libspdm_context_t *spdm_context, uint32_t *session_id) diff --git a/unit_test/test_spdm_requester/get_csr.c b/unit_test/test_spdm_requester/get_csr.c index 691d490695a..a5c7e428578 100644 --- a/unit_test/test_spdm_requester/get_csr.c +++ b/unit_test/test_spdm_requester/get_csr.c @@ -19,8 +19,8 @@ uint8_t csr_pointer[LIBSPDM_MAX_CSR_SIZE] = {0}; uint8_t *csr_data_pointer = csr_pointer; size_t global_csr_len; -uint8_t m_csr_opaque_data[8] = "libspdm"; -uint16_t m_csr_opaque_data_size = sizeof(m_csr_opaque_data); +static uint8_t m_csr_opaque_data[8] = "libspdm"; +static uint16_t m_csr_opaque_data_size = sizeof(m_csr_opaque_data); /*ECC 256 req_info(include right req_info attribute)*/ uint8_t req_info_sequence[] = {0x30, 0x81, 0xBF,}; diff --git a/unit_test/test_spdm_requester/get_key_pair_info.c b/unit_test/test_spdm_requester/get_key_pair_info.c index df0f4dfb887..b1a0ed77453 100644 --- a/unit_test/test_spdm_requester/get_key_pair_info.c +++ b/unit_test/test_spdm_requester/get_key_pair_info.c @@ -10,14 +10,14 @@ #if LIBSPDM_ENABLE_CAPABILITY_GET_KEY_PAIR_INFO_CAP -uint8_t m_response_total_key_pairs; -uint8_t m_response_key_pair_id; -uint16_t m_response_capabilities; -uint16_t m_response_key_usage_capabilities; -uint16_t m_response_current_key_usage; -uint32_t m_response_asym_algo_capabilities; -uint32_t m_response_current_asym_algo; -uint8_t m_response_assoc_cert_slot_mask; +static uint8_t m_response_total_key_pairs; +static uint8_t m_response_key_pair_id; +static uint16_t m_response_capabilities; +static uint16_t m_response_key_usage_capabilities; +static uint16_t m_response_current_key_usage; +static uint32_t m_response_asym_algo_capabilities; +static uint32_t m_response_current_asym_algo; +static uint8_t m_response_assoc_cert_slot_mask; libspdm_return_t libspdm_requester_get_key_pair_info_test_send_message( void *spdm_context, size_t request_size, const void *request, diff --git a/unit_test/test_spdm_requester/get_measurement_extension_log.c b/unit_test/test_spdm_requester/get_measurement_extension_log.c index 9ee87fd1ac8..09ca3d57431 100644 --- a/unit_test/test_spdm_requester/get_measurement_extension_log.c +++ b/unit_test/test_spdm_requester/get_measurement_extension_log.c @@ -12,9 +12,9 @@ #define LIBSPDM_MAX_MEASUREMENT_EXTENSION_LOG_SIZE 0x1000 -uint8_t m_libspdm_mel_test[LIBSPDM_MAX_MEASUREMENT_EXTENSION_LOG_SIZE]; -size_t m_libspdm_mel_len; -uint8_t m_libspdm_mel_number; +static uint8_t m_libspdm_mel_test[LIBSPDM_MAX_MEASUREMENT_EXTENSION_LOG_SIZE]; +static size_t m_libspdm_mel_len; +static uint8_t m_libspdm_mel_number; void generate_mel_entry_test() { diff --git a/unit_test/test_spdm_responder/algorithms.c b/unit_test/test_spdm_responder/algorithms.c index a327dbc3264..f12e3063cdc 100644 --- a/unit_test/test_spdm_responder/algorithms.c +++ b/unit_test/test_spdm_responder/algorithms.c @@ -55,7 +55,7 @@ spdm_negotiate_algorithms_request_t m_libspdm_negotiate_algorithms_request1 = { sizeof(spdm_negotiate_algorithms_request_t), SPDM_MEASUREMENT_SPECIFICATION_DMTF, }; -size_t m_libspdm_negotiate_algorithms_request1_size = +static size_t m_libspdm_negotiate_algorithms_request1_size = sizeof(m_libspdm_negotiate_algorithms_request1); spdm_negotiate_algorithms_request_t m_libspdm_negotiate_algorithms_request2 = { @@ -63,7 +63,7 @@ spdm_negotiate_algorithms_request_t m_libspdm_negotiate_algorithms_request2 = { sizeof(spdm_negotiate_algorithms_request_t), SPDM_MEASUREMENT_SPECIFICATION_DMTF, }; -size_t m_libspdm_negotiate_algorithms_request2_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_negotiate_algorithms_request2_size = sizeof(spdm_message_header_t); libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_request3 = { { @@ -99,7 +99,7 @@ libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_requ } } }; -size_t m_libspdm_negotiate_algorithm_request3_size = sizeof(m_libspdm_negotiate_algorithm_request3); +static size_t m_libspdm_negotiate_algorithm_request3_size = sizeof(m_libspdm_negotiate_algorithm_request3); libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_request4 = { { @@ -135,7 +135,7 @@ libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_requ } } }; -size_t m_libspdm_negotiate_algorithm_request4_size = sizeof(m_libspdm_negotiate_algorithm_request4); +static size_t m_libspdm_negotiate_algorithm_request4_size = sizeof(m_libspdm_negotiate_algorithm_request4); libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_request5 = { { @@ -171,7 +171,7 @@ libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_requ } } }; -size_t m_libspdm_negotiate_algorithm_request5_size = sizeof(m_libspdm_negotiate_algorithm_request5); +static size_t m_libspdm_negotiate_algorithm_request5_size = sizeof(m_libspdm_negotiate_algorithm_request5); libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_request6 = { { @@ -207,7 +207,7 @@ libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_requ } } }; -size_t m_libspdm_negotiate_algorithm_request6_size = sizeof(m_libspdm_negotiate_algorithm_request6); +static size_t m_libspdm_negotiate_algorithm_request6_size = sizeof(m_libspdm_negotiate_algorithm_request6); libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_request7 = { { @@ -243,7 +243,7 @@ libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_requ } } }; -size_t m_libspdm_negotiate_algorithm_request7_size = sizeof(m_libspdm_negotiate_algorithm_request7); +static size_t m_libspdm_negotiate_algorithm_request7_size = sizeof(m_libspdm_negotiate_algorithm_request7); libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_request8 = { { @@ -279,7 +279,7 @@ libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_requ } } }; -size_t m_libspdm_negotiate_algorithm_request8_size = sizeof(m_libspdm_negotiate_algorithm_request8); +static size_t m_libspdm_negotiate_algorithm_request8_size = sizeof(m_libspdm_negotiate_algorithm_request8); libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_request9 = { { @@ -315,7 +315,7 @@ libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_requ } } }; -size_t m_libspdm_negotiate_algorithm_request9_size = sizeof(m_libspdm_negotiate_algorithm_request9); +static size_t m_libspdm_negotiate_algorithm_request9_size = sizeof(m_libspdm_negotiate_algorithm_request9); spdm_negotiate_algorithms_request_t m_libspdm_negotiate_algorithm_request10 = { { @@ -327,7 +327,7 @@ spdm_negotiate_algorithms_request_t m_libspdm_negotiate_algorithm_request10 = { 0x44, SPDM_MEASUREMENT_SPECIFICATION_DMTF, }; -size_t m_libspdm_negotiate_algorithm_request10_size = 0x44; +static size_t m_libspdm_negotiate_algorithm_request10_size = 0x44; libspdm_negotiate_algorithms_request_spdm11_oversized_t m_libspdm_negotiate_algorithm_request11 = { { @@ -364,7 +364,7 @@ libspdm_negotiate_algorithms_request_spdm11_oversized_t m_libspdm_negotiate_algo } } }; -size_t m_libspdm_negotiate_algorithm_request11_size = +static size_t m_libspdm_negotiate_algorithm_request11_size = sizeof(m_libspdm_negotiate_algorithm_request11); libspdm_negotiate_algorithms_request_spdm11_multiple_tables_t @@ -443,7 +443,7 @@ libspdm_negotiate_algorithms_request_spdm11_multiple_tables_t } } }; -size_t m_libspdm_negotiate_algorithm_request12_size = +static size_t m_libspdm_negotiate_algorithm_request12_size = sizeof(m_libspdm_negotiate_algorithm_request12); libspdm_negotiate_algorithms_request_spdm11_t @@ -483,7 +483,7 @@ libspdm_negotiate_algorithms_request_spdm11_t } } }; -size_t m_libspdm_negotiate_algorithm_request13_size = +static size_t m_libspdm_negotiate_algorithm_request13_size = sizeof(m_libspdm_negotiate_algorithm_request13)- sizeof( spdm_negotiate_algorithms_common_struct_table_t); @@ -525,7 +525,7 @@ libspdm_negotiate_algorithms_request_spdm11_t }, } }; -size_t m_libspdm_negotiate_algorithm_request14_size = +static size_t m_libspdm_negotiate_algorithm_request14_size = sizeof(m_libspdm_negotiate_algorithm_request14)+ sizeof( spdm_negotiate_algorithms_common_struct_table_t); @@ -566,7 +566,7 @@ libspdm_negotiate_algorithms_request_spdm11_t } } }; -size_t m_libspdm_negotiate_algorithm_request15_size = +static size_t m_libspdm_negotiate_algorithm_request15_size = sizeof(m_libspdm_negotiate_algorithm_request15); libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_request16 = { @@ -604,7 +604,7 @@ libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_requ } } }; -size_t m_libspdm_negotiate_algorithm_request16_size = +static size_t m_libspdm_negotiate_algorithm_request16_size = sizeof(m_libspdm_negotiate_algorithm_request16); libspdm_negotiate_algorithms_request_spdm12_t @@ -644,7 +644,7 @@ libspdm_negotiate_algorithms_request_spdm12_t } } }; -size_t m_libspdm_negotiate_algorithm_request17_size = +static size_t m_libspdm_negotiate_algorithm_request17_size = sizeof(m_libspdm_negotiate_algorithm_request17); libspdm_negotiate_algorithms_request_spdm12_t @@ -685,7 +685,7 @@ libspdm_negotiate_algorithms_request_spdm12_t } } }; -size_t m_libspdm_negotiate_algorithm_request18_size = +static size_t m_libspdm_negotiate_algorithm_request18_size = sizeof(m_libspdm_negotiate_algorithm_request18); libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_request24 = { @@ -725,7 +725,7 @@ libspdm_negotiate_algorithms_request_spdm11_t m_libspdm_negotiate_algorithm_requ } } }; -size_t m_libspdm_negotiate_algorithm_request24_size = +static size_t m_libspdm_negotiate_algorithm_request24_size = sizeof(m_libspdm_negotiate_algorithm_request24); libspdm_negotiate_algorithms_request_spdm12_t @@ -767,7 +767,7 @@ libspdm_negotiate_algorithms_request_spdm12_t } } }; -size_t m_libspdm_negotiate_algorithm_request25_size = +static size_t m_libspdm_negotiate_algorithm_request25_size = sizeof(m_libspdm_negotiate_algorithm_request25); libspdm_negotiate_algorithms_request_spdm12_t @@ -809,7 +809,7 @@ libspdm_negotiate_algorithms_request_spdm12_t } } }; -size_t m_libspdm_negotiate_algorithm_request26_size = +static size_t m_libspdm_negotiate_algorithm_request26_size = sizeof(m_libspdm_negotiate_algorithm_request26); libspdm_negotiate_algorithms_request_spdm12_more_algo_t @@ -856,7 +856,7 @@ libspdm_negotiate_algorithms_request_spdm12_more_algo_t }, } }; -size_t m_libspdm_negotiate_algorithm_request27_size = +static size_t m_libspdm_negotiate_algorithm_request27_size = sizeof(m_libspdm_negotiate_algorithm_request27); libspdm_negotiate_algorithms_request_spdm12_more_algo_t @@ -903,7 +903,7 @@ libspdm_negotiate_algorithms_request_spdm12_more_algo_t } } }; -size_t m_libspdm_negotiate_algorithm_request28_size = +static size_t m_libspdm_negotiate_algorithm_request28_size = sizeof(m_libspdm_negotiate_algorithm_request28); libspdm_negotiate_algorithms_request_spdm12_t @@ -946,7 +946,7 @@ libspdm_negotiate_algorithms_request_spdm12_t } } }; -size_t m_libspdm_negotiate_algorithm_request29_size = +static size_t m_libspdm_negotiate_algorithm_request29_size = sizeof(m_libspdm_negotiate_algorithm_request29); spdm_negotiate_algorithms_request_t m_libspdm_negotiate_algorithms_request30 = { @@ -955,7 +955,7 @@ spdm_negotiate_algorithms_request_t m_libspdm_negotiate_algorithms_request30 = { SPDM_MEASUREMENT_SPECIFICATION_DMTF, SPDM_ALGORITHMS_MULTI_KEY_CONN, }; -size_t m_libspdm_negotiate_algorithms_request30_size = +static size_t m_libspdm_negotiate_algorithms_request30_size = sizeof(m_libspdm_negotiate_algorithms_request30); void libspdm_test_responder_algorithms_case1(void **state) diff --git a/unit_test/test_spdm_responder/challenge_auth.c b/unit_test/test_spdm_responder/challenge_auth.c index 65099d127fc..5be0411d986 100644 --- a/unit_test/test_spdm_responder/challenge_auth.c +++ b/unit_test/test_spdm_responder/challenge_auth.c @@ -13,43 +13,43 @@ spdm_challenge_request_t m_libspdm_challenge_request1 = { { SPDM_MESSAGE_VERSION_11, SPDM_CHALLENGE, 0, SPDM_CHALLENGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH }, }; -size_t m_libspdm_challenge_request1_size = sizeof(m_libspdm_challenge_request1); +static size_t m_libspdm_challenge_request1_size = sizeof(m_libspdm_challenge_request1); spdm_challenge_request_t m_libspdm_challenge_request3 = { { SPDM_MESSAGE_VERSION_11, SPDM_CHALLENGE, SPDM_MAX_SLOT_COUNT, SPDM_CHALLENGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH }, }; -size_t m_libspdm_challenge_request3_size = sizeof(m_libspdm_challenge_request3); +static size_t m_libspdm_challenge_request3_size = sizeof(m_libspdm_challenge_request3); spdm_challenge_request_t m_libspdm_challenge_request4 = { { SPDM_MESSAGE_VERSION_11, SPDM_CHALLENGE, 1, SPDM_CHALLENGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH }, }; -size_t m_libspdm_challenge_request4_size = sizeof(m_libspdm_challenge_request4); +static size_t m_libspdm_challenge_request4_size = sizeof(m_libspdm_challenge_request4); spdm_challenge_request_t m_libspdm_challenge_request5 = { { SPDM_MESSAGE_VERSION_11, SPDM_CHALLENGE, 0, SPDM_CHALLENGE_REQUEST_TCB_COMPONENT_MEASUREMENT_HASH }, }; -size_t m_libspdm_challenge_request5_size = sizeof(m_libspdm_challenge_request5); +static size_t m_libspdm_challenge_request5_size = sizeof(m_libspdm_challenge_request5); spdm_challenge_request_t m_libspdm_challenge_request6 = { { SPDM_MESSAGE_VERSION_11, SPDM_CHALLENGE, 0, SPDM_CHALLENGE_REQUEST_ALL_MEASUREMENTS_HASH }, }; -size_t m_libspdm_challenge_request6_size = sizeof(m_libspdm_challenge_request6); +static size_t m_libspdm_challenge_request6_size = sizeof(m_libspdm_challenge_request6); spdm_challenge_request_t m_libspdm_challenge_request7 = { { SPDM_MESSAGE_VERSION_11, SPDM_CHALLENGE, 0xFF, SPDM_CHALLENGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH }, }; -size_t m_libspdm_challenge_request7_size = sizeof(m_libspdm_challenge_request7); +static size_t m_libspdm_challenge_request7_size = sizeof(m_libspdm_challenge_request7); spdm_challenge_request_t m_libspdm_challenge_request8 = { {SPDM_MESSAGE_VERSION_13, SPDM_CHALLENGE, 0, SPDM_CHALLENGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH}, }; -size_t m_libspdm_challenge_request8_size = sizeof(m_libspdm_challenge_request8); +static size_t m_libspdm_challenge_request8_size = sizeof(m_libspdm_challenge_request8); extern size_t libspdm_secret_lib_challenge_opaque_data_size; diff --git a/unit_test/test_spdm_responder/chunk_send_ack.c b/unit_test/test_spdm_responder/chunk_send_ack.c index f392daa61fb..dc2c708e23c 100644 --- a/unit_test/test_spdm_responder/chunk_send_ack.c +++ b/unit_test/test_spdm_responder/chunk_send_ack.c @@ -54,7 +54,7 @@ libspdm_negotiate_algorithms_request_spdm_tables_t } }; -size_t m_libspdm_chunk_send_negotiate_algorithm_request1_size = +static size_t m_libspdm_chunk_send_negotiate_algorithm_request1_size = sizeof(m_libspdm_chunk_send_negotiate_algorithm_request1); void libspdm_test_responder_chunk_send_ack_setup_algo_state(libspdm_context_t* spdm_context) diff --git a/unit_test/test_spdm_responder/csr.c b/unit_test/test_spdm_responder/csr.c index 4453bb24dec..9052b5fe572 100644 --- a/unit_test/test_spdm_responder/csr.c +++ b/unit_test/test_spdm_responder/csr.c @@ -14,7 +14,7 @@ /*refer to https://github.com/Mbed-TLS/mbedtls/blob/3048c8c90654eb116a6b17c0d2d27c3ccbe6782c/programs/x509/cert_req.c#L119-L129*/ #define LIBSPDM_MAX_REQ_INFO_BUFFER_SIZE 4096 -uint8_t m_csr_opaque_data[8] = "libspdm"; +static uint8_t m_csr_opaque_data[8] = "libspdm"; /*ECC 256 req_info(include right req_info attribute)*/ uint8_t req_info_sequence[] = {0x30, 0x81, 0xBF,}; diff --git a/unit_test/test_spdm_responder/digests.c b/unit_test/test_spdm_responder/digests.c index d6a0b948399..cf0bd4d7bcc 100644 --- a/unit_test/test_spdm_responder/digests.c +++ b/unit_test/test_spdm_responder/digests.c @@ -15,7 +15,7 @@ spdm_get_digest_request_t m_libspdm_get_digests_request1 = { SPDM_GET_DIGESTS, }, }; -size_t m_libspdm_get_digests_request1_size = sizeof(m_libspdm_get_digests_request1); +static size_t m_libspdm_get_digests_request1_size = sizeof(m_libspdm_get_digests_request1); spdm_get_digest_request_t m_libspdm_get_digests_request2 = { { @@ -23,7 +23,7 @@ spdm_get_digest_request_t m_libspdm_get_digests_request2 = { SPDM_GET_DIGESTS, }, }; -size_t m_libspdm_get_digests_request2_size = sizeof(m_libspdm_get_digests_request2); +static size_t m_libspdm_get_digests_request2_size = sizeof(m_libspdm_get_digests_request2); static uint8_t m_libspdm_local_certificate_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; diff --git a/unit_test/test_spdm_responder/encap_get_certificate.c b/unit_test/test_spdm_responder/encap_get_certificate.c index a3a3026bf78..71074ceaa0b 100644 --- a/unit_test/test_spdm_responder/encap_get_certificate.c +++ b/unit_test/test_spdm_responder/encap_get_certificate.c @@ -13,14 +13,14 @@ static void *m_libspdm_local_certificate_chain; static size_t m_libspdm_local_certificate_chain_size; spdm_certificate_response_t m_spdm_get_certificate_response1; -size_t m_spdm_get_certificate_response1_size; +static size_t m_spdm_get_certificate_response1_size; spdm_certificate_response_t m_spdm_get_certificate_response2 = { {SPDM_MESSAGE_VERSION_10, SPDM_ERROR, SPDM_ERROR_CODE_INVALID_REQUEST, 0}, 0, 0 }; -size_t m_spdm_get_certificate_response2_size = sizeof(m_spdm_get_certificate_response2); +static size_t m_spdm_get_certificate_response2_size = sizeof(m_spdm_get_certificate_response2); /** * Test 1: Normal case, request a certificate chain diff --git a/unit_test/test_spdm_responder/encap_get_digests.c b/unit_test/test_spdm_responder/encap_get_digests.c index e42e2cc9fbe..a81eb092efb 100644 --- a/unit_test/test_spdm_responder/encap_get_digests.c +++ b/unit_test/test_spdm_responder/encap_get_digests.c @@ -10,7 +10,7 @@ #if (LIBSPDM_ENABLE_CAPABILITY_MUT_AUTH_CAP) && (LIBSPDM_ENABLE_CAPABILITY_ENCAP_CAP) && \ (LIBSPDM_SEND_GET_CERTIFICATE_SUPPORT) -uint8_t m_local_digests_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; +static uint8_t m_local_digests_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; static uint8_t m_libspdm_local_certificate_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; /** diff --git a/unit_test/test_spdm_responder/encap_response.c b/unit_test/test_spdm_responder/encap_response.c index d2b8ac70871..e1df9a171e0 100644 --- a/unit_test/test_spdm_responder/encap_response.c +++ b/unit_test/test_spdm_responder/encap_response.c @@ -12,13 +12,13 @@ spdm_get_encapsulated_request_request_t m_libspdm_encapsulated_request_t1 = { {SPDM_MESSAGE_VERSION_11, SPDM_GET_ENCAPSULATED_REQUEST, 0, 0} }; -size_t m_libspdm_encapsulated_request_t1_size = sizeof(m_libspdm_encapsulated_request_t1); +static size_t m_libspdm_encapsulated_request_t1_size = sizeof(m_libspdm_encapsulated_request_t1); spdm_deliver_encapsulated_response_request_t m_libspdm_m_deliver_encapsulated_response_request_t1 = { {SPDM_MESSAGE_VERSION_11, SPDM_DELIVER_ENCAPSULATED_RESPONSE, 0, 0} }; -size_t m_libspdm_m_deliver_encapsulated_response_request_t1_size = +static size_t m_libspdm_m_deliver_encapsulated_response_request_t1_size = sizeof(m_libspdm_m_deliver_encapsulated_response_request_t1); static uint8_t m_libspdm_local_certificate_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; @@ -27,7 +27,7 @@ spdm_deliver_encapsulated_response_request_t m_libspdm_m_deliver_encapsulated_re { {SPDM_MESSAGE_VERSION_12, SPDM_DELIVER_ENCAPSULATED_RESPONSE, 0xFF, 0} }; -size_t m_libspdm_m_deliver_encapsulated_response_request_t2_size = +static size_t m_libspdm_m_deliver_encapsulated_response_request_t2_size = sizeof(m_libspdm_m_deliver_encapsulated_response_request_t2); #if (LIBSPDM_ENABLE_CAPABILITY_MUT_AUTH_CAP) && (LIBSPDM_SEND_GET_CERTIFICATE_SUPPORT) diff --git a/unit_test/test_spdm_responder/end_session.c b/unit_test/test_spdm_responder/end_session.c index 05bc20ccab1..f30b81ed0e6 100644 --- a/unit_test/test_spdm_responder/end_session.c +++ b/unit_test/test_spdm_responder/end_session.c @@ -13,18 +13,18 @@ spdm_end_session_request_t m_libspdm_end_session_request1 = { { SPDM_MESSAGE_VERSION_11, SPDM_END_SESSION, 0, 0 } }; -size_t m_libspdm_end_session_request1_size = sizeof(m_libspdm_end_session_request1); +static size_t m_libspdm_end_session_request1_size = sizeof(m_libspdm_end_session_request1); spdm_end_session_request_t m_libspdm_end_session_request2 = { { SPDM_MESSAGE_VERSION_11, SPDM_END_SESSION, 0, 0 } }; -size_t m_libspdm_end_session_request2_size = LIBSPDM_MAX_SPDM_MSG_SIZE; +static size_t m_libspdm_end_session_request2_size = LIBSPDM_MAX_SPDM_MSG_SIZE; spdm_end_session_request_t m_libspdm_end_session_request3 = { { SPDM_MESSAGE_VERSION_11, SPDM_END_SESSION, SPDM_END_SESSION_REQUEST_ATTRIBUTES_PRESERVE_NEGOTIATED_STATE_CLEAR, 0 } }; -size_t m_libspdm_end_session_request3_size = sizeof(m_libspdm_end_session_request1); +static size_t m_libspdm_end_session_request3_size = sizeof(m_libspdm_end_session_request1); void libspdm_test_responder_end_session_case1(void **state) { diff --git a/unit_test/test_spdm_responder/finish.c b/unit_test/test_spdm_responder/finish.c index 324295ed4d9..e88133fe829 100644 --- a/unit_test/test_spdm_responder/finish.c +++ b/unit_test/test_spdm_responder/finish.c @@ -21,34 +21,34 @@ typedef struct { libspdm_finish_request_mine_t m_libspdm_finish_request1 = { { SPDM_MESSAGE_VERSION_11, SPDM_FINISH, 0, 0 }, }; -size_t m_libspdm_finish_request1_size = sizeof(m_libspdm_finish_request1); +static size_t m_libspdm_finish_request1_size = sizeof(m_libspdm_finish_request1); libspdm_finish_request_mine_t m_libspdm_finish_request3 = { { SPDM_MESSAGE_VERSION_11, SPDM_FINISH, 1, 0 }, }; -size_t m_libspdm_finish_request3_size = sizeof(m_libspdm_finish_request3); +static size_t m_libspdm_finish_request3_size = sizeof(m_libspdm_finish_request3); libspdm_finish_request_mine_t m_libspdm_finish_request4 = { { SPDM_MESSAGE_VERSION_11, SPDM_FINISH, 1, 0xFF }, }; -size_t m_libspdm_finish_request4_size = sizeof(m_libspdm_finish_request4); +static size_t m_libspdm_finish_request4_size = sizeof(m_libspdm_finish_request4); libspdm_finish_request_mine_t m_libspdm_finish_request5 = { { SPDM_MESSAGE_VERSION_11, SPDM_FINISH, 1, 10 }, }; -size_t m_libspdm_finish_request5_size = sizeof(m_libspdm_finish_request5); +static size_t m_libspdm_finish_request5_size = sizeof(m_libspdm_finish_request5); libspdm_finish_request_mine_t m_libspdm_finish_request6 = { { SPDM_MESSAGE_VERSION_11, SPDM_FINISH, 6, 10 }, }; -size_t m_libspdm_finish_request6_size = sizeof(m_libspdm_finish_request6); +static size_t m_libspdm_finish_request6_size = sizeof(m_libspdm_finish_request6); libspdm_finish_request_mine_t m_libspdm_finish_request7 = { { SPDM_MESSAGE_VERSION_11, SPDM_FINISH, 1, 3 }, }; -size_t m_libspdm_finish_request7_size = sizeof(m_libspdm_finish_request7); +static size_t m_libspdm_finish_request7_size = sizeof(m_libspdm_finish_request7); -uint8_t m_dummy_buffer[LIBSPDM_MAX_HASH_SIZE]; +static uint8_t m_dummy_buffer[LIBSPDM_MAX_HASH_SIZE]; #if LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP diff --git a/unit_test/test_spdm_responder/heartbeat.c b/unit_test/test_spdm_responder/heartbeat.c index 49e27ff9643..bdb3697cb35 100644 --- a/unit_test/test_spdm_responder/heartbeat.c +++ b/unit_test/test_spdm_responder/heartbeat.c @@ -13,12 +13,12 @@ spdm_heartbeat_request_t m_libspdm_heartbeat_request1 = { { SPDM_MESSAGE_VERSION_11, SPDM_HEARTBEAT, 0, 0 } }; -size_t m_libspdm_heartbeat_request1_size = sizeof(m_libspdm_heartbeat_request1); +static size_t m_libspdm_heartbeat_request1_size = sizeof(m_libspdm_heartbeat_request1); spdm_heartbeat_request_t m_libspdm_heartbeat_request2 = { { SPDM_MESSAGE_VERSION_11, SPDM_HEARTBEAT, 0, 0 } }; -size_t m_libspdm_heartbeat_request2_size = LIBSPDM_MAX_SPDM_MSG_SIZE; +static size_t m_libspdm_heartbeat_request2_size = LIBSPDM_MAX_SPDM_MSG_SIZE; void libspdm_test_responder_heartbeat_case1(void **state) diff --git a/unit_test/test_spdm_responder/key_update.c b/unit_test/test_spdm_responder/key_update.c index cbbd1fca484..a9ee5901812 100644 --- a/unit_test/test_spdm_responder/key_update.c +++ b/unit_test/test_spdm_responder/key_update.c @@ -14,60 +14,60 @@ spdm_key_update_request_t m_libspdm_key_update_request1 = { { SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_KEY, 0x3 } }; -size_t m_libspdm_key_update_request1_size = sizeof(m_libspdm_key_update_request1); +static size_t m_libspdm_key_update_request1_size = sizeof(m_libspdm_key_update_request1); spdm_key_update_request_t m_libspdm_key_update_request2 = { { SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_KEY, 0x3 } }; -size_t m_libspdm_key_update_request2_size = LIBSPDM_MAX_SPDM_MSG_SIZE; +static size_t m_libspdm_key_update_request2_size = LIBSPDM_MAX_SPDM_MSG_SIZE; spdm_key_update_request_t m_libspdm_key_update_request3 = { { SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_ALL_KEYS, 0x71 } }; -size_t m_libspdm_key_update_request3_size = sizeof(m_libspdm_key_update_request3); +static size_t m_libspdm_key_update_request3_size = sizeof(m_libspdm_key_update_request3); spdm_key_update_request_t m_libspdm_key_update_request4 = { { SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_ALL_KEYS, 0x71 } }; -size_t m_libspdm_key_update_request4_size = LIBSPDM_MAX_SPDM_MSG_SIZE; +static size_t m_libspdm_key_update_request4_size = LIBSPDM_MAX_SPDM_MSG_SIZE; spdm_key_update_request_t m_libspdm_key_update_request5 = { { SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_VERIFY_NEW_KEY, 0x4A } }; -size_t m_libspdm_key_update_request5_size = sizeof(m_libspdm_key_update_request5); +static size_t m_libspdm_key_update_request5_size = sizeof(m_libspdm_key_update_request5); spdm_key_update_request_t m_libspdm_key_update_request6 = { { SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_VERIFY_NEW_KEY, 0x4A } }; -size_t m_libspdm_key_update_request6_size = LIBSPDM_MAX_SPDM_MSG_SIZE; +static size_t m_libspdm_key_update_request6_size = LIBSPDM_MAX_SPDM_MSG_SIZE; spdm_key_update_request_t m_libspdm_key_update_request7 = { { SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_KEY, 0x92 } }; -size_t m_libspdm_key_update_request7_size = sizeof(m_libspdm_key_update_request7); +static size_t m_libspdm_key_update_request7_size = sizeof(m_libspdm_key_update_request7); spdm_key_update_request_t m_libspdm_key_update_request8 = { { SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_UPDATE_ALL_KEYS, 0x13 } }; -size_t m_libspdm_key_update_request8_size = sizeof(m_libspdm_key_update_request8); +static size_t m_libspdm_key_update_request8_size = sizeof(m_libspdm_key_update_request8); spdm_key_update_request_t m_libspdm_key_update_request9 = { { SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, SPDM_KEY_UPDATE_OPERATIONS_TABLE_VERIFY_NEW_KEY, 0x22 } }; -size_t m_libspdm_key_update_request9_size = sizeof(m_libspdm_key_update_request9); +static size_t m_libspdm_key_update_request9_size = sizeof(m_libspdm_key_update_request9); spdm_key_update_request_t m_libspdm_key_update_request10 = { { SPDM_MESSAGE_VERSION_11, SPDM_KEY_UPDATE, 0xFF, 0x12 } }; -size_t m_libspdm_key_update_request10_size = sizeof(m_libspdm_key_update_request10); +static size_t m_libspdm_key_update_request10_size = sizeof(m_libspdm_key_update_request10); static void libspdm_set_standard_key_update_test_state( libspdm_context_t *spdm_context, uint32_t *session_id) diff --git a/unit_test/test_spdm_responder/measurement_extension_log.c b/unit_test/test_spdm_responder/measurement_extension_log.c index af30b291ac3..ba253f3fdbb 100644 --- a/unit_test/test_spdm_responder/measurement_extension_log.c +++ b/unit_test/test_spdm_responder/measurement_extension_log.c @@ -14,7 +14,7 @@ spdm_get_measurement_extension_log_request_t m_libspdm_get_measurement_extension 0, LIBSPDM_MAX_MEL_BLOCK_LEN }; -size_t m_libspdm_get_measurement_extension_log_request1_size = +static size_t m_libspdm_get_measurement_extension_log_request1_size = sizeof(m_libspdm_get_measurement_extension_log_request1); spdm_get_measurement_extension_log_request_t m_libspdm_get_measurement_extension_log_request2 = { @@ -22,7 +22,7 @@ spdm_get_measurement_extension_log_request_t m_libspdm_get_measurement_extension 0, 0 }; -size_t m_libspdm_get_measurement_extension_log_request2_size = +static size_t m_libspdm_get_measurement_extension_log_request2_size = sizeof(m_libspdm_get_measurement_extension_log_request2); spdm_get_measurement_extension_log_request_t m_libspdm_get_measurement_extension_log_request3 = { @@ -30,7 +30,7 @@ spdm_get_measurement_extension_log_request_t m_libspdm_get_measurement_extension 0, LIBSPDM_MAX_MEL_BLOCK_LEN + 1 }; -size_t m_libspdm_get_measurement_extension_log_request3_size = +static size_t m_libspdm_get_measurement_extension_log_request3_size = sizeof(m_libspdm_get_measurement_extension_log_request3); spdm_get_measurement_extension_log_request_t m_libspdm_get_measurement_extension_log_request4 = { @@ -38,7 +38,7 @@ spdm_get_measurement_extension_log_request_t m_libspdm_get_measurement_extension LIBSPDM_MAX_MEL_BLOCK_LEN, LIBSPDM_MAX_MEL_BLOCK_LEN }; -size_t m_libspdm_get_measurement_extension_log_request4_size = +static size_t m_libspdm_get_measurement_extension_log_request4_size = sizeof(m_libspdm_get_measurement_extension_log_request4); /** diff --git a/unit_test/test_spdm_responder/measurements.c b/unit_test/test_spdm_responder/measurements.c index 4ec4e8a8046..fd7090dc5c5 100644 --- a/unit_test/test_spdm_responder/measurements.c +++ b/unit_test/test_spdm_responder/measurements.c @@ -14,58 +14,58 @@ spdm_get_measurements_request_t m_libspdm_get_measurements_request1 = { { SPDM_MESSAGE_VERSION_10, SPDM_GET_MEASUREMENTS, 0, SPDM_GET_MEASUREMENTS_REQUEST_MEASUREMENT_OPERATION_TOTAL_NUMBER_OF_MEASUREMENTS }, }; -size_t m_libspdm_get_measurements_request1_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_get_measurements_request1_size = sizeof(spdm_message_header_t); spdm_get_measurements_request_t m_libspdm_get_measurements_request3 = { { SPDM_MESSAGE_VERSION_10, SPDM_GET_MEASUREMENTS, SPDM_GET_MEASUREMENTS_REQUEST_ATTRIBUTES_GENERATE_SIGNATURE, 1 }, }; -size_t m_libspdm_get_measurements_request3_size = +static size_t m_libspdm_get_measurements_request3_size = sizeof(m_libspdm_get_measurements_request3) - sizeof(uint8_t); spdm_get_measurements_request_t m_libspdm_get_measurements_request4 = { { SPDM_MESSAGE_VERSION_10, SPDM_GET_MEASUREMENTS, SPDM_GET_MEASUREMENTS_REQUEST_ATTRIBUTES_GENERATE_SIGNATURE, 1 }, }; -size_t m_libspdm_get_measurements_request4_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_get_measurements_request4_size = sizeof(spdm_message_header_t); spdm_get_measurements_request_t m_libspdm_get_measurements_request5 = { { SPDM_MESSAGE_VERSION_10, SPDM_GET_MEASUREMENTS, SPDM_GET_MEASUREMENTS_REQUEST_ATTRIBUTES_GENERATE_SIGNATURE, SPDM_GET_MEASUREMENTS_REQUEST_MEASUREMENT_OPERATION_TOTAL_NUMBER_OF_MEASUREMENTS }, }; -size_t m_libspdm_get_measurements_request5_size = +static size_t m_libspdm_get_measurements_request5_size = sizeof(m_libspdm_get_measurements_request5) - sizeof(uint8_t); spdm_get_measurements_request_t m_libspdm_get_measurements_request6 = { { SPDM_MESSAGE_VERSION_10, SPDM_GET_MEASUREMENTS, 0, 1 }, }; -size_t m_libspdm_get_measurements_request6_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_get_measurements_request6_size = sizeof(spdm_message_header_t); spdm_get_measurements_request_t m_libspdm_get_measurements_request7 = { { SPDM_MESSAGE_VERSION_10, SPDM_GET_MEASUREMENTS, 0, SPDM_GET_MEASUREMENTS_REQUEST_MEASUREMENT_OPERATION_ALL_MEASUREMENTS }, }; -size_t m_libspdm_get_measurements_request7_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_get_measurements_request7_size = sizeof(spdm_message_header_t); spdm_get_measurements_request_t m_libspdm_get_measurements_request8 = { { SPDM_MESSAGE_VERSION_10, SPDM_GET_MEASUREMENTS, SPDM_GET_MEASUREMENTS_REQUEST_ATTRIBUTES_GENERATE_SIGNATURE, SPDM_GET_MEASUREMENTS_REQUEST_MEASUREMENT_OPERATION_ALL_MEASUREMENTS }, }; -size_t m_libspdm_get_measurements_request8_size = +static size_t m_libspdm_get_measurements_request8_size = sizeof(m_libspdm_get_measurements_request8) - sizeof(uint8_t); spdm_get_measurements_request_t m_libspdm_get_measurements_request9 = { { SPDM_MESSAGE_VERSION_11, SPDM_GET_MEASUREMENTS, 0, 1 }, }; -size_t m_libspdm_get_measurements_request9_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_get_measurements_request9_size = sizeof(spdm_message_header_t); spdm_get_measurements_request_t m_libspdm_get_measurements_request10 = { { SPDM_MESSAGE_VERSION_11, SPDM_GET_MEASUREMENTS, SPDM_GET_MEASUREMENTS_REQUEST_ATTRIBUTES_GENERATE_SIGNATURE, 1 }, }; -size_t m_libspdm_get_measurements_request10_size = +static size_t m_libspdm_get_measurements_request10_size = sizeof(m_libspdm_get_measurements_request10); spdm_get_measurements_request_t m_libspdm_get_measurements_request11 = { @@ -74,7 +74,7 @@ spdm_get_measurements_request_t m_libspdm_get_measurements_request11 = { /* nonce * SlotId != 0*/ }; -size_t m_libspdm_get_measurements_request11_size = +static size_t m_libspdm_get_measurements_request11_size = sizeof(m_libspdm_get_measurements_request11); spdm_get_measurements_request_t m_libspdm_get_measurements_request12 = { @@ -83,37 +83,37 @@ spdm_get_measurements_request_t m_libspdm_get_measurements_request12 = { /* nonce * SlotId >= SPDM_MAX_SLOT_COUNT*/ }; -size_t m_libspdm_get_measurements_request12_size = +static size_t m_libspdm_get_measurements_request12_size = sizeof(m_libspdm_get_measurements_request12); spdm_get_measurements_request_t m_libspdm_get_measurements_request13 = { { SPDM_MESSAGE_VERSION_11, SPDM_GET_MEASUREMENTS, 0, 0xF0 }, }; -size_t m_libspdm_get_measurements_request13_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_get_measurements_request13_size = sizeof(spdm_message_header_t); spdm_get_measurements_request_t m_libspdm_get_measurements_request14 = { { SPDM_MESSAGE_VERSION_12, SPDM_GET_MEASUREMENTS, SPDM_GET_MEASUREMENTS_REQUEST_ATTRIBUTES_RAW_BIT_STREAM_REQUESTED, 1}, }; -size_t m_libspdm_get_measurements_request14_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_get_measurements_request14_size = sizeof(spdm_message_header_t); spdm_get_measurements_request_t m_libspdm_get_measurements_request15 = { { SPDM_MESSAGE_VERSION_12, SPDM_GET_MEASUREMENTS, SPDM_GET_MEASUREMENTS_REQUEST_ATTRIBUTES_GENERATE_SIGNATURE, 1}, }; -size_t m_libspdm_get_measurements_request15_size = sizeof(m_libspdm_get_measurements_request14); +static size_t m_libspdm_get_measurements_request15_size = sizeof(m_libspdm_get_measurements_request14); spdm_get_measurements_request_t m_libspdm_get_measurements_request16 = { { SPDM_MESSAGE_VERSION_12, SPDM_GET_MEASUREMENTS, SPDM_GET_MEASUREMENTS_REQUEST_ATTRIBUTES_GENERATE_SIGNATURE, 1 }, }; -size_t m_libspdm_get_measurements_request16_size = sizeof(m_libspdm_get_measurements_request16); +static size_t m_libspdm_get_measurements_request16_size = sizeof(m_libspdm_get_measurements_request16); spdm_get_measurements_request_t m_libspdm_get_measurements_request17 = { { SPDM_MESSAGE_VERSION_13, SPDM_GET_MEASUREMENTS, 0, SPDM_GET_MEASUREMENTS_REQUEST_MEASUREMENT_OPERATION_TOTAL_NUMBER_OF_MEASUREMENTS }, }; -size_t m_libspdm_get_measurements_request17_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_get_measurements_request17_size = sizeof(spdm_message_header_t); extern size_t libspdm_secret_lib_meas_opaque_data_size; diff --git a/unit_test/test_spdm_responder/psk_exchange.c b/unit_test/test_spdm_responder/psk_exchange.c index 55d5809b093..e1cd8ed3cd4 100644 --- a/unit_test/test_spdm_responder/psk_exchange.c +++ b/unit_test/test_spdm_responder/psk_exchange.c @@ -59,58 +59,58 @@ libspdm_psk_exchange_request_mine_t m_libspdm_psk_exchange_request1 = { { SPDM_MESSAGE_VERSION_11, SPDM_PSK_EXCHANGE, SPDM_PSK_EXCHANGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH, 0 }, }; -size_t m_libspdm_psk_exchange_request1_size = sizeof(m_libspdm_psk_exchange_request1); +static size_t m_libspdm_psk_exchange_request1_size = sizeof(m_libspdm_psk_exchange_request1); libspdm_psk_exchange_request_mine_t m_libspdm_psk_exchange_request2 = { { SPDM_MESSAGE_VERSION_11, SPDM_PSK_EXCHANGE, SPDM_PSK_EXCHANGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH, 0 }, }; -size_t m_libspdm_psk_exchange_request2_size = sizeof(spdm_psk_exchange_request_t); +static size_t m_libspdm_psk_exchange_request2_size = sizeof(spdm_psk_exchange_request_t); libspdm_psk_exchange_request_mine_t m_libspdm_psk_exchange_request3 = { { SPDM_MESSAGE_VERSION_12, SPDM_PSK_EXCHANGE, SPDM_PSK_EXCHANGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH, 0 }, }; -size_t m_libspdm_psk_exchange_request3_size = sizeof(m_libspdm_psk_exchange_request3); +static size_t m_libspdm_psk_exchange_request3_size = sizeof(m_libspdm_psk_exchange_request3); /* Request TCB measurement hash */ libspdm_psk_exchange_request_mine_t m_libspdm_psk_exchange_request4 = { { SPDM_MESSAGE_VERSION_11, SPDM_PSK_EXCHANGE, SPDM_PSK_EXCHANGE_REQUEST_TCB_COMPONENT_MEASUREMENT_HASH, 0 }, }; -size_t m_libspdm_psk_exchange_request4_size = sizeof(m_libspdm_psk_exchange_request4); +static size_t m_libspdm_psk_exchange_request4_size = sizeof(m_libspdm_psk_exchange_request4); /* Request all measurement hash */ libspdm_psk_exchange_request_mine_t m_libspdm_psk_exchange_request5 = { { SPDM_MESSAGE_VERSION_11, SPDM_PSK_EXCHANGE, SPDM_PSK_EXCHANGE_REQUEST_ALL_MEASUREMENTS_HASH, 0 }, }; -size_t m_libspdm_psk_exchange_request5_size = sizeof(m_libspdm_psk_exchange_request5); +static size_t m_libspdm_psk_exchange_request5_size = sizeof(m_libspdm_psk_exchange_request5); /* Uses a reserved value in measurement hash */ libspdm_psk_exchange_request_mine_t m_libspdm_psk_exchange_request6 = { { SPDM_MESSAGE_VERSION_11, SPDM_PSK_EXCHANGE, 0x50, 0 }, }; -size_t m_libspdm_psk_exchange_request6_size = sizeof(m_libspdm_psk_exchange_request6); +static size_t m_libspdm_psk_exchange_request6_size = sizeof(m_libspdm_psk_exchange_request6); libspdm_psk_exchange_request_mine_t_noPSKHINT m_libspdm_psk_exchange_request7 = { { SPDM_MESSAGE_VERSION_11, SPDM_PSK_EXCHANGE, SPDM_PSK_EXCHANGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH, 0 }, }; -size_t m_libspdm_psk_exchange_request7_size = sizeof(m_libspdm_psk_exchange_request7); +static size_t m_libspdm_psk_exchange_request7_size = sizeof(m_libspdm_psk_exchange_request7); libspdm_psk_exchange_request_mine_t_noOPAQUE m_libspdm_psk_exchange_request8 = { { SPDM_MESSAGE_VERSION_11, SPDM_PSK_EXCHANGE, SPDM_PSK_EXCHANGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH, 0 }, }; -size_t m_libspdm_psk_exchange_request8_size = sizeof(m_libspdm_psk_exchange_request8); +static size_t m_libspdm_psk_exchange_request8_size = sizeof(m_libspdm_psk_exchange_request8); libspdm_psk_exchange_request_mine_t_noPSKHINT_noOPAQUE m_libspdm_psk_exchange_request9 = { { SPDM_MESSAGE_VERSION_11, SPDM_PSK_EXCHANGE, SPDM_PSK_EXCHANGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH, 0 }, }; -size_t m_libspdm_psk_exchange_request9_size = sizeof(m_libspdm_psk_exchange_request9); +static size_t m_libspdm_psk_exchange_request9_size = sizeof(m_libspdm_psk_exchange_request9); void libspdm_test_responder_psk_exchange_case1(void **state) { diff --git a/unit_test/test_spdm_responder/psk_finish.c b/unit_test/test_spdm_responder/psk_finish.c index bcdb434d88e..1a53877bf68 100644 --- a/unit_test/test_spdm_responder/psk_finish.c +++ b/unit_test/test_spdm_responder/psk_finish.c @@ -21,12 +21,12 @@ static libspdm_th_managed_buffer_t th_curr; libspdm_psk_finish_request_mine_t m_libspdm_psk_finish_request1 = { { SPDM_MESSAGE_VERSION_11, SPDM_PSK_FINISH, 0, 0 }, }; -size_t m_libspdm_psk_finish_request1_size = sizeof(m_libspdm_psk_finish_request1); +static size_t m_libspdm_psk_finish_request1_size = sizeof(m_libspdm_psk_finish_request1); libspdm_psk_finish_request_mine_t m_libspdm_psk_finish_request2 = { { SPDM_MESSAGE_VERSION_11, SPDM_PSK_FINISH, 0, 0 }, }; -size_t m_libspdm_psk_finish_request2_size = LIBSPDM_MAX_SPDM_MSG_SIZE; +static size_t m_libspdm_psk_finish_request2_size = LIBSPDM_MAX_SPDM_MSG_SIZE; static uint8_t m_libspdm_dummy_buffer[LIBSPDM_MAX_HASH_SIZE]; diff --git a/unit_test/test_spdm_responder/respond_if_ready.c b/unit_test/test_spdm_responder/respond_if_ready.c index 2639f49e98c..a884bb728b2 100644 --- a/unit_test/test_spdm_responder/respond_if_ready.c +++ b/unit_test/test_spdm_responder/respond_if_ready.c @@ -30,7 +30,7 @@ spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request1 = { LIBSPDM_MY_TEST_TOKEN }, }; -size_t m_libspdm_respond_if_ready_request1_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_respond_if_ready_request1_size = sizeof(spdm_message_header_t); spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request2 = { { @@ -40,7 +40,7 @@ spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request2 = { LIBSPDM_MY_TEST_TOKEN }, }; -size_t m_libspdm_respond_if_ready_request2_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_respond_if_ready_request2_size = sizeof(spdm_message_header_t); spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request3 = { { @@ -50,7 +50,7 @@ spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request3 = { LIBSPDM_MY_TEST_TOKEN }, }; -size_t m_libspdm_respond_if_ready_request3_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_respond_if_ready_request3_size = sizeof(spdm_message_header_t); spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request4 = { { @@ -60,7 +60,7 @@ spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request4 = { LIBSPDM_MY_TEST_TOKEN }, }; -size_t m_libspdm_respond_if_ready_request4_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_respond_if_ready_request4_size = sizeof(spdm_message_header_t); spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request5 = { { @@ -70,7 +70,7 @@ spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request5 = { LIBSPDM_MY_TEST_TOKEN }, }; -size_t m_libspdm_respond_if_ready_request5_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_respond_if_ready_request5_size = sizeof(spdm_message_header_t); spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request6 = { { @@ -80,7 +80,7 @@ spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request6 = { LIBSPDM_MY_TEST_TOKEN }, }; -size_t m_libspdm_respond_if_ready_request6_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_respond_if_ready_request6_size = sizeof(spdm_message_header_t); spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request7 = { { @@ -90,7 +90,7 @@ spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request7 = { LIBSPDM_MY_TEST_TOKEN }, }; -size_t m_libspdm_respond_if_ready_request7_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_respond_if_ready_request7_size = sizeof(spdm_message_header_t); spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request8 = { { @@ -100,7 +100,7 @@ spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request8 = { LIBSPDM_MY_TEST_TOKEN }, }; -size_t m_libspdm_respond_if_ready_request8_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_respond_if_ready_request8_size = sizeof(spdm_message_header_t); spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request10 = { { @@ -110,7 +110,7 @@ spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request10 = { LIBSPDM_MY_WRONG_TEST_TOKEN /*wrong token*/ }, }; -size_t m_libspdm_respond_if_ready_request10_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_respond_if_ready_request10_size = sizeof(spdm_message_header_t); spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request11 = { { @@ -120,7 +120,7 @@ spdm_response_if_ready_request_t m_libspdm_respond_if_ready_request11 = { LIBSPDM_MY_TEST_TOKEN }, }; -size_t m_libspdm_respond_if_ready_request11_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_respond_if_ready_request11_size = sizeof(spdm_message_header_t); #if LIBSPDM_ENABLE_CAPABILITY_CERT_CAP spdm_get_digest_request_t m_libspdm_get_digest_request = { @@ -131,7 +131,7 @@ spdm_get_digest_request_t m_libspdm_get_digest_request = { 0 }, }; -size_t m_libspdm_get_digest_request_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_get_digest_request_size = sizeof(spdm_message_header_t); spdm_get_certificate_request_t m_libspdm_get_certificate_request = { { @@ -143,7 +143,7 @@ spdm_get_certificate_request_t m_libspdm_get_certificate_request = { 0, LIBSPDM_MAX_CERT_CHAIN_BLOCK_LEN }; -size_t m_libspdm_get_certificate_request_size = sizeof(m_libspdm_get_certificate_request); +static size_t m_libspdm_get_certificate_request_size = sizeof(m_libspdm_get_certificate_request); #endif /* LIBSPDM_ENABLE_CAPABILITY_CERT_CAP*/ @@ -157,7 +157,7 @@ spdm_challenge_request_t m_libspdm_challenge_request = { SPDM_CHALLENGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH }, }; -size_t m_libspdm_challenge_request_size = sizeof(m_libspdm_challenge_request); +static size_t m_libspdm_challenge_request_size = sizeof(m_libspdm_challenge_request); #endif /* LIBSPDM_ENABLE_CAPABILITY_CHAL_CAP*/ @@ -170,7 +170,7 @@ spdm_get_measurements_request_t m_libspdm_get_measurements_request = { SPDM_GET_MEASUREMENTS_REQUEST_MEASUREMENT_OPERATION_TOTAL_NUMBER_OF_MEASUREMENTS }, }; -size_t m_libspdm_get_measurements_request_size = sizeof(spdm_message_header_t); +static size_t m_libspdm_get_measurements_request_size = sizeof(spdm_message_header_t); #endif /* LIBSPDM_ENABLE_CAPABILITY_MEAS_CAP*/ #pragma pack(1) @@ -220,7 +220,7 @@ libspdm_key_exchange_request_mine_t m_libspdm_key_exchange_request = { 0 }, }; -size_t m_libspdm_key_exchange_request_size = sizeof(m_libspdm_key_exchange_request); +static size_t m_libspdm_key_exchange_request_size = sizeof(m_libspdm_key_exchange_request); libspdm_finish_request_mine_t m_libspdm_finish_request = { { @@ -230,7 +230,7 @@ libspdm_finish_request_mine_t m_libspdm_finish_request = { 0 }, }; -size_t m_libspdm_finish_request_size = sizeof(m_libspdm_finish_request); +static size_t m_libspdm_finish_request_size = sizeof(m_libspdm_finish_request); #if LIBSPDM_ENABLE_CAPABILITY_PSK_CAP libspdm_psk_exchange_request_mine_t m_libspdm_psk_exchange_request = { @@ -241,7 +241,7 @@ libspdm_psk_exchange_request_mine_t m_libspdm_psk_exchange_request = { 0 }, }; -size_t m_libspdm_psk_exchange_request_size = sizeof(m_libspdm_psk_exchange_request); +static size_t m_libspdm_psk_exchange_request_size = sizeof(m_libspdm_psk_exchange_request); libspdm_psk_finish_request_mine_t m_libspdm_psk_finish_request = { { @@ -251,7 +251,7 @@ libspdm_psk_finish_request_mine_t m_libspdm_psk_finish_request = { 0 }, }; -size_t m_libspdm_psk_finish_request_size = sizeof(m_libspdm_psk_finish_request); +static size_t m_libspdm_psk_finish_request_size = sizeof(m_libspdm_psk_finish_request); #endif /* LIBSPDM_ENABLE_CAPABILITY_PSK_CAP */ spdm_end_session_request_t m_libspdm_end_session_request = { @@ -262,7 +262,7 @@ spdm_end_session_request_t m_libspdm_end_session_request = { 0 } }; -size_t m_libspdm_end_session_request_size = sizeof(m_libspdm_end_session_request); +static size_t m_libspdm_end_session_request_size = sizeof(m_libspdm_end_session_request); #if LIBSPDM_ENABLE_CAPABILITY_CERT_CAP static uint8_t m_libspdm_local_certificate_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; #endif diff --git a/unit_test/test_spdm_responder/version.c b/unit_test/test_spdm_responder/version.c index 9b2ece5a54e..30d4b5a36f0 100644 --- a/unit_test/test_spdm_responder/version.c +++ b/unit_test/test_spdm_responder/version.c @@ -24,7 +24,7 @@ spdm_get_version_request_t m_libspdm_get_version_request1 = { SPDM_GET_VERSION, }, }; -size_t m_libspdm_get_version_request1_size = sizeof(m_libspdm_get_version_request1); +static size_t m_libspdm_get_version_request1_size = sizeof(m_libspdm_get_version_request1); spdm_get_version_request_t m_libspdm_get_version_request3 = { { @@ -32,7 +32,7 @@ spdm_get_version_request_t m_libspdm_get_version_request3 = { SPDM_GET_VERSION, }, }; -size_t m_libspdm_get_version_request3_size = sizeof(m_libspdm_get_version_request3); +static size_t m_libspdm_get_version_request3_size = sizeof(m_libspdm_get_version_request3); spdm_get_version_request_t m_libspdm_get_version_request4 = { { @@ -40,7 +40,7 @@ spdm_get_version_request_t m_libspdm_get_version_request4 = { SPDM_VERSION, }, }; -size_t m_libspdm_get_version_request4_size = sizeof(m_libspdm_get_version_request4); +static size_t m_libspdm_get_version_request4_size = sizeof(m_libspdm_get_version_request4); /** * Test 1: receiving a correct GET_VERSION from the requester.