From 2a5fdc051597356d1326bd5c4df6b3d4d366e51c Mon Sep 17 00:00:00 2001 From: Qi Zhang Date: Wed, 23 Feb 2022 21:13:02 +0800 Subject: [PATCH] add LIBSPDM_ or libspdm_ for any external symbol or MACRO. for libspdm_common_lib. Signed-off-by: Qi Zhang --- include/internal/libspdm_common_lib.h | 352 +++--- include/internal/libspdm_requester_lib.h | 28 +- include/internal/libspdm_responder_lib.h | 26 +- .../libspdm_com_context_data.c | 261 +++-- .../libspdm_com_context_data_session.c | 50 +- .../libspdm_com_crypto_service.c | 270 ++--- .../libspdm_com_crypto_service_session.c | 260 ++--- .../spdm_common_lib/libspdm_com_opaque_data.c | 69 +- library/spdm_common_lib/libspdm_com_support.c | 46 +- .../libspdm_req_challenge.c | 38 +- .../libspdm_req_communication.c | 18 +- .../libspdm_req_encap_certificate.c | 10 +- .../libspdm_req_encap_challenge_auth.c | 14 +- .../libspdm_req_encap_digests.c | 14 +- .../libspdm_req_encap_error.c | 4 +- .../libspdm_req_encap_key_update.c | 12 +- .../libspdm_req_encap_request.c | 20 +- .../libspdm_req_end_session.c | 14 +- .../spdm_requester_lib/libspdm_req_finish.c | 32 +- .../libspdm_req_get_capabilities.c | 10 +- .../libspdm_req_get_certificate.c | 66 +- .../libspdm_req_get_digests.c | 18 +- .../libspdm_req_get_measurements.c | 30 +- .../libspdm_req_get_version.c | 22 +- .../libspdm_req_handle_error_response.c | 10 +- .../libspdm_req_heartbeat.c | 14 +- .../libspdm_req_key_exchange.c | 52 +- .../libspdm_req_key_update.c | 16 +- .../libspdm_req_negotiate_algorithms.c | 26 +- .../libspdm_req_psk_exchange.c | 48 +- .../libspdm_req_psk_finish.c | 18 +- .../libspdm_req_send_receive.c | 20 +- .../libspdm_rsp_algorithms.c | 24 +- .../libspdm_rsp_capabilities.c | 10 +- .../libspdm_rsp_certificate.c | 10 +- .../libspdm_rsp_challenge_auth.c | 32 +- .../libspdm_rsp_communication.c | 4 +- .../spdm_responder_lib/libspdm_rsp_digests.c | 14 +- .../libspdm_rsp_encap_challenge.c | 34 +- .../libspdm_rsp_encap_get_certificate.c | 50 +- .../libspdm_rsp_encap_get_digests.c | 20 +- .../libspdm_rsp_encap_key_update.c | 18 +- .../libspdm_rsp_encap_response.c | 38 +- .../libspdm_rsp_end_session.c | 10 +- .../spdm_responder_lib/libspdm_rsp_error.c | 4 +- .../spdm_responder_lib/libspdm_rsp_finish.c | 24 +- .../libspdm_rsp_handle_response_state.c | 2 +- .../libspdm_rsp_heartbeat.c | 12 +- .../libspdm_rsp_key_exchange.c | 54 +- .../libspdm_rsp_key_update.c | 12 +- .../libspdm_rsp_measurements.c | 22 +- .../libspdm_rsp_psk_exchange.c | 38 +- .../libspdm_rsp_psk_finish.c | 14 +- .../libspdm_rsp_receive_send.c | 38 +- .../libspdm_rsp_respond_if_ready.c | 4 +- .../spdm_responder_lib/libspdm_rsp_version.c | 6 +- .../libspdm_secmes_session.c | 70 +- .../test_spdm_requester_challenge/challenge.c | 21 +- .../encap_certificate.c | 2 +- .../encap_challenge_auth.c | 2 +- .../encap_digests.c | 2 +- .../encap_key_update.c | 10 +- .../encap_request.c | 8 +- .../end_session.c | 8 +- .../test_spdm_requester_finish/finish.c | 6 +- .../get_capabilities.c | 2 +- .../get_certificate.c | 12 +- .../get_digests.c | 2 +- .../get_measurements.c | 12 +- .../get_version.c | 2 +- .../test_spdm_requester_heartbeat/heartbeat.c | 8 +- .../key_exchange.c | 50 +- .../key_update.c | 16 +- .../negotiate_algorithms.c | 6 +- .../psk_exchange.c | 35 +- .../psk_finish.c | 8 +- .../algorithms.c | 20 +- .../capabilities.c | 6 +- .../certificate.c | 10 +- .../challenge_auth.c | 12 +- .../test_spdm_responder_digests/digests.c | 8 +- .../encap_challenge.c | 8 +- .../encap_get_certificate.c | 6 +- .../encap_get_digests.c | 4 +- .../encap_key_update.c | 22 +- .../encap_response.c | 41 +- .../end_session.c | 6 +- .../finish_rsp.c | 78 +- .../heartbeat_ack.c | 6 +- .../respond_if_ready.c | 2 +- .../key_exchange.c | 47 +- .../key_update.c | 10 +- .../measurements.c | 16 +- .../psk_exchange_rsp.c | 55 +- .../psk_finish_rsp.c | 25 +- .../test_spdm_responder_version/version.c | 2 +- .../spdm_decode_secured_message.c | 6 +- .../spdm_encode_secured_message.c | 6 +- .../spdm_transport_mctp_decode_message.c | 2 +- .../transport_mctp_encode_message.c | 2 +- .../spdm_transport_pci_doe_decode_message.c | 2 +- .../spdm_transport_pci_doe_encode_message.c | 2 +- unit_test/test_crypt/aead_verify.c | 2 +- unit_test/test_spdm_common/context_data.c | 70 +- unit_test/test_spdm_requester/challenge.c | 218 ++-- unit_test/test_spdm_requester/end_session.c | 98 +- unit_test/test_spdm_requester/finish.c | 436 +++---- .../test_spdm_requester/get_capabilities.c | 62 +- .../test_spdm_requester/get_certificate.c | 52 +- unit_test/test_spdm_requester/get_digests.c | 68 +- .../test_spdm_requester/get_measurements.c | 236 ++-- unit_test/test_spdm_requester/get_version.c | 30 +- unit_test/test_spdm_requester/heartbeat.c | 98 +- unit_test/test_spdm_requester/key_exchange.c | 1026 ++++++++--------- unit_test/test_spdm_requester/key_update.c | 244 ++-- .../negotiate_algorithms.c | 62 +- unit_test/test_spdm_requester/psk_exchange.c | 188 +-- unit_test/test_spdm_requester/psk_finish.c | 122 +- unit_test/test_spdm_responder/algorithms.c | 40 +- unit_test/test_spdm_responder/capabilities.c | 44 +- unit_test/test_spdm_responder/certificate.c | 24 +- .../test_spdm_responder/challenge_auth.c | 28 +- unit_test/test_spdm_responder/digests.c | 18 +- unit_test/test_spdm_responder/end_session.c | 42 +- unit_test/test_spdm_responder/finish.c | 316 ++--- unit_test/test_spdm_responder/heartbeat.c | 42 +- unit_test/test_spdm_responder/key_exchange.c | 96 +- unit_test/test_spdm_responder/key_update.c | 110 +- unit_test/test_spdm_responder/measurements.c | 50 +- unit_test/test_spdm_responder/psk_exchange.c | 42 +- unit_test/test_spdm_responder/psk_finish.c | 210 ++-- .../test_spdm_responder/respond_if_ready.c | 79 +- unit_test/test_spdm_responder/version.c | 14 +- 133 files changed, 3647 insertions(+), 3588 deletions(-) diff --git a/include/internal/libspdm_common_lib.h b/include/internal/libspdm_common_lib.h index ab4c28c378f..f5f90760dc2 100644 --- a/include/internal/libspdm_common_lib.h +++ b/include/internal/libspdm_common_lib.h @@ -15,7 +15,7 @@ typedef struct { uint8_t spdm_version_count; spdm_version_number_t spdm_version[SPDM_MAX_VERSION_COUNT]; -} spdm_device_version_t; +} libspdm_device_version_t; typedef struct { uint8_t ct_exponent; @@ -24,7 +24,7 @@ typedef struct { uint32_t flags; uint32_t data_transfer_size; uint32_t max_spdm_msg_size; -} spdm_device_capability_t; +} libspdm_device_capability_t; typedef struct { uint8_t measurement_spec; @@ -36,16 +36,16 @@ typedef struct { uint16_t aead_cipher_suite; uint16_t req_base_asym_alg; uint16_t key_schedule; -} spdm_device_algorithm_t; +} libspdm_device_algorithm_t; typedef struct { /* Local device info*/ - spdm_device_version_t version; - spdm_device_capability_t capability; - spdm_device_algorithm_t algorithm; - spdm_device_version_t secured_message_version; + libspdm_device_version_t version; + libspdm_device_capability_t capability; + libspdm_device_algorithm_t algorithm; + libspdm_device_version_t secured_message_version; /* My Certificate*/ @@ -86,7 +86,7 @@ typedef struct { bool basic_mut_auth_requested; uint8_t mut_auth_requested; uint8_t heartbeat_period; -} spdm_local_context_t; +} libspdm_local_context_t; typedef struct { @@ -97,8 +97,8 @@ typedef struct { /* Peer device info (negotiated)*/ spdm_version_number_t version; - spdm_device_capability_t capability; - spdm_device_algorithm_t algorithm; + libspdm_device_capability_t capability; + libspdm_device_algorithm_t algorithm; spdm_version_number_t secured_message_version; /* Peer CertificateChain */ @@ -116,31 +116,31 @@ typedef struct { uint8_t *local_used_cert_chain_buffer; uintn local_used_cert_chain_buffer_size; -} spdm_connection_info_t; +} libspdm_connection_info_t; typedef struct { uintn max_buffer_size; uintn buffer_size; /*uint8_t buffer[max_buffer_size];*/ -} managed_buffer_t; +} libspdm_managed_buffer_t; typedef struct { uintn max_buffer_size; uintn buffer_size; uint8_t buffer[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; -} large_managed_buffer_t; +} libspdm_large_managed_buffer_t; typedef struct { uintn max_buffer_size; uintn buffer_size; uint8_t buffer[LIBSPDM_MAX_MESSAGE_MEDIUM_BUFFER_SIZE]; -} medium_managed_buffer_t; +} libspdm_medium_managed_buffer_t; typedef struct { uintn max_buffer_size; uintn buffer_size; uint8_t buffer[LIBSPDM_MAX_MESSAGE_SMALL_BUFFER_SIZE]; -} small_managed_buffer_t; +} libspdm_small_managed_buffer_t; /* signature = Sign(SK, hash(M1)) @@ -163,19 +163,19 @@ typedef struct { typedef struct { /* the message_a must be plan text because we do not know the algorithm yet.*/ - small_managed_buffer_t message_a; + libspdm_small_managed_buffer_t message_a; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - large_managed_buffer_t message_b; - small_managed_buffer_t message_c; - large_managed_buffer_t message_mut_b; - small_managed_buffer_t message_mut_c; - large_managed_buffer_t message_m; + libspdm_large_managed_buffer_t message_b; + libspdm_small_managed_buffer_t message_c; + libspdm_large_managed_buffer_t message_mut_b; + libspdm_small_managed_buffer_t message_mut_c; + libspdm_large_managed_buffer_t message_m; #else void *digest_context_m1m2; void *digest_context_mut_m1m2; void *digest_context_l1l2; #endif -} spdm_transcript_t; +} libspdm_transcript_t; /* TH for KEY_EXCHANGE response signature: Concatenate (A, Ct, K) @@ -229,12 +229,12 @@ typedef struct { typedef struct { #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - large_managed_buffer_t message_k; - large_managed_buffer_t message_f; - large_managed_buffer_t message_m; + libspdm_large_managed_buffer_t message_k; + libspdm_large_managed_buffer_t message_f; + libspdm_large_managed_buffer_t message_m; #else /* the message_k must be plan text because we do not know the finished_key yet.*/ - medium_managed_buffer_t temp_message_k; + libspdm_medium_managed_buffer_t temp_message_k; bool message_f_initialized; bool finished_key_ready; void *digest_context_th; @@ -246,7 +246,7 @@ typedef struct { void *hmac_rsp_context_th_backup; void *hmac_req_context_th_backup; #endif -} spdm_session_transcript_t; +} libspdm_session_transcript_t; typedef struct { uint32_t session_id; @@ -254,16 +254,16 @@ typedef struct { uint8_t mut_auth_requested; uint8_t end_session_attributes; uint8_t session_policy; - spdm_session_transcript_t session_transcript; + libspdm_session_transcript_t session_transcript; void *secured_message_context; -} spdm_session_info_t; +} libspdm_session_info_t; -#define MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT 3 +#define LIBSPDM_MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT 3 typedef struct { uint32_t error_state; /* Valid OpCode: GET_DIEGST/GET_CERTIFICATE/CHALLENGE/KEY_UPDATE * The last one is 0x00, as terminator.*/ - uint8_t request_op_code_sequence[MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT + + uint8_t request_op_code_sequence[LIBSPDM_MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT + 1]; uint8_t request_op_code_count; uint8_t current_request_op_code; @@ -272,10 +272,10 @@ typedef struct { spdm_message_header_t last_encap_request_header; uintn last_encap_request_size; uint16_t cert_chain_total_len; - large_managed_buffer_t certificate_chain_buffer; -} spdm_encap_context_t; + libspdm_large_managed_buffer_t certificate_chain_buffer; +} libspdm_encap_context_t; -#define spdm_context_struct_version 0x2 +#define libspdm_context_struct_version 0x2 typedef struct { uint32_t version; @@ -318,7 +318,7 @@ typedef struct { /* Register GetEncapResponse function (requester only)*/ uintn get_encap_response_func; - spdm_encap_context_t encap_context; + libspdm_encap_context_t encap_context; /* Register spdm_session_state_callback function (responder only) * Register can know the state after StartSession / EndSession.*/ @@ -331,12 +331,12 @@ typedef struct { uintn spdm_connection_state_callback [LIBSPDM_MAX_CONNECTION_STATE_CALLBACK_NUM]; - spdm_local_context_t local_context; + libspdm_local_context_t local_context; - spdm_connection_info_t connection_info; - spdm_transcript_t transcript; + libspdm_connection_info_t connection_info; + libspdm_transcript_t transcript; - spdm_session_info_t session_info[LIBSPDM_MAX_SESSION_COUNT]; + libspdm_session_info_t session_info[LIBSPDM_MAX_SESSION_COUNT]; /* Cache lastest session ID for HANDSHAKE_IN_THE_CLEAR*/ @@ -383,7 +383,7 @@ typedef struct { * If the BIT0 set, drop the request silently. **/ uint8_t handle_error_return_policy; -} spdm_context_t; +} libspdm_context_t; /** * This function dump raw data. @@ -391,7 +391,7 @@ typedef struct { * @param data raw data * @param size raw data size **/ -void internal_dump_hex_str(const uint8_t *data, uintn size); +void libspdm_libspdm_internal_dump_hex_str(const uint8_t *data, uintn size); /** * This function dump raw data. @@ -399,7 +399,7 @@ void internal_dump_hex_str(const uint8_t *data, uintn size); * @param data raw data * @param size raw data size **/ -void internal_dump_data(const uint8_t *data, uintn size); +void libspdm_internal_dump_data(const uint8_t *data, uintn size); /** * This function dump raw data with colume format. @@ -407,20 +407,20 @@ void internal_dump_data(const uint8_t *data, uintn size); * @param data raw data * @param size raw data size **/ -void internal_dump_hex(const uint8_t *data, uintn size); +void libspdm_internal_dump_hex(const uint8_t *data, uintn size); /** * Append a new data buffer to the managed buffer. * - * @param managed_buffer_t The managed buffer to be appended. + * @param managed_buffer The managed buffer to be appended. * @param buffer The address of the data buffer to be appended to the managed buffer. * @param buffer_size The size in bytes of the data buffer to be appended to the managed buffer. * * @retval RETURN_SUCCESS The new data buffer is appended to the managed buffer. * @retval RETURN_BUFFER_TOO_SMALL The managed buffer is too small to be appended. **/ -return_status append_managed_buffer(void *managed_buffer_t, - const void *buffer, uintn buffer_size); +return_status libspdm_append_managed_buffer(void *managed_buffer, + const void *buffer, uintn buffer_size); /** * Reset the managed buffer. @@ -428,36 +428,36 @@ return_status append_managed_buffer(void *managed_buffer_t, * The max_buffer_size is unchanged. * The buffer is not freed. * - * @param managed_buffer_t The managed buffer to be shrinked. + * @param managed_buffer The managed buffer to be shrinked. **/ -void reset_managed_buffer(void *managed_buffer_t); +void libspdm_reset_managed_buffer(void *managed_buffer); /** * Return the size of managed buffer. * - * @param managed_buffer_t The managed buffer. + * @param managed_buffer The managed buffer. * * @return the size of managed buffer. **/ -uintn get_managed_buffer_size(void *managed_buffer_t); +uintn libspdm_get_managed_buffer_size(void *managed_buffer); /** * Return the address of managed buffer. * - * @param managed_buffer_t The managed buffer. + * @param managed_buffer The managed buffer. * * @return the address of managed buffer. **/ -void *get_managed_buffer(void *managed_buffer_t); +void *libspdm_get_managed_buffer(void *managed_buffer); /** * Init the managed buffer. * - * @param managed_buffer_t The managed buffer. + * @param managed_buffer The managed buffer. * @param max_buffer_size The maximum size in bytes of the managed buffer. **/ -void init_managed_buffer(void *managed_buffer_t, - uintn max_buffer_size); +void libspdm_init_managed_buffer(void *managed_buffer, + uintn max_buffer_size); /** * Reset message buffer in SPDM context according to request code. @@ -466,8 +466,8 @@ void init_managed_buffer(void *managed_buffer_t, * @param spdm_session_info A pointer to the SPDM session context. * @param spdm_request The SPDM request code. */ -void spdm_reset_message_buffer_via_request_code(void *context, void *session_info, - uint8_t request_code); +void libspdm_reset_message_buffer_via_request_code(void *context, void *session_info, + uint8_t request_code); /** * This function initializes the session info. @@ -475,9 +475,9 @@ void spdm_reset_message_buffer_via_request_code(void *context, void *session_inf * @param spdm_context A pointer to the SPDM context. * @param session_id The SPDM session ID. **/ -void spdm_session_info_init(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint32_t session_id, bool use_psk); +void libspdm_session_info_init(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint32_t session_id, bool use_psk); /** * This function allocates half of session ID for a requester. @@ -486,7 +486,7 @@ void spdm_session_info_init(spdm_context_t *spdm_context, * * @return half of session ID for a requester. **/ -uint16_t spdm_allocate_req_session_id(spdm_context_t *spdm_context); +uint16_t libspdm_allocate_req_session_id(libspdm_context_t *spdm_context); /** * This function allocates half of session ID for a responder. @@ -495,7 +495,7 @@ uint16_t spdm_allocate_req_session_id(spdm_context_t *spdm_context); * * @return half of session ID for a responder. **/ -uint16_t spdm_allocate_rsp_session_id(const spdm_context_t *spdm_context); +uint16_t libspdm_allocate_rsp_session_id(const libspdm_context_t *spdm_context); /** * This function returns if a given version is supported based upon the GET_VERSION/VERSION. @@ -506,8 +506,8 @@ uint16_t spdm_allocate_rsp_session_id(const spdm_context_t *spdm_context); * @retval true the version is supported. * @retval false the version is not supported. **/ -bool spdm_is_version_supported(const spdm_context_t *spdm_context, - uint8_t version); +bool libspdm_is_version_supported(const libspdm_context_t *spdm_context, + uint8_t version); /** * This function returns connection version negotiated by GET_VERSION/VERSION. @@ -516,7 +516,7 @@ bool spdm_is_version_supported(const spdm_context_t *spdm_context, * * @return the connection version. **/ -uint8_t spdm_get_connection_version(const spdm_context_t *spdm_context); +uint8_t libspdm_get_connection_version(const libspdm_context_t *spdm_context); /** * This function returns if a capablities flag is supported in current SPDM connection. @@ -530,10 +530,10 @@ uint8_t spdm_get_connection_version(const spdm_context_t *spdm_context); * @retval false the capablities flag is not supported. **/ bool -spdm_is_capabilities_flag_supported(const spdm_context_t *spdm_context, - bool is_requester, - uint32_t requester_capabilities_flag, - uint32_t responder_capabilities_flag); +libspdm_is_capabilities_flag_supported(const libspdm_context_t *spdm_context, + bool is_requester, + uint32_t requester_capabilities_flag, + uint32_t responder_capabilities_flag); #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT /* @@ -546,9 +546,9 @@ spdm_is_capabilities_flag_supported(const spdm_context_t *spdm_context, * * @retval RETURN_SUCCESS m1m2 is calculated. */ -bool spdm_calculate_m1m2(void *context, bool is_mut, - uintn *m1m2_buffer_size, - void *m1m2_buffer); +bool libspdm_calculate_m1m2(void *context, bool is_mut, + uintn *m1m2_buffer_size, + void *m1m2_buffer); #else /* * This function calculates m1m2 hash. @@ -560,9 +560,9 @@ bool spdm_calculate_m1m2(void *context, bool is_mut, * * @retval RETURN_SUCCESS m1m2 is calculated. */ -bool spdm_calculate_m1m2_hash(void *context, bool is_mut, - uintn *m1m2_hash_size, - void *m1m2_hash); +bool libspdm_calculate_m1m2_hash(void *context, bool is_mut, + uintn *m1m2_hash_size, + void *m1m2_hash); #endif #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT @@ -578,8 +578,8 @@ bool spdm_calculate_m1m2_hash(void *context, bool is_mut, * * @retval RETURN_SUCCESS l1l2 is calculated. */ -bool spdm_calculate_l1l2(void *context, void *session_info, - uintn *l1l2_buffer_size, void *l1l2_buffer); +bool libspdm_calculate_l1l2(void *context, void *session_info, + uintn *l1l2_buffer_size, void *l1l2_buffer); #else /* * This function calculates l1l2 hash. @@ -593,8 +593,8 @@ bool spdm_calculate_l1l2(void *context, void *session_info, * * @retval RETURN_SUCCESS l1l2 is calculated. */ -bool spdm_calculate_l1l2_hash(void *context, void *session_info, - uintn *l1l2_hash_size, void *l1l2_hash); +bool libspdm_calculate_l1l2_hash(void *context, void *session_info, + uintn *l1l2_hash_size, void *l1l2_hash); #endif /** @@ -607,8 +607,8 @@ bool spdm_calculate_l1l2_hash(void *context, void *session_info, * @retval true certificate chain hash is generated. * @retval false certificate chain hash is not generated. **/ -bool spdm_generate_cert_chain_hash(spdm_context_t *spdm_context, - uintn slot_id, uint8_t *hash); +bool libspdm_generate_cert_chain_hash(libspdm_context_t *spdm_context, + uintn slot_id, uint8_t *hash); /** * This function verifies the digest. @@ -620,8 +620,8 @@ bool spdm_generate_cert_chain_hash(spdm_context_t *spdm_context, * @retval true digest verification pass. * @retval false digest verification fail. **/ -bool spdm_verify_peer_digests(spdm_context_t *spdm_context, - void *digest, uintn digest_count); +bool libspdm_verify_peer_digests(libspdm_context_t *spdm_context, + void *digest, uintn digest_count); /** * This function verifies peer certificate chain buffer including spdm_cert_chain_t header. @@ -635,11 +635,11 @@ bool spdm_verify_peer_digests(spdm_context_t *spdm_context, * @retval true Peer certificate chain buffer verification passed. * @retval false Peer certificate chain buffer verification failed. **/ -bool spdm_verify_peer_cert_chain_buffer(spdm_context_t *spdm_context, - const void *cert_chain_buffer, - uintn cert_chain_buffer_size, - void **trust_anchor, - uintn *trust_anchor_size); +bool libspdm_verify_peer_cert_chain_buffer(libspdm_context_t *spdm_context, + const void *cert_chain_buffer, + uintn cert_chain_buffer_size, + void **trust_anchor, + uintn *trust_anchor_size); /** * This function generates the challenge signature based upon m1m2 for authentication. @@ -651,9 +651,9 @@ bool spdm_verify_peer_cert_chain_buffer(spdm_context_t *spdm_context, * @retval true challenge signature is generated. * @retval false challenge signature is not generated. **/ -bool spdm_generate_challenge_auth_signature(spdm_context_t *spdm_context, - bool is_requester, - uint8_t *signature); +bool libspdm_generate_challenge_auth_signature(libspdm_context_t *spdm_context, + bool is_requester, + uint8_t *signature); /** * This function verifies the certificate chain hash. @@ -666,9 +666,9 @@ bool spdm_generate_challenge_auth_signature(spdm_context_t *spdm_context, * @retval false hash verification fail. **/ bool -spdm_verify_certificate_chain_hash(spdm_context_t *spdm_context, - const void *certificate_chain_hash, - uintn certificate_chain_hash_size); +libspdm_verify_certificate_chain_hash(libspdm_context_t *spdm_context, + const void *certificate_chain_hash, + uintn certificate_chain_hash_size); /** * This function verifies the challenge signature based upon m1m2. @@ -681,10 +681,10 @@ spdm_verify_certificate_chain_hash(spdm_context_t *spdm_context, * @retval true signature verification pass. * @retval false signature verification fail. **/ -bool spdm_verify_challenge_auth_signature(spdm_context_t *spdm_context, - bool is_requester, - const void *sign_data, - uintn sign_data_size); +bool libspdm_verify_challenge_auth_signature(libspdm_context_t *spdm_context, + bool is_requester, + const void *sign_data, + uintn sign_data_size); /** * This function calculate the measurement summary hash size. @@ -697,9 +697,9 @@ bool spdm_verify_challenge_auth_signature(spdm_context_t *spdm_context, * @return measurement summary hash size according to type. **/ uint32_t -spdm_get_measurement_summary_hash_size(spdm_context_t *spdm_context, - bool is_requester, - uint8_t measurement_summary_hash_type); +libspdm_get_measurement_summary_hash_size(libspdm_context_t *spdm_context, + bool is_requester, + uint8_t measurement_summary_hash_type); /** * This function generates the measurement signature to response message based upon l1l2. @@ -713,9 +713,9 @@ spdm_get_measurement_summary_hash_size(spdm_context_t *spdm_context, * @retval true measurement signature is generated. * @retval false measurement signature is not generated. **/ -bool spdm_generate_measurement_signature(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *signature); +bool libspdm_generate_measurement_signature(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *signature); /** * This function verifies the measurement signature based upon l1l2. @@ -730,10 +730,10 @@ bool spdm_generate_measurement_signature(spdm_context_t *spdm_context, * @retval true signature verification pass. * @retval false signature verification fail. **/ -bool spdm_verify_measurement_signature(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const void *sign_data, - uintn sign_data_size); +bool libspdm_verify_measurement_signature(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const void *sign_data, + uintn sign_data_size); /** * This function generates the key exchange signature based upon TH. @@ -746,9 +746,9 @@ bool spdm_verify_measurement_signature(spdm_context_t *spdm_context, * @retval false key exchange signature is not generated. **/ bool -spdm_generate_key_exchange_rsp_signature(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *signature); +libspdm_generate_key_exchange_rsp_signature(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *signature); /** * This function generates the key exchange HMAC based upon TH. @@ -761,9 +761,9 @@ spdm_generate_key_exchange_rsp_signature(spdm_context_t *spdm_context, * @retval false key exchange HMAC is not generated. **/ bool -spdm_generate_key_exchange_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *hmac); +libspdm_generate_key_exchange_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *hmac); /** * This function verifies the key exchange signature based upon TH. @@ -776,8 +776,8 @@ spdm_generate_key_exchange_rsp_hmac(spdm_context_t *spdm_context, * @retval true signature verification pass. * @retval false signature verification fail. **/ -bool spdm_verify_key_exchange_rsp_signature( - spdm_context_t *spdm_context, spdm_session_info_t *session_info, +bool libspdm_verify_key_exchange_rsp_signature( + libspdm_context_t *spdm_context, libspdm_session_info_t *session_info, const void *sign_data, const intn sign_data_size); /** @@ -791,10 +791,10 @@ bool spdm_verify_key_exchange_rsp_signature( * @retval true HMAC verification pass. * @retval false HMAC verification fail. **/ -bool spdm_verify_key_exchange_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const void *hmac_data, - uintn hmac_data_size); +bool libspdm_verify_key_exchange_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const void *hmac_data, + uintn hmac_data_size); /** * This function generates the finish signature based upon TH. @@ -806,9 +806,9 @@ bool spdm_verify_key_exchange_rsp_hmac(spdm_context_t *spdm_context, * @retval true finish signature is generated. * @retval false finish signature is not generated. **/ -bool spdm_generate_finish_req_signature(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *signature); +bool libspdm_generate_finish_req_signature(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *signature); /** * This function generates the finish HMAC based upon TH. @@ -820,9 +820,9 @@ bool spdm_generate_finish_req_signature(spdm_context_t *spdm_context, * @retval true finish HMAC is generated. * @retval false finish HMAC is not generated. **/ -bool spdm_generate_finish_req_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - void *hmac); +bool libspdm_generate_finish_req_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + void *hmac); /** * This function verifies the finish signature based upon TH. @@ -835,10 +835,10 @@ bool spdm_generate_finish_req_hmac(spdm_context_t *spdm_context, * @retval true signature verification pass. * @retval false signature verification fail. **/ -bool spdm_verify_finish_req_signature(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const void *sign_data, - const intn sign_data_size); +bool libspdm_verify_finish_req_signature(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const void *sign_data, + const intn sign_data_size); /** * This function verifies the finish HMAC based upon TH. @@ -851,9 +851,9 @@ bool spdm_verify_finish_req_signature(spdm_context_t *spdm_context, * @retval true HMAC verification pass. * @retval false HMAC verification fail. **/ -bool spdm_verify_finish_req_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const uint8_t *hmac, uintn hmac_size); +bool libspdm_verify_finish_req_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const uint8_t *hmac, uintn hmac_size); /** * This function generates the finish HMAC based upon TH. @@ -865,9 +865,9 @@ bool spdm_verify_finish_req_hmac(spdm_context_t *spdm_context, * @retval true finish HMAC is generated. * @retval false finish HMAC is not generated. **/ -bool spdm_generate_finish_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *hmac); +bool libspdm_generate_finish_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *hmac); /** * This function verifies the finish HMAC based upon TH. @@ -880,10 +880,10 @@ bool spdm_generate_finish_rsp_hmac(spdm_context_t *spdm_context, * @retval true HMAC verification pass. * @retval false HMAC verification fail. **/ -bool spdm_verify_finish_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const void *hmac_data, - uintn hmac_data_size); +bool libspdm_verify_finish_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const void *hmac_data, + uintn hmac_data_size); /** * This function generates the PSK exchange HMAC based upon TH. @@ -896,9 +896,9 @@ bool spdm_verify_finish_rsp_hmac(spdm_context_t *spdm_context, * @retval false PSK exchange HMAC is not generated. **/ bool -spdm_generate_psk_exchange_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *hmac); +libspdm_generate_psk_exchange_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *hmac); /** * This function verifies the PSK exchange HMAC based upon TH. @@ -911,10 +911,10 @@ spdm_generate_psk_exchange_rsp_hmac(spdm_context_t *spdm_context, * @retval true HMAC verification pass. * @retval false HMAC verification fail. **/ -bool spdm_verify_psk_exchange_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const void *hmac_data, - uintn hmac_data_size); +bool libspdm_verify_psk_exchange_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const void *hmac_data, + uintn hmac_data_size); /** * This function generates the PSK finish HMAC based upon TH. @@ -927,9 +927,9 @@ bool spdm_verify_psk_exchange_rsp_hmac(spdm_context_t *spdm_context, * @retval false PSK finish HMAC is not generated. **/ bool -spdm_generate_psk_exchange_req_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - void *hmac); +libspdm_generate_psk_exchange_req_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + void *hmac); /** * This function verifies the PSK finish HMAC based upon TH. @@ -942,9 +942,9 @@ spdm_generate_psk_exchange_req_hmac(spdm_context_t *spdm_context, * @retval true HMAC verification pass. * @retval false HMAC verification fail. **/ -bool spdm_verify_psk_finish_req_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const uint8_t *hmac, uintn hmac_size); +bool libspdm_verify_psk_finish_req_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const uint8_t *hmac, uintn hmac_size); /** * Return the size in bytes of opaque data supproted version. @@ -953,8 +953,8 @@ bool spdm_verify_psk_finish_req_hmac(spdm_context_t *spdm_context, * * @return the size in bytes of opaque data supproted version. **/ -uintn spdm_get_opaque_data_supported_version_data_size( - spdm_context_t *spdm_context); +uintn libspdm_get_opaque_data_supported_version_data_size( + libspdm_context_t *spdm_context); /** * Build opaque data supported version. @@ -971,9 +971,9 @@ uintn spdm_get_opaque_data_supported_version_data_size( * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ return_status -spdm_build_opaque_data_supported_version_data(spdm_context_t *spdm_context, - uintn *data_out_size, - void *data_out); +libspdm_build_opaque_data_supported_version_data(libspdm_context_t *spdm_context, + uintn *data_out_size, + void *data_out); /** * Process opaque data version selection. @@ -987,9 +987,9 @@ spdm_build_opaque_data_supported_version_data(spdm_context_t *spdm_context, * @retval RETURN_UNSUPPORTED The data_in is NOT opaque data version selection. **/ return_status -spdm_process_opaque_data_version_selection_data(spdm_context_t *spdm_context, - uintn data_in_size, - void *data_in); +libspdm_process_opaque_data_version_selection_data(libspdm_context_t *spdm_context, + uintn data_in_size, + void *data_in); /** * Return the size in bytes of opaque data version selection. @@ -998,8 +998,8 @@ spdm_process_opaque_data_version_selection_data(spdm_context_t *spdm_context, * * @return the size in bytes of opaque data version selection. **/ -uintn spdm_get_opaque_data_version_selection_data_size( - const spdm_context_t *spdm_context); +uintn libspdm_get_opaque_data_version_selection_data_size( + const libspdm_context_t *spdm_context); /** * Build opaque data version selection. @@ -1016,9 +1016,9 @@ uintn spdm_get_opaque_data_version_selection_data_size( * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ return_status -spdm_build_opaque_data_version_selection_data(const spdm_context_t *spdm_context, - uintn *data_out_size, - void *data_out); +libspdm_build_opaque_data_version_selection_data(const libspdm_context_t *spdm_context, + uintn *data_out_size, + void *data_out); /** * Process opaque data supported version. @@ -1032,9 +1032,9 @@ spdm_build_opaque_data_version_selection_data(const spdm_context_t *spdm_context * @retval RETURN_UNSUPPORTED The data_in is NOT opaque data supported version. **/ return_status -spdm_process_opaque_data_supported_version_data(spdm_context_t *spdm_context, - uintn data_in_size, - void *data_in); +libspdm_process_opaque_data_supported_version_data(libspdm_context_t *spdm_context, + uintn data_in_size, + void *data_in); /** * Return the SPDMversion field of the version number struct. @@ -1043,7 +1043,7 @@ spdm_process_opaque_data_supported_version_data(spdm_context_t *spdm_context, * * @return the SPDMversion of the version number struct. **/ -uint8_t spdm_get_version_from_version_number(const spdm_version_number_t ver); +uint8_t libspdm_get_version_from_version_number(const spdm_version_number_t ver); /** * Sort SPDMversion in descending order. @@ -1052,7 +1052,7 @@ uint8_t spdm_get_version_from_version_number(const spdm_version_number_t ver); * @param ver_set A pointer to the version set. * @param ver_num Version number. */ -void spdm_version_number_sort(spdm_version_number_t *ver_set, uintn ver_num); +void libspdm_version_number_sort(spdm_version_number_t *ver_set, uintn ver_num); /** * Negotiate SPDMversion for connection. @@ -1067,10 +1067,10 @@ void spdm_version_number_sort(spdm_version_number_t *ver_set, uintn ver_num); * @retval true Negotiation successfully, connect version be saved to common_version. * @retval false Negotiation failed. */ -bool spdm_negotiate_connection_version(spdm_version_number_t *common_version, - spdm_version_number_t *req_ver_set, - uintn req_ver_num, - spdm_version_number_t *res_ver_set, - uintn res_ver_num); +bool libspdm_negotiate_connection_version(spdm_version_number_t *common_version, + spdm_version_number_t *req_ver_set, + uintn req_ver_num, + spdm_version_number_t *res_ver_set, + uintn res_ver_num); #endif diff --git a/include/internal/libspdm_requester_lib.h b/include/internal/libspdm_requester_lib.h index 49d8f2cf71d..46a5a15249f 100644 --- a/include/internal/libspdm_requester_lib.h +++ b/include/internal/libspdm_requester_lib.h @@ -52,7 +52,7 @@ return_status spdm_handle_simple_error_response(void *context, * @retval RETURN_SECURITY_VIOLATION The error code is DECRYPT_ERROR and session_id is NOT NULL. **/ return_status spdm_handle_error_response_main( - spdm_context_t *spdm_context, const uint32_t *session_id, + libspdm_context_t *spdm_context, const uint32_t *session_id, uintn *response_size, void *response, uint8_t original_request_code, uint8_t expected_response_code, uintn expected_response_size); @@ -65,7 +65,7 @@ return_status spdm_handle_error_response_main( * @retval RETURN_SUCCESS The GET_VERSION is sent and the VERSION is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_get_version(spdm_context_t *spdm_context, +return_status spdm_get_version(libspdm_context_t *spdm_context, uint8_t *version_number_entry_count, spdm_version_number_t *version_number_entry); @@ -81,7 +81,7 @@ return_status spdm_get_version(spdm_context_t *spdm_context, * @retval RETURN_SUCCESS The GET_CAPABILITIES is sent and the CAPABILITIES is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_get_capabilities(spdm_context_t *spdm_context); +return_status spdm_get_capabilities(libspdm_context_t *spdm_context); /** * This function sends NEGOTIATE_ALGORITHMS and receives ALGORITHMS. @@ -91,7 +91,7 @@ return_status spdm_get_capabilities(spdm_context_t *spdm_context); * @retval RETURN_SUCCESS The NEGOTIATE_ALGORITHMS is sent and the ALGORITHMS is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_negotiate_algorithms(spdm_context_t *spdm_context); +return_status spdm_negotiate_algorithms(libspdm_context_t *spdm_context); /** * This function sends KEY_EXCHANGE and receives KEY_EXCHANGE_RSP for SPDM key exchange. @@ -111,7 +111,7 @@ return_status spdm_negotiate_algorithms(spdm_context_t *spdm_context); #if LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP return_status spdm_send_receive_key_exchange( - spdm_context_t *spdm_context, uint8_t measurement_hash_type, + libspdm_context_t *spdm_context, uint8_t measurement_hash_type, uint8_t slot_id, uint8_t session_policy, uint32_t *session_id, uint8_t *heartbeat_period, uint8_t *req_slot_id_param, void *measurement_hash); @@ -139,7 +139,7 @@ return_status spdm_send_receive_key_exchange( #if LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP return_status spdm_send_receive_key_exchange_ex( - spdm_context_t *spdm_context, uint8_t measurement_hash_type, + libspdm_context_t *spdm_context, uint8_t measurement_hash_type, uint8_t slot_id, uint8_t session_policy, uint32_t *session_id, uint8_t *heartbeat_period, uint8_t *req_slot_id_param, void *measurement_hash, @@ -159,7 +159,7 @@ return_status spdm_send_receive_key_exchange_ex( * @retval RETURN_SUCCESS The FINISH is sent and the FINISH_RSP is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_send_receive_finish(spdm_context_t *spdm_context, +return_status spdm_send_receive_finish(libspdm_context_t *spdm_context, uint32_t session_id, uint8_t req_slot_id_param); @@ -178,7 +178,7 @@ return_status spdm_send_receive_finish(spdm_context_t *spdm_context, **/ #if LIBSPDM_ENABLE_CAPABILITY_PSK_EX_CAP -return_status spdm_send_receive_psk_exchange(spdm_context_t *spdm_context, +return_status spdm_send_receive_psk_exchange(libspdm_context_t *spdm_context, uint8_t measurement_hash_type, uint8_t session_policy, uint32_t *session_id, @@ -213,7 +213,7 @@ return_status spdm_send_receive_psk_exchange(spdm_context_t *spdm_context, **/ #if LIBSPDM_ENABLE_CAPABILITY_PSK_EX_CAP -return_status spdm_send_receive_psk_exchange_ex(spdm_context_t *spdm_context, +return_status spdm_send_receive_psk_exchange_ex(libspdm_context_t *spdm_context, uint8_t measurement_hash_type, uint8_t session_policy, uint32_t *session_id, @@ -239,7 +239,7 @@ return_status spdm_send_receive_psk_exchange_ex(spdm_context_t *spdm_context, **/ #if LIBSPDM_ENABLE_CAPABILITY_PSK_EX_CAP -return_status spdm_send_receive_psk_finish(spdm_context_t *spdm_context, +return_status spdm_send_receive_psk_finish(libspdm_context_t *spdm_context, uint32_t session_id); #endif /* LIBSPDM_ENABLE_CAPABILITY_PSK_EX_CAP*/ @@ -254,7 +254,7 @@ return_status spdm_send_receive_psk_finish(spdm_context_t *spdm_context, * @retval RETURN_SUCCESS The END_SESSION is sent and the END_SESSION_ACK is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_send_receive_end_session(spdm_context_t *spdm_context, +return_status spdm_send_receive_end_session(libspdm_context_t *spdm_context, uint32_t session_id, uint8_t end_session_attributes); @@ -274,7 +274,7 @@ return_status spdm_send_receive_end_session(spdm_context_t *spdm_context, * @retval RETURN_SUCCESS The SPDM Encapsulated requests are sent and the responses are received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_encapsulated_request(spdm_context_t *spdm_context, +return_status spdm_encapsulated_request(libspdm_context_t *spdm_context, const uint32_t *session_id, uint8_t mut_auth_requested, uint8_t *req_slot_id_param); @@ -388,7 +388,7 @@ return_status spdm_get_encap_response_key_update(void *context, * @retval RETURN_SUCCESS The SPDM request is sent successfully. * @retval RETURN_DEVICE_ERROR A device error occurs when the SPDM request is sent to the device. **/ -return_status spdm_send_spdm_request(spdm_context_t *spdm_context, +return_status spdm_send_spdm_request(libspdm_context_t *spdm_context, const uint32_t *session_id, uintn request_size, const void *request); @@ -407,7 +407,7 @@ return_status spdm_send_spdm_request(spdm_context_t *spdm_context, * @retval RETURN_SUCCESS The SPDM response is received successfully. * @retval RETURN_DEVICE_ERROR A device error occurs when the SPDM response is received from the device. **/ -return_status spdm_receive_spdm_response(spdm_context_t *spdm_context, +return_status spdm_receive_spdm_response(libspdm_context_t *spdm_context, const uint32_t *session_id, uintn *response_size, void *response); diff --git a/include/internal/libspdm_responder_lib.h b/include/internal/libspdm_responder_lib.h index 1ce784cd52b..38f22d494b1 100644 --- a/include/internal/libspdm_responder_lib.h +++ b/include/internal/libspdm_responder_lib.h @@ -471,7 +471,7 @@ return_status spdm_get_response_encapsulated_response_ack( * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ return_status -spdm_get_encap_request_get_digest(spdm_context_t *spdm_context, +spdm_get_encap_request_get_digest(libspdm_context_t *spdm_context, uintn *encap_request_size, void *encap_request); @@ -490,7 +490,7 @@ spdm_get_encap_request_get_digest(spdm_context_t *spdm_context, #if LIBSPDM_ENABLE_CAPABILITY_CERT_CAP return_status spdm_process_encap_response_digest( - spdm_context_t *spdm_context, uintn encap_response_size, + libspdm_context_t *spdm_context, uintn encap_response_size, const void *encap_response, bool *need_continue); #endif /* LIBSPDM_ENABLE_CAPABILITY_CERT_CAP*/ @@ -509,7 +509,7 @@ return_status spdm_process_encap_response_digest( * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ return_status -spdm_get_encap_request_get_certificate(spdm_context_t *spdm_context, +spdm_get_encap_request_get_certificate(libspdm_context_t *spdm_context, uintn *encap_request_size, void *encap_request); @@ -526,7 +526,7 @@ spdm_get_encap_request_get_certificate(spdm_context_t *spdm_context, * @retval RETURN_SECURITY_VIOLATION Any verification fails. **/ return_status spdm_process_encap_response_certificate( - spdm_context_t *spdm_context, uintn encap_response_size, + libspdm_context_t *spdm_context, uintn encap_response_size, const void *encap_response, bool *need_continue); /** @@ -542,7 +542,7 @@ return_status spdm_process_encap_response_certificate( * @retval RETURN_SUCCESS The encapsulated request is returned. * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ -return_status spdm_get_encap_request_challenge(spdm_context_t *spdm_context, +return_status spdm_get_encap_request_challenge(libspdm_context_t *spdm_context, uintn *encap_request_size, void *encap_request); @@ -559,7 +559,7 @@ return_status spdm_get_encap_request_challenge(spdm_context_t *spdm_context, * @retval RETURN_SECURITY_VIOLATION Any verification fails. **/ return_status spdm_process_encap_response_challenge_auth( - spdm_context_t *spdm_context, uintn encap_response_size, + libspdm_context_t *spdm_context, uintn encap_response_size, const void *encap_response, bool *need_continue); /** @@ -576,7 +576,7 @@ return_status spdm_process_encap_response_challenge_auth( * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ return_status -spdm_get_encap_request_key_update(spdm_context_t *spdm_context, +spdm_get_encap_request_key_update(libspdm_context_t *spdm_context, uintn *encap_request_size, void *encap_request); @@ -593,7 +593,7 @@ spdm_get_encap_request_key_update(spdm_context_t *spdm_context, * @retval RETURN_SECURITY_VIOLATION Any verification fails. **/ return_status spdm_process_encap_response_key_update( - spdm_context_t *spdm_context, uintn encap_response_size, + libspdm_context_t *spdm_context, uintn encap_response_size, const void *encap_response, bool *need_continue); /** @@ -612,7 +612,7 @@ spdm_get_response_func_via_request_code(uint8_t request_code); * @param spdm_context A pointer to the SPDM context. * @param mut_auth_requested Indicate of the mut_auth_requested through KEY_EXCHANGE response. **/ -void spdm_init_mut_auth_encap_state(spdm_context_t *spdm_context, +void spdm_init_mut_auth_encap_state(libspdm_context_t *spdm_context, uint8_t mut_auth_requested); /** @@ -620,7 +620,7 @@ void spdm_init_mut_auth_encap_state(spdm_context_t *spdm_context, * * @param spdm_context A pointer to the SPDM context. **/ -void spdm_init_basic_mut_auth_encap_state(spdm_context_t *spdm_context); +void spdm_init_basic_mut_auth_encap_state(libspdm_context_t *spdm_context); /** * This function handles the encap error response. @@ -631,7 +631,7 @@ void spdm_init_basic_mut_auth_encap_state(spdm_context_t *spdm_context); * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ return_status spdm_handle_encap_error_response_main( - spdm_context_t *spdm_context, uint8_t error_code); + libspdm_context_t *spdm_context, uint8_t error_code); /** * Set session_state to an SPDM secured message context and trigger callback. @@ -640,7 +640,7 @@ return_status spdm_handle_encap_error_response_main( * @param session_id Indicate the SPDM session ID. * @param session_state Indicate the SPDM session state. */ -void spdm_set_session_state(spdm_context_t *spdm_context, +void spdm_set_session_state(libspdm_context_t *spdm_context, uint32_t session_id, libspdm_session_state_t session_state); @@ -650,7 +650,7 @@ void spdm_set_session_state(spdm_context_t *spdm_context, * @param spdm_context A pointer to the SPDM context. * @param connection_state Indicate the SPDM connection state. */ -void spdm_set_connection_state(spdm_context_t *spdm_context, +void spdm_set_connection_state(libspdm_context_t *spdm_context, libspdm_connection_state_t connection_state); #endif diff --git a/library/spdm_common_lib/libspdm_com_context_data.c b/library/spdm_common_lib/libspdm_com_context_data.c index 7f4d280b2d2..f05ee8b59d1 100644 --- a/library/spdm_common_lib/libspdm_com_context_data.c +++ b/library/spdm_common_lib/libspdm_com_context_data.c @@ -46,9 +46,9 @@ return_status libspdm_set_data(void *context, libspdm_data_type_t data_type, const libspdm_data_parameter_t *parameter, void *data, uintn data_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t slot_id; uint8_t mut_auth_requested; uint8_t root_cert_index; @@ -522,11 +522,11 @@ return_status libspdm_get_data(void *context, libspdm_data_type_t data_type, const libspdm_data_parameter_t *parameter, void *data, uintn *data_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn target_data_size; void *target_data; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; if (!context || !data || !data_size || data_type >= LIBSPDM_DATA_MAX) { return RETURN_INVALID_PARAMETER; @@ -734,10 +734,10 @@ return_status libspdm_get_data(void *context, libspdm_data_type_t data_type, **/ void libspdm_reset_message_a(void *context) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; - reset_managed_buffer(&spdm_context->transcript.message_a); + libspdm_reset_managed_buffer(&spdm_context->transcript.message_a); } /** @@ -747,11 +747,11 @@ void libspdm_reset_message_a(void *context) **/ void libspdm_reset_message_b(void *context) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - reset_managed_buffer(&spdm_context->transcript.message_b); + libspdm_reset_managed_buffer(&spdm_context->transcript.message_b); #else if (spdm_context->transcript.digest_context_m1m2 != NULL) { libspdm_hash_free (spdm_context->connection_info.algorithm.base_hash_algo, @@ -768,11 +768,11 @@ void libspdm_reset_message_b(void *context) **/ void libspdm_reset_message_c(void *context) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - reset_managed_buffer(&spdm_context->transcript.message_c); + libspdm_reset_managed_buffer(&spdm_context->transcript.message_c); #else if (spdm_context->transcript.digest_context_m1m2 != NULL) { libspdm_hash_free (spdm_context->connection_info.algorithm.base_hash_algo, @@ -789,11 +789,11 @@ void libspdm_reset_message_c(void *context) **/ void libspdm_reset_message_mut_b(void *context) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - reset_managed_buffer(&spdm_context->transcript.message_mut_b); + libspdm_reset_managed_buffer(&spdm_context->transcript.message_mut_b); #else if (spdm_context->transcript.digest_context_mut_m1m2 != NULL) { libspdm_hash_free (spdm_context->connection_info.algorithm.base_hash_algo, @@ -810,11 +810,11 @@ void libspdm_reset_message_mut_b(void *context) **/ void libspdm_reset_message_mut_c(void *context) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - reset_managed_buffer(&spdm_context->transcript.message_mut_c); + libspdm_reset_managed_buffer(&spdm_context->transcript.message_mut_c); #else if (spdm_context->transcript.digest_context_mut_m1m2 != NULL) { libspdm_hash_free (spdm_context->connection_info.algorithm.base_hash_algo, @@ -834,16 +834,16 @@ void libspdm_reset_message_mut_c(void *context) **/ void libspdm_reset_message_m(void *context, void *session_info) { - spdm_context_t *spdm_context; - spdm_session_info_t *spdm_session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *spdm_session_info; spdm_context = context; spdm_session_info = session_info; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT if (spdm_session_info == NULL) { - reset_managed_buffer(&spdm_context->transcript.message_m); + libspdm_reset_managed_buffer(&spdm_context->transcript.message_m); } else { - reset_managed_buffer(&spdm_session_info->session_transcript.message_m); + libspdm_reset_managed_buffer(&spdm_session_info->session_transcript.message_m); } #else if (spdm_session_info == NULL) { @@ -870,20 +870,20 @@ void libspdm_reset_message_m(void *context, void *session_info) **/ void libspdm_reset_message_k(void *context, void *session_info) { - spdm_session_info_t *spdm_session_info; + libspdm_session_info_t *spdm_session_info; spdm_session_info = session_info; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - reset_managed_buffer(&spdm_session_info->session_transcript.message_k); + libspdm_reset_managed_buffer(&spdm_session_info->session_transcript.message_k); #else { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *secured_message_context; spdm_context = context; secured_message_context = spdm_session_info->secured_message_context; - reset_managed_buffer(&spdm_session_info->session_transcript.temp_message_k); + libspdm_reset_managed_buffer(&spdm_session_info->session_transcript.temp_message_k); if (spdm_session_info->session_transcript.digest_context_th != NULL) { libspdm_hash_free (spdm_context->connection_info.algorithm.base_hash_algo, @@ -928,14 +928,14 @@ void libspdm_reset_message_k(void *context, void *session_info) **/ void libspdm_reset_message_f(void *context, void *session_info) { - spdm_session_info_t *spdm_session_info; + libspdm_session_info_t *spdm_session_info; spdm_session_info = session_info; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - reset_managed_buffer(&spdm_session_info->session_transcript.message_f); + libspdm_reset_managed_buffer(&spdm_session_info->session_transcript.message_f); #else { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *secured_message_context; spdm_context = context; @@ -974,10 +974,10 @@ void libspdm_reset_message_f(void *context, void *session_info) * @param spdm_session_info A pointer to the SPDM session context. * @param spdm_request The SPDM request code. */ -void spdm_reset_message_buffer_via_request_code(void *context, void *session_info, - uint8_t request_code) +void libspdm_reset_message_buffer_via_request_code(void *context, void *session_info, + uint8_t request_code) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; /** @@ -1034,11 +1034,11 @@ void spdm_reset_message_buffer_via_request_code(void *context, void *session_inf return_status libspdm_append_message_a(void *context, const void *message, uintn message_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; - return append_managed_buffer(&spdm_context->transcript.message_a, - message, message_size); + return libspdm_append_managed_buffer(&spdm_context->transcript.message_a, + message, message_size); } /** @@ -1054,12 +1054,12 @@ return_status libspdm_append_message_a(void *context, const void *message, return_status libspdm_append_message_b(void *context, const void *message, uintn message_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - return append_managed_buffer(&spdm_context->transcript.message_b, - message, message_size); + return libspdm_append_managed_buffer(&spdm_context->transcript.message_b, + message, message_size); #else { bool result; @@ -1080,9 +1080,10 @@ return_status libspdm_append_message_b(void *context, const void *message, } result = libspdm_hash_update (spdm_context->connection_info.algorithm.base_hash_algo, spdm_context->transcript.digest_context_m1m2, - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size(&spdm_context->transcript. - message_a)); + libspdm_get_managed_buffer(&spdm_context->transcript. + message_a), + libspdm_get_managed_buffer_size(&spdm_context->transcript. + message_a)); if (!result) { libspdm_hash_free (spdm_context->connection_info.algorithm.base_hash_algo, spdm_context->transcript.digest_context_m1m2); @@ -1116,12 +1117,12 @@ return_status libspdm_append_message_b(void *context, const void *message, return_status libspdm_append_message_c(void *context, const void *message, uintn message_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - return append_managed_buffer(&spdm_context->transcript.message_c, - message, message_size); + return libspdm_append_managed_buffer(&spdm_context->transcript.message_c, + message, message_size); #else { bool result; @@ -1142,9 +1143,10 @@ return_status libspdm_append_message_c(void *context, const void *message, } result = libspdm_hash_update (spdm_context->connection_info.algorithm.base_hash_algo, spdm_context->transcript.digest_context_m1m2, - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size(&spdm_context->transcript. - message_a)); + libspdm_get_managed_buffer(&spdm_context->transcript. + message_a), + libspdm_get_managed_buffer_size(&spdm_context->transcript. + message_a)); if (!result) { libspdm_hash_free (spdm_context->connection_info.algorithm.base_hash_algo, spdm_context->transcript.digest_context_m1m2); @@ -1178,12 +1180,12 @@ return_status libspdm_append_message_c(void *context, const void *message, return_status libspdm_append_message_mut_b(void *context, const void *message, uintn message_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - return append_managed_buffer(&spdm_context->transcript.message_mut_b, - message, message_size); + return libspdm_append_managed_buffer(&spdm_context->transcript.message_mut_b, + message, message_size); #else { bool result; @@ -1229,12 +1231,12 @@ return_status libspdm_append_message_mut_b(void *context, const void *message, return_status libspdm_append_message_mut_c(void *context, const void *message, uintn message_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - return append_managed_buffer(&spdm_context->transcript.message_mut_c, - message, message_size); + return libspdm_append_managed_buffer(&spdm_context->transcript.message_mut_c, + message, message_size); #else { bool result; @@ -1283,18 +1285,18 @@ return_status libspdm_append_message_mut_c(void *context, const void *message, return_status libspdm_append_message_m(void *context, void *session_info, const void *message, uintn message_size) { - spdm_context_t *spdm_context; - spdm_session_info_t *spdm_session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *spdm_session_info; spdm_context = context; spdm_session_info = session_info; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT if (spdm_session_info == NULL) { - return append_managed_buffer(&spdm_context->transcript.message_m, - message, message_size); + return libspdm_append_managed_buffer(&spdm_context->transcript.message_m, + message, message_size); } else { - return append_managed_buffer(&spdm_session_info->session_transcript.message_m, - message, message_size); + return libspdm_append_managed_buffer(&spdm_session_info->session_transcript.message_m, + message, message_size); } #else { @@ -1324,10 +1326,10 @@ return_status libspdm_append_message_m(void *context, void *session_info, result = libspdm_hash_update ( spdm_context->connection_info.algorithm.base_hash_algo, spdm_context->transcript.digest_context_l1l2, - get_managed_buffer( + libspdm_get_managed_buffer( &spdm_context->transcript.message_a), - get_managed_buffer_size(&spdm_context->transcript. - message_a)); + libspdm_get_managed_buffer_size(&spdm_context->transcript. + message_a)); if (!result) { libspdm_hash_free (spdm_context->connection_info.algorithm.base_hash_algo, spdm_context->transcript.digest_context_l1l2); @@ -1362,10 +1364,10 @@ return_status libspdm_append_message_m(void *context, void *session_info, result = libspdm_hash_update ( spdm_context->connection_info.algorithm.base_hash_algo, spdm_session_info->session_transcript.digest_context_l1l2, - get_managed_buffer( + libspdm_get_managed_buffer( &spdm_context->transcript.message_a), - get_managed_buffer_size(&spdm_context->transcript. - message_a)); + libspdm_get_managed_buffer_size(&spdm_context->transcript. + message_a)); if (!result) { libspdm_hash_free (spdm_context->connection_info.algorithm.base_hash_algo, spdm_session_info->session_transcript.digest_context_l1l2); @@ -1403,16 +1405,16 @@ return_status libspdm_append_message_k(void *context, void *session_info, bool is_requester, const void *message, uintn message_size) { - spdm_session_info_t *spdm_session_info; + libspdm_session_info_t *spdm_session_info; spdm_session_info = session_info; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - return append_managed_buffer( + return libspdm_append_managed_buffer( &spdm_session_info->session_transcript.message_k, message, message_size); #else { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *secured_message_context; uint8_t *cert_chain_buffer; uintn cert_chain_buffer_size; @@ -1483,17 +1485,18 @@ return_status libspdm_append_message_k(void *context, void *session_info, spdm_session_info->session_transcript.digest_context_th); libspdm_hash_update (spdm_context->connection_info.algorithm.base_hash_algo, spdm_session_info->session_transcript.digest_context_th, - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size(&spdm_context->transcript.message_a)); - append_managed_buffer( + libspdm_get_managed_buffer(&spdm_context->transcript.message_a), + libspdm_get_managed_buffer_size( + &spdm_context->transcript.message_a)); + libspdm_append_managed_buffer( &spdm_session_info->session_transcript.temp_message_k, - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size(&spdm_context->transcript.message_a)); + libspdm_get_managed_buffer(&spdm_context->transcript.message_a), + libspdm_get_managed_buffer_size(&spdm_context->transcript.message_a)); if (!spdm_session_info->use_psk) { libspdm_hash_update (spdm_context->connection_info.algorithm.base_hash_algo, spdm_session_info->session_transcript.digest_context_th, cert_chain_buffer_hash, hash_size); - append_managed_buffer( + libspdm_append_managed_buffer( &spdm_session_info->session_transcript.temp_message_k, cert_chain_buffer_hash, hash_size); } @@ -1505,7 +1508,7 @@ return_status libspdm_append_message_k(void *context, void *session_info, /* append message only if finished_key is NOT ready.*/ - append_managed_buffer( + libspdm_append_managed_buffer( &spdm_session_info->session_transcript.temp_message_k, message, message_size); } @@ -1531,14 +1534,18 @@ return_status libspdm_append_message_k(void *context, void *session_info, spdm_session_info->session_transcript.hmac_rsp_context_th); libspdm_hmac_update_with_response_finished_key (secured_message_context, spdm_session_info->session_transcript.hmac_rsp_context_th, - get_managed_buffer(&spdm_session_info-> - session_transcript. - temp_message_k), - get_managed_buffer_size(& - spdm_session_info - -> - session_transcript - .temp_message_k)); + libspdm_get_managed_buffer(& + spdm_session_info + -> + session_transcript + . + temp_message_k), + libspdm_get_managed_buffer_size(& + spdm_session_info + -> + session_transcript + . + temp_message_k)); } libspdm_hmac_update_with_response_finished_key (secured_message_context, spdm_session_info->session_transcript.hmac_rsp_context_th, message, @@ -1555,14 +1562,18 @@ return_status libspdm_append_message_k(void *context, void *session_info, spdm_session_info->session_transcript.hmac_req_context_th); libspdm_hmac_update_with_request_finished_key (secured_message_context, spdm_session_info->session_transcript.hmac_req_context_th, - get_managed_buffer(&spdm_session_info-> - session_transcript. - temp_message_k), - get_managed_buffer_size(& - spdm_session_info - -> - session_transcript - .temp_message_k)); + libspdm_get_managed_buffer(& + spdm_session_info + -> + session_transcript + . + temp_message_k), + libspdm_get_managed_buffer_size(& + spdm_session_info + -> + session_transcript + . + temp_message_k)); } libspdm_hmac_update_with_request_finished_key (secured_message_context, spdm_session_info->session_transcript.hmac_req_context_th, message, @@ -1588,16 +1599,16 @@ return_status libspdm_append_message_f(void *context, void *session_info, bool is_requester, const void *message, uintn message_size) { - spdm_session_info_t *spdm_session_info; + libspdm_session_info_t *spdm_session_info; spdm_session_info = session_info; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT - return append_managed_buffer( + return libspdm_append_managed_buffer( &spdm_session_info->session_transcript.message_f, message, message_size); #else { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *secured_message_context; uint8_t *mut_cert_chain_buffer; uintn mut_cert_chain_buffer_size; @@ -1764,8 +1775,8 @@ return_status libspdm_append_message_f(void *context, void *session_info, * @retval true the version is supported. * @retval false the version is not supported. **/ -bool spdm_is_version_supported(const spdm_context_t *spdm_context, - uint8_t version) +bool libspdm_is_version_supported(const libspdm_context_t *spdm_context, + uint8_t version) { if (version == (spdm_context->connection_info.version >> SPDM_VERSION_NUMBER_SHIFT_BIT)) { @@ -1782,7 +1793,7 @@ bool spdm_is_version_supported(const spdm_context_t *spdm_context, * * @return the connection version. **/ -uint8_t spdm_get_connection_version(const spdm_context_t *spdm_context) +uint8_t libspdm_get_connection_version(const libspdm_context_t *spdm_context) { return (uint8_t)(spdm_context->connection_info.version >> SPDM_VERSION_NUMBER_SHIFT_BIT); } @@ -1799,10 +1810,10 @@ uint8_t spdm_get_connection_version(const spdm_context_t *spdm_context) * @retval false the capablities flag is not supported. **/ bool -spdm_is_capabilities_flag_supported(const spdm_context_t *spdm_context, - bool is_requester, - uint32_t requester_capabilities_flag, - uint32_t responder_capabilities_flag) +libspdm_is_capabilities_flag_supported(const libspdm_context_t *spdm_context, + bool is_requester, + uint32_t requester_capabilities_flag, + uint32_t responder_capabilities_flag) { uint32_t negotiated_requester_capabilities_flag; uint32_t negotiated_responder_capabilities_flag; @@ -1844,7 +1855,7 @@ void libspdm_register_device_io_func( void *context, libspdm_device_send_message_func send_message, libspdm_device_receive_message_func receive_message) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; spdm_context->send_message = send_message; @@ -1866,7 +1877,7 @@ void libspdm_register_transport_layer_func( const libspdm_transport_encode_message_func transport_encode_message, const libspdm_transport_decode_message_func transport_decode_message) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; spdm_context->transport_encode_message = transport_encode_message; @@ -1883,7 +1894,7 @@ void libspdm_register_transport_layer_func( */ uint32_t libspdm_get_last_error(void *context) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; return spdm_context->error_state; @@ -1898,7 +1909,7 @@ uint32_t libspdm_get_last_error(void *context) void libspdm_get_last_spdm_error_struct(void *context, libspdm_error_struct_t *last_spdm_error) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; copy_mem(last_spdm_error, sizeof(libspdm_error_struct_t), @@ -1914,7 +1925,7 @@ void libspdm_get_last_spdm_error_struct(void *context, void libspdm_set_last_spdm_error_struct(void *context, libspdm_error_struct_t *last_spdm_error) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; copy_mem(&spdm_context->last_spdm_error, sizeof(spdm_context->last_spdm_error), @@ -1933,14 +1944,14 @@ void libspdm_set_last_spdm_error_struct(void *context, */ return_status libspdm_init_context(void *context) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *secured_message_context; uintn SecuredMessageContextSize; uintn index; spdm_context = context; - zero_mem(spdm_context, sizeof(spdm_context_t)); - spdm_context->version = spdm_context_struct_version; + zero_mem(spdm_context, sizeof(libspdm_context_t)); + spdm_context->version = libspdm_context_struct_version; spdm_context->transcript.message_a.max_buffer_size = sizeof(spdm_context->transcript.message_a.buffer); #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT @@ -2014,16 +2025,16 @@ return_status libspdm_init_context(void *context) */ void libspdm_reset_context(void *context) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn index; spdm_context = context; /*Clear all info about last connection*/ zero_mem(&spdm_context->connection_info.version, sizeof(spdm_version_number_t)); - zero_mem(&spdm_context->connection_info.capability, sizeof(spdm_device_capability_t)); - zero_mem(&spdm_context->connection_info.algorithm, sizeof(spdm_device_algorithm_t)); + zero_mem(&spdm_context->connection_info.capability, sizeof(libspdm_device_capability_t)); + zero_mem(&spdm_context->connection_info.algorithm, sizeof(libspdm_device_algorithm_t)); zero_mem(&spdm_context->last_spdm_error, sizeof(libspdm_error_struct_t)); - zero_mem(&spdm_context->encap_context, sizeof(spdm_encap_context_t)); + zero_mem(&spdm_context->encap_context, sizeof(libspdm_encap_context_t)); spdm_context->connection_info.local_used_cert_chain_buffer_size = 0; spdm_context->connection_info.local_used_cert_chain_buffer = NULL; spdm_context->cache_spdm_request_size = 0; @@ -2037,10 +2048,10 @@ void libspdm_reset_context(void *context) sizeof(spdm_context->encap_context.certificate_chain_buffer.buffer); for (index = 0; index < LIBSPDM_MAX_SESSION_COUNT; index++) { - spdm_session_info_init(spdm_context, - &spdm_context->session_info[index], - INVALID_SESSION_ID, - false); + libspdm_session_info_init(spdm_context, + &spdm_context->session_info[index], + INVALID_SESSION_ID, + false); } } /** @@ -2050,7 +2061,7 @@ void libspdm_reset_context(void *context) **/ uintn libspdm_get_context_size(void) { - return sizeof(spdm_context_t) + + return sizeof(libspdm_context_t) + libspdm_secured_message_get_context_size() * LIBSPDM_MAX_SESSION_COUNT; } @@ -2061,7 +2072,7 @@ uintn libspdm_get_context_size(void) * * @return the SPDMversion of the version number struct. **/ -uint8_t spdm_get_version_from_version_number(const spdm_version_number_t ver) +uint8_t libspdm_get_version_from_version_number(const spdm_version_number_t ver) { return (uint8_t)(ver >> SPDM_VERSION_NUMBER_SHIFT_BIT); } @@ -2073,7 +2084,7 @@ uint8_t spdm_get_version_from_version_number(const spdm_version_number_t ver) * @param ver_set A pointer to the version set. * @param ver_num Version number. */ -void spdm_version_number_sort(spdm_version_number_t *ver_set, uintn ver_num) +void libspdm_version_number_sort(spdm_version_number_t *ver_set, uintn ver_num) { uintn index; uintn index_sort; @@ -2111,11 +2122,11 @@ void spdm_version_number_sort(spdm_version_number_t *ver_set, uintn ver_num) * @retval true Negotiation successfully, connect version be saved to common_version. * @retval false Negotiation failed. */ -bool spdm_negotiate_connection_version(spdm_version_number_t *common_version, - spdm_version_number_t *req_ver_set, - uintn req_ver_num, - spdm_version_number_t *res_ver_set, - uintn res_ver_num) +bool libspdm_negotiate_connection_version(spdm_version_number_t *common_version, + spdm_version_number_t *req_ver_set, + uintn req_ver_num, + spdm_version_number_t *res_ver_set, + uintn res_ver_num) { uintn req_index; uintn res_index; @@ -2125,8 +2136,8 @@ bool spdm_negotiate_connection_version(spdm_version_number_t *common_version, } /* Sort SPDMversion in descending order. */ - spdm_version_number_sort(req_ver_set, req_ver_num); - spdm_version_number_sort(res_ver_set, res_ver_num); + libspdm_version_number_sort(req_ver_set, req_ver_num); + libspdm_version_number_sort(res_ver_set, res_ver_num); /** * Find highest same version and make req_index point to it. @@ -2134,8 +2145,8 @@ bool spdm_negotiate_connection_version(spdm_version_number_t *common_version, **/ for (res_index = 0; res_index < res_ver_num; res_index++) { for (req_index = 0; req_index < req_ver_num; req_index++) { - if (spdm_get_version_from_version_number(req_ver_set[req_index]) == - spdm_get_version_from_version_number(res_ver_set[res_index])) { + if (libspdm_get_version_from_version_number(req_ver_set[req_index]) == + libspdm_get_version_from_version_number(res_ver_set[res_index])) { *common_version = req_ver_set[req_index]; return true; } diff --git a/library/spdm_common_lib/libspdm_com_context_data_session.c b/library/spdm_common_lib/libspdm_com_context_data_session.c index 5ec97032a1b..6b7b2076a55 100644 --- a/library/spdm_common_lib/libspdm_com_context_data_session.c +++ b/library/spdm_common_lib/libspdm_com_context_data_session.c @@ -12,9 +12,9 @@ * @param spdm_context A pointer to the SPDM context. * @param session_id The SPDM session ID. **/ -void spdm_session_info_init(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint32_t session_id, bool use_psk) +void libspdm_session_info_init(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint32_t session_id, bool use_psk) { libspdm_session_type_t session_type; uint32_t capabilities_flag; @@ -41,7 +41,7 @@ void spdm_session_info_init(spdm_context_t *spdm_context, } zero_mem(session_info, - OFFSET_OF(spdm_session_info_t, secured_message_context)); + OFFSET_OF(libspdm_session_info_t, secured_message_context)); libspdm_secured_message_init_context( session_info->secured_message_context); session_info->session_id = session_id; @@ -86,8 +86,8 @@ void spdm_session_info_init(spdm_context_t *spdm_context, void *libspdm_get_session_info_via_session_id(const void *context, uint32_t session_id) { - const spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + const libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; uintn index; if (session_id == INVALID_SESSION_ID) { @@ -99,7 +99,7 @@ void *libspdm_get_session_info_via_session_id(const void *context, spdm_context = context; - session_info = (spdm_session_info_t *)spdm_context->session_info; + session_info = (libspdm_session_info_t *)spdm_context->session_info; for (index = 0; index < LIBSPDM_MAX_SESSION_COUNT; index++) { if (session_info[index].session_id == session_id) { return &session_info[index]; @@ -122,7 +122,7 @@ void *libspdm_get_session_info_via_session_id(const void *context, void *libspdm_get_secured_message_context_via_session_id(const void *spdm_context, uint32_t session_id) { - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_info = libspdm_get_session_info_via_session_id(spdm_context, session_id); @@ -143,7 +143,7 @@ void *libspdm_get_secured_message_context_via_session_id(const void *spdm_contex void * libspdm_get_secured_message_context_via_session_info(void *spdm_session_info) { - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_info = spdm_session_info; if (session_info == NULL) { @@ -164,8 +164,8 @@ libspdm_get_secured_message_context_via_session_info(void *spdm_session_info) void *libspdm_assign_session_id(void *context, uint32_t session_id, bool use_psk) { - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; uintn index; spdm_context = context; @@ -190,9 +190,9 @@ void *libspdm_assign_session_id(void *context, uint32_t session_id, for (index = 0; index < LIBSPDM_MAX_SESSION_COUNT; index++) { if (session_info[index].session_id == INVALID_SESSION_ID) { - spdm_session_info_init(spdm_context, - &session_info[index], session_id, - use_psk); + libspdm_session_info_init(spdm_context, + &session_info[index], session_id, + use_psk); spdm_context->latest_session_id = session_id; return &session_info[index]; } @@ -209,10 +209,10 @@ void *libspdm_assign_session_id(void *context, uint32_t session_id, * * @return half of session ID for a requester. **/ -uint16_t spdm_allocate_req_session_id(spdm_context_t *spdm_context) +uint16_t libspdm_allocate_req_session_id(libspdm_context_t *spdm_context) { uint16_t req_session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uintn index; session_info = spdm_context->session_info; @@ -224,7 +224,7 @@ uint16_t spdm_allocate_req_session_id(spdm_context_t *spdm_context) } } - DEBUG((DEBUG_ERROR, "spdm_allocate_req_session_id - MAX session_id\n")); + DEBUG((DEBUG_ERROR, "libspdm_allocate_req_session_id - MAX session_id\n")); return (INVALID_SESSION_ID & 0xFFFF0000) >> 16; } @@ -235,10 +235,10 @@ uint16_t spdm_allocate_req_session_id(spdm_context_t *spdm_context) * * @return half of session ID for a responder. **/ -uint16_t spdm_allocate_rsp_session_id(const spdm_context_t *spdm_context) +uint16_t libspdm_allocate_rsp_session_id(const libspdm_context_t *spdm_context) { uint16_t rsp_session_id; - const spdm_session_info_t *session_info; + const libspdm_session_info_t *session_info; uintn index; session_info = spdm_context->session_info; @@ -250,7 +250,7 @@ uint16_t spdm_allocate_rsp_session_id(const spdm_context_t *spdm_context) } } - DEBUG((DEBUG_ERROR, "spdm_allocate_rsp_session_id - MAX session_id\n")); + DEBUG((DEBUG_ERROR, "libspdm_allocate_rsp_session_id - MAX session_id\n")); return (INVALID_SESSION_ID & 0xFFFF); } @@ -262,8 +262,8 @@ uint16_t spdm_allocate_rsp_session_id(const spdm_context_t *spdm_context) **/ void libspdm_free_session_id(void *context, uint32_t session_id) { - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; uintn index; spdm_context = context; @@ -278,9 +278,9 @@ void libspdm_free_session_id(void *context, uint32_t session_id) session_info = spdm_context->session_info; for (index = 0; index < LIBSPDM_MAX_SESSION_COUNT; index++) { if (session_info[index].session_id == session_id) { - spdm_session_info_init(spdm_context, - &session_info[index], - INVALID_SESSION_ID, false); + libspdm_session_info_init(spdm_context, + &session_info[index], + INVALID_SESSION_ID, false); return; } } diff --git a/library/spdm_common_lib/libspdm_com_crypto_service.c b/library/spdm_common_lib/libspdm_com_crypto_service.c index 2b8b56f23d3..1788427cb95 100644 --- a/library/spdm_common_lib/libspdm_com_crypto_service.c +++ b/library/spdm_common_lib/libspdm_com_crypto_service.c @@ -20,7 +20,7 @@ bool libspdm_get_peer_cert_chain_buffer(void *context, void **cert_chain_buffer, uintn *cert_chain_buffer_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT @@ -59,7 +59,7 @@ bool libspdm_get_peer_cert_chain_data(void *context, void **cert_chain_data, uintn *cert_chain_data_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; bool result; uintn hash_size; @@ -95,7 +95,7 @@ bool libspdm_get_local_cert_chain_buffer(void *context, void **cert_chain_buffer, uintn *cert_chain_buffer_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; if (spdm_context->connection_info.local_used_cert_chain_buffer_size != @@ -124,7 +124,7 @@ bool libspdm_get_local_cert_chain_data(void *context, void **cert_chain_data, uintn *cert_chain_data_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; bool result; uintn hash_size; @@ -157,52 +157,52 @@ bool libspdm_get_local_cert_chain_data(void *context, * * @retval RETURN_SUCCESS m1m2 is calculated. */ -bool spdm_calculate_m1m2(void *context, bool is_mut, - uintn *m1m2_buffer_size, - void *m1m2_buffer) +bool libspdm_calculate_m1m2(void *context, bool is_mut, + uintn *m1m2_buffer_size, + void *m1m2_buffer) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; uint32_t hash_size; uint8_t hash_data[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t m1m2; + libspdm_large_managed_buffer_t m1m2; uintn m1m2_buffer_capacity; spdm_context = context; - init_managed_buffer(&m1m2, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&m1m2, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); hash_size = libspdm_get_hash_size( spdm_context->connection_info.algorithm.base_hash_algo); if (is_mut) { DEBUG((DEBUG_INFO, "message_mut_b data :\n")); - internal_dump_hex( - get_managed_buffer( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer( &spdm_context->transcript.message_mut_b), - get_managed_buffer_size( + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_mut_b)); - status = append_managed_buffer( + status = libspdm_append_managed_buffer( &m1m2, - get_managed_buffer( + libspdm_get_managed_buffer( &spdm_context->transcript.message_mut_b), - get_managed_buffer_size( + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_mut_b)); if (RETURN_ERROR(status)) { return false; } DEBUG((DEBUG_INFO, "message_mut_c data :\n")); - internal_dump_hex( - get_managed_buffer( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer( &spdm_context->transcript.message_mut_c), - get_managed_buffer_size( + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_mut_c)); - status = append_managed_buffer( + status = libspdm_append_managed_buffer( &m1m2, - get_managed_buffer( + libspdm_get_managed_buffer( &spdm_context->transcript.message_mut_c), - get_managed_buffer_size( + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_mut_c)); if (RETURN_ERROR(status)) { return false; @@ -212,53 +212,53 @@ bool spdm_calculate_m1m2(void *context, bool is_mut, DEBUG_CODE( if (!libspdm_hash_all( spdm_context->connection_info.algorithm.base_hash_algo, - get_managed_buffer(&m1m2), - get_managed_buffer_size(&m1m2), hash_data)) { + libspdm_get_managed_buffer(&m1m2), + libspdm_get_managed_buffer_size(&m1m2), hash_data)) { return false; } DEBUG((DEBUG_INFO, "m1m2 Mut hash - ")); - internal_dump_data(hash_data, hash_size); + libspdm_internal_dump_data(hash_data, hash_size); DEBUG((DEBUG_INFO, "\n")); ); } else { DEBUG((DEBUG_INFO, "message_a data :\n")); - internal_dump_hex( - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer(&spdm_context->transcript.message_a), + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_a)); - status = append_managed_buffer( + status = libspdm_append_managed_buffer( &m1m2, - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size( + libspdm_get_managed_buffer(&spdm_context->transcript.message_a), + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_a)); if (RETURN_ERROR(status)) { return false; } DEBUG((DEBUG_INFO, "message_b data :\n")); - internal_dump_hex( - get_managed_buffer(&spdm_context->transcript.message_b), - get_managed_buffer_size( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer(&spdm_context->transcript.message_b), + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_b)); - status = append_managed_buffer( + status = libspdm_append_managed_buffer( &m1m2, - get_managed_buffer(&spdm_context->transcript.message_b), - get_managed_buffer_size( + libspdm_get_managed_buffer(&spdm_context->transcript.message_b), + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_b)); if (RETURN_ERROR(status)) { return false; } DEBUG((DEBUG_INFO, "message_c data :\n")); - internal_dump_hex( - get_managed_buffer(&spdm_context->transcript.message_c), - get_managed_buffer_size( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer(&spdm_context->transcript.message_c), + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_c)); - status = append_managed_buffer( + status = libspdm_append_managed_buffer( &m1m2, - get_managed_buffer(&spdm_context->transcript.message_c), - get_managed_buffer_size( + libspdm_get_managed_buffer(&spdm_context->transcript.message_c), + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_c)); if (RETURN_ERROR(status)) { return false; @@ -268,19 +268,19 @@ bool spdm_calculate_m1m2(void *context, bool is_mut, DEBUG_CODE( if (!libspdm_hash_all( spdm_context->connection_info.algorithm.base_hash_algo, - get_managed_buffer(&m1m2), - get_managed_buffer_size(&m1m2), hash_data)) { + libspdm_get_managed_buffer(&m1m2), + libspdm_get_managed_buffer_size(&m1m2), hash_data)) { return false; } DEBUG((DEBUG_INFO, "m1m2 hash - ")); - internal_dump_data(hash_data, hash_size); + libspdm_internal_dump_data(hash_data, hash_size); DEBUG((DEBUG_INFO, "\n")); ); } m1m2_buffer_capacity = *m1m2_buffer_size; - *m1m2_buffer_size = get_managed_buffer_size(&m1m2); + *m1m2_buffer_size = libspdm_get_managed_buffer_size(&m1m2); copy_mem(m1m2_buffer, m1m2_buffer_capacity, - get_managed_buffer(&m1m2), *m1m2_buffer_size); + libspdm_get_managed_buffer(&m1m2), *m1m2_buffer_size); return true; } @@ -295,11 +295,11 @@ bool spdm_calculate_m1m2(void *context, bool is_mut, * * @retval RETURN_SUCCESS m1m2 is calculated. */ -bool spdm_calculate_m1m2_hash(void *context, bool is_mut, - uintn *m1m2_hash_size, - void *m1m2_hash) +bool libspdm_calculate_m1m2_hash(void *context, bool is_mut, + uintn *m1m2_hash_size, + void *m1m2_hash) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t hash_size; bool result; @@ -315,7 +315,7 @@ bool spdm_calculate_m1m2_hash(void *context, bool is_mut, return false; } DEBUG((DEBUG_INFO, "m1m2 Mut hash - ")); - internal_dump_data(m1m2_hash, hash_size); + libspdm_internal_dump_data(m1m2_hash, hash_size); DEBUG((DEBUG_INFO, "\n")); } else { @@ -325,7 +325,7 @@ bool spdm_calculate_m1m2_hash(void *context, bool is_mut, return false; } DEBUG((DEBUG_INFO, "m1m2 hash - ")); - internal_dump_data(m1m2_hash, hash_size); + libspdm_internal_dump_data(m1m2_hash, hash_size); DEBUG((DEBUG_INFO, "\n")); } @@ -348,21 +348,21 @@ bool spdm_calculate_m1m2_hash(void *context, bool is_mut, * * @retval RETURN_SUCCESS l1l2 is calculated. */ -bool spdm_calculate_l1l2(void *context, void *session_info, - uintn *l1l2_buffer_size, void *l1l2_buffer) +bool libspdm_calculate_l1l2(void *context, void *session_info, + uintn *l1l2_buffer_size, void *l1l2_buffer) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; - spdm_session_info_t *spdm_session_info; + libspdm_session_info_t *spdm_session_info; uint32_t hash_size; uint8_t hash_data[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t l1l2; + libspdm_large_managed_buffer_t l1l2; uintn l1l2_buffer_capacity; spdm_context = context; spdm_session_info = session_info; - init_managed_buffer(&l1l2, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&l1l2, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); hash_size = libspdm_get_hash_size( spdm_context->connection_info.algorithm.base_hash_algo); @@ -373,14 +373,14 @@ bool spdm_calculate_l1l2(void *context, void *session_info, /* Need append VCA since 1.2 script*/ DEBUG((DEBUG_INFO, "message_a data :\n")); - internal_dump_hex( - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer(&spdm_context->transcript.message_a), + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_a)); - status = append_managed_buffer( + status = libspdm_append_managed_buffer( &l1l2, - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size( + libspdm_get_managed_buffer(&spdm_context->transcript.message_a), + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_a)); if (RETURN_ERROR(status)) { return false; @@ -389,23 +389,23 @@ bool spdm_calculate_l1l2(void *context, void *session_info, if (spdm_session_info == NULL) { DEBUG((DEBUG_INFO, "message_m data :\n")); - internal_dump_hex( - get_managed_buffer(&spdm_context->transcript.message_m), - get_managed_buffer_size(&spdm_context->transcript.message_m)); - status = append_managed_buffer( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer(&spdm_context->transcript.message_m), + libspdm_get_managed_buffer_size(&spdm_context->transcript.message_m)); + status = libspdm_append_managed_buffer( &l1l2, - get_managed_buffer(&spdm_context->transcript.message_m), - get_managed_buffer_size( + libspdm_get_managed_buffer(&spdm_context->transcript.message_m), + libspdm_get_managed_buffer_size( &spdm_context->transcript.message_m)); } else { DEBUG((DEBUG_INFO, "use message_m in session :\n")); - internal_dump_hex( - get_managed_buffer(&spdm_session_info->session_transcript.message_m), - get_managed_buffer_size(&spdm_session_info->session_transcript.message_m)); - status = append_managed_buffer( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer(&spdm_session_info->session_transcript.message_m), + libspdm_get_managed_buffer_size(&spdm_session_info->session_transcript.message_m)); + status = libspdm_append_managed_buffer( &l1l2, - get_managed_buffer(&spdm_session_info->session_transcript.message_m), - get_managed_buffer_size( + libspdm_get_managed_buffer(&spdm_session_info->session_transcript.message_m), + libspdm_get_managed_buffer_size( &spdm_session_info->session_transcript.message_m)); } if (RETURN_ERROR(status)) { @@ -413,25 +413,25 @@ bool spdm_calculate_l1l2(void *context, void *session_info, } DEBUG((DEBUG_INFO, "message_m data :\n")); - internal_dump_hex(l1l2_buffer, *l1l2_buffer_size); + libspdm_internal_dump_hex(l1l2_buffer, *l1l2_buffer_size); /* Debug code only - calculate and print value of l1l2 hash*/ DEBUG_CODE( if (!libspdm_hash_all( spdm_context->connection_info.algorithm.base_hash_algo, - get_managed_buffer(&l1l2), - get_managed_buffer_size(&l1l2), hash_data)) { + libspdm_get_managed_buffer(&l1l2), + libspdm_get_managed_buffer_size(&l1l2), hash_data)) { return false; } DEBUG((DEBUG_INFO, "l1l2 hash - ")); - internal_dump_data(hash_data, hash_size); + libspdm_internal_dump_data(hash_data, hash_size); DEBUG((DEBUG_INFO, "\n")); ); l1l2_buffer_capacity = *l1l2_buffer_size; - *l1l2_buffer_size = get_managed_buffer_size(&l1l2); + *l1l2_buffer_size = libspdm_get_managed_buffer_size(&l1l2); copy_mem(l1l2_buffer, l1l2_buffer_capacity, - get_managed_buffer(&l1l2), *l1l2_buffer_size); + libspdm_get_managed_buffer(&l1l2), *l1l2_buffer_size); return true; } @@ -448,11 +448,11 @@ bool spdm_calculate_l1l2(void *context, void *session_info, * * @retval RETURN_SUCCESS l1l2 is calculated. */ -bool spdm_calculate_l1l2_hash(void *context, void *session_info, - uintn *l1l2_hash_size, void *l1l2_hash) +bool libspdm_calculate_l1l2_hash(void *context, void *session_info, + uintn *l1l2_hash_size, void *l1l2_hash) { - spdm_context_t *spdm_context; - spdm_session_info_t *spdm_session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *spdm_session_info; bool result; uint32_t hash_size; @@ -476,7 +476,7 @@ bool spdm_calculate_l1l2_hash(void *context, void *session_info, return false; } DEBUG((DEBUG_INFO, "l1l2 hash - ")); - internal_dump_data(l1l2_hash, hash_size); + libspdm_internal_dump_data(l1l2_hash, hash_size); DEBUG((DEBUG_INFO, "\n")); *l1l2_hash_size = hash_size; @@ -495,8 +495,8 @@ bool spdm_calculate_l1l2_hash(void *context, void *session_info, * @retval true certificate chain hash is generated. * @retval false certificate chain hash is not generated. **/ -bool spdm_generate_cert_chain_hash(spdm_context_t *spdm_context, - uintn slot_id, uint8_t *hash) +bool libspdm_generate_cert_chain_hash(libspdm_context_t *spdm_context, + uintn slot_id, uint8_t *hash) { ASSERT(slot_id < spdm_context->local_context.slot_count); return libspdm_hash_all( @@ -517,8 +517,8 @@ bool spdm_generate_cert_chain_hash(spdm_context_t *spdm_context, * @retval true digest verification pass. * @retval false digest verification fail. **/ -bool spdm_verify_peer_digests(spdm_context_t *spdm_context, - void *digest, uintn digest_count) +bool libspdm_verify_peer_digests(libspdm_context_t *spdm_context, + void *digest, uintn digest_count) { uintn hash_size; uint8_t *hash_buffer; @@ -576,11 +576,11 @@ bool spdm_verify_peer_digests(spdm_context_t *spdm_context, * @retval true Peer certificate chain buffer verification passed. * @retval false Peer certificate chain buffer verification failed. **/ -bool spdm_verify_peer_cert_chain_buffer(spdm_context_t *spdm_context, - const void *cert_chain_buffer, - uintn cert_chain_buffer_size, - void **trust_anchor, - uintn *trust_anchor_size) +bool libspdm_verify_peer_cert_chain_buffer(libspdm_context_t *spdm_context, + const void *cert_chain_buffer, + uintn cert_chain_buffer_size, + void **trust_anchor, + uintn *trust_anchor_size) { uint8_t *cert_chain_data; uintn cert_chain_data_size; @@ -710,9 +710,9 @@ bool spdm_verify_peer_cert_chain_buffer(spdm_context_t *spdm_context, * @retval true challenge signature is generated. * @retval false challenge signature is not generated. **/ -bool spdm_generate_challenge_auth_signature(spdm_context_t *spdm_context, - bool is_requester, - uint8_t *signature) +bool libspdm_generate_challenge_auth_signature(libspdm_context_t *spdm_context, + bool is_requester, + uint8_t *signature) { bool result; uintn signature_size; @@ -726,12 +726,12 @@ bool spdm_generate_challenge_auth_signature(spdm_context_t *spdm_context, #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT m1m2_buffer_size = sizeof(m1m2_buffer); - result = spdm_calculate_m1m2(spdm_context, is_requester, - &m1m2_buffer_size, &m1m2_buffer); + result = libspdm_calculate_m1m2(spdm_context, is_requester, + &m1m2_buffer_size, &m1m2_buffer); #else m1m2_hash_size = sizeof(m1m2_hash); - result = spdm_calculate_m1m2_hash(spdm_context, is_requester, - &m1m2_hash_size, &m1m2_hash); + result = libspdm_calculate_m1m2_hash(spdm_context, is_requester, + &m1m2_hash_size, &m1m2_hash); #endif if (!result) { return false; @@ -791,9 +791,9 @@ bool spdm_generate_challenge_auth_signature(spdm_context_t *spdm_context, * @retval true hash verification pass. * @retval false hash verification fail. **/ -bool spdm_verify_certificate_chain_hash(spdm_context_t *spdm_context, - const void *certificate_chain_hash, - uintn certificate_chain_hash_size) +bool libspdm_verify_certificate_chain_hash(libspdm_context_t *spdm_context, + const void *certificate_chain_hash, + uintn certificate_chain_hash_size) { uintn hash_size; uint8_t cert_chain_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -897,10 +897,10 @@ bool spdm_verify_certificate_chain_hash(spdm_context_t *spdm_context, * @retval true signature verification pass. * @retval false signature verification fail. **/ -bool spdm_verify_challenge_auth_signature(spdm_context_t *spdm_context, - bool is_requester, - const void *sign_data, - uintn sign_data_size) +bool libspdm_verify_challenge_auth_signature(libspdm_context_t *spdm_context, + bool is_requester, + const void *sign_data, + uintn sign_data_size) { bool result; uint8_t *cert_buffer; @@ -918,12 +918,12 @@ bool spdm_verify_challenge_auth_signature(spdm_context_t *spdm_context, #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT m1m2_buffer_size = sizeof(m1m2_buffer); - result = spdm_calculate_m1m2(spdm_context, !is_requester, - &m1m2_buffer_size, &m1m2_buffer); + result = libspdm_calculate_m1m2(spdm_context, !is_requester, + &m1m2_buffer_size, &m1m2_buffer); #else m1m2_hash_size = sizeof(m1m2_hash); - result = spdm_calculate_m1m2_hash(spdm_context, !is_requester, - &m1m2_hash_size, &m1m2_hash); + result = libspdm_calculate_m1m2_hash(spdm_context, !is_requester, + &m1m2_hash_size, &m1m2_hash); #endif if (!result) { return false; @@ -1094,11 +1094,11 @@ bool spdm_verify_challenge_auth_signature(spdm_context_t *spdm_context, * @return measurement summary hash size according to type. **/ uint32_t -spdm_get_measurement_summary_hash_size(spdm_context_t *spdm_context, - bool is_requester, - uint8_t measurement_summary_hash_type) +libspdm_get_measurement_summary_hash_size(libspdm_context_t *spdm_context, + bool is_requester, + uint8_t measurement_summary_hash_type) { - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, is_requester, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) { return 0; @@ -1132,9 +1132,9 @@ spdm_get_measurement_summary_hash_size(spdm_context_t *spdm_context, * @retval true measurement signature is generated. * @retval false measurement signature is not generated. **/ -bool spdm_generate_measurement_signature(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *signature) +bool libspdm_generate_measurement_signature(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *signature) { uintn signature_size; bool result; @@ -1148,12 +1148,12 @@ bool spdm_generate_measurement_signature(spdm_context_t *spdm_context, #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT l1l2_buffer_size = sizeof(l1l2_buffer); - result = spdm_calculate_l1l2(spdm_context, session_info, &l1l2_buffer_size, - l1l2_buffer); + result = libspdm_calculate_l1l2(spdm_context, session_info, &l1l2_buffer_size, + l1l2_buffer); #else l1l2_hash_size = sizeof(l1l2_hash); - result = spdm_calculate_l1l2_hash(spdm_context, session_info, &l1l2_hash_size, - l1l2_hash); + result = libspdm_calculate_l1l2_hash(spdm_context, session_info, &l1l2_hash_size, + l1l2_hash); #endif if (!result) { return false; @@ -1190,10 +1190,10 @@ bool spdm_generate_measurement_signature(spdm_context_t *spdm_context, * @retval true signature verification pass. * @retval false signature verification fail. **/ -bool spdm_verify_measurement_signature(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const void *sign_data, - uintn sign_data_size) +bool libspdm_verify_measurement_signature(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const void *sign_data, + uintn sign_data_size) { bool result; uint8_t *cert_buffer; @@ -1211,12 +1211,12 @@ bool spdm_verify_measurement_signature(spdm_context_t *spdm_context, #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT l1l2_buffer_size = sizeof(l1l2_buffer); - result = spdm_calculate_l1l2(spdm_context, session_info, &l1l2_buffer_size, - l1l2_buffer); + result = libspdm_calculate_l1l2(spdm_context, session_info, &l1l2_buffer_size, + l1l2_buffer); #else l1l2_hash_size = sizeof(l1l2_hash); - result = spdm_calculate_l1l2_hash(spdm_context, session_info, &l1l2_hash_size, - l1l2_hash); + result = libspdm_calculate_l1l2_hash(spdm_context, session_info, &l1l2_hash_size, + l1l2_hash); #endif if (!result) { return false; diff --git a/library/spdm_common_lib/libspdm_com_crypto_service_session.c b/library/spdm_common_lib/libspdm_com_crypto_service_session.c index 7d7d50f52cf..4f9cbb70c83 100644 --- a/library/spdm_common_lib/libspdm_com_crypto_service_session.c +++ b/library/spdm_common_lib/libspdm_com_crypto_service_session.c @@ -24,12 +24,12 @@ bool libspdm_calculate_th_for_exchange( uintn cert_chain_buffer_size, uintn *th_data_buffer_size, void *th_data_buffer) { - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; uint8_t cert_chain_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; uint32_t hash_size; return_status status; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; bool result; uintn th_data_buffer_capacity; @@ -40,23 +40,23 @@ bool libspdm_calculate_th_for_exchange( spdm_context->connection_info.algorithm.base_hash_algo); ASSERT(*th_data_buffer_size >= LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); DEBUG((DEBUG_INFO, "message_a data :\n")); - internal_dump_hex( - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size(&spdm_context->transcript.message_a)); - status = append_managed_buffer( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer(&spdm_context->transcript.message_a), + libspdm_get_managed_buffer_size(&spdm_context->transcript.message_a)); + status = libspdm_append_managed_buffer( &th_curr, - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size(&spdm_context->transcript.message_a)); + libspdm_get_managed_buffer(&spdm_context->transcript.message_a), + libspdm_get_managed_buffer_size(&spdm_context->transcript.message_a)); if (RETURN_ERROR(status)) { return false; } if (cert_chain_buffer != NULL) { DEBUG((DEBUG_INFO, "th_message_ct data :\n")); - internal_dump_hex(cert_chain_buffer, cert_chain_buffer_size); + libspdm_internal_dump_hex(cert_chain_buffer, cert_chain_buffer_size); result = libspdm_hash_all( spdm_context->connection_info.algorithm.base_hash_algo, cert_chain_buffer, cert_chain_buffer_size, @@ -64,31 +64,31 @@ bool libspdm_calculate_th_for_exchange( if (!result) { return false; } - status = append_managed_buffer(&th_curr, cert_chain_buffer_hash, - hash_size); + status = libspdm_append_managed_buffer(&th_curr, cert_chain_buffer_hash, + hash_size); if (RETURN_ERROR(status)) { return false; } } DEBUG((DEBUG_INFO, "message_k data :\n")); - internal_dump_hex( - get_managed_buffer(&session_info->session_transcript.message_k), - get_managed_buffer_size( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer(&session_info->session_transcript.message_k), + libspdm_get_managed_buffer_size( &session_info->session_transcript.message_k)); - status = append_managed_buffer( + status = libspdm_append_managed_buffer( &th_curr, - get_managed_buffer(&session_info->session_transcript.message_k), - get_managed_buffer_size( + libspdm_get_managed_buffer(&session_info->session_transcript.message_k), + libspdm_get_managed_buffer_size( &session_info->session_transcript.message_k)); if (RETURN_ERROR(status)) { return false; } th_data_buffer_capacity = *th_data_buffer_size; - *th_data_buffer_size = get_managed_buffer_size(&th_curr); + *th_data_buffer_size = libspdm_get_managed_buffer_size(&th_curr); copy_mem(th_data_buffer, th_data_buffer_capacity, - get_managed_buffer(&th_curr), *th_data_buffer_size); + libspdm_get_managed_buffer(&th_curr), *th_data_buffer_size); return true; } @@ -107,8 +107,8 @@ bool libspdm_calculate_th_hash_for_exchange( void *context, void *spdm_session_info, uintn *th_hash_buffer_size, void *th_hash_buffer) { - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; uint32_t hash_size; void *digest_context_th; bool result; @@ -161,8 +161,8 @@ bool libspdm_calculate_th_hmac_for_exchange_rsp( void *context, void *spdm_session_info, bool is_requester, uintn *th_hmac_buffer_size, void *th_hmac_buffer) { - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; void *secured_message_context; uint32_t hash_size; void *hmac_context_th; @@ -236,13 +236,13 @@ bool libspdm_calculate_th_for_finish(void *context, uintn *th_data_buffer_size, void *th_data_buffer) { - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; uint8_t cert_chain_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; uint8_t mut_cert_chain_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; uint32_t hash_size; return_status status; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; bool result; uintn th_data_buffer_capacity; @@ -253,23 +253,23 @@ bool libspdm_calculate_th_for_finish(void *context, spdm_context->connection_info.algorithm.base_hash_algo); ASSERT(*th_data_buffer_size >= LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); DEBUG((DEBUG_INFO, "message_a data :\n")); - internal_dump_hex( - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size(&spdm_context->transcript.message_a)); - status = append_managed_buffer( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer(&spdm_context->transcript.message_a), + libspdm_get_managed_buffer_size(&spdm_context->transcript.message_a)); + status = libspdm_append_managed_buffer( &th_curr, - get_managed_buffer(&spdm_context->transcript.message_a), - get_managed_buffer_size(&spdm_context->transcript.message_a)); + libspdm_get_managed_buffer(&spdm_context->transcript.message_a), + libspdm_get_managed_buffer_size(&spdm_context->transcript.message_a)); if (RETURN_ERROR(status)) { return false; } if (cert_chain_buffer != NULL) { DEBUG((DEBUG_INFO, "th_message_ct data :\n")); - internal_dump_hex(cert_chain_buffer, cert_chain_buffer_size); + libspdm_internal_dump_hex(cert_chain_buffer, cert_chain_buffer_size); result = libspdm_hash_all( spdm_context->connection_info.algorithm.base_hash_algo, cert_chain_buffer, cert_chain_buffer_size, @@ -277,22 +277,22 @@ bool libspdm_calculate_th_for_finish(void *context, if (!result) { return false; } - status = append_managed_buffer(&th_curr, cert_chain_buffer_hash, - hash_size); + status = libspdm_append_managed_buffer(&th_curr, cert_chain_buffer_hash, + hash_size); if (RETURN_ERROR(status)) { return false; } } DEBUG((DEBUG_INFO, "message_k data :\n")); - internal_dump_hex( - get_managed_buffer(&session_info->session_transcript.message_k), - get_managed_buffer_size( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer(&session_info->session_transcript.message_k), + libspdm_get_managed_buffer_size( &session_info->session_transcript.message_k)); - status = append_managed_buffer( + status = libspdm_append_managed_buffer( &th_curr, - get_managed_buffer(&session_info->session_transcript.message_k), - get_managed_buffer_size( + libspdm_get_managed_buffer(&session_info->session_transcript.message_k), + libspdm_get_managed_buffer_size( &session_info->session_transcript.message_k)); if (RETURN_ERROR(status)) { return false; @@ -300,8 +300,8 @@ bool libspdm_calculate_th_for_finish(void *context, if (mut_cert_chain_buffer != NULL) { DEBUG((DEBUG_INFO, "th_message_cm data :\n")); - internal_dump_hex(mut_cert_chain_buffer, - mut_cert_chain_buffer_size); + libspdm_internal_dump_hex(mut_cert_chain_buffer, + mut_cert_chain_buffer_size); result = libspdm_hash_all( spdm_context->connection_info.algorithm.base_hash_algo, mut_cert_chain_buffer, mut_cert_chain_buffer_size, @@ -309,31 +309,31 @@ bool libspdm_calculate_th_for_finish(void *context, if (!result) { return false; } - status = append_managed_buffer(&th_curr, mut_cert_chain_buffer_hash, - hash_size); + status = libspdm_append_managed_buffer(&th_curr, mut_cert_chain_buffer_hash, + hash_size); if (RETURN_ERROR(status)) { return false; } } DEBUG((DEBUG_INFO, "message_f data :\n")); - internal_dump_hex( - get_managed_buffer(&session_info->session_transcript.message_f), - get_managed_buffer_size( + libspdm_internal_dump_hex( + libspdm_get_managed_buffer(&session_info->session_transcript.message_f), + libspdm_get_managed_buffer_size( &session_info->session_transcript.message_f)); - status = append_managed_buffer( + status = libspdm_append_managed_buffer( &th_curr, - get_managed_buffer(&session_info->session_transcript.message_f), - get_managed_buffer_size( + libspdm_get_managed_buffer(&session_info->session_transcript.message_f), + libspdm_get_managed_buffer_size( &session_info->session_transcript.message_f)); if (RETURN_ERROR(status)) { return false; } th_data_buffer_capacity = *th_data_buffer_size; - *th_data_buffer_size = get_managed_buffer_size(&th_curr); + *th_data_buffer_size = libspdm_get_managed_buffer_size(&th_curr); copy_mem(th_data_buffer, th_data_buffer_capacity, - get_managed_buffer(&th_curr), *th_data_buffer_size); + libspdm_get_managed_buffer(&th_curr), *th_data_buffer_size); return true; } @@ -353,8 +353,8 @@ bool libspdm_calculate_th_hash_for_finish(void *context, uintn *th_hash_buffer_size, void *th_hash_buffer) { - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; uint32_t hash_size; void *digest_context_th; bool result; @@ -408,8 +408,8 @@ bool libspdm_calculate_th_hmac_for_finish_rsp(void *context, uintn *th_hmac_buffer_size, void *th_hmac_buffer) { - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; void *secured_message_context; uint32_t hash_size; void *hmac_context_th; @@ -465,8 +465,8 @@ bool libspdm_calculate_th_hmac_for_finish_req(void *context, uintn *th_hmac_buffer_size, void *th_hmac_buffer) { - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; void *secured_message_context; uint32_t hash_size; void *hmac_context_th; @@ -519,9 +519,9 @@ bool libspdm_calculate_th_hmac_for_finish_req(void *context, * @retval false key exchange signature is not generated. **/ bool -spdm_generate_key_exchange_rsp_signature(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *signature) +libspdm_generate_key_exchange_rsp_signature(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *signature) { uint8_t hash_data[LIBSPDM_MAX_HASH_SIZE]; uint8_t *cert_chain_buffer; @@ -570,7 +570,7 @@ spdm_generate_key_exchange_rsp_signature(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hash - ")); - internal_dump_data(hash_data, hash_size); + libspdm_internal_dump_data(hash_data, hash_size); DEBUG((DEBUG_INFO, "\n")); #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT @@ -588,7 +588,7 @@ spdm_generate_key_exchange_rsp_signature(spdm_context_t *spdm_context, #endif if (result) { DEBUG((DEBUG_INFO, "signature - ")); - internal_dump_data(signature, signature_size); + libspdm_internal_dump_data(signature, signature_size); DEBUG((DEBUG_INFO, "\n")); } return result; @@ -605,9 +605,9 @@ spdm_generate_key_exchange_rsp_signature(spdm_context_t *spdm_context, * @retval false key exchange HMAC is not generated. **/ bool -spdm_generate_key_exchange_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *hmac) +libspdm_generate_key_exchange_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *hmac) { uint8_t hmac_data[LIBSPDM_MAX_HASH_SIZE]; uintn hash_size; @@ -651,7 +651,7 @@ spdm_generate_key_exchange_rsp_hmac(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hmac - ")); - internal_dump_data(hmac_data, hash_size); + libspdm_internal_dump_data(hmac_data, hash_size); DEBUG((DEBUG_INFO, "\n")); copy_mem(hmac, hash_size, hmac_data, hash_size); @@ -669,8 +669,8 @@ spdm_generate_key_exchange_rsp_hmac(spdm_context_t *spdm_context, * @retval true signature verification pass. * @retval false signature verification fail. **/ -bool spdm_verify_key_exchange_rsp_signature( - spdm_context_t *spdm_context, spdm_session_info_t *session_info, +bool libspdm_verify_key_exchange_rsp_signature( + libspdm_context_t *spdm_context, libspdm_session_info_t *session_info, const void *sign_data, const intn sign_data_size) { uintn hash_size; @@ -722,11 +722,11 @@ bool spdm_verify_key_exchange_rsp_signature( } #endif DEBUG((DEBUG_INFO, "th_curr hash - ")); - internal_dump_data(hash_data, hash_size); + libspdm_internal_dump_data(hash_data, hash_size); DEBUG((DEBUG_INFO, "\n")); DEBUG((DEBUG_INFO, "signature - ")); - internal_dump_data(sign_data, sign_data_size); + libspdm_internal_dump_data(sign_data, sign_data_size); DEBUG((DEBUG_INFO, "\n")); #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT @@ -817,10 +817,10 @@ bool spdm_verify_key_exchange_rsp_signature( * @retval true HMAC verification pass. * @retval false HMAC verification fail. **/ -bool spdm_verify_key_exchange_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const void *hmac_data, - uintn hmac_data_size) +bool libspdm_verify_key_exchange_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const void *hmac_data, + uintn hmac_data_size) { uintn hash_size; uint8_t calc_hmac_data[LIBSPDM_MAX_HASH_SIZE]; @@ -865,7 +865,7 @@ bool spdm_verify_key_exchange_rsp_hmac(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hmac - ")); - internal_dump_data(calc_hmac_data, hash_size); + libspdm_internal_dump_data(calc_hmac_data, hash_size); DEBUG((DEBUG_INFO, "\n")); if (const_compare_mem(calc_hmac_data, hmac_data, hash_size) != 0) { @@ -888,9 +888,9 @@ bool spdm_verify_key_exchange_rsp_hmac(spdm_context_t *spdm_context, * @retval true finish signature is generated. * @retval false finish signature is not generated. **/ -bool spdm_generate_finish_req_signature(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *signature) +bool libspdm_generate_finish_req_signature(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *signature) { uint8_t hash_data[LIBSPDM_MAX_HASH_SIZE]; bool result; @@ -949,7 +949,7 @@ bool spdm_generate_finish_req_signature(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hash - ")); - internal_dump_data(hash_data, hash_size); + libspdm_internal_dump_data(hash_data, hash_size); DEBUG((DEBUG_INFO, "\n")); #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT @@ -967,7 +967,7 @@ bool spdm_generate_finish_req_signature(spdm_context_t *spdm_context, #endif if (result) { DEBUG((DEBUG_INFO, "signature - ")); - internal_dump_data(signature, signature_size); + libspdm_internal_dump_data(signature, signature_size); DEBUG((DEBUG_INFO, "\n")); } @@ -984,9 +984,9 @@ bool spdm_generate_finish_req_signature(spdm_context_t *spdm_context, * @retval true finish HMAC is generated. * @retval false finish HMAC is not generated. **/ -bool spdm_generate_finish_req_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - void *hmac) +bool libspdm_generate_finish_req_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + void *hmac) { uintn hash_size; uint8_t calc_hmac_data[LIBSPDM_MAX_HASH_SIZE]; @@ -1045,7 +1045,7 @@ bool spdm_generate_finish_req_hmac(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hmac - ")); - internal_dump_data(calc_hmac_data, hash_size); + libspdm_internal_dump_data(calc_hmac_data, hash_size); DEBUG((DEBUG_INFO, "\n")); copy_mem(hmac, hash_size, calc_hmac_data, hash_size); @@ -1064,10 +1064,10 @@ bool spdm_generate_finish_req_hmac(spdm_context_t *spdm_context, * @retval true signature verification pass. * @retval false signature verification fail. **/ -bool spdm_verify_finish_req_signature(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const void *sign_data, - const intn sign_data_size) +bool libspdm_verify_finish_req_signature(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const void *sign_data, + const intn sign_data_size) { uintn hash_size; uint8_t hash_data[LIBSPDM_MAX_HASH_SIZE]; @@ -1128,11 +1128,11 @@ bool spdm_verify_finish_req_signature(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hash - ")); - internal_dump_data(hash_data, hash_size); + libspdm_internal_dump_data(hash_data, hash_size); DEBUG((DEBUG_INFO, "\n")); DEBUG((DEBUG_INFO, "signature - ")); - internal_dump_data(sign_data, sign_data_size); + libspdm_internal_dump_data(sign_data, sign_data_size); DEBUG((DEBUG_INFO, "\n")); #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT @@ -1229,9 +1229,9 @@ bool spdm_verify_finish_req_signature(spdm_context_t *spdm_context, * @retval true HMAC verification pass. * @retval false HMAC verification fail. **/ -bool spdm_verify_finish_req_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const uint8_t *hmac, uintn hmac_size) +bool libspdm_verify_finish_req_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const uint8_t *hmac, uintn hmac_size) { uint8_t hmac_data[LIBSPDM_MAX_HASH_SIZE]; uintn hash_size; @@ -1291,7 +1291,7 @@ bool spdm_verify_finish_req_hmac(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hmac - ")); - internal_dump_data(hmac_data, hash_size); + libspdm_internal_dump_data(hmac_data, hash_size); DEBUG((DEBUG_INFO, "\n")); if (const_compare_mem(hmac, hmac_data, hash_size) != 0) { @@ -1312,9 +1312,9 @@ bool spdm_verify_finish_req_hmac(spdm_context_t *spdm_context, * @retval true finish HMAC is generated. * @retval false finish HMAC is not generated. **/ -bool spdm_generate_finish_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *hmac) +bool libspdm_generate_finish_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *hmac) { uint8_t hmac_data[LIBSPDM_MAX_HASH_SIZE]; uintn hash_size; @@ -1373,7 +1373,7 @@ bool spdm_generate_finish_rsp_hmac(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hmac - ")); - internal_dump_data(hmac_data, hash_size); + libspdm_internal_dump_data(hmac_data, hash_size); DEBUG((DEBUG_INFO, "\n")); copy_mem(hmac, hash_size, hmac_data, hash_size); @@ -1392,9 +1392,9 @@ bool spdm_generate_finish_rsp_hmac(spdm_context_t *spdm_context, * @retval true HMAC verification pass. * @retval false HMAC verification fail. **/ -bool spdm_verify_finish_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const void *hmac_data, uintn hmac_data_size) +bool libspdm_verify_finish_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const void *hmac_data, uintn hmac_data_size) { uintn hash_size; uint8_t calc_hmac_data[LIBSPDM_MAX_HASH_SIZE]; @@ -1453,7 +1453,7 @@ bool spdm_verify_finish_rsp_hmac(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hmac - ")); - internal_dump_data(calc_hmac_data, hash_size); + libspdm_internal_dump_data(calc_hmac_data, hash_size); DEBUG((DEBUG_INFO, "\n")); if (const_compare_mem(calc_hmac_data, hmac_data, hash_size) != 0) { @@ -1476,9 +1476,9 @@ bool spdm_verify_finish_rsp_hmac(spdm_context_t *spdm_context, * @retval false PSK exchange HMAC is not generated. **/ bool -spdm_generate_psk_exchange_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - uint8_t *hmac) +libspdm_generate_psk_exchange_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + uint8_t *hmac) { uint8_t hmac_data[LIBSPDM_MAX_HASH_SIZE]; uintn hash_size; @@ -1514,7 +1514,7 @@ spdm_generate_psk_exchange_rsp_hmac(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hmac - ")); - internal_dump_data(hmac_data, hash_size); + libspdm_internal_dump_data(hmac_data, hash_size); DEBUG((DEBUG_INFO, "\n")); copy_mem(hmac, hash_size, hmac_data, hash_size); @@ -1533,10 +1533,10 @@ spdm_generate_psk_exchange_rsp_hmac(spdm_context_t *spdm_context, * @retval true HMAC verification pass. * @retval false HMAC verification fail. **/ -bool spdm_verify_psk_exchange_rsp_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const void *hmac_data, - uintn hmac_data_size) +bool libspdm_verify_psk_exchange_rsp_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const void *hmac_data, + uintn hmac_data_size) { uintn hash_size; uint8_t calc_hmac_data[LIBSPDM_MAX_HASH_SIZE]; @@ -1573,7 +1573,7 @@ bool spdm_verify_psk_exchange_rsp_hmac(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hmac - ")); - internal_dump_data(calc_hmac_data, hash_size); + libspdm_internal_dump_data(calc_hmac_data, hash_size); DEBUG((DEBUG_INFO, "\n")); if (const_compare_mem(calc_hmac_data, hmac_data, hash_size) != 0) { @@ -1597,9 +1597,9 @@ bool spdm_verify_psk_exchange_rsp_hmac(spdm_context_t *spdm_context, * @retval false PSK finish HMAC is not generated. **/ bool -spdm_generate_psk_exchange_req_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - void *hmac) +libspdm_generate_psk_exchange_req_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + void *hmac) { uintn hash_size; uint8_t calc_hmac_data[LIBSPDM_MAX_HASH_SIZE]; @@ -1635,7 +1635,7 @@ spdm_generate_psk_exchange_req_hmac(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "th_curr hmac - ")); - internal_dump_data(calc_hmac_data, hash_size); + libspdm_internal_dump_data(calc_hmac_data, hash_size); DEBUG((DEBUG_INFO, "\n")); copy_mem(hmac, hash_size, calc_hmac_data, hash_size); @@ -1654,9 +1654,9 @@ spdm_generate_psk_exchange_req_hmac(spdm_context_t *spdm_context, * @retval true HMAC verification pass. * @retval false HMAC verification fail. **/ -bool spdm_verify_psk_finish_req_hmac(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, - const uint8_t *hmac, uintn hmac_size) +bool libspdm_verify_psk_finish_req_hmac(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, + const uint8_t *hmac, uintn hmac_size) { uint8_t hmac_data[LIBSPDM_MAX_HASH_SIZE]; uintn hash_size; @@ -1693,7 +1693,7 @@ bool spdm_verify_psk_finish_req_hmac(spdm_context_t *spdm_context, } #endif DEBUG((DEBUG_INFO, "Calc th_curr hmac - ")); - internal_dump_data(hmac_data, hash_size); + libspdm_internal_dump_data(hmac_data, hash_size); DEBUG((DEBUG_INFO, "\n")); if (const_compare_mem(hmac, hmac_data, hash_size) != 0) { @@ -1720,9 +1720,9 @@ return_status libspdm_calculate_th1_hash(void *context, bool is_requester, uint8_t *th1_hash_data) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; bool result; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT uint8_t *cert_chain_buffer; @@ -1780,7 +1780,7 @@ return_status libspdm_calculate_th1_hash(void *context, } #endif DEBUG((DEBUG_INFO, "th1 hash - ")); - internal_dump_data(th1_hash_data, hash_size); + libspdm_internal_dump_data(th1_hash_data, hash_size); DEBUG((DEBUG_INFO, "\n")); return RETURN_SUCCESS; @@ -1801,9 +1801,9 @@ return_status libspdm_calculate_th2_hash(void *context, bool is_requester, uint8_t *th2_hash_data) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; bool result; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT uint8_t *cert_chain_buffer; @@ -1885,7 +1885,7 @@ return_status libspdm_calculate_th2_hash(void *context, } #endif DEBUG((DEBUG_INFO, "th2 hash - ")); - internal_dump_data(th2_hash_data, hash_size); + libspdm_internal_dump_data(th2_hash_data, hash_size); DEBUG((DEBUG_INFO, "\n")); return RETURN_SUCCESS; diff --git a/library/spdm_common_lib/libspdm_com_opaque_data.c b/library/spdm_common_lib/libspdm_com_opaque_data.c index 16b4a980770..93b8af6f915 100644 --- a/library/spdm_common_lib/libspdm_com_opaque_data.c +++ b/library/spdm_common_lib/libspdm_com_opaque_data.c @@ -14,8 +14,8 @@ * * @return the size in bytes of opaque data version selection. **/ -uintn spdm_get_opaque_data_version_selection_data_size( - const spdm_context_t *spdm_context) +uintn libspdm_get_opaque_data_version_selection_data_size( + const libspdm_context_t *spdm_context) { uintn size; @@ -24,7 +24,7 @@ uintn spdm_get_opaque_data_version_selection_data_size( return 0; } - if (spdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { + if (libspdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { size = sizeof(spdm_general_opaque_data_table_header_t) + sizeof(secured_message_opaque_element_table_header_t) + sizeof(secured_message_opaque_element_version_selection_t); @@ -44,8 +44,8 @@ uintn spdm_get_opaque_data_version_selection_data_size( * * @return the size in bytes of opaque data supproted version. **/ -uintn spdm_get_opaque_data_supported_version_data_size( - spdm_context_t *spdm_context) +uintn libspdm_get_opaque_data_supported_version_data_size( + libspdm_context_t *spdm_context) { uintn size; @@ -54,7 +54,7 @@ uintn spdm_get_opaque_data_supported_version_data_size( return 0; } - if (spdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { + if (libspdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { size = sizeof(spdm_general_opaque_data_table_header_t) + sizeof(secured_message_opaque_element_table_header_t) + sizeof(secured_message_opaque_element_supported_version_t) + @@ -84,9 +84,9 @@ uintn spdm_get_opaque_data_supported_version_data_size( * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ return_status -spdm_build_opaque_data_supported_version_data(spdm_context_t *spdm_context, - uintn *data_out_size, - void *data_out) +libspdm_build_opaque_data_supported_version_data(libspdm_context_t *spdm_context, + uintn *data_out_size, + void *data_out) { uintn final_data_size; secured_message_general_opaque_data_table_header_t @@ -107,12 +107,12 @@ spdm_build_opaque_data_supported_version_data(spdm_context_t *spdm_context, } final_data_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); if (*data_out_size < final_data_size) { *data_out_size = final_data_size; return RETURN_BUFFER_TOO_SMALL; } - if (spdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { + if (libspdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { spdm_general_opaque_data_table_header = data_out; spdm_general_opaque_data_table_header->total_elements = 1; libspdm_write_uint24(spdm_general_opaque_data_table_header->reserved, 0); @@ -171,9 +171,9 @@ spdm_build_opaque_data_supported_version_data(spdm_context_t *spdm_context, * @retval RETURN_UNSUPPORTED The data_in is NOT opaque data supported version. **/ return_status -spdm_process_opaque_data_supported_version_data(spdm_context_t *spdm_context, - uintn data_in_size, - void *data_in) +libspdm_process_opaque_data_supported_version_data(libspdm_context_t *spdm_context, + uintn data_in_size, + void *data_in) { secured_message_general_opaque_data_table_header_t *general_opaque_data_table_header; @@ -193,10 +193,10 @@ spdm_process_opaque_data_supported_version_data(spdm_context_t *spdm_context, } if (data_in_size != - spdm_get_opaque_data_supported_version_data_size(spdm_context)) { + libspdm_get_opaque_data_supported_version_data_size(spdm_context)) { return RETURN_UNSUPPORTED; } - if (spdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { + if (libspdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { spdm_general_opaque_data_table_header = data_in; if (spdm_general_opaque_data_table_header->total_elements != 1) { return RETURN_UNSUPPORTED; @@ -233,11 +233,11 @@ spdm_process_opaque_data_supported_version_data(spdm_context_t *spdm_context, } versions_list = (void *)(opaque_element_support_version + 1); - result = spdm_negotiate_connection_version(&common_version, - spdm_context->local_context.secured_message_version.spdm_version, - spdm_context->local_context.secured_message_version.spdm_version_count, - versions_list, - opaque_element_support_version->version_count); + result = libspdm_negotiate_connection_version(&common_version, + spdm_context->local_context.secured_message_version.spdm_version, + spdm_context->local_context.secured_message_version.spdm_version_count, + versions_list, + opaque_element_support_version->version_count); if (result == false) { return RETURN_UNSUPPORTED; } @@ -264,9 +264,9 @@ spdm_process_opaque_data_supported_version_data(spdm_context_t *spdm_context, * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ return_status -spdm_build_opaque_data_version_selection_data(const spdm_context_t *spdm_context, - uintn *data_out_size, - void *data_out) +libspdm_build_opaque_data_version_selection_data(const libspdm_context_t *spdm_context, + uintn *data_out_size, + void *data_out) { uintn final_data_size; secured_message_general_opaque_data_table_header_t @@ -286,13 +286,13 @@ spdm_build_opaque_data_version_selection_data(const spdm_context_t *spdm_context } final_data_size = - spdm_get_opaque_data_version_selection_data_size(spdm_context); + libspdm_get_opaque_data_version_selection_data_size(spdm_context); if (*data_out_size < final_data_size) { *data_out_size = final_data_size; return RETURN_BUFFER_TOO_SMALL; } - if (spdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { + if (libspdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { spdm_general_opaque_data_table_header = data_out; spdm_general_opaque_data_table_header->total_elements = 1; libspdm_write_uint24(spdm_general_opaque_data_table_header->reserved, 0); @@ -342,9 +342,9 @@ spdm_build_opaque_data_version_selection_data(const spdm_context_t *spdm_context * @retval RETURN_UNSUPPORTED The data_in is NOT opaque data version selection. **/ return_status -spdm_process_opaque_data_version_selection_data(spdm_context_t *spdm_context, - uintn data_in_size, - void *data_in) +libspdm_process_opaque_data_version_selection_data(libspdm_context_t *spdm_context, + uintn data_in_size, + void *data_in) { secured_message_general_opaque_data_table_header_t *general_opaque_data_table_header; @@ -362,10 +362,10 @@ spdm_process_opaque_data_version_selection_data(spdm_context_t *spdm_context, } if (data_in_size != - spdm_get_opaque_data_version_selection_data_size(spdm_context)) { + libspdm_get_opaque_data_version_selection_data_size(spdm_context)) { return RETURN_UNSUPPORTED; } - if (spdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { + if (libspdm_get_connection_version (spdm_context) >= SPDM_MESSAGE_VERSION_12) { spdm_general_opaque_data_table_header = data_in; if (spdm_general_opaque_data_table_header->total_elements != 1) { return RETURN_UNSUPPORTED; @@ -403,10 +403,11 @@ spdm_process_opaque_data_version_selection_data(spdm_context_t *spdm_context, spdm_context->local_context.secured_message_version.spdm_version_count; secured_message_version_index++) { - if (spdm_get_version_from_version_number(opaque_element_version_section->selected_version) + if (libspdm_get_version_from_version_number(opaque_element_version_section->selected_version) == - spdm_get_version_from_version_number(spdm_context->local_context.secured_message_version - .spdm_version[secured_message_version_index])) { + libspdm_get_version_from_version_number(spdm_context->local_context. + secured_message_version + .spdm_version[secured_message_version_index])) { return RETURN_SUCCESS; } } diff --git a/library/spdm_common_lib/libspdm_com_support.c b/library/spdm_common_lib/libspdm_com_support.c index 030f4eea00b..5b699344fdf 100644 --- a/library/spdm_common_lib/libspdm_com_support.c +++ b/library/spdm_common_lib/libspdm_com_support.c @@ -12,7 +12,7 @@ * @param data raw data * @param size raw data size **/ -void internal_dump_hex_str(const uint8_t *data, uintn size) +void libspdm_libspdm_internal_dump_hex_str(const uint8_t *data, uintn size) { uintn index; for (index = 0; index < size; index++) { @@ -26,7 +26,7 @@ void internal_dump_hex_str(const uint8_t *data, uintn size) * @param data raw data * @param size raw data size **/ -void internal_dump_data(const uint8_t *data, uintn size) +void libspdm_internal_dump_data(const uint8_t *data, uintn size) { uintn index; for (index = 0; index < size; index++) { @@ -40,7 +40,7 @@ void internal_dump_data(const uint8_t *data, uintn size) * @param data raw data * @param size raw data size **/ -void internal_dump_hex(const uint8_t *data, uintn size) +void libspdm_internal_dump_hex(const uint8_t *data, uintn size) { uintn index; uintn count; @@ -52,13 +52,13 @@ void internal_dump_hex(const uint8_t *data, uintn size) left = size % COLUME_SIZE; for (index = 0; index < count; index++) { DEBUG((DEBUG_INFO, "%04x: ", index * COLUME_SIZE)); - internal_dump_data(data + index * COLUME_SIZE, COLUME_SIZE); + libspdm_internal_dump_data(data + index * COLUME_SIZE, COLUME_SIZE); DEBUG((DEBUG_INFO, "\n")); } if (left != 0) { DEBUG((DEBUG_INFO, "%04x: ", index * COLUME_SIZE)); - internal_dump_data(data + index * COLUME_SIZE, left); + libspdm_internal_dump_data(data + index * COLUME_SIZE, left); DEBUG((DEBUG_INFO, "\n")); } } @@ -92,17 +92,17 @@ void libspdm_write_uint24(uint8_t *buffer, uint32_t value) /** * Append a new data buffer to the managed buffer. * - * @param managed_buffer_t The managed buffer to be appended. + * @param libspdm_managed_buffer_t The managed buffer to be appended. * @param buffer The address of the data buffer to be appended to the managed buffer. * @param buffer_size The size in bytes of the data buffer to be appended to the managed buffer. * * @retval RETURN_SUCCESS The new data buffer is appended to the managed buffer. * @retval RETURN_BUFFER_TOO_SMALL The managed buffer is too small to be appended. **/ -return_status append_managed_buffer(void *m_buffer, const void *buffer, - uintn buffer_size) +return_status libspdm_append_managed_buffer(void *m_buffer, const void *buffer, + uintn buffer_size) { - managed_buffer_t *managed_buffer; + libspdm_managed_buffer_t *managed_buffer; managed_buffer = m_buffer; @@ -125,7 +125,7 @@ return_status append_managed_buffer(void *m_buffer, const void *buffer, managed_buffer->max_buffer_size - managed_buffer->buffer_size) { /* Do not ASSERT here, because command processor will append message from external.*/ DEBUG((DEBUG_ERROR, - "append_managed_buffer 0x%x fail, rest 0x%x only\n", + "libspdm_append_managed_buffer 0x%x fail, rest 0x%x only\n", (uint32_t)buffer_size, (uint32_t)(managed_buffer->max_buffer_size - managed_buffer->buffer_size))); @@ -147,11 +147,11 @@ return_status append_managed_buffer(void *m_buffer, const void *buffer, * The max_buffer_size is unchanged. * The buffer is not freed. * - * @param managed_buffer_t The managed buffer to be shrinked. + * @param libspdm_managed_buffer_t The managed buffer to be shrinked. **/ -void reset_managed_buffer(void *m_buffer) +void libspdm_reset_managed_buffer(void *m_buffer) { - managed_buffer_t *managed_buffer; + libspdm_managed_buffer_t *managed_buffer; managed_buffer = m_buffer; @@ -168,13 +168,13 @@ void reset_managed_buffer(void *m_buffer) /** * Return the size of managed buffer. * - * @param managed_buffer_t The managed buffer. + * @param libspdm_managed_buffer_t The managed buffer. * * @return the size of managed buffer. **/ -uintn get_managed_buffer_size(void *m_buffer) +uintn libspdm_get_managed_buffer_size(void *m_buffer) { - managed_buffer_t *managed_buffer; + libspdm_managed_buffer_t *managed_buffer; managed_buffer = m_buffer; @@ -190,13 +190,13 @@ uintn get_managed_buffer_size(void *m_buffer) /** * Return the address of managed buffer. * - * @param managed_buffer_t The managed buffer. + * @param libspdm_managed_buffer_t The managed buffer. * * @return the address of managed buffer. **/ -void *get_managed_buffer(void *m_buffer) +void *libspdm_get_managed_buffer(void *m_buffer) { - managed_buffer_t *managed_buffer; + libspdm_managed_buffer_t *managed_buffer; managed_buffer = m_buffer; @@ -212,12 +212,12 @@ void *get_managed_buffer(void *m_buffer) /** * Init the managed buffer. * - * @param managed_buffer_t The managed buffer. + * @param libspdm_managed_buffer_t The managed buffer. * @param max_buffer_size The maximum size in bytes of the managed buffer. **/ -void init_managed_buffer(void *m_buffer, uintn max_buffer_size) +void libspdm_init_managed_buffer(void *m_buffer, uintn max_buffer_size) { - managed_buffer_t *managed_buffer; + libspdm_managed_buffer_t *managed_buffer; managed_buffer = m_buffer; @@ -226,5 +226,5 @@ void init_managed_buffer(void *m_buffer, uintn max_buffer_size) (max_buffer_size == LIBSPDM_MAX_MESSAGE_SMALL_BUFFER_SIZE)); managed_buffer->max_buffer_size = max_buffer_size; - reset_managed_buffer(m_buffer); + libspdm_reset_managed_buffer(m_buffer); } diff --git a/library/spdm_requester_lib/libspdm_req_challenge.c b/library/spdm_requester_lib/libspdm_req_challenge.c index b4e739b8f02..b4a742fcbcc 100644 --- a/library/spdm_requester_lib/libspdm_req_challenge.c +++ b/library/spdm_requester_lib/libspdm_req_challenge.c @@ -67,15 +67,15 @@ return_status try_spdm_challenge(void *context, uint8_t slot_id, void *opaque; void *signature; uintn signature_size; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t auth_attribute; ASSERT((slot_id < SPDM_MAX_SLOT_COUNT) || (slot_id == 0xff)); spdm_context = context; - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - SPDM_CHALLENGE); - if (!spdm_is_capabilities_flag_supported( + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + SPDM_CHALLENGE); + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP)) { return RETURN_UNSUPPORTED; @@ -92,7 +92,7 @@ return_status try_spdm_challenge(void *context, uint8_t slot_id, spdm_context->error_state = LIBSPDM_STATUS_ERROR_DEVICE_NO_CAPABILITIES; - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_CHALLENGE; spdm_request.header.param1 = slot_id; spdm_request.header.param2 = measurement_hash_type; @@ -105,7 +105,7 @@ return_status try_spdm_challenge(void *context, uint8_t slot_id, requester_nonce_in, SPDM_NONCE_SIZE); } DEBUG((DEBUG_INFO, "ClientNonce - ")); - internal_dump_data(spdm_request.nonce, SPDM_NONCE_SIZE); + libspdm_internal_dump_data(spdm_request.nonce, SPDM_NONCE_SIZE); DEBUG((DEBUG_INFO, "\n")); if (requester_nonce != NULL) { copy_mem(requester_nonce, SPDM_NONCE_SIZE, @@ -170,7 +170,7 @@ return_status try_spdm_challenge(void *context, uint8_t slot_id, } } if ((auth_attribute & SPDM_CHALLENGE_AUTH_RESPONSE_ATTRIBUTE_BASIC_MUT_AUTH_REQ) != 0) { - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP)) { @@ -181,7 +181,7 @@ return_status try_spdm_challenge(void *context, uint8_t slot_id, spdm_context->connection_info.algorithm.base_hash_algo); signature_size = libspdm_get_asym_signature_size( spdm_context->connection_info.algorithm.base_asym_algo); - measurement_summary_hash_size = spdm_get_measurement_summary_hash_size( + measurement_summary_hash_size = libspdm_get_measurement_summary_hash_size( spdm_context, true, measurement_hash_type); if (spdm_response_size <= sizeof(spdm_challenge_auth_response_t) + @@ -196,10 +196,10 @@ return_status try_spdm_challenge(void *context, uint8_t slot_id, cert_chain_hash = ptr; ptr += hash_size; DEBUG((DEBUG_INFO, "cert_chain_hash (0x%x) - ", hash_size)); - internal_dump_data(cert_chain_hash, hash_size); + libspdm_internal_dump_data(cert_chain_hash, hash_size); DEBUG((DEBUG_INFO, "\n")); - result = spdm_verify_certificate_chain_hash(spdm_context, - cert_chain_hash, hash_size); + result = libspdm_verify_certificate_chain_hash(spdm_context, + cert_chain_hash, hash_size); if (!result) { spdm_context->error_state = LIBSPDM_STATUS_ERROR_CERTIFICATE_FAILURE; @@ -208,7 +208,7 @@ return_status try_spdm_challenge(void *context, uint8_t slot_id, nonce = ptr; DEBUG((DEBUG_INFO, "nonce (0x%x) - ", SPDM_NONCE_SIZE)); - internal_dump_data(nonce, SPDM_NONCE_SIZE); + libspdm_internal_dump_data(nonce, SPDM_NONCE_SIZE); DEBUG((DEBUG_INFO, "\n")); ptr += SPDM_NONCE_SIZE; if (responder_nonce != NULL) { @@ -219,8 +219,8 @@ return_status try_spdm_challenge(void *context, uint8_t slot_id, ptr += measurement_summary_hash_size; DEBUG((DEBUG_INFO, "measurement_summary_hash (0x%x) - ", measurement_summary_hash_size)); - internal_dump_data(measurement_summary_hash, - measurement_summary_hash_size); + libspdm_internal_dump_data(measurement_summary_hash, + measurement_summary_hash_size); DEBUG((DEBUG_INFO, "\n")); opaque_length = *(uint16_t *)ptr; @@ -256,12 +256,12 @@ return_status try_spdm_challenge(void *context, uint8_t slot_id, opaque = ptr; ptr += opaque_length; DEBUG((DEBUG_INFO, "opaque (0x%x):\n", opaque_length)); - internal_dump_hex(opaque, opaque_length); + libspdm_internal_dump_hex(opaque, opaque_length); signature = ptr; DEBUG((DEBUG_INFO, "signature (0x%x):\n", signature_size)); - internal_dump_hex(signature, signature_size); - result = spdm_verify_challenge_auth_signature( + libspdm_internal_dump_hex(signature, signature_size); + result = libspdm_verify_challenge_auth_signature( spdm_context, true, signature, signature_size); if (!result) { libspdm_reset_message_c(spdm_context); @@ -324,7 +324,7 @@ return_status libspdm_challenge(void *context, uint8_t slot_id, void *measurement_hash, uint8_t *slot_mask) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn retry; return_status status; @@ -373,7 +373,7 @@ return_status libspdm_challenge_ex(void *context, uint8_t slot_id, void *requester_nonce, void *responder_nonce) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn retry; return_status status; diff --git a/library/spdm_requester_lib/libspdm_req_communication.c b/library/spdm_requester_lib/libspdm_req_communication.c index a4e8acfad5e..c719f65e571 100644 --- a/library/spdm_requester_lib/libspdm_req_communication.c +++ b/library/spdm_requester_lib/libspdm_req_communication.c @@ -22,7 +22,7 @@ return_status libspdm_init_connection(void *context, bool get_version_only) { return_status status; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; @@ -74,10 +74,10 @@ return_status libspdm_start_session(void *context, bool use_psk, void *measurement_hash) { return_status status; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; #if LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t req_slot_id_param; #endif /* LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP*/ @@ -154,7 +154,7 @@ return_status libspdm_start_session(void *context, bool use_psk, } /* send PSK_FINISH only if Responder supports context.*/ - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP_RESPONDER_WITH_CONTEXT)) { status = spdm_send_receive_psk_finish(spdm_context, @@ -219,10 +219,10 @@ return_status libspdm_start_session_ex(void *context, bool use_psk, uintn *responder_random_size) { return_status status; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; #if LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t req_slot_id_param; #endif /* LIBSPDM_ENABLE_CAPABILITY_KEY_EX_CAP*/ @@ -306,7 +306,7 @@ return_status libspdm_start_session_ex(void *context, bool use_psk, } /* send PSK_FINISH only if Responder supports context.*/ - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP_RESPONDER_WITH_CONTEXT)) { status = spdm_send_receive_psk_finish(spdm_context, @@ -341,7 +341,7 @@ return_status libspdm_stop_session(void *context, uint32_t session_id, uint8_t end_session_attributes) { return_status status; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; @@ -386,7 +386,7 @@ return_status libspdm_send_receive_data(void *context, const uint32_t *session_i uintn *response_size) { return_status status; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_error_response_t *spdm_response; spdm_context = context; diff --git a/library/spdm_requester_lib/libspdm_req_encap_certificate.c b/library/spdm_requester_lib/libspdm_req_encap_certificate.c index 11af1e9c4ef..1f5b31ebdb8 100644 --- a/library/spdm_requester_lib/libspdm_req_encap_certificate.c +++ b/library/spdm_requester_lib/libspdm_req_encap_certificate.c @@ -37,20 +37,20 @@ return_status spdm_get_encap_response_certificate(void *context, uint16_t length; uintn remainder_length; uint8_t slot_id; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; uintn response_capacity; spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_encap_error_response( spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, SPDM_GET_CERTIFICATE, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CERT_CAP, 0)) { return libspdm_generate_encap_error_response( @@ -104,8 +104,8 @@ return_status spdm_get_encap_response_certificate(void *context, .local_cert_chain_provision_size[slot_id] - (length + offset); - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); ASSERT(*response_size >= sizeof(spdm_certificate_response_t) + length); response_capacity = *response_size; diff --git a/library/spdm_requester_lib/libspdm_req_encap_challenge_auth.c b/library/spdm_requester_lib/libspdm_req_encap_challenge_auth.c index f5d69f9372d..e66f023b576 100644 --- a/library/spdm_requester_lib/libspdm_req_encap_challenge_auth.c +++ b/library/spdm_requester_lib/libspdm_req_encap_challenge_auth.c @@ -38,7 +38,7 @@ return_status spdm_get_encap_response_challenge_auth( uint32_t measurement_summary_hash_size; uint8_t *ptr; uintn total_size; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t auth_attribute; return_status status; uintn response_capacity; @@ -46,13 +46,13 @@ return_status spdm_get_encap_response_challenge_auth( spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_encap_error_response( spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, SPDM_CHALLENGE, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CHAL_CAP, 0)) { return libspdm_generate_encap_error_response( @@ -75,8 +75,8 @@ return_status spdm_get_encap_response_challenge_auth( response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); signature_size = libspdm_get_req_asym_signature_size( spdm_context->connection_info.algorithm.req_base_asym_alg); @@ -109,7 +109,7 @@ return_status spdm_get_encap_response_challenge_auth( } ptr = (void *)(spdm_response + 1); - result = spdm_generate_cert_chain_hash(spdm_context, slot_id, ptr); + result = libspdm_generate_cert_chain_hash(spdm_context, slot_id, ptr); if (!result) { return libspdm_generate_encap_error_response( spdm_context, SPDM_ERROR_CODE_UNSPECIFIED, 0, @@ -154,7 +154,7 @@ return_status spdm_get_encap_response_challenge_auth( response_size, response); } result = - spdm_generate_challenge_auth_signature(spdm_context, true, ptr); + libspdm_generate_challenge_auth_signature(spdm_context, true, ptr); if (!result) { return libspdm_generate_encap_error_response( spdm_context, SPDM_ERROR_CODE_UNSPECIFIED, diff --git a/library/spdm_requester_lib/libspdm_req_encap_digests.c b/library/spdm_requester_lib/libspdm_req_encap_digests.c index f1e26db3a71..9701652014a 100644 --- a/library/spdm_requester_lib/libspdm_req_encap_digests.c +++ b/library/spdm_requester_lib/libspdm_req_encap_digests.c @@ -36,20 +36,20 @@ return_status spdm_get_encap_response_digest(void *context, uintn index; uint32_t hash_size; uint8_t *digest; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; bool result; spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_encap_error_response( spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, SPDM_GET_DIGESTS, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CERT_CAP, 0)) { return libspdm_generate_encap_error_response( @@ -63,8 +63,8 @@ return_status spdm_get_encap_response_digest(void *context, response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); hash_size = libspdm_get_hash_size( spdm_context->connection_info.algorithm.base_hash_algo); @@ -92,8 +92,8 @@ return_status spdm_get_encap_response_digest(void *context, 0, response_size, response); } spdm_response->header.param2 |= (1 << index); - result = spdm_generate_cert_chain_hash(spdm_context, index, - &digest[hash_size * index]); + result = libspdm_generate_cert_chain_hash(spdm_context, index, + &digest[hash_size * index]); if (!result) { return libspdm_generate_encap_error_response( spdm_context, SPDM_ERROR_CODE_UNSPECIFIED, diff --git a/library/spdm_requester_lib/libspdm_req_encap_error.c b/library/spdm_requester_lib/libspdm_req_encap_error.c index fa9cb067297..5ef8322770b 100644 --- a/library/spdm_requester_lib/libspdm_req_encap_error.c +++ b/library/spdm_requester_lib/libspdm_req_encap_error.c @@ -35,7 +35,7 @@ return_status libspdm_generate_encap_error_response(const void *context, *response_size = sizeof(spdm_error_response_t); spdm_response = response; - spdm_response->header.spdm_version = spdm_get_connection_version (context); + spdm_response->header.spdm_version = libspdm_get_connection_version (context); spdm_response->header.request_response_code = SPDM_ERROR; spdm_response->header.param1 = error_code; spdm_response->header.param2 = error_data; @@ -72,7 +72,7 @@ return_status libspdm_generate_encap_extended_error_response( sizeof(spdm_error_response_t) + extended_error_data_size); spdm_response = response; - spdm_response->header.spdm_version = spdm_get_connection_version (context); + spdm_response->header.spdm_version = libspdm_get_connection_version (context); spdm_response->header.request_response_code = SPDM_ERROR; spdm_response->header.param1 = error_code; spdm_response->header.param2 = error_data; diff --git a/library/spdm_requester_lib/libspdm_req_encap_key_update.c b/library/spdm_requester_lib/libspdm_req_encap_key_update.c index 80e515f6610..709bcd0b115 100644 --- a/library/spdm_requester_lib/libspdm_req_encap_key_update.c +++ b/library/spdm_requester_lib/libspdm_req_encap_key_update.c @@ -32,21 +32,21 @@ return_status spdm_get_encap_response_key_update(void *context, uint32_t session_id; spdm_key_update_response_t *spdm_response; spdm_key_update_request_t *spdm_request; - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; return_status status; spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_encap_error_response( spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, SPDM_KEY_UPDATE, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_UPD_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_UPD_CAP)) { @@ -114,8 +114,8 @@ return_status spdm_get_encap_response_key_update(void *context, response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + spdm_request->header.request_response_code); ASSERT(*response_size >= sizeof(spdm_key_update_response_t)); *response_size = sizeof(spdm_key_update_response_t); diff --git a/library/spdm_requester_lib/libspdm_req_encap_request.c b/library/spdm_requester_lib/libspdm_req_encap_request.c index 81608aedb2c..849b24f8ad5 100644 --- a/library/spdm_requester_lib/libspdm_req_encap_request.c +++ b/library/spdm_requester_lib/libspdm_req_encap_request.c @@ -38,7 +38,7 @@ void libspdm_register_get_encap_response_func(void *context, const libspdm_get_encap_response_func get_encap_response_func) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; spdm_context->get_encap_response_func = (uintn)get_encap_response_func; @@ -84,7 +84,7 @@ SpdmGetEncapResponseFuncViaRequestCode(uint8_t request_response_code) * @retval RETURN_SUCCESS The SPDM response is processed successfully. * @retval RETURN_DEVICE_ERROR A device error occurs when the SPDM response is sent to the device. **/ -return_status SpdmProcessEncapsulatedRequest(spdm_context_t *spdm_context, +return_status SpdmProcessEncapsulatedRequest(libspdm_context_t *spdm_context, uintn encap_request_size, void *encap_request, uintn *encap_response_size, @@ -142,7 +142,7 @@ return_status SpdmProcessEncapsulatedRequest(spdm_context_t *spdm_context, * @retval RETURN_SUCCESS The SPDM Encapsulated requests are sent and the responses are received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_encapsulated_request(spdm_context_t *spdm_context, +return_status spdm_encapsulated_request(libspdm_context_t *spdm_context, const uint32_t *session_id, uint8_t mut_auth_requested, uint8_t *req_slot_id_param) @@ -159,7 +159,7 @@ return_status spdm_encapsulated_request(spdm_context_t *spdm_context, spdm_encapsulated_request_response_t *spdm_encapsulated_request_response; spdm_encapsulated_response_ack_response_t *spdm_encapsulated_response_ack_response; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t request_id; void *encapsulated_request; uintn encapsulated_request_size; @@ -171,7 +171,7 @@ return_status spdm_encapsulated_request(spdm_context_t *spdm_context, spdm_get_digest_request_t get_digests; #endif /* LIBSPDM_ENABLE_CAPABILITY_CERT_CAP*/ - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP)) { @@ -213,7 +213,7 @@ return_status spdm_encapsulated_request(spdm_context_t *spdm_context, #if LIBSPDM_ENABLE_CAPABILITY_CERT_CAP - get_digests.header.spdm_version = spdm_get_connection_version (spdm_context); + get_digests.header.spdm_version = libspdm_get_connection_version (spdm_context); get_digests.header.request_response_code = SPDM_GET_DIGESTS; get_digests.header.param1 = 0; get_digests.header.param2 = 0; @@ -228,15 +228,15 @@ return_status spdm_encapsulated_request(spdm_context_t *spdm_context, spdm_context->crypto_request = true; spdm_get_encapsulated_request_request = (void *)request; spdm_get_encapsulated_request_request->header.spdm_version = - spdm_get_connection_version (spdm_context); + libspdm_get_connection_version (spdm_context); spdm_get_encapsulated_request_request->header .request_response_code = SPDM_GET_ENCAPSULATED_REQUEST; spdm_get_encapsulated_request_request->header.param1 = 0; spdm_get_encapsulated_request_request->header.param2 = 0; spdm_request_size = sizeof(spdm_get_encapsulated_request_request_t); - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_get_encapsulated_request_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_get_encapsulated_request_request->header.request_response_code); status = spdm_send_spdm_request( spdm_context, session_id, spdm_request_size, spdm_get_encapsulated_request_request); @@ -284,7 +284,7 @@ return_status spdm_encapsulated_request(spdm_context_t *spdm_context, spdm_context->crypto_request = true; spdm_deliver_encapsulated_response_request = (void *)request; spdm_deliver_encapsulated_response_request->header.spdm_version = - spdm_get_connection_version (spdm_context); + libspdm_get_connection_version (spdm_context); spdm_deliver_encapsulated_response_request->header .request_response_code = SPDM_DELIVER_ENCAPSULATED_RESPONSE; diff --git a/library/spdm_requester_lib/libspdm_req_end_session.c b/library/spdm_requester_lib/libspdm_req_end_session.c index 01447831bcb..ca90cdcf70c 100644 --- a/library/spdm_requester_lib/libspdm_req_end_session.c +++ b/library/spdm_requester_lib/libspdm_req_end_session.c @@ -25,7 +25,7 @@ typedef struct { * @retval RETURN_SUCCESS The END_SESSION is sent and the END_SESSION_ACK is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status try_spdm_send_receive_end_session(spdm_context_t *spdm_context, +return_status try_spdm_send_receive_end_session(libspdm_context_t *spdm_context, uint32_t session_id, uint8_t end_session_attributes) { @@ -34,7 +34,7 @@ return_status try_spdm_send_receive_end_session(spdm_context_t *spdm_context, uintn spdm_request_size; spdm_end_session_response_mine_t spdm_response; uintn spdm_response_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; if (spdm_context->connection_info.connection_state < @@ -55,13 +55,13 @@ return_status try_spdm_send_receive_end_session(spdm_context_t *spdm_context, spdm_context->error_state = LIBSPDM_STATUS_ERROR_DEVICE_NO_CAPABILITIES; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CACHE_CAP)) { end_session_attributes = 0; } - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_END_SESSION; spdm_request.header.param1 = end_session_attributes; spdm_request.header.param2 = 0; @@ -73,8 +73,8 @@ return_status try_spdm_send_receive_end_session(spdm_context_t *spdm_context, return status; } - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - SPDM_END_SESSION); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + SPDM_END_SESSION); spdm_response_size = sizeof(spdm_response); zero_mem(&spdm_response, sizeof(spdm_response)); @@ -117,7 +117,7 @@ return_status try_spdm_send_receive_end_session(spdm_context_t *spdm_context, return RETURN_SUCCESS; } -return_status spdm_send_receive_end_session(spdm_context_t *spdm_context, +return_status spdm_send_receive_end_session(libspdm_context_t *spdm_context, uint32_t session_id, uint8_t end_session_attributes) { diff --git a/library/spdm_requester_lib/libspdm_req_finish.c b/library/spdm_requester_lib/libspdm_req_finish.c index c1345b141bb..83002c96cc1 100644 --- a/library/spdm_requester_lib/libspdm_req_finish.c +++ b/library/spdm_requester_lib/libspdm_req_finish.c @@ -33,7 +33,7 @@ typedef struct { * @retval RETURN_SUCCESS The FINISH is sent and the FINISH_RSP is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status try_spdm_send_receive_finish(spdm_context_t *spdm_context, +return_status try_spdm_send_receive_finish(libspdm_context_t *spdm_context, uint32_t session_id, uint8_t req_slot_id_param) { @@ -44,13 +44,13 @@ return_status try_spdm_send_receive_finish(spdm_context_t *spdm_context, uintn hmac_size; spdm_finish_response_mine_t spdm_response; uintn spdm_response_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t *ptr; bool result; uint8_t th2_hash_data[64]; libspdm_session_state_t session_state; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP)) { @@ -94,7 +94,7 @@ return_status try_spdm_send_receive_finish(spdm_context_t *spdm_context, spdm_context->error_state = LIBSPDM_STATUS_ERROR_DEVICE_NO_CAPABILITIES; - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_FINISH; if (session_info->mut_auth_requested) { spdm_request.header.param1 = @@ -137,8 +137,8 @@ return_status try_spdm_send_receive_finish(spdm_context_t *spdm_context, goto error; } if (session_info->mut_auth_requested) { - result = spdm_generate_finish_req_signature(spdm_context, - session_info, ptr); + result = libspdm_generate_finish_req_signature(spdm_context, + session_info, ptr); if (!result) { status = RETURN_SECURITY_VIOLATION; goto error; @@ -152,7 +152,7 @@ return_status try_spdm_send_receive_finish(spdm_context_t *spdm_context, ptr += signature_size; } - result = spdm_generate_finish_req_hmac(spdm_context, session_info, ptr); + result = libspdm_generate_finish_req_hmac(spdm_context, session_info, ptr); if (!result) { status = RETURN_SECURITY_VIOLATION; goto error; @@ -170,8 +170,8 @@ return_status try_spdm_send_receive_finish(spdm_context_t *spdm_context, goto error; } - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - SPDM_FINISH); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + SPDM_FINISH); spdm_response_size = sizeof(spdm_response); zero_mem(&spdm_response, sizeof(spdm_response)); @@ -210,7 +210,7 @@ return_status try_spdm_send_receive_finish(spdm_context_t *spdm_context, goto error; } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { @@ -229,15 +229,15 @@ return_status try_spdm_send_receive_finish(spdm_context_t *spdm_context, goto error; } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { DEBUG((DEBUG_INFO, "verify_data (0x%x):\n", hmac_size)); - internal_dump_hex(spdm_response.verify_data, hmac_size); - result = spdm_verify_finish_rsp_hmac(spdm_context, session_info, - spdm_response.verify_data, - hmac_size); + libspdm_internal_dump_hex(spdm_response.verify_data, hmac_size); + result = libspdm_verify_finish_rsp_hmac(spdm_context, session_info, + spdm_response.verify_data, + hmac_size); if (!result) { status = RETURN_SECURITY_VIOLATION; goto error; @@ -281,7 +281,7 @@ return_status try_spdm_send_receive_finish(spdm_context_t *spdm_context, return status; } -return_status spdm_send_receive_finish(spdm_context_t *spdm_context, +return_status spdm_send_receive_finish(libspdm_context_t *spdm_context, uint32_t session_id, uint8_t req_slot_id_param) { diff --git a/library/spdm_requester_lib/libspdm_req_get_capabilities.c b/library/spdm_requester_lib/libspdm_req_get_capabilities.c index f479b0785ba..fe79d7498a4 100644 --- a/library/spdm_requester_lib/libspdm_req_get_capabilities.c +++ b/library/spdm_requester_lib/libspdm_req_get_capabilities.c @@ -97,7 +97,7 @@ bool spdm_check_response_flag_compability(uint32_t capabilities_flag, * @retval RETURN_SUCCESS The GET_CAPABILITIES is sent and the CAPABILITIES is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status try_spdm_get_capabilities(spdm_context_t *spdm_context) +return_status try_spdm_get_capabilities(libspdm_context_t *spdm_context) { return_status status; spdm_get_capabilities_request_t spdm_request; @@ -105,15 +105,15 @@ return_status try_spdm_get_capabilities(spdm_context_t *spdm_context) spdm_capabilities_response_t spdm_response; uintn spdm_response_size; - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - SPDM_GET_CAPABILITIES); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + SPDM_GET_CAPABILITIES); if (spdm_context->connection_info.connection_state != LIBSPDM_CONNECTION_STATE_AFTER_VERSION) { return RETURN_UNSUPPORTED; } zero_mem(&spdm_request, sizeof(spdm_request)); - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); if (spdm_request.header.spdm_version >= SPDM_MESSAGE_VERSION_12) { spdm_request_size = sizeof(spdm_request); } else if (spdm_request.header.spdm_version >= SPDM_MESSAGE_VERSION_11) { @@ -230,7 +230,7 @@ return_status try_spdm_get_capabilities(spdm_context_t *spdm_context) * @retval RETURN_SUCCESS The GET_CAPABILITIES is sent and the CAPABILITIES is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_get_capabilities(spdm_context_t *spdm_context) +return_status spdm_get_capabilities(libspdm_context_t *spdm_context) { uintn retry; return_status status; diff --git a/library/spdm_requester_lib/libspdm_req_get_certificate.c b/library/spdm_requester_lib/libspdm_req_get_certificate.c index 15ab1ba9379..c108f6f6680 100644 --- a/library/spdm_requester_lib/libspdm_req_get_certificate.c +++ b/library/spdm_requester_lib/libspdm_req_get_certificate.c @@ -54,21 +54,21 @@ return_status try_spdm_get_certificate(void *context, uint8_t slot_id, spdm_get_certificate_request_t spdm_request; spdm_certificate_response_max_t spdm_response; uintn spdm_response_size; - large_managed_buffer_t certificate_chain_buffer; - spdm_context_t *spdm_context; + libspdm_large_managed_buffer_t certificate_chain_buffer; + libspdm_context_t *spdm_context; uint16_t total_responder_cert_chain_buffer_length; uintn cert_chain_capacity; ASSERT(slot_id < SPDM_MAX_SLOT_COUNT); spdm_context = context; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_CAP)) { return RETURN_UNSUPPORTED; } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - SPDM_GET_CERTIFICATE); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + SPDM_GET_CERTIFICATE); if ((spdm_context->connection_info.connection_state != LIBSPDM_CONNECTION_STATE_NEGOTIATED) && (spdm_context->connection_info.connection_state != @@ -78,20 +78,20 @@ return_status try_spdm_get_certificate(void *context, uint8_t slot_id, return RETURN_UNSUPPORTED; } - init_managed_buffer(&certificate_chain_buffer, - LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&certificate_chain_buffer, + LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); length = MIN(length, LIBSPDM_MAX_CERT_CHAIN_BLOCK_LEN); spdm_context->error_state = LIBSPDM_STATUS_ERROR_DEVICE_NO_CAPABILITIES; do { spdm_request.header.spdm_version = - spdm_get_connection_version (spdm_context); + libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_GET_CERTIFICATE; spdm_request.header.param1 = slot_id; spdm_request.header.param2 = 0; - spdm_request.offset = (uint16_t)get_managed_buffer_size( + spdm_request.offset = (uint16_t)libspdm_get_managed_buffer_size( &certificate_chain_buffer); if (spdm_request.offset == 0) { spdm_request.length = length; @@ -189,12 +189,12 @@ return_status try_spdm_get_certificate(void *context, uint8_t slot_id, DEBUG((DEBUG_INFO, "Certificate (offset 0x%x, size 0x%x):\n", spdm_request.offset, spdm_response.portion_length)); - internal_dump_hex(spdm_response.cert_chain, - spdm_response.portion_length); + libspdm_internal_dump_hex(spdm_response.cert_chain, + spdm_response.portion_length); - status = append_managed_buffer(&certificate_chain_buffer, - spdm_response.cert_chain, - spdm_response.portion_length); + status = libspdm_append_managed_buffer(&certificate_chain_buffer, + spdm_response.cert_chain, + spdm_response.portion_length); if (RETURN_ERROR(status)) { status = RETURN_SECURITY_VIOLATION; goto done; @@ -206,8 +206,8 @@ return_status try_spdm_get_certificate(void *context, uint8_t slot_id, if (spdm_context->local_context.verify_peer_spdm_cert_chain != NULL) { status = spdm_context->local_context.verify_peer_spdm_cert_chain ( - spdm_context, slot_id, get_managed_buffer_size(&certificate_chain_buffer), - get_managed_buffer(&certificate_chain_buffer), + spdm_context, slot_id, libspdm_get_managed_buffer_size(&certificate_chain_buffer), + libspdm_get_managed_buffer(&certificate_chain_buffer), trust_anchor, trust_anchor_size); if (RETURN_ERROR(status)) { spdm_context->error_state = @@ -216,9 +216,9 @@ return_status try_spdm_get_certificate(void *context, uint8_t slot_id, goto done; } } else { - result = spdm_verify_peer_cert_chain_buffer( - spdm_context, get_managed_buffer(&certificate_chain_buffer), - get_managed_buffer_size(&certificate_chain_buffer), + result = libspdm_verify_peer_cert_chain_buffer( + spdm_context, libspdm_get_managed_buffer(&certificate_chain_buffer), + libspdm_get_managed_buffer_size(&certificate_chain_buffer), trust_anchor, trust_anchor_size); if (!result) { spdm_context->error_state = @@ -230,16 +230,16 @@ return_status try_spdm_get_certificate(void *context, uint8_t slot_id, #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT spdm_context->connection_info.peer_used_cert_chain_buffer_size = - get_managed_buffer_size(&certificate_chain_buffer); + libspdm_get_managed_buffer_size(&certificate_chain_buffer); copy_mem(spdm_context->connection_info.peer_used_cert_chain_buffer, sizeof(spdm_context->connection_info.peer_used_cert_chain_buffer), - get_managed_buffer(&certificate_chain_buffer), - get_managed_buffer_size(&certificate_chain_buffer)); + libspdm_get_managed_buffer(&certificate_chain_buffer), + libspdm_get_managed_buffer_size(&certificate_chain_buffer)); #else result = libspdm_hash_all( spdm_context->connection_info.algorithm.base_hash_algo, - get_managed_buffer(&certificate_chain_buffer), - get_managed_buffer_size(&certificate_chain_buffer), + libspdm_get_managed_buffer(&certificate_chain_buffer), + libspdm_get_managed_buffer_size(&certificate_chain_buffer), spdm_context->connection_info.peer_used_cert_chain_buffer_hash); if (!result) { spdm_context->error_state = @@ -254,8 +254,8 @@ return_status try_spdm_get_certificate(void *context, uint8_t slot_id, result = libspdm_get_leaf_cert_public_key_from_cert_chain( spdm_context->connection_info.algorithm.base_hash_algo, spdm_context->connection_info.algorithm.base_asym_algo, - get_managed_buffer(&certificate_chain_buffer), - get_managed_buffer_size(&certificate_chain_buffer), + libspdm_get_managed_buffer(&certificate_chain_buffer), + libspdm_get_managed_buffer_size(&certificate_chain_buffer), &spdm_context->connection_info.peer_used_leaf_cert_public_key); if (!result) { spdm_context->error_state = @@ -269,19 +269,19 @@ return_status try_spdm_get_certificate(void *context, uint8_t slot_id, if (cert_chain_size != NULL) { if (*cert_chain_size < - get_managed_buffer_size(&certificate_chain_buffer)) { - *cert_chain_size = get_managed_buffer_size( + libspdm_get_managed_buffer_size(&certificate_chain_buffer)) { + *cert_chain_size = libspdm_get_managed_buffer_size( &certificate_chain_buffer); return RETURN_BUFFER_TOO_SMALL; } cert_chain_capacity = *cert_chain_size; *cert_chain_size = - get_managed_buffer_size(&certificate_chain_buffer); + libspdm_get_managed_buffer_size(&certificate_chain_buffer); if (cert_chain != NULL) { copy_mem(cert_chain, cert_chain_capacity, - get_managed_buffer(&certificate_chain_buffer), - get_managed_buffer_size(&certificate_chain_buffer)); + libspdm_get_managed_buffer(&certificate_chain_buffer), + libspdm_get_managed_buffer_size(&certificate_chain_buffer)); } } @@ -380,7 +380,7 @@ return_status libspdm_get_certificate_choose_length(void *context, uintn *cert_chain_size, void *cert_chain) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn retry; return_status status; @@ -429,7 +429,7 @@ return_status libspdm_get_certificate_choose_length_ex(void *context, void **trust_anchor, uintn *trust_anchor_size) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn retry; return_status status; diff --git a/library/spdm_requester_lib/libspdm_req_get_digests.c b/library/spdm_requester_lib/libspdm_req_get_digests.c index ccda867d383..6b6212b48bc 100644 --- a/library/spdm_requester_lib/libspdm_req_get_digests.c +++ b/library/spdm_requester_lib/libspdm_req_get_digests.c @@ -45,16 +45,16 @@ return_status try_spdm_get_digest(void *context, uint8_t *slot_mask, uintn digest_size; uintn digest_count; uintn index; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_CAP)) { return RETURN_UNSUPPORTED; } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - SPDM_GET_DIGESTS); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + SPDM_GET_DIGESTS); if (spdm_context->connection_info.connection_state != LIBSPDM_CONNECTION_STATE_NEGOTIATED) { return RETURN_UNSUPPORTED; @@ -62,7 +62,7 @@ return_status try_spdm_get_digest(void *context, uint8_t *slot_mask, spdm_context->error_state = LIBSPDM_STATUS_ERROR_DEVICE_NO_CAPABILITIES; - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_GET_DIGESTS; spdm_request.header.param1 = 0; spdm_request.header.param2 = 0; @@ -140,12 +140,12 @@ return_status try_spdm_get_digest(void *context, uint8_t *slot_mask, for (index = 0; index < digest_count; index++) { DEBUG((DEBUG_INFO, "digest (0x%x) - ", index)); - internal_dump_data(&spdm_response.digest[digest_size * index], - digest_size); + libspdm_internal_dump_data(&spdm_response.digest[digest_size * index], + digest_size); DEBUG((DEBUG_INFO, "\n")); } - result = spdm_verify_peer_digests( + result = libspdm_verify_peer_digests( spdm_context, spdm_response.digest, digest_count); if (!result) { spdm_context->error_state = @@ -185,7 +185,7 @@ return_status try_spdm_get_digest(void *context, uint8_t *slot_mask, return_status libspdm_get_digest(void *context, uint8_t *slot_mask, void *total_digest_buffer) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn retry; return_status status; diff --git a/library/spdm_requester_lib/libspdm_req_get_measurements.c b/library/spdm_requester_lib/libspdm_req_get_measurements.c index 4ea068c0517..3bc319880b0 100644 --- a/library/spdm_requester_lib/libspdm_req_get_measurements.c +++ b/library/spdm_requester_lib/libspdm_req_get_measurements.c @@ -78,18 +78,18 @@ return_status try_spdm_get_measurement(void *context, const uint32_t *session_id void *opaque; void *signature; uintn signature_size; - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; spdm_context = context; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) { return RETURN_UNSUPPORTED; } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - SPDM_GET_MEASUREMENTS); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + SPDM_GET_MEASUREMENTS); if (session_id == NULL) { if (spdm_context->connection_info.connection_state < LIBSPDM_CONNECTION_STATE_AUTHENTICATED) { @@ -124,7 +124,7 @@ return_status try_spdm_get_measurement(void *context, const uint32_t *session_id spdm_context->error_state = LIBSPDM_STATUS_ERROR_DEVICE_NO_CAPABILITIES; - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP_NO_SIG) && (request_attribute != 0)) { @@ -139,7 +139,7 @@ return_status try_spdm_get_measurement(void *context, const uint32_t *session_id signature_size = 0; } - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_GET_MEASUREMENTS; spdm_request.header.param1 = request_attribute; spdm_request.header.param2 = measurement_operation; @@ -161,7 +161,7 @@ return_status try_spdm_get_measurement(void *context, const uint32_t *session_id requester_nonce_in, SPDM_NONCE_SIZE); } DEBUG((DEBUG_INFO, "ClientNonce - ")); - internal_dump_data(spdm_request.nonce, SPDM_NONCE_SIZE); + libspdm_internal_dump_data(spdm_request.nonce, SPDM_NONCE_SIZE); DEBUG((DEBUG_INFO, "\n")); spdm_request.slot_id_param = slot_id_param; @@ -276,7 +276,7 @@ return_status try_spdm_get_measurement(void *context, const uint32_t *session_id ptr = measurement_record_data + measurement_record_data_length; nonce = ptr; DEBUG((DEBUG_INFO, "nonce (0x%x) - ", SPDM_NONCE_SIZE)); - internal_dump_data(nonce, SPDM_NONCE_SIZE); + libspdm_internal_dump_data(nonce, SPDM_NONCE_SIZE); DEBUG((DEBUG_INFO, "\n")); ptr += SPDM_NONCE_SIZE; if (responder_nonce != NULL) { @@ -319,13 +319,13 @@ return_status try_spdm_get_measurement(void *context, const uint32_t *session_id opaque = ptr; ptr += opaque_length; DEBUG((DEBUG_INFO, "opaque (0x%x):\n", opaque_length)); - internal_dump_hex(opaque, opaque_length); + libspdm_internal_dump_hex(opaque, opaque_length); signature = ptr; DEBUG((DEBUG_INFO, "signature (0x%x):\n", signature_size)); - internal_dump_hex(signature, signature_size); + libspdm_internal_dump_hex(signature, signature_size); - result = spdm_verify_measurement_signature( + result = libspdm_verify_measurement_signature( spdm_context, session_info, signature, signature_size); if (!result) { spdm_context->error_state = @@ -345,7 +345,7 @@ return_status try_spdm_get_measurement(void *context, const uint32_t *session_id nonce = ptr; DEBUG((DEBUG_INFO, "nonce (0x%x) - ", SPDM_NONCE_SIZE)); - internal_dump_data(nonce, SPDM_NONCE_SIZE); + libspdm_internal_dump_data(nonce, SPDM_NONCE_SIZE); DEBUG((DEBUG_INFO, "\n")); ptr += SPDM_NONCE_SIZE; if (responder_nonce != NULL) { @@ -507,7 +507,7 @@ return_status libspdm_get_measurement(void *context, const uint32_t *session_id, uint32_t *measurement_record_length, void *measurement_record) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn retry; return_status status; @@ -564,7 +564,7 @@ return_status libspdm_get_measurement_ex(void *context, const uint32_t *session_ const void *requester_nonce_in, void *requester_nonce, void *responder_nonce) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn retry; return_status status; diff --git a/library/spdm_requester_lib/libspdm_req_get_version.c b/library/spdm_requester_lib/libspdm_req_get_version.c index 232d857a391..03cbd0f9400 100644 --- a/library/spdm_requester_lib/libspdm_req_get_version.c +++ b/library/spdm_requester_lib/libspdm_req_get_version.c @@ -24,7 +24,7 @@ typedef struct { * @retval RETURN_SUCCESS The GET_VERSION is sent and the VERSION is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status try_spdm_get_version(spdm_context_t *spdm_context, +return_status try_spdm_get_version(libspdm_context_t *spdm_context, uint8_t *version_number_entry_count, spdm_version_number_t *version_number_entry) { @@ -49,8 +49,8 @@ return_status try_spdm_get_version(spdm_context_t *spdm_context, libspdm_reset_context(spdm_context); - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request.header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request.header.request_response_code); status = spdm_send_spdm_request(spdm_context, NULL, sizeof(spdm_request), &spdm_request); @@ -117,13 +117,13 @@ return_status try_spdm_get_version(spdm_context_t *spdm_context, return RETURN_SECURITY_VIOLATION; } - /* spdm_negotiate_connection_version will change the spdm_response. + /* libspdm_negotiate_connection_version will change the spdm_response. * It must be done after append_message_a.*/ - result = spdm_negotiate_connection_version(&common_version, - spdm_context->local_context.version.spdm_version, - spdm_context->local_context.version.spdm_version_count, - spdm_response.version_number_entry, - spdm_response.version_number_entry_count); + result = libspdm_negotiate_connection_version(&common_version, + spdm_context->local_context.version.spdm_version, + spdm_context->local_context.version.spdm_version_count, + spdm_response.version_number_entry, + spdm_response.version_number_entry_count); if (result == false) { libspdm_reset_message_a(spdm_context); return RETURN_DEVICE_ERROR; @@ -145,7 +145,7 @@ return_status try_spdm_get_version(spdm_context_t *spdm_context, spdm_response.version_number_entry_count * sizeof(spdm_version_number_t), spdm_response.version_number_entry, spdm_response.version_number_entry_count * sizeof(spdm_version_number_t)); - spdm_version_number_sort (version_number_entry, *version_number_entry_count); + libspdm_version_number_sort (version_number_entry, *version_number_entry_count); } } @@ -164,7 +164,7 @@ return_status try_spdm_get_version(spdm_context_t *spdm_context, * @retval RETURN_SUCCESS The GET_VERSION is sent and the VERSION is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_get_version(spdm_context_t *spdm_context, +return_status spdm_get_version(libspdm_context_t *spdm_context, uint8_t *version_number_entry_count, spdm_version_number_t *version_number_entry) { diff --git a/library/spdm_requester_lib/libspdm_req_handle_error_response.c b/library/spdm_requester_lib/libspdm_req_handle_error_response.c index 6f166a49f10..c955782f1ea 100644 --- a/library/spdm_requester_lib/libspdm_req_handle_error_response.c +++ b/library/spdm_requester_lib/libspdm_req_handle_error_response.c @@ -21,7 +21,7 @@ * @retval RETURN_SUCCESS The RESPOND_IF_READY is sent and an expected SPDM response is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_requester_respond_if_ready(spdm_context_t *spdm_context, +return_status spdm_requester_respond_if_ready(libspdm_context_t *spdm_context, const uint32_t *session_id, uintn *response_size, void *response, @@ -35,7 +35,7 @@ return_status spdm_requester_respond_if_ready(spdm_context_t *spdm_context, spdm_response = response; spdm_context->crypto_request = true; - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_RESPOND_IF_READY; spdm_request.header.param1 = spdm_context->error_data.request_code; spdm_request.header.param2 = spdm_context->error_data.token; @@ -80,7 +80,7 @@ return_status spdm_requester_respond_if_ready(spdm_context_t *spdm_context, return_status spdm_handle_simple_error_response(void *context, uint8_t error_code) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; @@ -119,7 +119,7 @@ return_status spdm_handle_simple_error_response(void *context, * @retval RETURN_SUCCESS The RESPOND_IF_READY is sent and an expected SPDM response is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_handle_response_not_ready(spdm_context_t *spdm_context, +return_status spdm_handle_response_not_ready(libspdm_context_t *spdm_context, const uint32_t *session_id, uintn *response_size, void *response, @@ -186,7 +186,7 @@ return_status spdm_handle_response_not_ready(spdm_context_t *spdm_context, * @retval RETURN_SECURITY_VIOLATION The error code is DECRYPT_ERROR and session_id is NOT NULL. **/ return_status spdm_handle_error_response_main( - spdm_context_t *spdm_context, const uint32_t *session_id, + libspdm_context_t *spdm_context, const uint32_t *session_id, uintn *response_size, void *response, uint8_t original_request_code, uint8_t expected_response_code, uintn expected_response_size) diff --git a/library/spdm_requester_lib/libspdm_req_heartbeat.c b/library/spdm_requester_lib/libspdm_req_heartbeat.c index e28099f39a6..261ccc81825 100644 --- a/library/spdm_requester_lib/libspdm_req_heartbeat.c +++ b/library/spdm_requester_lib/libspdm_req_heartbeat.c @@ -32,12 +32,12 @@ return_status try_spdm_heartbeat(void *context, uint32_t session_id) spdm_heartbeat_request_t spdm_request; spdm_heartbeat_response_mine_t spdm_response; uintn spdm_response_size; - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; spdm_context = context; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HBEAT_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HBEAT_CAP)) { @@ -60,7 +60,7 @@ return_status try_spdm_heartbeat(void *context, uint32_t session_id) return RETURN_UNSUPPORTED; } - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_HEARTBEAT; spdm_request.header.param1 = 0; spdm_request.header.param2 = 0; @@ -70,8 +70,8 @@ return_status try_spdm_heartbeat(void *context, uint32_t session_id) return status; } - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - SPDM_HEARTBEAT); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + SPDM_HEARTBEAT); spdm_response_size = sizeof(spdm_response); zero_mem(&spdm_response, sizeof(spdm_response)); @@ -109,7 +109,7 @@ return_status libspdm_heartbeat(void *context, uint32_t session_id) { uintn retry; return_status status; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; spdm_context->crypto_request = true; diff --git a/library/spdm_requester_lib/libspdm_req_key_exchange.c b/library/spdm_requester_lib/libspdm_req_key_exchange.c index b19139a411b..aed4c70c4d6 100644 --- a/library/spdm_requester_lib/libspdm_req_key_exchange.c +++ b/library/spdm_requester_lib/libspdm_req_key_exchange.c @@ -56,7 +56,7 @@ typedef struct { * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ return_status try_spdm_send_receive_key_exchange( - spdm_context_t *spdm_context, uint8_t measurement_hash_type, + libspdm_context_t *spdm_context, uint8_t measurement_hash_type, uint8_t slot_id, uint8_t session_policy, uint32_t *session_id, uint8_t *heartbeat_period, uint8_t *req_slot_id_param, void *measurement_hash, @@ -82,20 +82,20 @@ return_status try_spdm_send_receive_key_exchange( void *dhe_context; uint16_t req_session_id; uint16_t rsp_session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uintn opaque_key_exchange_req_size; uint8_t th1_hash_data[64]; ASSERT((slot_id < SPDM_MAX_SLOT_COUNT) || (slot_id == 0xff)); - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP)) { return RETURN_UNSUPPORTED; } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - SPDM_KEY_EXCHANGE); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + SPDM_KEY_EXCHANGE); if (spdm_context->connection_info.connection_state < LIBSPDM_CONNECTION_STATE_NEGOTIATED) { return RETURN_UNSUPPORTED; @@ -108,7 +108,7 @@ return_status try_spdm_send_receive_key_exchange( spdm_context->error_state = LIBSPDM_STATUS_ERROR_DEVICE_NO_CAPABILITIES; - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_KEY_EXCHANGE; spdm_request.header.param1 = measurement_hash_type; spdm_request.header.param2 = slot_id; @@ -122,14 +122,14 @@ return_status try_spdm_send_receive_key_exchange( } DEBUG((DEBUG_INFO, "ClientRandomData (0x%x) - ", SPDM_RANDOM_DATA_SIZE)); - internal_dump_data(spdm_request.random_data, SPDM_RANDOM_DATA_SIZE); + libspdm_internal_dump_data(spdm_request.random_data, SPDM_RANDOM_DATA_SIZE); DEBUG((DEBUG_INFO, "\n")); if (requester_random != NULL) { copy_mem(requester_random, SPDM_RANDOM_DATA_SIZE, spdm_request.random_data, SPDM_RANDOM_DATA_SIZE); } - req_session_id = spdm_allocate_req_session_id(spdm_context); + req_session_id = libspdm_allocate_req_session_id(spdm_context); spdm_request.req_session_id = req_session_id; if (spdm_request.header.spdm_version >= SPDM_MESSAGE_VERSION_12) { spdm_request.session_policy = session_policy; @@ -158,14 +158,14 @@ return_status try_spdm_send_receive_key_exchange( return RETURN_DEVICE_ERROR; } DEBUG((DEBUG_INFO, "ClientKey (0x%x):\n", dhe_key_size)); - internal_dump_hex(ptr, dhe_key_size); + libspdm_internal_dump_hex(ptr, dhe_key_size); ptr += dhe_key_size; opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - status = spdm_build_opaque_data_supported_version_data( + status = libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ASSERT_RETURN_ERROR(status); ptr += opaque_key_exchange_req_size; @@ -235,7 +235,7 @@ return_status try_spdm_send_receive_key_exchange( return RETURN_DEVICE_ERROR; } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HBEAT_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HBEAT_CAP)) { @@ -293,12 +293,12 @@ return_status try_spdm_send_receive_key_exchange( signature_size = libspdm_get_asym_signature_size( spdm_context->connection_info.algorithm.base_asym_algo); - measurement_summary_hash_size = spdm_get_measurement_summary_hash_size( + measurement_summary_hash_size = libspdm_get_measurement_summary_hash_size( spdm_context, true, measurement_hash_type); hmac_size = libspdm_get_hash_size( spdm_context->connection_info.algorithm.base_hash_algo); - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { @@ -318,7 +318,7 @@ return_status try_spdm_send_receive_key_exchange( DEBUG((DEBUG_INFO, "ServerRandomData (0x%x) - ", SPDM_RANDOM_DATA_SIZE)); - internal_dump_data(spdm_response.random_data, SPDM_RANDOM_DATA_SIZE); + libspdm_internal_dump_data(spdm_response.random_data, SPDM_RANDOM_DATA_SIZE); DEBUG((DEBUG_INFO, "\n")); if (responder_random != NULL) { copy_mem(responder_random, SPDM_RANDOM_DATA_SIZE, @@ -326,7 +326,7 @@ return_status try_spdm_send_receive_key_exchange( } DEBUG((DEBUG_INFO, "ServerKey (0x%x):\n", dhe_key_size)); - internal_dump_hex(spdm_response.exchange_data, dhe_key_size); + libspdm_internal_dump_hex(spdm_response.exchange_data, dhe_key_size); ptr = spdm_response.exchange_data; ptr += dhe_key_size; @@ -334,8 +334,8 @@ return_status try_spdm_send_receive_key_exchange( measurement_summary_hash = ptr; DEBUG((DEBUG_INFO, "measurement_summary_hash (0x%x) - ", measurement_summary_hash_size)); - internal_dump_data(measurement_summary_hash, - measurement_summary_hash_size); + libspdm_internal_dump_data(measurement_summary_hash, + measurement_summary_hash_size); DEBUG((DEBUG_INFO, "\n")); ptr += measurement_summary_hash_size; @@ -359,7 +359,7 @@ return_status try_spdm_send_receive_key_exchange( dhe_context); return RETURN_DEVICE_ERROR; } - status = spdm_process_opaque_data_version_selection_data( + status = libspdm_process_opaque_data_version_selection_data( spdm_context, opaque_length, ptr); if (RETURN_ERROR(status)) { libspdm_free_session_id(spdm_context, *session_id); @@ -402,9 +402,9 @@ return_status try_spdm_send_receive_key_exchange( signature = ptr; DEBUG((DEBUG_INFO, "signature (0x%x):\n", signature_size)); - internal_dump_hex(signature, signature_size); + libspdm_internal_dump_hex(signature, signature_size); ptr += signature_size; - result = spdm_verify_key_exchange_rsp_signature( + result = libspdm_verify_key_exchange_rsp_signature( spdm_context, session_info, signature, signature_size); if (!result) { libspdm_free_session_id(spdm_context, *session_id); @@ -455,14 +455,14 @@ return_status try_spdm_send_receive_key_exchange( return RETURN_SECURITY_VIOLATION; } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { verify_data = ptr; DEBUG((DEBUG_INFO, "verify_data (0x%x):\n", hmac_size)); - internal_dump_hex(verify_data, hmac_size); - result = spdm_verify_key_exchange_rsp_hmac( + libspdm_internal_dump_hex(verify_data, hmac_size); + result = libspdm_verify_key_exchange_rsp_hmac( spdm_context, session_info, verify_data, hmac_size); if (!result) { libspdm_free_session_id(spdm_context, *session_id); @@ -511,7 +511,7 @@ return_status try_spdm_send_receive_key_exchange( * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ return_status spdm_send_receive_key_exchange( - spdm_context_t *spdm_context, uint8_t measurement_hash_type, + libspdm_context_t *spdm_context, uint8_t measurement_hash_type, uint8_t slot_id, uint8_t session_policy, uint32_t *session_id, uint8_t *heartbeat_period, uint8_t *req_slot_id_param, void *measurement_hash) @@ -553,7 +553,7 @@ return_status spdm_send_receive_key_exchange( * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ return_status spdm_send_receive_key_exchange_ex( - spdm_context_t *spdm_context, uint8_t measurement_hash_type, + libspdm_context_t *spdm_context, uint8_t measurement_hash_type, uint8_t slot_id, uint8_t session_policy, uint32_t *session_id, uint8_t *heartbeat_period, uint8_t *req_slot_id_param, void *measurement_hash, diff --git a/library/spdm_requester_lib/libspdm_req_key_update.c b/library/spdm_requester_lib/libspdm_req_key_update.c index 1e7def7355c..6bceb78376f 100644 --- a/library/spdm_requester_lib/libspdm_req_key_update.c +++ b/library/spdm_requester_lib/libspdm_req_key_update.c @@ -40,12 +40,12 @@ return_status try_spdm_key_update(void *context, uint32_t session_id, spdm_key_update_request_t spdm_request; spdm_key_update_response_mine_t spdm_response; uintn spdm_response_size; - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; spdm_context = context; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_UPD_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_UPD_CAP)) { @@ -68,14 +68,14 @@ return_status try_spdm_key_update(void *context, uint32_t session_id, return RETURN_UNSUPPORTED; } - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - SPDM_KEY_UPDATE); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + SPDM_KEY_UPDATE); if(!(*key_updated)) { /* Update key*/ - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_KEY_UPDATE; if (single_direction) { spdm_request.header.param1 = @@ -211,7 +211,7 @@ return_status try_spdm_key_update(void *context, uint32_t session_id, /* Verify key*/ - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_KEY_UPDATE; spdm_request.header.param1 = SPDM_KEY_UPDATE_OPERATIONS_TABLE_VERIFY_NEW_KEY; @@ -268,7 +268,7 @@ return_status try_spdm_key_update(void *context, uint32_t session_id, return_status libspdm_key_update(void *context, uint32_t session_id, bool single_direction) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn retry; return_status status; bool key_updated; diff --git a/library/spdm_requester_lib/libspdm_req_negotiate_algorithms.c b/library/spdm_requester_lib/libspdm_req_negotiate_algorithms.c index b630a51b09b..31b6e9497dc 100644 --- a/library/spdm_requester_lib/libspdm_req_negotiate_algorithms.c +++ b/library/spdm_requester_lib/libspdm_req_negotiate_algorithms.c @@ -53,7 +53,7 @@ typedef struct { * @retval RETURN_SUCCESS The NEGOTIATE_ALGORITHMS is sent and the ALGORITHMS is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status try_spdm_negotiate_algorithms(spdm_context_t *spdm_context) +return_status try_spdm_negotiate_algorithms(libspdm_context_t *spdm_context) { return_status status; spdm_negotiate_algorithms_request_mine_t spdm_request; @@ -65,8 +65,8 @@ return_status try_spdm_negotiate_algorithms(spdm_context_t *spdm_context) uint8_t fixed_alg_size; uint8_t ext_alg_count; - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - SPDM_NEGOTIATE_ALGORITHMS); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + SPDM_NEGOTIATE_ALGORITHMS); if (spdm_context->connection_info.connection_state != LIBSPDM_CONNECTION_STATE_AFTER_CAPABILITIES) { @@ -74,7 +74,7 @@ return_status try_spdm_negotiate_algorithms(spdm_context_t *spdm_context) } zero_mem(&spdm_request, sizeof(spdm_request)); - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); if (spdm_request.header.spdm_version >= SPDM_MESSAGE_VERSION_11) { spdm_request.length = sizeof(spdm_request); spdm_request.header.param1 = @@ -237,7 +237,7 @@ return_status try_spdm_negotiate_algorithms(spdm_context_t *spdm_context) spdm_context->connection_info.algorithm.base_hash_algo = spdm_response.base_hash_sel; - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) { if (spdm_context->connection_info.algorithm.measurement_spec != @@ -260,7 +260,7 @@ return_status try_spdm_negotiate_algorithms(spdm_context_t *spdm_context) spdm_context->local_context.algorithm.base_hash_algo) == 0) { return RETURN_SECURITY_VIOLATION; } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP)) { algo_size = libspdm_get_asym_signature_size( @@ -312,7 +312,7 @@ return_status try_spdm_negotiate_algorithms(spdm_context_t *spdm_context) sizeof(uint32_t) * ext_alg_count); } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP)) { @@ -327,11 +327,11 @@ return_status try_spdm_negotiate_algorithms(spdm_context_t *spdm_context) return RETURN_SECURITY_VIOLATION; } } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP) || - spdm_is_capabilities_flag_supported( + libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP)) { @@ -346,7 +346,7 @@ return_status try_spdm_negotiate_algorithms(spdm_context_t *spdm_context) return RETURN_SECURITY_VIOLATION; } } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP)) { @@ -361,11 +361,11 @@ return_status try_spdm_negotiate_algorithms(spdm_context_t *spdm_context) return RETURN_SECURITY_VIOLATION; } } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP) || - spdm_is_capabilities_flag_supported( + libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP)) { @@ -406,7 +406,7 @@ return_status try_spdm_negotiate_algorithms(spdm_context_t *spdm_context) * @retval RETURN_SUCCESS The NEGOTIATE_ALGORITHMS is sent and the ALGORITHMS is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_negotiate_algorithms(spdm_context_t *spdm_context) +return_status spdm_negotiate_algorithms(libspdm_context_t *spdm_context) { uintn retry; return_status status; diff --git a/library/spdm_requester_lib/libspdm_req_psk_exchange.c b/library/spdm_requester_lib/libspdm_req_psk_exchange.c index f244f8c8ec3..8e7847a32fd 100644 --- a/library/spdm_requester_lib/libspdm_req_psk_exchange.c +++ b/library/spdm_requester_lib/libspdm_req_psk_exchange.c @@ -60,7 +60,7 @@ typedef struct { * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ return_status try_spdm_send_receive_psk_exchange( - spdm_context_t *spdm_context, uint8_t measurement_hash_type, + libspdm_context_t *spdm_context, uint8_t measurement_hash_type, uint8_t session_policy, uint32_t *session_id, uint8_t *heartbeat_period, void *measurement_hash, @@ -84,7 +84,7 @@ return_status try_spdm_send_receive_psk_exchange( uint8_t *verify_data; uint16_t req_session_id; uint16_t rsp_session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uintn opaque_psk_exchange_req_size; uint8_t th1_hash_data[64]; uint8_t th2_hash_data[64]; @@ -92,14 +92,14 @@ return_status try_spdm_send_receive_psk_exchange( /* Check capabilities even if GET_CAPABILITIES is not sent. * Assuming capabilities are provisioned.*/ - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP)) { return RETURN_UNSUPPORTED; } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - SPDM_PSK_EXCHANGE); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + SPDM_PSK_EXCHANGE); if (spdm_context->connection_info.connection_state < LIBSPDM_CONNECTION_STATE_NEGOTIATED) { return RETURN_UNSUPPORTED; @@ -107,7 +107,7 @@ return_status try_spdm_send_receive_psk_exchange( { /* Double check if algorithm has been provisioned, because ALGORITHM might be skipped.*/ - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) { if (spdm_context->connection_info.algorithm @@ -135,7 +135,7 @@ return_status try_spdm_send_receive_psk_exchange( spdm_context->error_state = LIBSPDM_STATUS_ERROR_DEVICE_NO_CAPABILITIES; - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_PSK_EXCHANGE; spdm_request.header.param1 = measurement_hash_type; if (spdm_request.header.spdm_version >= SPDM_MESSAGE_VERSION_12) { @@ -152,10 +152,10 @@ return_status try_spdm_send_receive_psk_exchange( spdm_request.context_length = (uint16_t)requester_context_in_size; } opaque_psk_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); spdm_request.opaque_length = (uint16_t)opaque_psk_exchange_req_size; - req_session_id = spdm_allocate_req_session_id(spdm_context); + req_session_id = libspdm_allocate_req_session_id(spdm_context); spdm_request.req_session_id = req_session_id; ptr = spdm_request.psk_hint; @@ -163,7 +163,7 @@ return_status try_spdm_send_receive_psk_exchange( spdm_context->local_context.psk_hint, spdm_context->local_context.psk_hint_size); DEBUG((DEBUG_INFO, "psk_hint (0x%x) - ", spdm_request.psk_hint_length)); - internal_dump_data(ptr, spdm_request.psk_hint_length); + libspdm_internal_dump_data(ptr, spdm_request.psk_hint_length); DEBUG((DEBUG_INFO, "\n")); ptr += spdm_request.psk_hint_length; @@ -177,7 +177,7 @@ return_status try_spdm_send_receive_psk_exchange( } DEBUG((DEBUG_INFO, "ClientContextData (0x%x) - ", spdm_request.context_length)); - internal_dump_data(ptr, spdm_request.context_length); + libspdm_internal_dump_data(ptr, spdm_request.context_length); DEBUG((DEBUG_INFO, "\n")); if (requester_context != NULL) { if (*requester_context_size > spdm_request.context_length) { @@ -188,7 +188,7 @@ return_status try_spdm_send_receive_psk_exchange( } ptr += spdm_request.context_length; - status = spdm_build_opaque_data_supported_version_data( + status = libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_psk_exchange_req_size, ptr); ASSERT_RETURN_ERROR(status); ptr += opaque_psk_exchange_req_size; @@ -233,7 +233,7 @@ return_status try_spdm_send_receive_psk_exchange( return RETURN_DEVICE_ERROR; } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HBEAT_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HBEAT_CAP)) { @@ -251,7 +251,7 @@ return_status try_spdm_send_receive_psk_exchange( return RETURN_DEVICE_ERROR; } - measurement_summary_hash_size = spdm_get_measurement_summary_hash_size( + measurement_summary_hash_size = libspdm_get_measurement_summary_hash_size( spdm_context, true, measurement_hash_type); hmac_size = libspdm_get_hash_size( spdm_context->connection_info.algorithm.base_hash_algo); @@ -266,7 +266,7 @@ return_status try_spdm_send_receive_psk_exchange( ptr = (uint8_t *)&spdm_response + sizeof(spdm_psk_exchange_response_t) + measurement_summary_hash_size + spdm_response.context_length; - status = spdm_process_opaque_data_version_selection_data( + status = libspdm_process_opaque_data_version_selection_data( spdm_context, spdm_response.opaque_length, ptr); if (RETURN_ERROR(status)) { libspdm_free_session_id(spdm_context, *session_id); @@ -282,8 +282,8 @@ return_status try_spdm_send_receive_psk_exchange( measurement_summary_hash = ptr; DEBUG((DEBUG_INFO, "measurement_summary_hash (0x%x) - ", measurement_summary_hash_size)); - internal_dump_data(measurement_summary_hash, - measurement_summary_hash_size); + libspdm_internal_dump_data(measurement_summary_hash, + measurement_summary_hash_size); DEBUG((DEBUG_INFO, "\n")); ptr += measurement_summary_hash_size; @@ -294,7 +294,7 @@ return_status try_spdm_send_receive_psk_exchange( } DEBUG((DEBUG_INFO, "ServerContextData (0x%x) - ", spdm_response.context_length)); - internal_dump_data(ptr, spdm_response.context_length); + libspdm_internal_dump_data(ptr, spdm_response.context_length); DEBUG((DEBUG_INFO, "\n")); if (responder_context != NULL) { if (*responder_context_size > spdm_response.context_length) { @@ -342,9 +342,9 @@ return_status try_spdm_send_receive_psk_exchange( verify_data = ptr; DEBUG((DEBUG_INFO, "verify_data (0x%x):\n", hmac_size)); - internal_dump_hex(verify_data, hmac_size); - result = spdm_verify_psk_exchange_rsp_hmac(spdm_context, session_info, - verify_data, hmac_size); + libspdm_internal_dump_hex(verify_data, hmac_size); + result = libspdm_verify_psk_exchange_rsp_hmac(spdm_context, session_info, + verify_data, hmac_size); if (!result) { libspdm_free_session_id(spdm_context, *session_id); spdm_context->error_state = @@ -370,7 +370,7 @@ return_status try_spdm_send_receive_psk_exchange( LIBSPDM_SESSION_STATE_HANDSHAKING); spdm_context->error_state = LIBSPDM_STATUS_SUCCESS; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP_RESPONDER_WITH_CONTEXT)) { /* No need to send PSK_FINISH, enter application phase directly.*/ @@ -411,7 +411,7 @@ return_status try_spdm_send_receive_psk_exchange( * @retval RETURN_SUCCESS The PSK_EXCHANGE is sent and the PSK_EXCHANGE_RSP is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_send_receive_psk_exchange(spdm_context_t *spdm_context, +return_status spdm_send_receive_psk_exchange(libspdm_context_t *spdm_context, uint8_t measurement_hash_type, uint8_t session_policy, uint32_t *session_id, @@ -460,7 +460,7 @@ return_status spdm_send_receive_psk_exchange(spdm_context_t *spdm_context, * @retval RETURN_SUCCESS The PSK_EXCHANGE is sent and the PSK_EXCHANGE_RSP is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status spdm_send_receive_psk_exchange_ex(spdm_context_t *spdm_context, +return_status spdm_send_receive_psk_exchange_ex(libspdm_context_t *spdm_context, uint8_t measurement_hash_type, uint8_t session_policy, uint32_t *session_id, diff --git a/library/spdm_requester_lib/libspdm_req_psk_finish.c b/library/spdm_requester_lib/libspdm_req_psk_finish.c index 376490b68e2..299ff8c2646 100644 --- a/library/spdm_requester_lib/libspdm_req_psk_finish.c +++ b/library/spdm_requester_lib/libspdm_req_psk_finish.c @@ -31,7 +31,7 @@ typedef struct { * @retval RETURN_SUCCESS The PSK_FINISH is sent and the PSK_FINISH_RSP is received. * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ -return_status try_spdm_send_receive_psk_finish(spdm_context_t *spdm_context, +return_status try_spdm_send_receive_psk_finish(libspdm_context_t *spdm_context, uint32_t session_id) { return_status status; @@ -40,12 +40,12 @@ return_status try_spdm_send_receive_psk_finish(spdm_context_t *spdm_context, uintn hmac_size; spdm_psk_finish_response_max_t spdm_response; uintn spdm_response_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t th2_hash_data[64]; libspdm_session_state_t session_state; bool result; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP_RESPONDER_WITH_CONTEXT)) { @@ -75,7 +75,7 @@ return_status try_spdm_send_receive_psk_finish(spdm_context_t *spdm_context, spdm_context->error_state = LIBSPDM_STATUS_ERROR_DEVICE_NO_CAPABILITIES; - spdm_request.header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request.header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request.header.request_response_code = SPDM_PSK_FINISH; spdm_request.header.param1 = 0; spdm_request.header.param2 = 0; @@ -91,8 +91,8 @@ return_status try_spdm_send_receive_psk_finish(spdm_context_t *spdm_context, goto error; } - result = spdm_generate_psk_exchange_req_hmac(spdm_context, session_info, - spdm_request.verify_data); + result = libspdm_generate_psk_exchange_req_hmac(spdm_context, session_info, + spdm_request.verify_data); if (!result) { status = RETURN_SECURITY_VIOLATION; goto error; @@ -113,8 +113,8 @@ return_status try_spdm_send_receive_psk_finish(spdm_context_t *spdm_context, goto error; } - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - SPDM_PSK_FINISH); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + SPDM_PSK_FINISH); spdm_response_size = sizeof(spdm_response); zero_mem(&spdm_response, sizeof(spdm_response)); @@ -189,7 +189,7 @@ return_status try_spdm_send_receive_psk_finish(spdm_context_t *spdm_context, return status; } -return_status spdm_send_receive_psk_finish(spdm_context_t *spdm_context, +return_status spdm_send_receive_psk_finish(libspdm_context_t *spdm_context, uint32_t session_id) { uintn retry; diff --git a/library/spdm_requester_lib/libspdm_req_send_receive.c b/library/spdm_requester_lib/libspdm_req_send_receive.c index 421ff5678cf..95ea9af1046 100644 --- a/library/spdm_requester_lib/libspdm_req_send_receive.c +++ b/library/spdm_requester_lib/libspdm_req_send_receive.c @@ -26,7 +26,7 @@ return_status libspdm_send_request(void *context, const uint32_t *session_id, bool is_app_message, uintn request_size, const void *request) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; uint8_t message[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn message_size; @@ -36,7 +36,7 @@ return_status libspdm_send_request(void *context, const uint32_t *session_id, DEBUG((DEBUG_INFO, "spdm_send_spdm_request[%x] (0x%x): \n", (session_id != NULL) ? *session_id : 0x0, request_size)); - internal_dump_hex(request, request_size); + libspdm_internal_dump_hex(request, request_size); message_size = sizeof(message); status = spdm_context->transport_encode_message( @@ -81,7 +81,7 @@ return_status libspdm_receive_response(void *context, const uint32_t *session_id uintn *response_size, void *response) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; uint8_t message[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn message_size; @@ -156,7 +156,7 @@ return_status libspdm_receive_response(void *context, const uint32_t *session_id "spdm_receive_spdm_response[%x] status - %p\n", (session_id != NULL) ? *session_id : 0x0, status)); } else { - internal_dump_hex(response, *response_size); + libspdm_internal_dump_hex(response, *response_size); } return status; @@ -183,11 +183,11 @@ return_status libspdm_receive_response(void *context, const uint32_t *session_id * @retval RETURN_SUCCESS The SPDM request is sent successfully. * @retval RETURN_DEVICE_ERROR A device error occurs when the SPDM request is sent to the device. **/ -return_status spdm_send_spdm_request(spdm_context_t *spdm_context, +return_status spdm_send_spdm_request(libspdm_context_t *spdm_context, const uint32_t *session_id, uintn request_size, const void *request) { - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; if ((spdm_context->connection_info.capability.data_transfer_size != 0) && @@ -196,7 +196,7 @@ return_status spdm_send_spdm_request(spdm_context_t *spdm_context, } if ((session_id != NULL) && - spdm_is_capabilities_flag_supported( + libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { @@ -233,16 +233,16 @@ return_status spdm_send_spdm_request(spdm_context_t *spdm_context, * @retval RETURN_SUCCESS The SPDM response is received successfully. * @retval RETURN_DEVICE_ERROR A device error occurs when the SPDM response is received from the device. **/ -return_status spdm_receive_spdm_response(spdm_context_t *spdm_context, +return_status spdm_receive_spdm_response(libspdm_context_t *spdm_context, const uint32_t *session_id, uintn *response_size, void *response) { - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; if ((session_id != NULL) && - spdm_is_capabilities_flag_supported( + libspdm_is_capabilities_flag_supported( spdm_context, true, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { diff --git a/library/spdm_responder_lib/libspdm_rsp_algorithms.c b/library/spdm_responder_lib/libspdm_rsp_algorithms.c index 1146663b4e1..70cab52670e 100644 --- a/library/spdm_responder_lib/libspdm_rsp_algorithms.c +++ b/library/spdm_responder_lib/libspdm_rsp_algorithms.c @@ -228,7 +228,7 @@ return_status spdm_get_response_algorithms(void *context, spdm_algorithms_response_mine_t *spdm_response; spdm_negotiate_algorithms_common_struct_table_t *struct_table; uintn index; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; uint32_t algo_size; uint8_t fixed_alg_size; @@ -248,7 +248,7 @@ return_status spdm_get_response_algorithms(void *context, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP) == 0) ^ (spdm_context->local_context.algorithm.measurement_hash_algo == 0))); - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -349,8 +349,8 @@ return_status spdm_get_response_algorithms(void *context, } spdm_request_size = request_size; - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); ASSERT(*response_size >= sizeof(spdm_algorithms_response_mine_t)); *response_size = sizeof(spdm_algorithms_response_mine_t); @@ -496,7 +496,7 @@ return_status spdm_get_response_algorithms(void *context, spdm_context->connection_info.algorithm.base_hash_algo = spdm_response->base_hash_sel; - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) { if (spdm_context->connection_info.algorithm.measurement_spec != @@ -521,7 +521,7 @@ return_status spdm_get_response_algorithms(void *context, SPDM_ERROR_CODE_INVALID_REQUEST, 0, response_size, response); } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP)) { algo_size = libspdm_get_asym_signature_size( @@ -549,7 +549,7 @@ return_status spdm_get_response_algorithms(void *context, spdm_context->connection_info.algorithm.other_params_support = 0; } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP)) { @@ -563,11 +563,11 @@ return_status spdm_get_response_algorithms(void *context, response_size, response); } } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCRYPT_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCRYPT_CAP) || - spdm_is_capabilities_flag_supported( + libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MAC_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MAC_CAP)) { @@ -581,7 +581,7 @@ return_status spdm_get_response_algorithms(void *context, response_size, response); } } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP)) { @@ -595,11 +595,11 @@ return_status spdm_get_response_algorithms(void *context, response_size, response); } } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP) || - spdm_is_capabilities_flag_supported( + libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP)) { diff --git a/library/spdm_responder_lib/libspdm_rsp_capabilities.c b/library/spdm_responder_lib/libspdm_rsp_capabilities.c index aaf1c28b5b9..2ce9637d516 100644 --- a/library/spdm_responder_lib/libspdm_rsp_capabilities.c +++ b/library/spdm_responder_lib/libspdm_rsp_capabilities.c @@ -17,7 +17,7 @@ * @retval True The received SPDM version is valid. * @retval False The received SPDM version is invalid. **/ -bool spdm_check_request_version_compability(spdm_context_t *spdm_context, uint8_t version) +bool spdm_check_request_version_compability(libspdm_context_t *spdm_context, uint8_t version) { uint8_t local_ver; uintn index; @@ -25,7 +25,7 @@ bool spdm_check_request_version_compability(spdm_context_t *spdm_context, uint8_ for (index = 0; index < spdm_context->local_context.version.spdm_version_count; index++) { - local_ver = spdm_get_version_from_version_number( + local_ver = libspdm_get_version_from_version_number( spdm_context->local_context.version.spdm_version[index]); if (local_ver == version) { spdm_context->connection_info.version = version << SPDM_VERSION_NUMBER_SHIFT_BIT; @@ -150,7 +150,7 @@ return_status spdm_get_response_capabilities(void *context, { const spdm_get_capabilities_request_t *spdm_request; spdm_capabilities_response_t *spdm_response; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; spdm_context = context; @@ -205,8 +205,8 @@ return_status spdm_get_response_capabilities(void *context, response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); ASSERT(*response_size >= sizeof(spdm_capabilities_response_t)); *response_size = sizeof(spdm_capabilities_response_t); diff --git a/library/spdm_responder_lib/libspdm_rsp_certificate.c b/library/spdm_responder_lib/libspdm_rsp_certificate.c index 59e78242de9..a49fc161176 100644 --- a/library/spdm_responder_lib/libspdm_rsp_certificate.c +++ b/library/spdm_responder_lib/libspdm_rsp_certificate.c @@ -36,14 +36,14 @@ return_status spdm_get_response_certificate(void *context, uint16_t length; uintn remainder_length; uint8_t slot_id; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; uintn response_capacity; spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -64,7 +64,7 @@ return_status spdm_get_response_certificate(void *context, SPDM_ERROR_CODE_UNEXPECTED_REQUEST, 0, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_CAP)) { return libspdm_generate_error_response( @@ -106,8 +106,8 @@ return_status spdm_get_response_certificate(void *context, response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); if ((uintn)(offset + length) > spdm_context->local_context diff --git a/library/spdm_responder_lib/libspdm_rsp_challenge_auth.c b/library/spdm_responder_lib/libspdm_rsp_challenge_auth.c index 29c01aedd3a..6a490cc4381 100644 --- a/library/spdm_responder_lib/libspdm_rsp_challenge_auth.c +++ b/library/spdm_responder_lib/libspdm_rsp_challenge_auth.c @@ -41,7 +41,7 @@ return_status spdm_get_response_challenge_auth(void *context, uintn measurement_summary_hash_size; uint8_t *ptr; uintn total_size; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t auth_attribute; return_status status; uintn response_capacity; @@ -49,7 +49,7 @@ return_status spdm_get_response_challenge_auth(void *context, spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -60,7 +60,7 @@ return_status spdm_get_response_challenge_auth(void *context, spdm_request->header.request_response_code, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CHAL_CAP)) { return libspdm_generate_error_response( @@ -79,8 +79,8 @@ return_status spdm_get_response_challenge_auth(void *context, SPDM_ERROR_CODE_INVALID_REQUEST, 0, response_size, response); } - if (!spdm_is_capabilities_flag_supported(spdm_context, false, 0, - SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP) && + if (!libspdm_is_capabilities_flag_supported(spdm_context, false, 0, + SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP) && spdm_request->header.param2 > 0) { return libspdm_generate_error_response (spdm_context, SPDM_ERROR_CODE_UNSUPPORTED_REQUEST, SPDM_CHALLENGE, response_size, response); @@ -99,7 +99,7 @@ return_status spdm_get_response_challenge_auth(void *context, spdm_context->connection_info.algorithm.base_asym_algo); hash_size = libspdm_get_hash_size( spdm_context->connection_info.algorithm.base_hash_algo); - measurement_summary_hash_size = spdm_get_measurement_summary_hash_size( + measurement_summary_hash_size = libspdm_get_measurement_summary_hash_size( spdm_context, false, spdm_request->header.param2); if ((measurement_summary_hash_size == 0) && (spdm_request->header.param2 != SPDM_CHALLENGE_REQUEST_NO_MEASUREMENT_SUMMARY_HASH)) { @@ -120,24 +120,24 @@ return_status spdm_get_response_challenge_auth(void *context, zero_mem(response, *response_size); spdm_response = response; - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); spdm_response->header.spdm_version = spdm_request->header.spdm_version; spdm_response->header.request_response_code = SPDM_CHALLENGE_AUTH; auth_attribute = (uint8_t)(slot_id & 0xF); if (spdm_request->header.spdm_version >= SPDM_MESSAGE_VERSION_11) { - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP) && - spdm_is_capabilities_flag_supported( + libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CHAL_CAP, 0) && - (spdm_is_capabilities_flag_supported( + (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CERT_CAP, 0) || - spdm_is_capabilities_flag_supported( + libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PUB_KEY_ID_CAP, 0))) { if (spdm_context->local_context.basic_mut_auth_requested) { @@ -160,7 +160,7 @@ return_status spdm_get_response_challenge_auth(void *context, } ptr = (void *)(spdm_response + 1); - result = spdm_generate_cert_chain_hash(spdm_context, slot_id, ptr); + result = libspdm_generate_cert_chain_hash(spdm_context, slot_id, ptr); if (!result) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_UNSPECIFIED, 0, @@ -176,7 +176,7 @@ return_status spdm_get_response_challenge_auth(void *context, } ptr += SPDM_NONCE_SIZE; - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) { result = libspdm_generate_measurement_summary_hash( @@ -229,8 +229,8 @@ return_status spdm_get_response_challenge_auth(void *context, SPDM_ERROR_CODE_UNSPECIFIED, 0, response_size, response); } - result = spdm_generate_challenge_auth_signature(spdm_context, false, - ptr); + result = libspdm_generate_challenge_auth_signature(spdm_context, false, + ptr); if (!result) { libspdm_reset_message_c(spdm_context); return libspdm_generate_error_response( diff --git a/library/spdm_responder_lib/libspdm_rsp_communication.c b/library/spdm_responder_lib/libspdm_rsp_communication.c index e786ee7535e..99287e062f5 100644 --- a/library/spdm_responder_lib/libspdm_rsp_communication.c +++ b/library/spdm_responder_lib/libspdm_rsp_communication.c @@ -42,7 +42,7 @@ return_status libspdm_process_message(void *context, uint32_t **session_id, uintn *response_size) { return_status status; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; bool is_app_message; uint32_t tmp_session_id; uint32_t *session_id_ptr; @@ -88,7 +88,7 @@ return_status libspdm_process_message(void *context, uint32_t **session_id, return_status libspdm_responder_dispatch_message(void *context) { return_status status; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t *request; uintn request_size; uint8_t *response; diff --git a/library/spdm_responder_lib/libspdm_rsp_digests.c b/library/spdm_responder_lib/libspdm_rsp_digests.c index 21e854702fa..dd1e1f7ac02 100644 --- a/library/spdm_responder_lib/libspdm_rsp_digests.c +++ b/library/spdm_responder_lib/libspdm_rsp_digests.c @@ -36,14 +36,14 @@ return_status spdm_get_response_digests(void *context, uintn request_size, bool no_local_cert_chain; uint32_t hash_size; uint8_t *digest; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; bool result; spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -54,7 +54,7 @@ return_status spdm_get_response_digests(void *context, uintn request_size, spdm_request->header.request_response_code, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_CAP)) { return libspdm_generate_error_response( @@ -74,8 +74,8 @@ return_status spdm_get_response_digests(void *context, uintn request_size, response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); no_local_cert_chain = true; for (index = 0; index < SPDM_MAX_SLOT_COUNT; index++) { @@ -116,8 +116,8 @@ return_status spdm_get_response_digests(void *context, uintn request_size, 0, response_size, response); } spdm_response->header.param2 |= (1 << index); - result = spdm_generate_cert_chain_hash(spdm_context, index, - &digest[hash_size * index]); + result = libspdm_generate_cert_chain_hash(spdm_context, index, + &digest[hash_size * index]); if (!result) { return libspdm_generate_error_response( spdm_context, SPDM_ERROR_CODE_UNSPECIFIED, diff --git a/library/spdm_responder_lib/libspdm_rsp_encap_challenge.c b/library/spdm_responder_lib/libspdm_rsp_encap_challenge.c index 934b4f8edde..5227e2018a8 100644 --- a/library/spdm_responder_lib/libspdm_rsp_encap_challenge.c +++ b/library/spdm_responder_lib/libspdm_rsp_encap_challenge.c @@ -21,7 +21,7 @@ * @retval RETURN_SUCCESS The encapsulated request is returned. * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ -return_status spdm_get_encap_request_challenge(spdm_context_t *spdm_context, +return_status spdm_get_encap_request_challenge(libspdm_context_t *spdm_context, uintn *encap_request_size, void *encap_request) { @@ -30,7 +30,7 @@ return_status spdm_get_encap_request_challenge(spdm_context_t *spdm_context, spdm_context->encap_context.last_encap_request_size = 0; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CHAL_CAP, 0)) { return RETURN_DEVICE_ERROR; @@ -41,7 +41,7 @@ return_status spdm_get_encap_request_challenge(spdm_context_t *spdm_context, spdm_request = encap_request; - spdm_request->header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request->header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request->header.request_response_code = SPDM_CHALLENGE; spdm_request->header.param1 = spdm_context->encap_context.req_slot_id; spdm_request->header.param2 = @@ -50,11 +50,11 @@ return_status spdm_get_encap_request_challenge(spdm_context_t *spdm_context, return RETURN_DEVICE_ERROR; } DEBUG((DEBUG_INFO, "Encap ClientNonce - ")); - internal_dump_data(spdm_request->nonce, SPDM_NONCE_SIZE); + libspdm_internal_dump_data(spdm_request->nonce, SPDM_NONCE_SIZE); DEBUG((DEBUG_INFO, "\n")); - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); /* Cache data*/ @@ -87,7 +87,7 @@ return_status spdm_get_encap_request_challenge(spdm_context_t *spdm_context, * @retval RETURN_SECURITY_VIOLATION Any verification fails. **/ return_status spdm_process_encap_response_challenge_auth( - spdm_context_t *spdm_context, uintn encap_response_size, + libspdm_context_t *spdm_context, uintn encap_response_size, const void *encap_response, bool *need_continue) { bool result; @@ -115,7 +115,7 @@ return_status spdm_process_encap_response_challenge_auth( if (spdm_response_size < sizeof(spdm_message_header_t)) { return RETURN_DEVICE_ERROR; } - if (spdm_response->header.spdm_version != spdm_get_connection_version (spdm_context)) { + if (spdm_response->header.spdm_version != libspdm_get_connection_version (spdm_context)) { return RETURN_DEVICE_ERROR; } if (spdm_response->header.request_response_code == SPDM_ERROR) { @@ -169,10 +169,10 @@ return_status spdm_process_encap_response_challenge_auth( cert_chain_hash = ptr; ptr += hash_size; DEBUG((DEBUG_INFO, "Encap cert_chain_hash (0x%x) - ", hash_size)); - internal_dump_data(cert_chain_hash, hash_size); + libspdm_internal_dump_data(cert_chain_hash, hash_size); DEBUG((DEBUG_INFO, "\n")); - result = spdm_verify_certificate_chain_hash(spdm_context, - cert_chain_hash, hash_size); + result = libspdm_verify_certificate_chain_hash(spdm_context, + cert_chain_hash, hash_size); if (!result) { spdm_context->encap_context.error_state = LIBSPDM_STATUS_ERROR_CERTIFICATE_FAILURE; @@ -181,7 +181,7 @@ return_status spdm_process_encap_response_challenge_auth( nonce = ptr; DEBUG((DEBUG_INFO, "Encap nonce (0x%x) - ", SPDM_NONCE_SIZE)); - internal_dump_data(nonce, SPDM_NONCE_SIZE); + libspdm_internal_dump_data(nonce, SPDM_NONCE_SIZE); DEBUG((DEBUG_INFO, "\n")); ptr += SPDM_NONCE_SIZE; @@ -189,8 +189,8 @@ return_status spdm_process_encap_response_challenge_auth( ptr += measurement_summary_hash_size; DEBUG((DEBUG_INFO, "Encap measurement_summary_hash (0x%x) - ", measurement_summary_hash_size)); - internal_dump_data(measurement_summary_hash, - measurement_summary_hash_size); + libspdm_internal_dump_data(measurement_summary_hash, + measurement_summary_hash_size); DEBUG((DEBUG_INFO, "\n")); opaque_length = *(uint16_t *)ptr; @@ -218,12 +218,12 @@ return_status spdm_process_encap_response_challenge_auth( opaque = ptr; ptr += opaque_length; DEBUG((DEBUG_INFO, "Encap opaque (0x%x):\n", opaque_length)); - internal_dump_hex(opaque, opaque_length); + libspdm_internal_dump_hex(opaque, opaque_length); signature = ptr; DEBUG((DEBUG_INFO, "Encap signature (0x%x):\n", signature_size)); - internal_dump_hex(signature, signature_size); - result = spdm_verify_challenge_auth_signature( + libspdm_internal_dump_hex(signature, signature_size); + result = libspdm_verify_challenge_auth_signature( spdm_context, false, signature, signature_size); if (!result) { spdm_context->encap_context.error_state = diff --git a/library/spdm_responder_lib/libspdm_rsp_encap_get_certificate.c b/library/spdm_responder_lib/libspdm_rsp_encap_get_certificate.c index bace01e2da9..9643b23271c 100644 --- a/library/spdm_responder_lib/libspdm_rsp_encap_get_certificate.c +++ b/library/spdm_responder_lib/libspdm_rsp_encap_get_certificate.c @@ -22,7 +22,7 @@ * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ return_status -spdm_get_encap_request_get_certificate(spdm_context_t *spdm_context, +spdm_get_encap_request_get_certificate(libspdm_context_t *spdm_context, uintn *encap_request_size, void *encap_request) { @@ -31,7 +31,7 @@ spdm_get_encap_request_get_certificate(spdm_context_t *spdm_context, spdm_context->encap_context.last_encap_request_size = 0; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CERT_CAP, 0)) { return RETURN_DEVICE_ERROR; @@ -42,18 +42,18 @@ spdm_get_encap_request_get_certificate(spdm_context_t *spdm_context, spdm_request = encap_request; - spdm_request->header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request->header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request->header.request_response_code = SPDM_GET_CERTIFICATE; spdm_request->header.param1 = spdm_context->encap_context.req_slot_id; spdm_request->header.param2 = 0; - spdm_request->offset = (uint16_t)get_managed_buffer_size( + spdm_request->offset = (uint16_t)libspdm_get_managed_buffer_size( &spdm_context->encap_context.certificate_chain_buffer); spdm_request->length = LIBSPDM_MAX_CERT_CHAIN_BLOCK_LEN; DEBUG((DEBUG_INFO, "request (offset 0x%x, size 0x%x):\n", spdm_request->offset, spdm_request->length)); - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); /* Cache data*/ @@ -86,7 +86,7 @@ spdm_get_encap_request_get_certificate(spdm_context_t *spdm_context, * @retval RETURN_SECURITY_VIOLATION Any verification fails. **/ return_status spdm_process_encap_response_certificate( - spdm_context_t *spdm_context, uintn encap_response_size, + libspdm_context_t *spdm_context, uintn encap_response_size, const void *encap_response, bool *need_continue) { const spdm_certificate_response_t *spdm_response; @@ -104,7 +104,7 @@ return_status spdm_process_encap_response_certificate( if (spdm_response_size < sizeof(spdm_message_header_t)) { return RETURN_DEVICE_ERROR; } - if (spdm_response->header.spdm_version != spdm_get_connection_version (spdm_context)) { + if (spdm_response->header.spdm_version != libspdm_get_connection_version (spdm_context)) { return RETURN_DEVICE_ERROR; } if (spdm_response->header.request_response_code == SPDM_ERROR) { @@ -125,7 +125,7 @@ return_status spdm_process_encap_response_certificate( (spdm_response->portion_length == 0)) { return RETURN_DEVICE_ERROR; } - request_offset = (uint16_t)get_managed_buffer_size( + request_offset = (uint16_t)libspdm_get_managed_buffer_size( &spdm_context->encap_context.certificate_chain_buffer); if (request_offset == 0) { spdm_context->encap_context.cert_chain_total_len = spdm_response->portion_length + @@ -154,13 +154,13 @@ return_status spdm_process_encap_response_certificate( } DEBUG((DEBUG_INFO, "Certificate (offset 0x%x, size 0x%x):\n", - get_managed_buffer_size( + libspdm_get_managed_buffer_size( &spdm_context->encap_context.certificate_chain_buffer), spdm_response->portion_length)); - internal_dump_hex((void *)(spdm_response + 1), - spdm_response->portion_length); + libspdm_internal_dump_hex((void *)(spdm_response + 1), + spdm_response->portion_length); - status = append_managed_buffer( + status = libspdm_append_managed_buffer( &spdm_context->encap_context.certificate_chain_buffer, (void *)(spdm_response + 1), spdm_response->portion_length); if (RETURN_ERROR(status)) { @@ -177,9 +177,9 @@ return_status spdm_process_encap_response_certificate( if (spdm_context->local_context.verify_peer_spdm_cert_chain != NULL) { status = spdm_context->local_context.verify_peer_spdm_cert_chain ( spdm_context, spdm_context->encap_context.req_slot_id, - get_managed_buffer_size( + libspdm_get_managed_buffer_size( &spdm_context->encap_context.certificate_chain_buffer), - get_managed_buffer( + libspdm_get_managed_buffer( &spdm_context->encap_context.certificate_chain_buffer), NULL, NULL); if (RETURN_ERROR(status)) { @@ -188,11 +188,11 @@ return_status spdm_process_encap_response_certificate( return RETURN_SECURITY_VIOLATION; } } else { - result = spdm_verify_peer_cert_chain_buffer( + result = libspdm_verify_peer_cert_chain_buffer( spdm_context, - get_managed_buffer( + libspdm_get_managed_buffer( &spdm_context->encap_context.certificate_chain_buffer), - get_managed_buffer_size( + libspdm_get_managed_buffer_size( &spdm_context->encap_context.certificate_chain_buffer), NULL, NULL); if (!result) { @@ -204,20 +204,20 @@ return_status spdm_process_encap_response_certificate( #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT spdm_context->connection_info.peer_used_cert_chain_buffer_size = - get_managed_buffer_size( + libspdm_get_managed_buffer_size( &spdm_context->encap_context.certificate_chain_buffer); copy_mem(spdm_context->connection_info.peer_used_cert_chain_buffer, sizeof(spdm_context->connection_info.peer_used_cert_chain_buffer), - get_managed_buffer( + libspdm_get_managed_buffer( &spdm_context->encap_context.certificate_chain_buffer), - get_managed_buffer_size( + libspdm_get_managed_buffer_size( &spdm_context->encap_context.certificate_chain_buffer)); #else result = libspdm_hash_all( spdm_context->connection_info.algorithm.base_hash_algo, - get_managed_buffer( + libspdm_get_managed_buffer( &spdm_context->encap_context.certificate_chain_buffer), - get_managed_buffer_size( + libspdm_get_managed_buffer_size( &spdm_context->encap_context.certificate_chain_buffer), spdm_context->connection_info.peer_used_cert_chain_buffer_hash); if (!result) { @@ -231,9 +231,9 @@ return_status spdm_process_encap_response_certificate( result = libspdm_get_leaf_cert_public_key_from_cert_chain( spdm_context->connection_info.algorithm.base_hash_algo, spdm_context->connection_info.algorithm.req_base_asym_alg, - get_managed_buffer( + libspdm_get_managed_buffer( &spdm_context->encap_context.certificate_chain_buffer), - get_managed_buffer_size( + libspdm_get_managed_buffer_size( &spdm_context->encap_context.certificate_chain_buffer), &spdm_context->connection_info.peer_used_leaf_cert_public_key); if (!result) { diff --git a/library/spdm_responder_lib/libspdm_rsp_encap_get_digests.c b/library/spdm_responder_lib/libspdm_rsp_encap_get_digests.c index eb0cf9e24d6..cd67ceba5a2 100644 --- a/library/spdm_responder_lib/libspdm_rsp_encap_get_digests.c +++ b/library/spdm_responder_lib/libspdm_rsp_encap_get_digests.c @@ -22,7 +22,7 @@ * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ return_status -spdm_get_encap_request_get_digest(spdm_context_t *spdm_context, +spdm_get_encap_request_get_digest(libspdm_context_t *spdm_context, uintn *encap_request_size, void *encap_request) { @@ -31,7 +31,7 @@ spdm_get_encap_request_get_digest(spdm_context_t *spdm_context, spdm_context->encap_context.last_encap_request_size = 0; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CERT_CAP, 0)) { return RETURN_DEVICE_ERROR; @@ -42,10 +42,10 @@ spdm_get_encap_request_get_digest(spdm_context_t *spdm_context, spdm_request = encap_request; - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); - spdm_request->header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request->header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request->header.request_response_code = SPDM_GET_DIGESTS; spdm_request->header.param1 = 0; spdm_request->header.param2 = 0; @@ -81,7 +81,7 @@ spdm_get_encap_request_get_digest(spdm_context_t *spdm_context, * @retval RETURN_SECURITY_VIOLATION Any verification fails. **/ return_status spdm_process_encap_response_digest( - spdm_context_t *spdm_context, uintn encap_response_size, + libspdm_context_t *spdm_context, uintn encap_response_size, const void *encap_response, bool *need_continue) { bool result; @@ -99,7 +99,7 @@ return_status spdm_process_encap_response_digest( if (spdm_response_size < sizeof(spdm_message_header_t)) { return RETURN_DEVICE_ERROR; } - if (spdm_response->header.spdm_version != spdm_get_connection_version (spdm_context)) { + if (spdm_response->header.spdm_version != libspdm_get_connection_version (spdm_context)) { return RETURN_DEVICE_ERROR; } if (spdm_response->header.request_response_code == SPDM_ERROR) { @@ -146,12 +146,12 @@ return_status spdm_process_encap_response_digest( digest = (void *)(spdm_response + 1); for (index = 0; index < digest_count; index++) { DEBUG((DEBUG_INFO, "digest (0x%x) - ", index)); - internal_dump_data(&digest[digest_size * index], digest_size); + libspdm_internal_dump_data(&digest[digest_size * index], digest_size); DEBUG((DEBUG_INFO, "\n")); } - result = spdm_verify_peer_digests(spdm_context, digest, - digest_count); + result = libspdm_verify_peer_digests(spdm_context, digest, + digest_count); if (!result) { return RETURN_SECURITY_VIOLATION; } diff --git a/library/spdm_responder_lib/libspdm_rsp_encap_key_update.c b/library/spdm_responder_lib/libspdm_rsp_encap_key_update.c index d5d09d1ec2a..dfa0289186e 100644 --- a/library/spdm_responder_lib/libspdm_rsp_encap_key_update.c +++ b/library/spdm_responder_lib/libspdm_rsp_encap_key_update.c @@ -20,19 +20,19 @@ * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ return_status -spdm_get_encap_request_key_update(spdm_context_t *spdm_context, +spdm_get_encap_request_key_update(libspdm_context_t *spdm_context, uintn *encap_request_size, void *encap_request) { spdm_key_update_request_t *spdm_request; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; return_status status; spdm_context->encap_context.last_encap_request_size = 0; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_UPD_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_UPD_CAP)) { @@ -59,11 +59,11 @@ spdm_get_encap_request_key_update(spdm_context_t *spdm_context, spdm_request = encap_request; - spdm_request->header.spdm_version = spdm_get_connection_version (spdm_context); + spdm_request->header.spdm_version = libspdm_get_connection_version (spdm_context); spdm_request->header.request_response_code = SPDM_KEY_UPDATE; - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + spdm_request->header.request_response_code); if (spdm_context->encap_context.last_encap_request_header .request_response_code != SPDM_KEY_UPDATE) { @@ -126,14 +126,14 @@ spdm_get_encap_request_key_update(spdm_context_t *spdm_context, * @retval RETURN_SECURITY_VIOLATION Any verification fails. **/ return_status spdm_process_encap_response_key_update( - spdm_context_t *spdm_context, uintn encap_response_size, + libspdm_context_t *spdm_context, uintn encap_response_size, const void *encap_response, bool *need_continue) { spdm_key_update_request_t *spdm_request; const spdm_key_update_response_t *spdm_response; uintn spdm_response_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; if (!spdm_context->last_spdm_request_session_id_valid) { @@ -157,7 +157,7 @@ return_status spdm_process_encap_response_key_update( spdm_response = encap_response; spdm_response_size = encap_response_size; - if (spdm_response->header.spdm_version != spdm_get_connection_version (spdm_context)) { + if (spdm_response->header.spdm_version != libspdm_get_connection_version (spdm_context)) { return RETURN_DEVICE_ERROR; } diff --git a/library/spdm_responder_lib/libspdm_rsp_encap_response.c b/library/spdm_responder_lib/libspdm_rsp_encap_response.c index 7eea3543321..635edb06353 100644 --- a/library/spdm_responder_lib/libspdm_rsp_encap_response.c +++ b/library/spdm_responder_lib/libspdm_rsp_encap_response.c @@ -20,7 +20,7 @@ * @retval RETURN_BUFFER_TOO_SMALL The buffer is too small to hold the data. **/ typedef return_status (*spdm_get_encap_request_func)( - spdm_context_t *spdm_context, uintn *encap_request_size, + libspdm_context_t *spdm_context, uintn *encap_request_size, void *encap_request); /** @@ -36,7 +36,7 @@ typedef return_status (*spdm_get_encap_request_func)( * @retval RETURN_SECURITY_VIOLATION Any verification fails. **/ typedef return_status (*spdm_process_encap_response_func)( - spdm_context_t *spdm_context, uintn encap_response_size, + libspdm_context_t *spdm_context, uintn encap_response_size, const void *encap_response, bool *need_continue); typedef struct { @@ -78,12 +78,12 @@ spdm_get_encap_struct_via_op_code(uint8_t request_op_code) return NULL; } -void spdm_encap_move_to_next_op_code(spdm_context_t *spdm_context) +void spdm_encap_move_to_next_op_code(libspdm_context_t *spdm_context) { uint8_t index; ASSERT(spdm_context->encap_context.request_op_code_count <= - MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT); + LIBSPDM_MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT); if (spdm_context->encap_context.current_request_op_code == 0) { spdm_context->encap_context.current_request_op_code = spdm_context->encap_context.request_op_code_sequence[0]; @@ -116,7 +116,7 @@ void spdm_encap_move_to_next_op_code(spdm_context_t *spdm_context) * @retval RETURN_UNSUPPORTED Do not know how to process the request. **/ return_status spdm_process_encapsulated_response( - spdm_context_t *spdm_context, uintn encap_response_size, + libspdm_context_t *spdm_context, uintn encap_response_size, const void *encap_response, uintn *encap_request_size, void *encap_request) { @@ -182,7 +182,7 @@ return_status spdm_process_encapsulated_response( * @param spdm_context A pointer to the SPDM context. * @param mut_auth_requested Indicate of the mut_auth_requested through KEY_EXCHANGE or CHALLENG response. **/ -void spdm_init_mut_auth_encap_state(spdm_context_t *spdm_context, +void spdm_init_mut_auth_encap_state(libspdm_context_t *spdm_context, uint8_t mut_auth_requested) { spdm_context->encap_context.error_state = 0; @@ -215,7 +215,7 @@ void spdm_init_mut_auth_encap_state(spdm_context_t *spdm_context, zero_mem(spdm_context->encap_context.request_op_code_sequence, sizeof(spdm_context->encap_context.request_op_code_sequence)); /* Session Mutual Auth*/ - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PUB_KEY_ID_CAP, 0) || (mut_auth_requested == @@ -240,7 +240,7 @@ void spdm_init_mut_auth_encap_state(spdm_context_t *spdm_context, * * @param spdm_context A pointer to the SPDM context. **/ -void spdm_init_basic_mut_auth_encap_state(spdm_context_t *spdm_context) +void spdm_init_basic_mut_auth_encap_state(libspdm_context_t *spdm_context) { spdm_context->encap_context.error_state = 0; spdm_context->encap_context.current_request_op_code = 0x00; @@ -267,7 +267,7 @@ void spdm_init_basic_mut_auth_encap_state(spdm_context_t *spdm_context) zero_mem(spdm_context->encap_context.request_op_code_sequence, sizeof(spdm_context->encap_context.request_op_code_sequence)); /* Basic Mutual Auth*/ - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PUB_KEY_ID_CAP, 0)) { spdm_context->encap_context.request_op_code_count = 1; @@ -297,7 +297,7 @@ void spdm_init_basic_mut_auth_encap_state(spdm_context_t *spdm_context) **/ void libspdm_init_key_update_encap_state(void *context) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; @@ -342,7 +342,7 @@ return_status spdm_get_response_encapsulated_request( uintn *response_size, void *response) { spdm_encapsulated_request_response_t *spdm_response; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *encap_request; uintn encap_request_size; return_status status; @@ -351,7 +351,7 @@ return_status spdm_get_response_encapsulated_request( spdm_context = context; spdm_request = request; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP)) { @@ -380,8 +380,8 @@ return_status spdm_get_response_encapsulated_request( response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); ASSERT(*response_size > sizeof(spdm_encapsulated_request_response_t)); zero_mem(response, *response_size); @@ -439,7 +439,7 @@ return_status spdm_get_response_encapsulated_response_ack( const spdm_deliver_encapsulated_response_request_t *spdm_request; uintn spdm_request_size; spdm_encapsulated_response_ack_response_t *spdm_response; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; const void *encap_response; uintn encap_response_size; void *encap_request; @@ -450,7 +450,7 @@ return_status spdm_get_response_encapsulated_response_ack( spdm_context = context; spdm_request = request; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP)) { @@ -520,8 +520,8 @@ return_status spdm_get_response_encapsulated_response_ack( response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); status = spdm_process_encapsulated_response( context, encap_response_size, encap_response, @@ -565,7 +565,7 @@ return_status spdm_get_response_encapsulated_response_ack( * @retval RETURN_DEVICE_ERROR A device error occurs when communicates with the device. **/ return_status spdm_handle_encap_error_response_main( - spdm_context_t *spdm_context, uint8_t error_code) + libspdm_context_t *spdm_context, uint8_t error_code) { /* According to "Timing Specification for SPDM messages", RESPONSE_NOT_READY is only for responder. diff --git a/library/spdm_responder_lib/libspdm_rsp_end_session.c b/library/spdm_responder_lib/libspdm_rsp_end_session.c index 60473bfd265..468f6b7bc0f 100644 --- a/library/spdm_responder_lib/libspdm_rsp_end_session.c +++ b/library/spdm_responder_lib/libspdm_rsp_end_session.c @@ -31,14 +31,14 @@ return_status spdm_get_response_end_session(void *context, { spdm_end_session_response_t *spdm_response; const spdm_end_session_request_t *spdm_request; - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -82,8 +82,8 @@ return_status spdm_get_response_end_session(void *context, response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + spdm_request->header.request_response_code); session_info->end_session_attributes = spdm_request->header.param1; diff --git a/library/spdm_responder_lib/libspdm_rsp_error.c b/library/spdm_responder_lib/libspdm_rsp_error.c index 4c33d76fb19..6af29eb77df 100644 --- a/library/spdm_responder_lib/libspdm_rsp_error.c +++ b/library/spdm_responder_lib/libspdm_rsp_error.c @@ -35,7 +35,7 @@ return_status libspdm_generate_error_response(const void *context, *response_size = sizeof(spdm_error_response_t); spdm_response = response; - spdm_response->header.spdm_version = spdm_get_connection_version (context); + spdm_response->header.spdm_version = libspdm_get_connection_version (context); if (spdm_response->header.spdm_version == 0) { /* if version is not negotiated, then use default version 1.0 */ spdm_response->header.spdm_version = SPDM_MESSAGE_VERSION_10; @@ -81,7 +81,7 @@ return_status libspdm_generate_extended_error_response( sizeof(spdm_error_response_t) + extended_error_data_size; spdm_response = response; - spdm_response->header.spdm_version = spdm_get_connection_version (context); + spdm_response->header.spdm_version = libspdm_get_connection_version (context); spdm_response->header.request_response_code = SPDM_ERROR; spdm_response->header.param1 = error_code; spdm_response->header.param2 = error_data; diff --git a/library/spdm_responder_lib/libspdm_rsp_finish.c b/library/spdm_responder_lib/libspdm_rsp_finish.c index 50620ea0b7f..cc30a9a7bf4 100644 --- a/library/spdm_responder_lib/libspdm_rsp_finish.c +++ b/library/spdm_responder_lib/libspdm_rsp_finish.c @@ -38,8 +38,8 @@ return_status spdm_get_response_finish(void *context, uintn request_size, uint8_t req_slot_id; const spdm_finish_request_t *spdm_request; spdm_finish_response_t *spdm_response; - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; uint8_t th2_hash_data[64]; return_status status; libspdm_session_state_t session_state; @@ -47,7 +47,7 @@ return_status spdm_get_response_finish(void *context, uintn request_size, spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -58,7 +58,7 @@ return_status spdm_get_response_finish(void *context, uintn request_size, spdm_request->header.request_response_code, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP)) { @@ -72,7 +72,7 @@ return_status spdm_get_response_finish(void *context, uintn request_size, SPDM_ERROR_CODE_UNEXPECTED_REQUEST, 0, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { @@ -152,8 +152,8 @@ return_status spdm_get_response_finish(void *context, uintn request_size, response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + spdm_request->header.request_response_code); status = libspdm_append_message_f(spdm_context, session_info, false, request, sizeof(spdm_finish_request_t)); @@ -163,7 +163,7 @@ return_status spdm_get_response_finish(void *context, uintn request_size, response_size, response); } if (session_info->mut_auth_requested) { - result = spdm_verify_finish_req_signature( + result = libspdm_verify_finish_req_signature( spdm_context, session_info, (uint8_t *)request + sizeof(spdm_finish_request_t), signature_size); @@ -192,7 +192,7 @@ return_status spdm_get_response_finish(void *context, uintn request_size, } } - result = spdm_verify_finish_req_hmac( + result = libspdm_verify_finish_req_hmac( spdm_context, session_info, (uint8_t *)request + signature_size + sizeof(spdm_finish_request_t), @@ -222,7 +222,7 @@ return_status spdm_get_response_finish(void *context, uintn request_size, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { @@ -247,11 +247,11 @@ return_status spdm_get_response_finish(void *context, uintn request_size, response_size, response); } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { - result = spdm_generate_finish_rsp_hmac( + result = libspdm_generate_finish_rsp_hmac( spdm_context, session_info, (uint8_t *)spdm_response + sizeof(spdm_finish_request_t)); if (!result) { diff --git a/library/spdm_responder_lib/libspdm_rsp_handle_response_state.c b/library/spdm_responder_lib/libspdm_rsp_handle_response_state.c index 53e12a6ffc7..8622d770c62 100644 --- a/library/spdm_responder_lib/libspdm_rsp_handle_response_state.c +++ b/library/spdm_responder_lib/libspdm_rsp_handle_response_state.c @@ -27,7 +27,7 @@ return_status spdm_responder_handle_response_state(void *context, uintn *response_size, void *response) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; spdm_context = context; diff --git a/library/spdm_responder_lib/libspdm_rsp_heartbeat.c b/library/spdm_responder_lib/libspdm_rsp_heartbeat.c index bb1ab7860de..a0fd41109e7 100644 --- a/library/spdm_responder_lib/libspdm_rsp_heartbeat.c +++ b/library/spdm_responder_lib/libspdm_rsp_heartbeat.c @@ -31,14 +31,14 @@ return_status spdm_get_response_heartbeat(void *context, { spdm_heartbeat_response_t *spdm_response; const spdm_heartbeat_request_t *spdm_request; - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -49,7 +49,7 @@ return_status spdm_get_response_heartbeat(void *context, spdm_request->header.request_response_code, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HBEAT_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HBEAT_CAP)) { @@ -90,8 +90,8 @@ return_status spdm_get_response_heartbeat(void *context, response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + spdm_request->header.request_response_code); ASSERT(*response_size >= sizeof(spdm_heartbeat_response_t)); *response_size = sizeof(spdm_heartbeat_response_t); diff --git a/library/spdm_responder_lib/libspdm_rsp_key_exchange.c b/library/spdm_responder_lib/libspdm_rsp_key_exchange.c index 6d312e6aac8..8990f65c8a7 100644 --- a/library/spdm_responder_lib/libspdm_rsp_key_exchange.c +++ b/library/spdm_responder_lib/libspdm_rsp_key_exchange.c @@ -43,9 +43,9 @@ return_status spdm_get_response_key_exchange(void *context, uint8_t slot_id; uint32_t session_id; void *dhe_context; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uintn total_size; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint16_t req_session_id; uint16_t rsp_session_id; return_status status; @@ -55,7 +55,7 @@ return_status spdm_get_response_key_exchange(void *context, spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -66,7 +66,7 @@ return_status spdm_get_response_key_exchange(void *context, spdm_request->header.request_response_code, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP)) { @@ -81,7 +81,7 @@ return_status spdm_get_response_key_exchange(void *context, 0, response_size, response); } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP)) { @@ -94,7 +94,7 @@ return_status spdm_get_response_key_exchange(void *context, 0, response_size, response); } } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP) && spdm_request->header.param1 > 0) { @@ -121,7 +121,7 @@ return_status spdm_get_response_key_exchange(void *context, spdm_context->connection_info.algorithm.base_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size( spdm_context->connection_info.algorithm.dhe_named_group); - measurement_summary_hash_size = spdm_get_measurement_summary_hash_size( + measurement_summary_hash_size = libspdm_get_measurement_summary_hash_size( spdm_context, false, spdm_request->header.param1); if ((measurement_summary_hash_size == 0) && @@ -150,7 +150,7 @@ return_status spdm_get_response_key_exchange(void *context, ptr = (uint8_t *)request + sizeof(spdm_key_exchange_request_t) + dhe_key_size + sizeof(uint16_t); - status = spdm_process_opaque_data_supported_version_data( + status = libspdm_process_opaque_data_supported_version_data( spdm_context, opaque_data_length, ptr); if (RETURN_ERROR(status)) { return libspdm_generate_error_response(spdm_context, @@ -159,12 +159,12 @@ return_status spdm_get_response_key_exchange(void *context, } opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size(spdm_context); + libspdm_get_opaque_data_version_selection_data_size(spdm_context); - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { @@ -185,7 +185,7 @@ return_status spdm_get_response_key_exchange(void *context, spdm_response->header.param1 = spdm_context->local_context.heartbeat_period; req_session_id = spdm_request->req_session_id; - rsp_session_id = spdm_allocate_rsp_session_id(spdm_context); + rsp_session_id = libspdm_allocate_rsp_session_id(spdm_context); if (rsp_session_id == (INVALID_SESSION_ID & 0xFFFF)) { return libspdm_generate_error_response( spdm_context, SPDM_ERROR_CODE_SESSION_LIMIT_EXCEEDED, 0, @@ -202,14 +202,14 @@ return_status spdm_get_response_key_exchange(void *context, spdm_response->rsp_session_id = rsp_session_id; spdm_response->mut_auth_requested = 0; - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP) && - (spdm_is_capabilities_flag_supported( + (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CERT_CAP, 0) || - spdm_is_capabilities_flag_supported( + libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PUB_KEY_ID_CAP, 0))) { spdm_response->mut_auth_requested = @@ -246,12 +246,12 @@ return_status spdm_get_response_key_exchange(void *context, response_size, response); } DEBUG((DEBUG_INFO, "Calc SelfKey (0x%x):\n", dhe_key_size)); - internal_dump_hex(ptr, dhe_key_size); + libspdm_internal_dump_hex(ptr, dhe_key_size); DEBUG((DEBUG_INFO, "Calc peer_key (0x%x):\n", dhe_key_size)); - internal_dump_hex((uint8_t *)request + - sizeof(spdm_key_exchange_request_t), - dhe_key_size); + libspdm_internal_dump_hex((uint8_t *)request + + sizeof(spdm_key_exchange_request_t), + dhe_key_size); result = libspdm_secured_message_dhe_compute_key( spdm_context->connection_info.algorithm.dhe_named_group, @@ -270,7 +270,7 @@ return_status spdm_get_response_key_exchange(void *context, ptr += dhe_key_size; - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) { result = libspdm_generate_measurement_summary_hash( @@ -296,7 +296,7 @@ return_status spdm_get_response_key_exchange(void *context, *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - status = spdm_build_opaque_data_version_selection_data( + status = libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ASSERT_RETURN_ERROR(status); ptr += opaque_key_exchange_rsp_size; @@ -323,8 +323,8 @@ return_status spdm_get_response_key_exchange(void *context, SPDM_ERROR_CODE_UNSPECIFIED, 0, response_size, response); } - result = spdm_generate_key_exchange_rsp_signature(spdm_context, - session_info, ptr); + result = libspdm_generate_key_exchange_rsp_signature(spdm_context, + session_info, ptr); if (!result) { libspdm_free_session_id(spdm_context, session_id); return libspdm_generate_error_response( @@ -361,12 +361,12 @@ return_status spdm_get_response_key_exchange(void *context, ptr += signature_size; - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { - result = spdm_generate_key_exchange_rsp_hmac(spdm_context, - session_info, ptr); + result = libspdm_generate_key_exchange_rsp_hmac(spdm_context, + session_info, ptr); if (!result) { libspdm_free_session_id(spdm_context, session_id); return libspdm_generate_error_response( diff --git a/library/spdm_responder_lib/libspdm_rsp_key_update.c b/library/spdm_responder_lib/libspdm_rsp_key_update.c index e7aa40c17ea..53d10f5d319 100644 --- a/library/spdm_responder_lib/libspdm_rsp_key_update.c +++ b/library/spdm_responder_lib/libspdm_rsp_key_update.c @@ -33,15 +33,15 @@ return_status spdm_get_response_key_update(void *context, spdm_key_update_response_t *spdm_response; const spdm_key_update_request_t *spdm_request; spdm_key_update_request_t *prev_spdm_request; - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; return_status status; spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -52,7 +52,7 @@ return_status spdm_get_response_key_update(void *context, spdm_request->header.request_response_code, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_UPD_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_UPD_CAP)) { @@ -188,8 +188,8 @@ return_status spdm_get_response_key_update(void *context, copy_mem(prev_spdm_request, sizeof(spdm_key_update_request_t), spdm_request, request_size); - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + spdm_request->header.request_response_code); ASSERT(*response_size >= sizeof(spdm_key_update_response_t)); *response_size = sizeof(spdm_key_update_response_t); diff --git a/library/spdm_responder_lib/libspdm_rsp_measurements.c b/library/spdm_responder_lib/libspdm_rsp_measurements.c index 8c4fb553fbc..ce73c976154 100644 --- a/library/spdm_responder_lib/libspdm_rsp_measurements.c +++ b/library/spdm_responder_lib/libspdm_rsp_measurements.c @@ -21,8 +21,8 @@ * @retval true measurement signature is created. * @retval false measurement signature is not created. **/ -bool spdm_create_measurement_signature(spdm_context_t *spdm_context, - spdm_session_info_t *session_info, +bool spdm_create_measurement_signature(libspdm_context_t *spdm_context, + libspdm_session_info_t *session_info, void *response_message, uintn response_message_size) { @@ -65,7 +65,7 @@ bool spdm_create_measurement_signature(spdm_context_t *spdm_context, return false; } - result = spdm_generate_measurement_signature(spdm_context, session_info, ptr); + result = libspdm_generate_measurement_signature(spdm_context, session_info, ptr); return result; } @@ -76,7 +76,7 @@ bool spdm_create_measurement_signature(spdm_context_t *spdm_context, * @param response_message The measurement response message with empty signature to be filled. * @param response_message_size Total size in bytes of the response message including signature. **/ -bool spdm_create_measurement_opaque(spdm_context_t *spdm_context, +bool spdm_create_measurement_opaque(libspdm_context_t *spdm_context, void *response_message, uintn response_message_size) { @@ -142,21 +142,21 @@ return_status spdm_get_response_measurements(void *context, uintn measurements_sig_size; uintn measurements_no_sig_size; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_id_param; uint8_t measurements_index; uint8_t *measurements; uint8_t measurements_count; uintn measurements_size; bool ret; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; libspdm_session_state_t session_state; uint8_t content_changed; spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -168,7 +168,7 @@ return_status spdm_get_response_measurements(void *context, response_size, response); } /* check local context here, because meas_cap is reserved for requester.*/ - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) { return libspdm_generate_error_response( @@ -246,7 +246,7 @@ return_status spdm_get_response_measurements(void *context, if ((spdm_request->header.param1 & SPDM_GET_MEASUREMENTS_REQUEST_ATTRIBUTES_GENERATE_SIGNATURE) != 0) { - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP_SIG)) { return libspdm_generate_error_response( @@ -431,8 +431,8 @@ return_status spdm_get_response_measurements(void *context, } } - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + spdm_request->header.request_response_code); status = libspdm_append_message_m( spdm_context, session_info, spdm_request, diff --git a/library/spdm_responder_lib/libspdm_rsp_psk_exchange.c b/library/spdm_responder_lib/libspdm_rsp_psk_exchange.c index 55b74d7e1ed..fb22909d136 100644 --- a/library/spdm_responder_lib/libspdm_rsp_psk_exchange.c +++ b/library/spdm_responder_lib/libspdm_rsp_psk_exchange.c @@ -39,9 +39,9 @@ return_status spdm_get_response_psk_exchange(void *context, uintn measurement_summary_hash_size; uint32_t hmac_size; uint8_t *ptr; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uintn total_size; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint16_t req_session_id; uint16_t rsp_session_id; return_status status; @@ -54,7 +54,7 @@ return_status spdm_get_response_psk_exchange(void *context, spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -67,7 +67,7 @@ return_status spdm_get_response_psk_exchange(void *context, } /* Check capabilities even if GET_CAPABILITIES is not sent. * Assuming capabilities are provisioned.*/ - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP)) { @@ -84,7 +84,7 @@ return_status spdm_get_response_psk_exchange(void *context, { /* Double check if algorithm has been provisioned, because ALGORITHM might be skipped.*/ - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, true, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) { if (spdm_context->connection_info.algorithm @@ -124,7 +124,7 @@ return_status spdm_get_response_psk_exchange(void *context, } } - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_MUT_AUTH_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MUT_AUTH_CAP)) { @@ -137,7 +137,7 @@ return_status spdm_get_response_psk_exchange(void *context, 0, response_size, response); } } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP) && spdm_request->header.param1 > 0) { @@ -152,7 +152,7 @@ return_status spdm_get_response_psk_exchange(void *context, response_size, response); } - measurement_summary_hash_size = spdm_get_measurement_summary_hash_size( + measurement_summary_hash_size = libspdm_get_measurement_summary_hash_size( spdm_context, false, spdm_request->header.param1); hmac_size = libspdm_get_hash_size( spdm_context->connection_info.algorithm.base_hash_algo); @@ -177,7 +177,7 @@ return_status spdm_get_response_psk_exchange(void *context, ptr = (uint8_t *)request + sizeof(spdm_psk_exchange_request_t) + spdm_request->psk_hint_length + spdm_request->context_length; - status = spdm_process_opaque_data_supported_version_data( + status = libspdm_process_opaque_data_supported_version_data( spdm_context, spdm_request->opaque_length, ptr); if (RETURN_ERROR(status)) { return libspdm_generate_error_response(spdm_context, @@ -186,8 +186,8 @@ return_status spdm_get_response_psk_exchange(void *context, } opaque_psk_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size(spdm_context); - if (spdm_is_capabilities_flag_supported( + libspdm_get_opaque_data_version_selection_data_size(spdm_context); + if (libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP_RESPONDER_WITH_CONTEXT)) { context_length = LIBSPDM_PSK_CONTEXT_LENGTH; @@ -208,7 +208,7 @@ return_status spdm_get_response_psk_exchange(void *context, spdm_response->header.param1 = spdm_context->local_context.heartbeat_period; req_session_id = spdm_request->req_session_id; - rsp_session_id = spdm_allocate_rsp_session_id(spdm_context); + rsp_session_id = libspdm_allocate_rsp_session_id(spdm_context); if (rsp_session_id == (INVALID_SESSION_ID & 0xFFFF)) { return libspdm_generate_error_response( spdm_context, SPDM_ERROR_CODE_SESSION_LIMIT_EXCEEDED, 0, @@ -222,8 +222,8 @@ return_status spdm_get_response_psk_exchange(void *context, response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); spdm_response->rsp_session_id = rsp_session_id; spdm_response->reserved = 0; @@ -233,7 +233,7 @@ return_status spdm_get_response_psk_exchange(void *context, ptr = (void *)(spdm_response + 1); - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_MEAS_CAP)) { result = libspdm_generate_measurement_summary_hash( @@ -270,7 +270,7 @@ return_status spdm_get_response_psk_exchange(void *context, ptr += context_length; } - status = spdm_build_opaque_data_version_selection_data( + status = libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_psk_exchange_rsp_size, ptr); ASSERT_RETURN_ERROR(status); ptr += opaque_psk_exchange_rsp_size; @@ -312,8 +312,8 @@ return_status spdm_get_response_psk_exchange(void *context, response_size, response); } - result = spdm_generate_psk_exchange_rsp_hmac(spdm_context, session_info, - ptr); + result = libspdm_generate_psk_exchange_rsp_hmac(spdm_context, session_info, + ptr); if (!result) { libspdm_free_session_id(spdm_context, session_id); return libspdm_generate_error_response( @@ -335,7 +335,7 @@ return_status spdm_get_response_psk_exchange(void *context, spdm_set_session_state(spdm_context, session_id, LIBSPDM_SESSION_STATE_HANDSHAKING); - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, 0, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP_RESPONDER_WITH_CONTEXT)) { /* No need to receive PSK_FINISH, enter application phase directly.*/ diff --git a/library/spdm_responder_lib/libspdm_rsp_psk_finish.c b/library/spdm_responder_lib/libspdm_rsp_psk_finish.c index dbd92a6f36a..41dfb437ebb 100644 --- a/library/spdm_responder_lib/libspdm_rsp_psk_finish.c +++ b/library/spdm_responder_lib/libspdm_rsp_psk_finish.c @@ -34,8 +34,8 @@ return_status spdm_get_response_psk_finish(void *context, bool result; uint32_t hmac_size; spdm_psk_finish_response_t *spdm_response; - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; uint8_t th2_hash_data[64]; const spdm_psk_finish_request_t *spdm_request; return_status status; @@ -44,7 +44,7 @@ return_status spdm_get_response_psk_finish(void *context, spdm_context = context; spdm_request = request; - if (spdm_request->header.spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->header.spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); @@ -55,7 +55,7 @@ return_status spdm_get_response_psk_finish(void *context, spdm_request->header.request_response_code, response_size, response); } - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_PSK_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_PSK_CAP_RESPONDER_WITH_CONTEXT)) { @@ -101,8 +101,8 @@ return_status spdm_get_response_psk_finish(void *context, response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, session_info, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, session_info, + spdm_request->header.request_response_code); status = libspdm_append_message_f(spdm_context, session_info, false, request, request_size - hmac_size); @@ -122,7 +122,7 @@ return_status spdm_get_response_psk_finish(void *context, spdm_response->header.param1 = 0; spdm_response->header.param2 = 0; - result = spdm_verify_psk_finish_req_hmac( + result = libspdm_verify_psk_finish_req_hmac( spdm_context, session_info, (uint8_t *)request + sizeof(spdm_psk_finish_request_t), hmac_size); diff --git a/library/spdm_responder_lib/libspdm_rsp_receive_send.c b/library/spdm_responder_lib/libspdm_rsp_receive_send.c index ba0413093e1..e535f4dae4c 100644 --- a/library/spdm_responder_lib/libspdm_rsp_receive_send.c +++ b/library/spdm_responder_lib/libspdm_rsp_receive_send.c @@ -94,7 +94,7 @@ spdm_get_response_func_via_request_code(uint8_t request_code) * @return GET_SPDM_RESPONSE function according to the last request. **/ spdm_get_spdm_response_func -spdm_get_response_func_via_last_request(spdm_context_t *spdm_context) +spdm_get_response_func_via_last_request(libspdm_context_t *spdm_context) { spdm_message_header_t *spdm_request; @@ -123,9 +123,9 @@ return_status libspdm_process_request(void *context, uint32_t **session_id, bool *is_app_message, uintn request_size, const void *request) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t *message_session_id; spdm_context = context; @@ -187,8 +187,8 @@ return_status libspdm_process_request(void *context, uint32_t **session_id, DEBUG((DEBUG_INFO, "SpdmReceiveRequest[%x] (0x%x): \n", (message_session_id != NULL) ? *message_session_id : 0, spdm_context->last_spdm_request_size)); - internal_dump_hex((uint8_t *)spdm_context->last_spdm_request, - spdm_context->last_spdm_request_size); + libspdm_internal_dump_hex((uint8_t *)spdm_context->last_spdm_request, + spdm_context->last_spdm_request_size); return RETURN_SUCCESS; } @@ -200,7 +200,7 @@ return_status libspdm_process_request(void *context, uint32_t **session_id, * @param session_id The session_id of a session. * @param session_state The state of a session. **/ -void spdm_trigger_session_state_callback(spdm_context_t *spdm_context, +void spdm_trigger_session_state_callback(libspdm_context_t *spdm_context, uint32_t session_id, libspdm_session_state_t session_state) { @@ -222,11 +222,11 @@ void spdm_trigger_session_state_callback(spdm_context_t *spdm_context, * @param session_id Indicate the SPDM session ID. * @param session_state Indicate the SPDM session state. */ -void spdm_set_session_state(spdm_context_t *spdm_context, +void spdm_set_session_state(libspdm_context_t *spdm_context, uint32_t session_id, libspdm_session_state_t session_state) { - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; libspdm_session_state_t old_session_state; session_info = @@ -252,7 +252,7 @@ void spdm_set_session_state(spdm_context_t *spdm_context, * @param spdm_context A pointer to the SPDM context. * @param connection_state Indicate the SPDM connection state. **/ -void spdm_trigger_connection_state_callback(spdm_context_t *spdm_context, +void spdm_trigger_connection_state_callback(libspdm_context_t *spdm_context, const libspdm_connection_state_t connection_state) { @@ -274,7 +274,7 @@ void spdm_trigger_connection_state_callback(spdm_context_t *spdm_context, * @param spdm_context A pointer to the SPDM context. * @param connection_state Indicate the SPDM connection state. */ -void spdm_set_connection_state(spdm_context_t *spdm_context, +void spdm_set_connection_state(libspdm_context_t *spdm_context, libspdm_connection_state_t connection_state) { if (spdm_context->connection_info.connection_state != @@ -309,12 +309,12 @@ return_status libspdm_build_response(void *context, const uint32_t *session_id, uintn *response_size, void *response) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t my_response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn my_response_size; return_status status; spdm_get_spdm_response_func get_response_func; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_message_header_t *spdm_request; spdm_message_header_t *spdm_response; bool result; @@ -365,7 +365,7 @@ return_status libspdm_build_response(void *context, const uint32_t *session_id, DEBUG((DEBUG_INFO, "SpdmSendResponse[%x] (0x%x): \n", (session_id != NULL) ? *session_id : 0, my_response_size)); - internal_dump_hex(my_response, my_response_size); + libspdm_internal_dump_hex(my_response, my_response_size); status = spdm_context->transport_encode_message( spdm_context, session_id, false, false, @@ -466,7 +466,7 @@ return_status libspdm_build_response(void *context, const uint32_t *session_id, DEBUG((DEBUG_INFO, "SpdmSendResponse[%x] (0x%x): \n", (session_id != NULL) ? *session_id : 0, my_response_size)); - internal_dump_hex(my_response, my_response_size); + libspdm_internal_dump_hex(my_response, my_response_size); status = spdm_context->transport_encode_message( spdm_context, session_id, is_app_message, false, @@ -480,7 +480,7 @@ return_status libspdm_build_response(void *context, const uint32_t *session_id, if (session_id != NULL) { switch (spdm_response->request_response_code) { case SPDM_FINISH_RSP: - if (!spdm_is_capabilities_flag_supported( + if (!libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { @@ -513,7 +513,7 @@ return_status libspdm_build_response(void *context, const uint32_t *session_id, } else { switch (spdm_response->request_response_code) { case SPDM_FINISH_RSP: - if (spdm_is_capabilities_flag_supported( + if (libspdm_is_capabilities_flag_supported( spdm_context, false, SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP, SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP)) { @@ -544,7 +544,7 @@ return_status libspdm_build_response(void *context, const uint32_t *session_id, void libspdm_register_get_response_func( void *context, libspdm_get_response_func get_response_func) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_context = context; spdm_context->get_response_func = (uintn)get_response_func; @@ -567,7 +567,7 @@ return_status libspdm_register_session_state_callback_func( void *context, libspdm_session_state_callback_func spdm_session_state_callback) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn index; spdm_context = context; @@ -598,7 +598,7 @@ return_status libspdm_register_connection_state_callback_func( void *context, libspdm_connection_state_callback_func spdm_connection_state_callback) { - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn index; spdm_context = context; diff --git a/library/spdm_responder_lib/libspdm_rsp_respond_if_ready.c b/library/spdm_responder_lib/libspdm_rsp_respond_if_ready.c index dcd76e8e96a..1f48e085ef9 100644 --- a/library/spdm_responder_lib/libspdm_rsp_respond_if_ready.c +++ b/library/spdm_responder_lib/libspdm_rsp_respond_if_ready.c @@ -30,14 +30,14 @@ return_status spdm_get_response_respond_if_ready(void *context, void *response) { const spdm_message_header_t *spdm_request; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_get_spdm_response_func get_response_func; return_status status; spdm_context = context; spdm_request = request; - if (spdm_request->spdm_version != spdm_get_connection_version(spdm_context)) { + if (spdm_request->spdm_version != libspdm_get_connection_version(spdm_context)) { return libspdm_generate_error_response(spdm_context, SPDM_ERROR_CODE_VERSION_MISMATCH, 0, response_size, response); diff --git a/library/spdm_responder_lib/libspdm_rsp_version.c b/library/spdm_responder_lib/libspdm_rsp_version.c index dbadf82dfe3..42a75854654 100644 --- a/library/spdm_responder_lib/libspdm_rsp_version.c +++ b/library/spdm_responder_lib/libspdm_rsp_version.c @@ -39,7 +39,7 @@ return_status spdm_get_response_version(void *context, uintn request_size, { const spdm_get_version_request_t *spdm_request; spdm_version_response_mine_t *spdm_response; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; return_status status; spdm_context = context; @@ -73,8 +73,8 @@ return_status spdm_get_response_version(void *context, uintn request_size, response_size, response); } - spdm_reset_message_buffer_via_request_code(spdm_context, NULL, - spdm_request->header.request_response_code); + libspdm_reset_message_buffer_via_request_code(spdm_context, NULL, + spdm_request->header.request_response_code); /* Cache*/ diff --git a/library/spdm_secured_message_lib/libspdm_secmes_session.c b/library/spdm_secured_message_lib/libspdm_secmes_session.c index 3e8938bb73d..6774cc7f595 100644 --- a/library/spdm_secured_message_lib/libspdm_secmes_session.c +++ b/library/spdm_secured_message_lib/libspdm_secmes_session.c @@ -14,7 +14,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED uint8_t m_zero_filled_buffer[64]; * @param data raw data * @param size raw data size **/ -void internal_dump_hex_str(const uint8_t *data, uintn size); +void libspdm_libspdm_internal_dump_hex_str(const uint8_t *data, uintn size); /** * This function dump raw data. @@ -22,7 +22,7 @@ void internal_dump_hex_str(const uint8_t *data, uintn size); * @param data raw data * @param size raw data size **/ -void internal_dump_data(const uint8_t *data, uintn size); +void libspdm_internal_dump_data(const uint8_t *data, uintn size); /** * This function dump raw data with colume format. @@ -30,7 +30,7 @@ void internal_dump_data(const uint8_t *data, uintn size); * @param data raw data * @param size raw data size **/ -void internal_dump_hex(const uint8_t *data, uintn size); +void libspdm_internal_dump_hex(const uint8_t *data, uintn size); /** * This function concatenates binary data, which is used as info in HKDF expand later. @@ -118,13 +118,13 @@ return_status spdm_generate_aead_key_and_iv( &bin_str5_size); ASSERT_RETURN_ERROR(status); DEBUG((DEBUG_INFO, "bin_str5 (0x%x):\n", bin_str5_size)); - internal_dump_hex(bin_str5, bin_str5_size); + libspdm_internal_dump_hex(bin_str5, bin_str5_size); ret_val = libspdm_hkdf_expand(secured_message_context->base_hash_algo, major_secret, hash_size, bin_str5, bin_str5_size, key, key_length); ASSERT(ret_val); DEBUG((DEBUG_INFO, "key (0x%x) - ", key_length)); - internal_dump_data(key, key_length); + libspdm_internal_dump_data(key, key_length); DEBUG((DEBUG_INFO, "\n")); bin_str6_size = sizeof(bin_str6); @@ -133,13 +133,13 @@ return_status spdm_generate_aead_key_and_iv( &bin_str6_size); ASSERT_RETURN_ERROR(status); DEBUG((DEBUG_INFO, "bin_str6 (0x%x):\n", bin_str6_size)); - internal_dump_hex(bin_str6, bin_str6_size); + libspdm_internal_dump_hex(bin_str6, bin_str6_size); ret_val = libspdm_hkdf_expand(secured_message_context->base_hash_algo, major_secret, hash_size, bin_str6, bin_str6_size, iv, iv_length); ASSERT(ret_val); DEBUG((DEBUG_INFO, "iv (0x%x) - ", iv_length)); - internal_dump_data(iv, iv_length); + libspdm_internal_dump_data(iv, iv_length); DEBUG((DEBUG_INFO, "\n")); return RETURN_SUCCESS; @@ -172,13 +172,13 @@ return_status spdm_generate_finished_key( &bin_str7_size); ASSERT_RETURN_ERROR(status); DEBUG((DEBUG_INFO, "bin_str7 (0x%x):\n", bin_str7_size)); - internal_dump_hex(bin_str7, bin_str7_size); + libspdm_internal_dump_hex(bin_str7, bin_str7_size); ret_val = libspdm_hkdf_expand(secured_message_context->base_hash_algo, handshake_secret, hash_size, bin_str7, bin_str7_size, finished_key, hash_size); ASSERT(ret_val); DEBUG((DEBUG_INFO, "finished_key (0x%x) - ", hash_size)); - internal_dump_data(finished_key, hash_size); + libspdm_internal_dump_data(finished_key, hash_size); DEBUG((DEBUG_INFO, "\n")); return RETURN_SUCCESS; @@ -217,13 +217,13 @@ libspdm_generate_session_handshake_key(void *spdm_secured_message_context, &bin_str0_size); ASSERT_RETURN_ERROR(status); DEBUG((DEBUG_INFO, "bin_str0 (0x%x):\n", bin_str0_size)); - internal_dump_hex(bin_str0, bin_str0_size); + libspdm_internal_dump_hex(bin_str0, bin_str0_size); if (secured_message_context->use_psk) { /* No handshake_secret generation for PSK.*/ } else { DEBUG((DEBUG_INFO, "[DHE Secret]: ")); - internal_dump_hex_str( + libspdm_libspdm_internal_dump_hex_str( secured_message_context->master_secret.dhe_secret, secured_message_context->dhe_key_size); DEBUG((DEBUG_INFO, "\n")); @@ -235,7 +235,7 @@ libspdm_generate_session_handshake_key(void *spdm_secured_message_context, secured_message_context->master_secret.handshake_secret); ASSERT(ret_val); DEBUG((DEBUG_INFO, "handshake_secret (0x%x) - ", hash_size)); - internal_dump_data( + libspdm_internal_dump_data( secured_message_context->master_secret.handshake_secret, hash_size); DEBUG((DEBUG_INFO, "\n")); @@ -247,7 +247,7 @@ libspdm_generate_session_handshake_key(void *spdm_secured_message_context, bin_str1, &bin_str1_size); ASSERT_RETURN_ERROR(status); DEBUG((DEBUG_INFO, "bin_str1 (0x%x):\n", bin_str1_size)); - internal_dump_hex(bin_str1, bin_str1_size); + libspdm_internal_dump_hex(bin_str1, bin_str1_size); if (secured_message_context->use_psk) { ret_val = libspdm_psk_handshake_secret_hkdf_expand( secured_message_context->version, @@ -272,9 +272,9 @@ libspdm_generate_session_handshake_key(void *spdm_secured_message_context, } ASSERT(ret_val); DEBUG((DEBUG_INFO, "request_handshake_secret (0x%x) - ", hash_size)); - internal_dump_data(secured_message_context->handshake_secret - .request_handshake_secret, - hash_size); + libspdm_internal_dump_data(secured_message_context->handshake_secret + .request_handshake_secret, + hash_size); DEBUG((DEBUG_INFO, "\n")); bin_str2_size = sizeof(bin_str2); status = libspdm_bin_concat(SPDM_BIN_STR_2_LABEL, sizeof(SPDM_BIN_STR_2_LABEL) - 1, @@ -282,7 +282,7 @@ libspdm_generate_session_handshake_key(void *spdm_secured_message_context, bin_str2, &bin_str2_size); ASSERT_RETURN_ERROR(status); DEBUG((DEBUG_INFO, "bin_str2 (0x%x):\n", bin_str2_size)); - internal_dump_hex(bin_str2, bin_str2_size); + libspdm_internal_dump_hex(bin_str2, bin_str2_size); if (secured_message_context->use_psk) { ret_val = libspdm_psk_handshake_secret_hkdf_expand( secured_message_context->version, @@ -307,9 +307,9 @@ libspdm_generate_session_handshake_key(void *spdm_secured_message_context, } ASSERT(ret_val); DEBUG((DEBUG_INFO, "response_handshake_secret (0x%x) - ", hash_size)); - internal_dump_data(secured_message_context->handshake_secret - .response_handshake_secret, - hash_size); + libspdm_internal_dump_data(secured_message_context->handshake_secret + .response_handshake_secret, + hash_size); DEBUG((DEBUG_INFO, "\n")); status = spdm_generate_finished_key( @@ -409,7 +409,7 @@ libspdm_generate_session_data_key(void *spdm_secured_message_context, hash_size, bin_str0, bin_str0_size, salt1, hash_size); ASSERT(ret_val); DEBUG((DEBUG_INFO, "salt1 (0x%x) - ", hash_size)); - internal_dump_data(salt1, hash_size); + libspdm_internal_dump_data(salt1, hash_size); DEBUG((DEBUG_INFO, "\n")); ret_val = libspdm_hmac_all( @@ -418,7 +418,7 @@ libspdm_generate_session_data_key(void *spdm_secured_message_context, secured_message_context->master_secret.master_secret); ASSERT(ret_val); DEBUG((DEBUG_INFO, "master_secret (0x%x) - ", hash_size)); - internal_dump_data( + libspdm_internal_dump_data( secured_message_context->master_secret.master_secret, hash_size); DEBUG((DEBUG_INFO, "\n")); @@ -430,7 +430,7 @@ libspdm_generate_session_data_key(void *spdm_secured_message_context, bin_str3, &bin_str3_size); ASSERT_RETURN_ERROR(status); DEBUG((DEBUG_INFO, "bin_str3 (0x%x):\n", bin_str3_size)); - internal_dump_hex(bin_str3, bin_str3_size); + libspdm_internal_dump_hex(bin_str3, bin_str3_size); if (secured_message_context->use_psk) { ret_val = libspdm_psk_master_secret_hkdf_expand( secured_message_context->version, @@ -455,7 +455,7 @@ libspdm_generate_session_data_key(void *spdm_secured_message_context, } ASSERT(ret_val); DEBUG((DEBUG_INFO, "request_data_secret (0x%x) - ", hash_size)); - internal_dump_data( + libspdm_internal_dump_data( secured_message_context->application_secret.request_data_secret, hash_size); DEBUG((DEBUG_INFO, "\n")); @@ -465,7 +465,7 @@ libspdm_generate_session_data_key(void *spdm_secured_message_context, bin_str4, &bin_str4_size); ASSERT_RETURN_ERROR(status); DEBUG((DEBUG_INFO, "bin_str4 (0x%x):\n", bin_str4_size)); - internal_dump_hex(bin_str4, bin_str4_size); + libspdm_internal_dump_hex(bin_str4, bin_str4_size); if (secured_message_context->use_psk) { ret_val = libspdm_psk_master_secret_hkdf_expand( secured_message_context->version, @@ -490,7 +490,7 @@ libspdm_generate_session_data_key(void *spdm_secured_message_context, } ASSERT(ret_val); DEBUG((DEBUG_INFO, "response_data_secret (0x%x) - ", hash_size)); - internal_dump_data( + libspdm_internal_dump_data( secured_message_context->application_secret.response_data_secret, hash_size); DEBUG((DEBUG_INFO, "\n")); @@ -501,7 +501,7 @@ libspdm_generate_session_data_key(void *spdm_secured_message_context, bin_str8, &bin_str8_size); ASSERT_RETURN_ERROR(status); DEBUG((DEBUG_INFO, "bin_str8 (0x%x):\n", bin_str8_size)); - internal_dump_hex(bin_str8, bin_str8_size); + libspdm_internal_dump_hex(bin_str8, bin_str8_size); if (secured_message_context->use_psk) { ret_val = libspdm_psk_master_secret_hkdf_expand( secured_message_context->version, @@ -526,7 +526,7 @@ libspdm_generate_session_data_key(void *spdm_secured_message_context, } ASSERT(ret_val); DEBUG((DEBUG_INFO, "export_master_secret (0x%x) - ", hash_size)); - internal_dump_data( + libspdm_internal_dump_data( secured_message_context->handshake_secret.export_master_secret, hash_size); DEBUG((DEBUG_INFO, "\n")); @@ -590,7 +590,7 @@ libspdm_create_update_session_data_key(void *spdm_secured_message_context, return status; } DEBUG((DEBUG_INFO, "bin_str9 (0x%x):\n", bin_str9_size)); - internal_dump_hex(bin_str9, bin_str9_size); + libspdm_internal_dump_hex(bin_str9, bin_str9_size); if (action == LIBSPDM_KEY_UPDATE_ACTION_REQUESTER) { copy_mem(&secured_message_context->application_secret_backup @@ -633,9 +633,9 @@ libspdm_create_update_session_data_key(void *spdm_secured_message_context, } DEBUG((DEBUG_INFO, "RequestDataSecretUpdate (0x%x) - ", hash_size)); - internal_dump_data(secured_message_context->application_secret - .request_data_secret, - hash_size); + libspdm_internal_dump_data(secured_message_context->application_secret + .request_data_secret, + hash_size); DEBUG((DEBUG_INFO, "\n")); status = spdm_generate_aead_key_and_iv( @@ -694,9 +694,9 @@ libspdm_create_update_session_data_key(void *spdm_secured_message_context, } DEBUG((DEBUG_INFO, "ResponseDataSecretUpdate (0x%x) - ", hash_size)); - internal_dump_data(secured_message_context->application_secret - .response_data_secret, - hash_size); + libspdm_internal_dump_data(secured_message_context->application_secret + .response_data_secret, + hash_size); DEBUG((DEBUG_INFO, "\n")); status = spdm_generate_aead_key_and_iv( diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_challenge/challenge.c b/unit_test/fuzzing/test_requester/test_spdm_requester_challenge/challenge.c index a594876de1d..3fa532a08b5 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_challenge/challenge.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_challenge/challenge.c @@ -40,10 +40,11 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si spdm_test_context->test_buffer_size); read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t *)spdm_context)->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t *)spdm_context)->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t *)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; + ((libspdm_context_t *)spdm_context)->local_context.local_cert_chain_provision_size[0] = + data_size; + ((libspdm_context_t *)spdm_context)->local_context.local_cert_chain_provision[0] = data; + ((libspdm_context_t *)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; + ((libspdm_context_t *)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + libspdm_get_hash_size(m_use_hash_algo) + SPDM_NONCE_SIZE + 0 + sizeof(uint16_t) + 0 + libspdm_get_asym_signature_size(m_use_asym_algo); @@ -52,8 +53,8 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si ptr = (void *)(spdm_response + 1); libspdm_hash_all( m_use_hash_algo, - ((spdm_context_t *)spdm_context)->local_context.local_cert_chain_provision[0], - ((spdm_context_t *)spdm_context)->local_context.local_cert_chain_provision_size[0], ptr); + ((libspdm_context_t *)spdm_context)->local_context.local_cert_chain_provision[0], + ((libspdm_context_t *)spdm_context)->local_context.local_cert_chain_provision_size[0], ptr); free(data); ptr += libspdm_get_hash_size(m_use_hash_algo); libspdm_get_random_number(SPDM_NONCE_SIZE, ptr); @@ -65,9 +66,9 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer), spdm_response, (uintn)ptr - (uintn)spdm_response); m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); libspdm_responder_data_sign(spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_CHALLENGE_AUTH, m_use_asym_algo, m_use_hash_algo, false, @@ -96,7 +97,7 @@ return_status spdm_device_send_message(void *spdm_context, uintn request_size, void test_spdm_requester_challenge_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -135,7 +136,7 @@ void test_spdm_requester_challenge_case1(void **State) void test_spdm_requester_challenge_ex_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_encap_certificate/encap_certificate.c b/unit_test/fuzzing/test_requester/test_spdm_requester_encap_certificate/encap_certificate.c index ca6e7a4ef3b..982a9243007 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_encap_certificate/encap_certificate.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_encap_certificate/encap_certificate.c @@ -19,7 +19,7 @@ uintn get_max_buffer_size(void) void test_spdm_requester_encap_certificate(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn request_size; uintn response_size; uint8_t test_message_header_size; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_encap_challenge_auth/encap_challenge_auth.c b/unit_test/fuzzing/test_requester/test_spdm_requester_encap_challenge_auth/encap_challenge_auth.c index 03cda73e585..f4f83e9af6c 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_encap_challenge_auth/encap_challenge_auth.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_encap_challenge_auth/encap_challenge_auth.c @@ -19,7 +19,7 @@ uintn get_max_buffer_size(void) void test_spdm_requester_encap_challenge(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn request_size; uintn response_size; uint8_t test_message_header_size; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_encap_digests/encap_digests.c b/unit_test/fuzzing/test_requester/test_spdm_requester_encap_digests/encap_digests.c index db4a9e0fd46..f8962ab198f 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_encap_digests/encap_digests.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_encap_digests/encap_digests.c @@ -19,7 +19,7 @@ uintn get_max_buffer_size(void) void test_spdm_requester_encap_digests(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn request_size; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_encap_key_update/encap_key_update.c b/unit_test/fuzzing/test_requester/test_spdm_requester_encap_key_update/encap_key_update.c index 81390e1d78f..79b5bdbf682 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_encap_key_update/encap_key_update.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_encap_key_update/encap_key_update.c @@ -9,10 +9,10 @@ #include "spdm_unit_fuzzing.h" #include "toolchain_harness.h" -static void spdm_set_standard_key_update_test_state(spdm_context_t *spdm_context, +static void spdm_set_standard_key_update_test_state(libspdm_context_t *spdm_context, uint32_t *session_id) { - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_context->response_state = LIBSPDM_RESPONSE_STATE_NORMAL; spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NEGOTIATED; @@ -36,7 +36,7 @@ static void spdm_set_standard_key_update_test_state(spdm_context_t *spdm_context spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = *session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, *session_id, true); + libspdm_session_info_init(spdm_context, session_info, *session_id, true); libspdm_secured_message_set_session_state(session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -103,9 +103,9 @@ uintn get_max_buffer_size(void) void test_spdm_requester_encap_key_update(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn request_size; uintn response_size; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_encap_request/encap_request.c b/unit_test/fuzzing/test_requester/test_spdm_requester_encap_request/encap_request.c index a58790a006a..fdafd541d42 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_encap_request/encap_request.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_encap_request/encap_request.c @@ -26,7 +26,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si void *response, uint64_t timeout) { spdm_test_context_t *spdm_test_context; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; static uint8_t sub_index = 0; uint32_t session_id; uint8_t test_message_header_size; @@ -100,13 +100,13 @@ spdm_test_context_t m_spdm_requester_encap_request_test_context = { void test_spdm_requester_encap_request(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *State; spdm_context = spdm_test_context->spdm_context; @@ -140,7 +140,7 @@ void test_spdm_requester_encap_request(void **State) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state(session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); libspdm_register_get_encap_response_func(spdm_context,spdm_get_encap_response_digest); diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_end_session/end_session.c b/unit_test/fuzzing/test_requester/test_spdm_requester_end_session/end_session.c index 7efd946a726..cb47f78cb0d 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_end_session/end_session.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_end_session/end_session.c @@ -50,7 +50,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si void *response, uint64_t timeout) { spdm_test_context_t *spdm_test_context; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_end_session_response_t spdm_response; uintn spdm_response_size; uint32_t session_id; @@ -81,13 +81,13 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si void test_spdm_requester_end_session(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *State; spdm_context = spdm_test_context->spdm_context; @@ -128,7 +128,7 @@ void test_spdm_requester_end_session(void **State) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state(session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_finish/finish.c b/unit_test/fuzzing/test_requester/test_spdm_requester_finish/finish.c index 93ca1393271..a37ed0403e4 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_finish/finish.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_finish/finish.c @@ -62,14 +62,14 @@ uintn m_spdm_finish_request1_size = sizeof(m_spdm_finish_request1); void test_spdm_send_receive_finish_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_dummy_buffer[LIBSPDM_MAX_HASH_SIZE]; spdm_test_context = *State; @@ -98,7 +98,7 @@ void test_spdm_send_receive_finish_case1(void **State) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key(session_info->secured_message_context, diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_get_capabilities/get_capabilities.c b/unit_test/fuzzing/test_requester/test_spdm_requester_get_capabilities/get_capabilities.c index 35e6d101484..f8f672a3c2d 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_get_capabilities/get_capabilities.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_get_capabilities/get_capabilities.c @@ -37,7 +37,7 @@ return_status spdm_device_receive_message(void *spdm_context, void test_spdm_requester_get_capabilities(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *State; spdm_context = spdm_test_context->spdm_context; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_get_certificate/get_certificate.c b/unit_test/fuzzing/test_requester/test_spdm_requester_get_certificate/get_certificate.c index f916544d33e..4457b479293 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_get_certificate/get_certificate.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_get_certificate/get_certificate.c @@ -57,7 +57,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si void test_spdm_requester_get_certificate_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -79,7 +79,7 @@ void test_spdm_requester_get_certificate_case1(void **State) x509_get_cert_from_cert_chain((uint8_t *)data + sizeof(spdm_cert_chain_t) + hash_size, data_size - sizeof(spdm_cert_chain_t) - hash_size, 0, &root_cert, &root_cert_size); - internal_dump_hex(root_cert, root_cert_size); + libspdm_internal_dump_hex(root_cert, root_cert_size); spdm_context->local_context.peer_root_cert_provision_size[0] = root_cert_size; spdm_context->local_context.peer_root_cert_provision[0] = root_cert; spdm_context->local_context.peer_cert_chain_provision = NULL; @@ -98,7 +98,7 @@ void test_spdm_requester_get_certificate_case1(void **State) void test_spdm_requester_get_certificate_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -121,7 +121,7 @@ void test_spdm_requester_get_certificate_case2(void **State) x509_get_cert_from_cert_chain((uint8_t *)data + sizeof(spdm_cert_chain_t) + hash_size, data_size - sizeof(spdm_cert_chain_t) - hash_size, 0, &root_cert, &root_cert_size); - internal_dump_hex(root_cert, root_cert_size); + libspdm_internal_dump_hex(root_cert, root_cert_size); spdm_context->local_context.peer_root_cert_provision_size[0] = root_cert_size; spdm_context->local_context.peer_root_cert_provision[0] = root_cert; spdm_context->local_context.peer_cert_chain_provision = NULL; @@ -140,7 +140,7 @@ void test_spdm_requester_get_certificate_case2(void **State) void test_spdm_requester_get_certificate_ex_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -163,7 +163,7 @@ void test_spdm_requester_get_certificate_ex_case1(void **State) x509_get_cert_from_cert_chain((uint8_t *)data + sizeof(spdm_cert_chain_t) + hash_size, data_size - sizeof(spdm_cert_chain_t) - hash_size, 0, &root_cert, &root_cert_size); - internal_dump_hex(root_cert, root_cert_size); + libspdm_internal_dump_hex(root_cert, root_cert_size); spdm_context->local_context.peer_root_cert_provision_size[0] = root_cert_size; spdm_context->local_context.peer_root_cert_provision[0] = root_cert; spdm_context->local_context.peer_cert_chain_provision = NULL; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_get_digests/get_digests.c b/unit_test/fuzzing/test_requester/test_spdm_requester_get_digests/get_digests.c index fc5ef4b5db9..0e056148ef7 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_get_digests/get_digests.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_get_digests/get_digests.c @@ -39,7 +39,7 @@ return_status spdm_device_receive_message(void *spdm_context, void test_spdm_requester_get_diges(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; uint8_t m_local_certificate_chain[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_get_measurements/get_measurements.c b/unit_test/fuzzing/test_requester/test_spdm_requester_get_measurements/get_measurements.c index bfbe3bbf1e7..661e03b8e32 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_get_measurements/get_measurements.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_get_measurements/get_measurements.c @@ -99,7 +99,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si void test_spdm_requester_get_measurement_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -163,7 +163,7 @@ void test_spdm_requester_get_measurement_case1(void **State) void test_spdm_requester_get_measurement_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -222,8 +222,8 @@ void test_spdm_requester_get_measurement_case2(void **State) void test_spdm_requester_get_measurement_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; uint8_t number_of_block; uint32_t measurement_record_length; uint32_t session_id; @@ -258,7 +258,7 @@ void test_spdm_requester_get_measurement_case3(void **State) session_id = 0xFFFFFFFF; test_message_header = TEST_MESSAGE_TYPE_SECURED_TEST; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state(session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -301,7 +301,7 @@ void test_spdm_requester_get_measurement_case3(void **State) void test_spdm_requester_get_measurement_case4(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_get_version/get_version.c b/unit_test/fuzzing/test_requester/test_spdm_requester_get_version/get_version.c index 737feebf623..216af3ac42b 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_get_version/get_version.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_get_version/get_version.c @@ -37,7 +37,7 @@ return_status spdm_device_receive_message(void *spdm_context, void test_spdm_requester_get_version(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *State; spdm_context = spdm_test_context->spdm_context; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_heartbeat/heartbeat.c b/unit_test/fuzzing/test_requester/test_spdm_requester_heartbeat/heartbeat.c index 4a2946c9078..712afd639b6 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_heartbeat/heartbeat.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_heartbeat/heartbeat.c @@ -55,7 +55,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si spdm_test_context_t *spdm_test_context; spdm_heartbeat_response_t *spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t test_message_header_size; spdm_test_context = get_spdm_test_context(); @@ -82,13 +82,13 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si void test_spdm_requester_heartbeat_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *State; test_message_header = TEST_MESSAGE_TYPE_SECURED_TEST; @@ -130,7 +130,7 @@ void test_spdm_requester_heartbeat_case1(void **State) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state(session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); set_mem( diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_key_exchange/key_exchange.c b/unit_test/fuzzing/test_requester/test_spdm_requester_key_exchange/key_exchange.c index e1d0db1b1ec..6724a2ef8ea 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_key_exchange/key_exchange.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_key_exchange/key_exchange.c @@ -102,7 +102,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -123,20 +123,20 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si (uint8_t *)spdm_test_context->test_buffer + test_message_header_size, spdm_test_context->test_buffer_size); - ((spdm_context_t *)spdm_context)->connection_info.algorithm.base_asym_algo = + ((libspdm_context_t *)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context)->connection_info.algorithm.base_hash_algo = + ((libspdm_context_t *)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context)->connection_info.algorithm.dhe_named_group = + ((libspdm_context_t *)spdm_context)->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context)->connection_info.algorithm.measurement_hash_algo = + ((libspdm_context_t *)spdm_context)->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size(spdm_context); + libspdm_get_opaque_data_version_selection_data_size(spdm_context); temp_buff_size = sizeof(spdm_key_exchange_response_t) + dhe_key_size + 0 + sizeof(uint16_t) + opaque_key_exchange_rsp_size + signature_size + hmac_size; @@ -158,8 +158,9 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data(spdm_context, &opaque_key_exchange_rsp_size, - ptr); + libspdm_build_opaque_data_version_selection_data(spdm_context, + &opaque_key_exchange_rsp_size, + ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); @@ -169,30 +170,30 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si (uintn)ptr - (uintn)spdm_response); m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, false, - get_managed_buffer(&th_curr), get_managed_buffer_size( + libspdm_get_managed_buffer(&th_curr), libspdm_get_managed_buffer_size( &th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), THCurrHashData); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, NULL, (uint16_t)hash_size, hash_size, bin_str0, &bin_str0_size); @@ -208,8 +209,9 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si (uint16_t)hash_size, hash_size, bin_str7, &bin_str7_size); libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size( + &th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; spdm_transport_test_encode_message(spdm_context, NULL, false, false, temp_buff_size, @@ -242,7 +244,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si void test_spdm_requester_key_exchange_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -288,7 +290,7 @@ void test_spdm_requester_key_exchange_case1(void **State) void test_spdm_requester_key_exchange_case2(void **state) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -333,7 +335,7 @@ void test_spdm_requester_key_exchange_case2(void **state) void test_spdm_requester_key_exchange_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -382,7 +384,7 @@ void test_spdm_requester_key_exchange_case3(void **State) void test_spdm_requester_key_exchange_ex_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_key_update/key_update.c b/unit_test/fuzzing/test_requester/test_spdm_requester_key_update/key_update.c index 083862e9c38..5f618c627ce 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_key_update/key_update.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_key_update/key_update.c @@ -9,14 +9,14 @@ #include "spdm_unit_fuzzing.h" #include "toolchain_harness.h" -static void spdm_set_standard_key_update_test_state(spdm_context_t *spdm_context, +static void spdm_set_standard_key_update_test_state(libspdm_context_t *spdm_context, uint32_t *session_id) { void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NEGOTIATED; spdm_context->connection_info.capability.flags |= @@ -47,7 +47,7 @@ static void spdm_set_standard_key_update_test_state(spdm_context_t *spdm_context #endif *session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, *session_id, true); + libspdm_session_info_init(spdm_context, session_info, *session_id, true); libspdm_secured_message_set_session_state(session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -120,7 +120,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si { static uint8_t sub_index = 0; spdm_key_update_response_t spdm_response; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint8_t test_message_header_size; uint8_t spdm_response_size; @@ -157,8 +157,8 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si void test_spdm_requester_key_update_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; - spdm_session_info_t *session_info; + libspdm_context_t *spdm_context; + libspdm_session_info_t *session_info; uint32_t session_id; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -189,9 +189,9 @@ void test_spdm_requester_key_update_case1(void **State) void test_spdm_requester_key_update_case2(void **state) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_negotiate_algorithms/negotiate_algorithms.c b/unit_test/fuzzing/test_requester/test_spdm_requester_negotiate_algorithms/negotiate_algorithms.c index b3d31e4db9d..e569fe0a9b7 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_negotiate_algorithms/negotiate_algorithms.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_negotiate_algorithms/negotiate_algorithms.c @@ -34,7 +34,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si void test_spdm_requester_negotiate_algorithms_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *State; spdm_context = spdm_test_context->spdm_context; spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_11 << @@ -51,7 +51,7 @@ void test_spdm_requester_negotiate_algorithms_case1(void **State) void test_spdm_requester_negotiate_algorithms_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *State; spdm_context = spdm_test_context->spdm_context; spdm_context->connection_info.version = SPDM_MESSAGE_VERSION_10 << @@ -68,7 +68,7 @@ void test_spdm_requester_negotiate_algorithms_case2(void **State) void test_spdm_requester_negotiate_algorithms_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *State; spdm_context = spdm_test_context->spdm_context; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_psk_exchange/psk_exchange.c b/unit_test/fuzzing/test_requester/test_spdm_requester_psk_exchange/psk_exchange.c index 5e1bdf4d61f..bd69ca84808 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_psk_exchange/psk_exchange.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_psk_exchange/psk_exchange.c @@ -82,7 +82,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t bin_str2[128]; uintn bin_str2_size; uint8_t bin_str7[128]; @@ -99,14 +99,15 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si (uint8_t *)spdm_test_context->test_buffer + test_message_header_size, spdm_test_context->test_buffer_size); - ((spdm_context_t *)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context)->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context)->connection_info.algorithm.measurement_hash_algo = + ((libspdm_context_t *)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; + ((libspdm_context_t *)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; + ((libspdm_context_t *)spdm_context)->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; + ((libspdm_context_t *)spdm_context)->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); - opaque_psk_exchange_rsp_size = spdm_get_opaque_data_version_selection_data_size(spdm_context); + opaque_psk_exchange_rsp_size = + libspdm_get_opaque_data_version_selection_data_size(spdm_context); temp_buf_size = sizeof(spdm_psk_exchange_response_t) + 0 + LIBSPDM_PSK_CONTEXT_LENGTH + opaque_psk_exchange_rsp_size + hmac_size; spdm_response = (void *)temp_buf; @@ -116,24 +117,25 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si * ptr += hash_size;*/ libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += LIBSPDM_PSK_CONTEXT_LENGTH; - spdm_build_opaque_data_version_selection_data(spdm_context, &opaque_psk_exchange_rsp_size, ptr); + libspdm_build_opaque_data_version_selection_data(spdm_context, &opaque_psk_exchange_rsp_size, + ptr); ptr += opaque_psk_exchange_rsp_size; copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), spdm_response, (uintn)ptr - (uintn)spdm_response); m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); cert_buffer = (uint8_t *)data + sizeof(spdm_cert_chain_t) + hash_size; cert_buffer_size = data_size - (sizeof(spdm_cert_chain_t) + hash_size); libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); bin_str2_size = sizeof(bin_str2); libspdm_bin_concat(SPDM_BIN_STR_2_LABEL, sizeof(SPDM_BIN_STR_2_LABEL) - 1, hash_data, @@ -150,8 +152,9 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si (uint16_t)hash_size, hash_size, bin_str7, &bin_str7_size); libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size( + &th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; spdm_transport_test_encode_message(spdm_context, NULL, false, false, temp_buf_size, temp_buf, @@ -162,7 +165,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si void test_spdm_requester_psk_exchange_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -212,7 +215,7 @@ void test_spdm_requester_psk_exchange_case1(void **State) void test_spdm_requester_psk_exchange_ex_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; diff --git a/unit_test/fuzzing/test_requester/test_spdm_requester_psk_finish/psk_finish.c b/unit_test/fuzzing/test_requester/test_spdm_requester_psk_finish/psk_finish.c index 393dc37107e..d0e048c70b8 100644 --- a/unit_test/fuzzing/test_requester/test_spdm_requester_psk_finish/psk_finish.c +++ b/unit_test/fuzzing/test_requester/test_spdm_requester_psk_finish/psk_finish.c @@ -66,7 +66,7 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t test_message_header_size; spdm_test_context = get_spdm_test_context(); @@ -94,13 +94,13 @@ return_status spdm_device_receive_message(void *spdm_context, uintn *response_si void test_spdm_requester_psk_finish_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; test_message_header = TEST_MESSAGE_TYPE_SECURED_TEST; spdm_test_context = *State; @@ -141,7 +141,7 @@ void test_spdm_requester_psk_finish_case1(void **State) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state(session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_algorithms/algorithms.c b/unit_test/fuzzing/test_responder/test_spdm_responder_algorithms/algorithms.c index 5096d5ce439..e3eae88429f 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_algorithms/algorithms.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_algorithms/algorithms.c @@ -16,7 +16,7 @@ uintn get_max_buffer_size(void) void test_spdm_responder_algorithms_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; response_size = sizeof(response); @@ -34,7 +34,7 @@ void test_spdm_responder_algorithms_case1(void **State) void test_spdm_responder_algorithms_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; response_size = sizeof(response); @@ -57,7 +57,7 @@ void test_spdm_responder_algorithms_case2(void **State) void test_spdm_responder_algorithms_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; response_size = sizeof(response); @@ -87,7 +87,7 @@ void test_spdm_responder_algorithms_case3(void **State) void test_spdm_responder_algorithms_case4(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; response_size = sizeof(response); @@ -129,7 +129,7 @@ void test_spdm_responder_algorithms_case4(void **State) void test_spdm_responder_algorithms_case5(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; response_size = sizeof(response); @@ -161,7 +161,7 @@ void test_spdm_responder_algorithms_case5(void **State) void test_spdm_responder_algorithms_case6(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; response_size = sizeof(response); @@ -193,7 +193,7 @@ void test_spdm_responder_algorithms_case6(void **State) void test_spdm_responder_algorithms_case7(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; response_size = sizeof(response); @@ -224,7 +224,7 @@ void test_spdm_responder_algorithms_case7(void **State) void test_spdm_responder_algorithms_case8(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; response_size = sizeof(response); @@ -254,7 +254,7 @@ void test_spdm_responder_algorithms_case8(void **State) void test_spdm_responder_algorithms_case9(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; response_size = sizeof(response); @@ -276,7 +276,7 @@ void test_spdm_responder_algorithms_case9(void **State) void test_spdm_responder_algorithms_case10(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; response_size = sizeof(response); diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_capabilities/capabilities.c b/unit_test/fuzzing/test_responder/test_spdm_responder_capabilities/capabilities.c index 7465605c494..25642461cd3 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_capabilities/capabilities.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_capabilities/capabilities.c @@ -16,7 +16,7 @@ uintn get_max_buffer_size(void) void test_spdm_responder_capabilities_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -36,7 +36,7 @@ void test_spdm_responder_capabilities_case1(void **State) void test_spdm_responder_capabilities_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -57,7 +57,7 @@ void test_spdm_responder_capabilities_case2(void **State) void test_spdm_responder_capabilities_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_certificate/certificate.c b/unit_test/fuzzing/test_responder/test_spdm_responder_certificate/certificate.c index 8784ee06a13..2e7b81f445f 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_certificate/certificate.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_certificate/certificate.c @@ -24,7 +24,7 @@ spdm_test_context_t m_spdm_responder_certificate_test_context = { void test_spdm_responder_certificate_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -60,7 +60,7 @@ void test_spdm_responder_certificate_case1(void **State) void test_spdm_responder_certificate_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -97,7 +97,7 @@ void test_spdm_responder_certificate_case2(void **State) void test_spdm_responder_certificate_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -120,7 +120,7 @@ void test_spdm_responder_certificate_case3(void **State) void test_spdm_responder_certificate_case4(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -141,7 +141,7 @@ void test_spdm_responder_certificate_case4(void **State) void test_spdm_responder_certificate_case5(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_challenge_auth/challenge_auth.c b/unit_test/fuzzing/test_responder/test_spdm_responder_challenge_auth/challenge_auth.c index 5f06c22a655..4f1696058d0 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_challenge_auth/challenge_auth.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_challenge_auth/challenge_auth.c @@ -24,7 +24,7 @@ spdm_test_context_t m_spdm_responder_challenge_test_context = { void test_spdm_responder_challenge_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -60,7 +60,7 @@ void test_spdm_responder_challenge_case1(void **State) void test_spdm_responder_challenge_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -96,7 +96,7 @@ void test_spdm_responder_challenge_case2(void **State) void test_spdm_responder_challenge_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -133,7 +133,7 @@ void test_spdm_responder_challenge_case3(void **State) void test_spdm_responder_challenge_case4(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -172,7 +172,7 @@ void test_spdm_responder_challenge_case4(void **State) void test_spdm_responder_challenge_case5(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -214,7 +214,7 @@ void test_spdm_responder_challenge_case5(void **State) void test_spdm_responder_challenge_case6(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_digests/digests.c b/unit_test/fuzzing/test_responder/test_spdm_responder_digests/digests.c index 44420a16b0c..4eaa5afeb29 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_digests/digests.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_digests/digests.c @@ -18,7 +18,7 @@ uintn get_max_buffer_size(void) void test_spdm_responder_digests_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uint8_t m_local_certificate_chain[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -49,7 +49,7 @@ void test_spdm_responder_digests_case1(void **State) void test_spdm_responder_digests_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn response_size; @@ -72,7 +72,7 @@ void test_spdm_responder_digests_case2(void **State) void test_spdm_responder_digests_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn response_size; @@ -94,7 +94,7 @@ void test_spdm_responder_digests_case3(void **State) void test_spdm_responder_digests_case4(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn response_size; diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_encap_challenge/encap_challenge.c b/unit_test/fuzzing/test_responder/test_spdm_responder_encap_challenge/encap_challenge.c index f4a2131c1ea..f05fee1c268 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_encap_challenge/encap_challenge.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_encap_challenge/encap_challenge.c @@ -27,7 +27,7 @@ static uint8_t m_local_buffer[LIBSPDM_MAX_MESSAGE_SMALL_BUFFER_SIZE]; void test_spdm_responder_encap_challenge_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_challenge_auth_response_t *spdm_response; uint8_t hash_data[LIBSPDM_MAX_HASH_SIZE]; uint8_t *ptr; @@ -96,9 +96,9 @@ void test_spdm_responder_encap_challenge_case1(void **State) sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), spdm_response, (uintn)ptr - (uintn)spdm_response); m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); ptr += sig_size; @@ -115,7 +115,7 @@ void test_spdm_responder_encap_challenge_case1(void **State) void test_spdm_get_encap_request_challenge_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn encap_request_size; void *data; uintn data_size; diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_encap_get_certificate/encap_get_certificate.c b/unit_test/fuzzing/test_responder/test_spdm_responder_encap_get_certificate/encap_get_certificate.c index 3573a15f8c0..1a12d1e28ee 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_encap_get_certificate/encap_get_certificate.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_encap_get_certificate/encap_get_certificate.c @@ -28,7 +28,7 @@ void test_spdm_responder_encap_get_certificate_case1(void **State) uintn spdm_response_size; bool need_continue; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *data; uintn data_size; @@ -49,7 +49,7 @@ void test_spdm_responder_encap_get_certificate_case1(void **State) x509_get_cert_from_cert_chain((uint8_t *)data + sizeof(spdm_cert_chain_t) + hash_size, data_size - sizeof(spdm_cert_chain_t) - hash_size, 0, &root_cert, &root_cert_size); - internal_dump_hex(root_cert, root_cert_size); + libspdm_internal_dump_hex(root_cert, root_cert_size); spdm_context->local_context.peer_root_cert_provision_size[0] = root_cert_size; spdm_context->local_context.peer_root_cert_provision[0] = root_cert; spdm_context->local_context.peer_cert_chain_provision = NULL; @@ -69,7 +69,7 @@ void test_spdm_responder_encap_get_certificate_case1(void **State) void test_spdm_get_encap_request_get_certificate_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn encap_request_size; void *data; uintn data_size; diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_encap_get_digests/encap_get_digests.c b/unit_test/fuzzing/test_responder/test_spdm_responder_encap_get_digests/encap_get_digests.c index 431a93bb922..9a651d111e5 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_encap_get_digests/encap_get_digests.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_encap_get_digests/encap_get_digests.c @@ -24,7 +24,7 @@ spdm_test_context_t m_spdm_responder_encap_get_digests_test_context = { void test_spdm_responder_encap_get_digests_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; bool need_continue; uint8_t m_local_certificate_chain[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -47,7 +47,7 @@ void test_spdm_get_encap_request_get_digest_case2(void **State) { spdm_test_context_t *spdm_test_context; spdm_get_digest_request_t *spdm_request; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn encap_request_size; void *data; uintn data_size; diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_encap_key_update/encap_key_update.c b/unit_test/fuzzing/test_responder/test_spdm_responder_encap_key_update/encap_key_update.c index 545e46f98d2..a567be83d08 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_encap_key_update/encap_key_update.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_encap_key_update/encap_key_update.c @@ -9,10 +9,10 @@ #include "spdm_unit_fuzzing.h" #include "toolchain_harness.h" -static void spdm_set_standard_key_update_test_state(spdm_context_t *spdm_context, +static void spdm_set_standard_key_update_test_state(libspdm_context_t *spdm_context, uint32_t *session_id) { - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_context->response_state = LIBSPDM_RESPONSE_STATE_NORMAL; spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NEGOTIATED; @@ -36,7 +36,7 @@ static void spdm_set_standard_key_update_test_state(spdm_context_t *spdm_context spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = *session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, *session_id, true); + libspdm_session_info_init(spdm_context, session_info, *session_id, true); libspdm_secured_message_set_session_state(session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -108,10 +108,10 @@ spdm_test_context_t m_spdm_responder_encap_get_digests_test_context = { void test_spdm_process_encap_response_key_update_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; bool need_continue; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -141,12 +141,12 @@ void test_spdm_get_encap_request_key_update_case1(void **State) { spdm_test_context_t *spdm_test_context; spdm_key_update_request_t *spdm_request; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn encap_request_size; void *data; uintn data_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *State; spdm_context = spdm_test_context->spdm_context; @@ -177,7 +177,7 @@ void test_spdm_get_encap_request_key_update_case1(void **State) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state(session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); spdm_get_encap_request_key_update(spdm_context, &encap_request_size, spdm_request); @@ -189,12 +189,12 @@ void test_spdm_get_encap_request_key_update_case2(void **State) { spdm_test_context_t *spdm_test_context; spdm_key_update_request_t *spdm_request; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn encap_request_size; void *data; uintn data_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *State; spdm_context = spdm_test_context->spdm_context; @@ -227,7 +227,7 @@ void test_spdm_get_encap_request_key_update_case2(void **State) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state(session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); spdm_get_encap_request_key_update(spdm_context, &encap_request_size, spdm_request); diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_encap_response/encap_response.c b/unit_test/fuzzing/test_responder/test_spdm_responder_encap_response/encap_response.c index 8623220c09a..b6d34d3b7f4 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_encap_response/encap_response.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_encap_response/encap_response.c @@ -24,7 +24,7 @@ spdm_test_context_t m_spdm_response_encapsulated_request_test_context = { void test_spdm_get_response_encapsulated_request_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn data_size; void *data; @@ -35,7 +35,8 @@ void test_spdm_get_response_encapsulated_request_case1(void **State) spdm_context->response_state = LIBSPDM_RESPONSE_STATE_PROCESSING_ENCAP; spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP; spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP; - spdm_context->encap_context.request_op_code_count = MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; + spdm_context->encap_context.request_op_code_count = + LIBSPDM_MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; spdm_context->encap_context.current_request_op_code = 0; spdm_context->encap_context.request_op_code_sequence[0] = SPDM_GET_DIGESTS; @@ -64,7 +65,7 @@ void test_spdm_get_response_encapsulated_request_case1(void **State) void test_spdm_get_response_encapsulated_request_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uint8_t m_local_certificate_chain[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -96,7 +97,7 @@ void test_spdm_get_response_encapsulated_request_case2(void **State) void test_spdm_get_response_encapsulated_request_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uint8_t m_local_certificate_chain[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -128,7 +129,7 @@ void test_spdm_get_response_encapsulated_request_case3(void **State) void test_spdm_get_response_encapsulated_request_case4(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uint8_t m_local_certificate_chain[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -160,7 +161,7 @@ void test_spdm_get_response_encapsulated_request_case4(void **State) void test_spdm_get_response_encapsulated_request_case5(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn response_size; spdm_test_context = *State; @@ -169,7 +170,8 @@ void test_spdm_get_response_encapsulated_request_case5(void **State) spdm_context->response_state = LIBSPDM_RESPONSE_STATE_PROCESSING_ENCAP; spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP; spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP; - spdm_context->encap_context.request_op_code_count = MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; + spdm_context->encap_context.request_op_code_count = + LIBSPDM_MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; spdm_context->encap_context.current_request_op_code = 0; response_size = sizeof(response); @@ -181,7 +183,7 @@ void test_spdm_get_response_encapsulated_request_case5(void **State) void test_spdm_spdm_get_response_encapsulated_response_ack_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn data_size; void *data; @@ -192,7 +194,8 @@ void test_spdm_spdm_get_response_encapsulated_response_ack_case1(void **State) spdm_context->response_state = LIBSPDM_RESPONSE_STATE_PROCESSING_ENCAP; spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP; spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP; - spdm_context->encap_context.request_op_code_count = MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; + spdm_context->encap_context.request_op_code_count = + LIBSPDM_MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; spdm_context->encap_context.current_request_op_code = 0; spdm_context->encap_context.request_op_code_sequence[0] = SPDM_GET_DIGESTS; @@ -219,7 +222,7 @@ void test_spdm_spdm_get_response_encapsulated_response_ack_case1(void **State) void test_spdm_spdm_get_response_encapsulated_response_ack_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; spdm_test_context = *State; spdm_context = spdm_test_context->spdm_context; @@ -228,7 +231,8 @@ void test_spdm_spdm_get_response_encapsulated_response_ack_case2(void **State) spdm_context->response_state = LIBSPDM_RESPONSE_STATE_PROCESSING_ENCAP; spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP; spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP; - spdm_context->encap_context.request_op_code_count = MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; + spdm_context->encap_context.request_op_code_count = + LIBSPDM_MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; spdm_context->encap_context.current_request_op_code = 0; response_size = sizeof(response); @@ -241,7 +245,7 @@ void test_spdm_spdm_get_response_encapsulated_response_ack_case2(void **State) void test_spdm_spdm_get_response_encapsulated_response_ack_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn data_size; void *data; uintn response_size; @@ -255,7 +259,8 @@ void test_spdm_spdm_get_response_encapsulated_response_ack_case3(void **State) spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_CERT_CAP; spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CERT_CAP; spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP; - spdm_context->encap_context.request_op_code_count = MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; + spdm_context->encap_context.request_op_code_count = + LIBSPDM_MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; spdm_context->encap_context.current_request_op_code = SPDM_GET_DIGESTS; spdm_context->encap_context.request_op_code_sequence[0] = SPDM_GET_DIGESTS; spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NEGOTIATED; @@ -286,7 +291,7 @@ void test_spdm_spdm_get_response_encapsulated_response_ack_case3(void **State) void test_spdm_spdm_get_response_encapsulated_response_ack_case4(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn response_size; spdm_test_context = *State; @@ -295,7 +300,8 @@ void test_spdm_spdm_get_response_encapsulated_response_ack_case4(void **State) spdm_context->response_state = LIBSPDM_RESPONSE_STATE_NORMAL; spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP; spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP; - spdm_context->encap_context.request_op_code_count = MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; + spdm_context->encap_context.request_op_code_count = + LIBSPDM_MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; response_size = sizeof(response); spdm_get_response_encapsulated_response_ack(spdm_context, spdm_test_context->test_buffer_size, @@ -306,7 +312,7 @@ void test_spdm_spdm_get_response_encapsulated_response_ack_case4(void **State) void test_spdm_spdm_get_response_encapsulated_response_ack_case5(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn response_size; spdm_test_context = *State; @@ -315,7 +321,8 @@ void test_spdm_spdm_get_response_encapsulated_response_ack_case5(void **State) spdm_context->response_state = LIBSPDM_RESPONSE_STATE_NOT_READY; spdm_context->connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_ENCAP_CAP; spdm_context->local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_ENCAP_CAP; - spdm_context->encap_context.request_op_code_count = MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; + spdm_context->encap_context.request_op_code_count = + LIBSPDM_MAX_ENCAP_REQUEST_OP_CODE_SEQUENCE_COUNT; response_size = sizeof(response); spdm_get_response_encapsulated_response_ack(spdm_context, spdm_test_context->test_buffer_size, diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_end_session/end_session.c b/unit_test/fuzzing/test_responder/test_spdm_responder_end_session/end_session.c index f93132150e8..0928e58dce5 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_end_session/end_session.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_end_session/end_session.c @@ -25,12 +25,12 @@ spdm_test_context_t m_spdm_responder_end_session_test_context = { void test_spdm_responder_end_session(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; uintn data_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *State; @@ -77,7 +77,7 @@ void test_spdm_responder_end_session(void **State) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_finish_rsp/finish_rsp.c b/unit_test/fuzzing/test_responder/test_spdm_responder_finish_rsp/finish_rsp.c index 7e593844524..93735efa987 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_finish_rsp/finish_rsp.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_finish_rsp/finish_rsp.c @@ -43,7 +43,7 @@ typedef struct { void test_spdm_responder_finish_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data1; @@ -52,9 +52,9 @@ void test_spdm_responder_finish_case1(void **State) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -68,7 +68,7 @@ void test_spdm_responder_finish_case1(void **State) m_spdm_finish_request1 = *(spdm_finish_request_mine_t *)spdm_test_context->test_buffer; m_spdm_finish_request1_size = spdm_test_context->test_buffer_size; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; spdm_context.connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NEGOTIATED; spdm_context.connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP; spdm_context.local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP; @@ -95,7 +95,7 @@ void test_spdm_responder_finish_case1(void **State) session_id = 0xFFFFFFFF; spdm_context.latest_session_id = session_id; session_info = &spdm_context.session_info[0]; - spdm_session_info_init(&spdm_context, session_info, session_id, false); + libspdm_session_info_init(&spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key(session_info->secured_message_context, @@ -106,17 +106,18 @@ void test_spdm_responder_finish_case1(void **State) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request1.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, &m_spdm_finish_request1, sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, &m_spdm_finish_request1, sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, + ptr); m_spdm_finish_request1_size = sizeof(spdm_finish_request_t) + hmac_size; response_size = sizeof(response); spdm_get_response_finish(&spdm_context, m_spdm_finish_request1_size, &m_spdm_finish_request1, @@ -127,12 +128,12 @@ void test_spdm_responder_finish_case1(void **State) void test_spdm_responder_finish_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_test_context = *State; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; spdm_context.response_state = LIBSPDM_RESPONSE_STATE_NOT_READY; response_size = sizeof(response); @@ -143,12 +144,12 @@ void test_spdm_responder_finish_case2(void **State) void test_spdm_responder_finish_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_test_context = *State; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; spdm_context.response_state = LIBSPDM_RESPONSE_STATE_NORMAL; spdm_context.connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NEGOTIATED; spdm_context.local_context.capability.flags = 0; @@ -161,12 +162,12 @@ void test_spdm_responder_finish_case3(void **State) void test_spdm_responder_finish_case4(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_test_context = *State; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; spdm_context.response_state = LIBSPDM_RESPONSE_STATE_NORMAL; spdm_context.connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NOT_STARTED; spdm_context.connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP; @@ -179,13 +180,13 @@ void test_spdm_responder_finish_case4(void **State) void test_spdm_responder_finish_case5(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_test_context = *State; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; spdm_context.response_state = LIBSPDM_RESPONSE_STATE_NORMAL; spdm_context.connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NEGOTIATED; spdm_context.connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP; @@ -199,13 +200,13 @@ void test_spdm_responder_finish_case5(void **State) void test_spdm_responder_finish_case6(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_test_context = *State; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; spdm_context.response_state = LIBSPDM_RESPONSE_STATE_NORMAL; spdm_context.connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NEGOTIATED; spdm_context.connection_info.capability.flags |= @@ -224,19 +225,19 @@ void test_spdm_responder_finish_case6(void **State) void test_spdm_responder_finish_case7(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint8_t m_dummy_buffer[LIBSPDM_MAX_HASH_SIZE]; spdm_test_context = *State; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; spdm_context.connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NEGOTIATED; spdm_context.connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP; spdm_context.local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP; @@ -263,7 +264,7 @@ void test_spdm_responder_finish_case7(void **State) session_id = 0xFFFFFFFF; spdm_context.latest_session_id = session_id; session_info = &spdm_context.session_info[0]; - spdm_session_info_init(&spdm_context, session_info, session_id, false); + libspdm_session_info_init(&spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key(session_info->secured_message_context, @@ -282,7 +283,7 @@ void test_spdm_responder_finish_case7(void **State) void test_spdm_responder_finish_case8(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data1; @@ -294,9 +295,9 @@ void test_spdm_responder_finish_case8(void **State) uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; uint8_t req_cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -310,7 +311,7 @@ void test_spdm_responder_finish_case8(void **State) m_spdm_finish_request = *(spdm_finish_request_mine_t *)spdm_test_context->test_buffer; m_spdm_finish_request_size = spdm_test_context->test_buffer_size; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; spdm_context.connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NEGOTIATED; spdm_context.connection_info.capability.flags |= SPDM_GET_CAPABILITIES_REQUEST_FLAGS_KEY_EX_CAP; spdm_context.local_context.capability.flags |= SPDM_GET_CAPABILITIES_RESPONSE_FLAGS_KEY_EX_CAP; @@ -343,7 +344,7 @@ void test_spdm_responder_finish_case8(void **State) session_id = 0xFFFFFEE; spdm_context.latest_session_id = session_id; session_info = &spdm_context.session_info[0]; - spdm_session_info_init(&spdm_context, session_info, session_id, false); + libspdm_session_info_init(&spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key(session_info->secured_message_context, @@ -360,7 +361,7 @@ void test_spdm_responder_finish_case8(void **State) hmac_size = libspdm_get_hash_size(m_use_hash_algo); req_asym_signature_size = libspdm_get_req_asym_signature_size(m_use_req_asym_algo); ptr = m_spdm_finish_request.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); @@ -368,19 +369,20 @@ void test_spdm_responder_finish_case8(void **State) cert_buffer_size = data_size2; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, req_cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, req_cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, &m_spdm_finish_request, sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, req_cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, &m_spdm_finish_request, sizeof(spdm_finish_request_t)); libspdm_requester_data_sign( m_spdm_finish_request.header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_FINISH, - m_use_req_asym_algo, m_use_hash_algo, false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, &req_asym_signature_size); - append_managed_buffer(&th_curr, ptr, req_asym_signature_size); + m_use_req_asym_algo, m_use_hash_algo, false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &req_asym_signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, req_asym_signature_size); ptr += req_asym_signature_size; set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, + ptr); m_spdm_finish_request_size = sizeof(spdm_finish_request_t) + req_asym_signature_size + hmac_size; response_size = sizeof(response); diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_heartbeat_ack/heartbeat_ack.c b/unit_test/fuzzing/test_responder/test_spdm_responder_heartbeat_ack/heartbeat_ack.c index 491afb1fff7..1827b2142d9 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_heartbeat_ack/heartbeat_ack.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_heartbeat_ack/heartbeat_ack.c @@ -22,12 +22,12 @@ spdm_test_context_t m_spdm_responder_heartbeat_test_context = { void test_spdm_responder_heartbeat(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint8_t m_local_psk_hint[32]; @@ -75,7 +75,7 @@ void test_spdm_responder_heartbeat(void **State) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_if_ready/respond_if_ready.c b/unit_test/fuzzing/test_responder/test_spdm_responder_if_ready/respond_if_ready.c index e94b9b7f77d..6eb928a647e 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_if_ready/respond_if_ready.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_if_ready/respond_if_ready.c @@ -25,7 +25,7 @@ spdm_test_context_t m_spdm_responder_if_ready_test_context = { void test_spdm_responder_respond_if_ready(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uint8_t m_local_certificate_chain[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_key_exchange/key_exchange.c b/unit_test/fuzzing/test_responder/test_spdm_responder_key_exchange/key_exchange.c index 380c05771d2..2fbbf5a2959 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_key_exchange/key_exchange.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_key_exchange/key_exchange.c @@ -34,7 +34,7 @@ typedef struct { void test_spdm_responder_key_exchange_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_request_mine_t m_spdm_key_exchange_request; @@ -77,11 +77,12 @@ void test_spdm_responder_key_exchange_case1(void **State) libspdm_dhe_generate_key(m_use_dhe_algo, dhe_context, ptr, &dhe_key_size); ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); - opaque_key_exchange_req_size = spdm_get_opaque_data_supported_version_data_size(spdm_context); + opaque_key_exchange_req_size = + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data(spdm_context, &opaque_key_exchange_req_size, - ptr); + libspdm_build_opaque_data_supported_version_data(spdm_context, &opaque_key_exchange_req_size, + ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -95,7 +96,7 @@ void test_spdm_responder_key_exchange_case2(void **State) spdm_test_context_t *spdm_test_context; spdm_key_exchange_request_mine_t m_spdm_key_exchange_request; uintn m_spdm_key_exchange_request_size; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -135,11 +136,12 @@ void test_spdm_responder_key_exchange_case2(void **State) libspdm_dhe_generate_key(m_use_dhe_algo, dhe_context, ptr, &dhe_key_size); ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); - opaque_key_exchange_req_size = spdm_get_opaque_data_supported_version_data_size(spdm_context); + opaque_key_exchange_req_size = + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data(spdm_context, &opaque_key_exchange_req_size, - ptr); + libspdm_build_opaque_data_supported_version_data(spdm_context, &opaque_key_exchange_req_size, + ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -153,7 +155,7 @@ void test_spdm_responder_key_exchange_case3(void **State) spdm_test_context_t *spdm_test_context; spdm_key_exchange_request_mine_t m_spdm_key_exchange_request; uintn m_spdm_key_exchange_request_size; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -194,7 +196,7 @@ void test_spdm_responder_key_exchange_case3(void **State) void test_spdm_responder_key_exchange_case4(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_request_mine_t m_spdm_key_exchange_request; @@ -243,11 +245,12 @@ void test_spdm_responder_key_exchange_case4(void **State) libspdm_dhe_generate_key(m_use_dhe_algo, dhe_context, ptr, &dhe_key_size); ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); - opaque_key_exchange_req_size = spdm_get_opaque_data_supported_version_data_size(spdm_context); + opaque_key_exchange_req_size = + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data(spdm_context, &opaque_key_exchange_req_size, - ptr); + libspdm_build_opaque_data_supported_version_data(spdm_context, &opaque_key_exchange_req_size, + ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -259,7 +262,7 @@ void test_spdm_responder_key_exchange_case4(void **State) void test_spdm_responder_key_exchange_case5(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_request_mine_t m_spdm_key_exchange_request; @@ -306,11 +309,12 @@ void test_spdm_responder_key_exchange_case5(void **State) libspdm_dhe_generate_key(m_use_dhe_algo, dhe_context, ptr, &dhe_key_size); ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); - opaque_key_exchange_req_size = spdm_get_opaque_data_supported_version_data_size(spdm_context); + opaque_key_exchange_req_size = + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data(spdm_context, &opaque_key_exchange_req_size, - ptr); + libspdm_build_opaque_data_supported_version_data(spdm_context, &opaque_key_exchange_req_size, + ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -324,7 +328,7 @@ void test_spdm_responder_key_exchange_case6(void **State) spdm_test_context_t *spdm_test_context; spdm_key_exchange_request_mine_t m_spdm_key_exchange_request; uintn m_spdm_key_exchange_request_size; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -363,11 +367,12 @@ void test_spdm_responder_key_exchange_case6(void **State) libspdm_dhe_generate_key(m_use_dhe_algo, dhe_context, ptr, &dhe_key_size); ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); - opaque_key_exchange_req_size = spdm_get_opaque_data_supported_version_data_size(spdm_context); + opaque_key_exchange_req_size = + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data(spdm_context, &opaque_key_exchange_req_size, - ptr); + libspdm_build_opaque_data_supported_version_data(spdm_context, &opaque_key_exchange_req_size, + ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_key_update/key_update.c b/unit_test/fuzzing/test_responder/test_spdm_responder_key_update/key_update.c index 6ce0ec584b5..d20a3d92184 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_key_update/key_update.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_key_update/key_update.c @@ -11,10 +11,10 @@ static void -spdm_set_standard_key_update_test_state(spdm_context_t *spdm_context, +spdm_set_standard_key_update_test_state(libspdm_context_t *spdm_context, uint32_t *session_id) { - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_context->response_state = LIBSPDM_RESPONSE_STATE_NORMAL; spdm_context->connection_info.connection_state = @@ -47,7 +47,7 @@ spdm_set_standard_key_update_test_state(spdm_context_t *spdm_context, spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = *session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, *session_id, true); + libspdm_session_info_init(spdm_context, session_info, *session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -127,9 +127,9 @@ spdm_test_context_t m_spdm_responder_key_update_test_context = { void test_spdm_responder_key_update(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_measurements/measurements.c b/unit_test/fuzzing/test_responder/test_spdm_responder_measurements/measurements.c index 35b0400cbf7..86deaaf34ce 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_measurements/measurements.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_measurements/measurements.c @@ -21,7 +21,7 @@ uintn get_max_buffer_size(void) void test_spdm_responder_measurements_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -47,8 +47,8 @@ void test_spdm_responder_measurements_case1(void **State) void test_spdm_responder_measurements_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_session_info_t *session_info; - spdm_context_t *spdm_context; + libspdm_session_info_t *session_info; + libspdm_context_t *spdm_context; uintn response_size; uint32_t session_id; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -79,7 +79,7 @@ void test_spdm_responder_measurements_case2(void **State) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); response_size = sizeof(response); @@ -92,7 +92,7 @@ void test_spdm_responder_measurements_case2(void **State) void test_spdm_responder_measurements_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -131,8 +131,8 @@ void test_spdm_responder_measurements_case3(void **State) void test_spdm_responder_measurements_case4(void **State) { spdm_test_context_t *spdm_test_context; - spdm_session_info_t *session_info; - spdm_context_t *spdm_context; + libspdm_session_info_t *session_info; + libspdm_context_t *spdm_context; uintn response_size; uintn data_size; void *data; @@ -175,7 +175,7 @@ void test_spdm_responder_measurements_case4(void **State) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); response_size = sizeof(response); diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_psk_exchange_rsp/psk_exchange_rsp.c b/unit_test/fuzzing/test_responder/test_spdm_responder_psk_exchange_rsp/psk_exchange_rsp.c index 3f3ece171eb..5a36ac66184 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_psk_exchange_rsp/psk_exchange_rsp.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_psk_exchange_rsp/psk_exchange_rsp.c @@ -35,7 +35,7 @@ typedef struct { void test_spdm_responder_psk_exchange_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -47,7 +47,7 @@ void test_spdm_responder_psk_exchange_case1(void **State) uintn opaque_psk_exchange_req_size; spdm_test_context = *State; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; m_spdm_psk_exchange_request = *(spdm_psk_exchange_request_mine_t *)spdm_test_context->test_buffer; @@ -77,15 +77,16 @@ void test_spdm_responder_psk_exchange_case1(void **State) spdm_context.local_context.psk_hint_size = sizeof(TEST_PSK_HINT_STRING); spdm_context.local_context.psk_hint = m_local_psk_hint; - opaque_psk_exchange_req_size = spdm_get_opaque_data_supported_version_data_size(&spdm_context); + opaque_psk_exchange_req_size = + libspdm_get_opaque_data_supported_version_data_size(&spdm_context); ptr = m_spdm_psk_exchange_request.psk_hint; copy_mem_s(ptr, sizeof(m_spdm_psk_exchange_request.psk_hint), &spdm_context.local_context.psk_hint, spdm_context.local_context.psk_hint_size); ptr += m_spdm_psk_exchange_request.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request.context_length; - spdm_build_opaque_data_supported_version_data(&spdm_context, &opaque_psk_exchange_req_size, - ptr); + libspdm_build_opaque_data_supported_version_data(&spdm_context, &opaque_psk_exchange_req_size, + ptr); ptr += opaque_psk_exchange_req_size; response_size = sizeof(response); @@ -97,7 +98,7 @@ void test_spdm_responder_psk_exchange_case1(void **State) void test_spdm_responder_psk_exchange_case2(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -109,7 +110,7 @@ void test_spdm_responder_psk_exchange_case2(void **State) uintn opaque_psk_exchange_req_size; spdm_test_context = *State; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; m_spdm_psk_exchange_request = *(spdm_psk_exchange_request_mine_t *)spdm_test_context->test_buffer; m_spdm_psk_exchange_request_size = spdm_test_context->test_buffer_size; @@ -137,15 +138,16 @@ void test_spdm_responder_psk_exchange_case2(void **State) spdm_context.local_context.psk_hint_size = sizeof(TEST_PSK_HINT_STRING); spdm_context.local_context.psk_hint = m_local_psk_hint; - opaque_psk_exchange_req_size = spdm_get_opaque_data_supported_version_data_size(&spdm_context); + opaque_psk_exchange_req_size = + libspdm_get_opaque_data_supported_version_data_size(&spdm_context); ptr = m_spdm_psk_exchange_request.psk_hint; copy_mem_s(ptr, sizeof(m_spdm_psk_exchange_request.psk_hint), &spdm_context.local_context.psk_hint, spdm_context.local_context.psk_hint_size); ptr += m_spdm_psk_exchange_request.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request.context_length; - spdm_build_opaque_data_supported_version_data(&spdm_context, &opaque_psk_exchange_req_size, - ptr); + libspdm_build_opaque_data_supported_version_data(&spdm_context, &opaque_psk_exchange_req_size, + ptr); ptr += opaque_psk_exchange_req_size; response_size = sizeof(response); @@ -157,7 +159,7 @@ void test_spdm_responder_psk_exchange_case2(void **State) void test_spdm_responder_psk_exchange_case3(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -169,7 +171,7 @@ void test_spdm_responder_psk_exchange_case3(void **State) uintn opaque_psk_exchange_req_size; spdm_test_context = *State; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; m_spdm_psk_exchange_request = *(spdm_psk_exchange_request_mine_t *)spdm_test_context->test_buffer; @@ -198,15 +200,16 @@ void test_spdm_responder_psk_exchange_case3(void **State) spdm_context.local_context.psk_hint_size = sizeof(TEST_PSK_HINT_STRING); spdm_context.local_context.psk_hint = m_local_psk_hint; - opaque_psk_exchange_req_size = spdm_get_opaque_data_supported_version_data_size(&spdm_context); + opaque_psk_exchange_req_size = + libspdm_get_opaque_data_supported_version_data_size(&spdm_context); ptr = m_spdm_psk_exchange_request.psk_hint; copy_mem_s(ptr, sizeof(m_spdm_psk_exchange_request.psk_hint), &spdm_context.local_context.psk_hint, spdm_context.local_context.psk_hint_size); ptr += m_spdm_psk_exchange_request.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request.context_length; - spdm_build_opaque_data_supported_version_data(&spdm_context, &opaque_psk_exchange_req_size, - ptr); + libspdm_build_opaque_data_supported_version_data(&spdm_context, &opaque_psk_exchange_req_size, + ptr); ptr += opaque_psk_exchange_req_size; response_size = sizeof(response); @@ -218,7 +221,7 @@ void test_spdm_responder_psk_exchange_case3(void **State) void test_spdm_responder_psk_exchange_case4(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -230,7 +233,7 @@ void test_spdm_responder_psk_exchange_case4(void **State) uintn opaque_psk_exchange_req_size; spdm_test_context = *State; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; m_spdm_psk_exchange_request = *(spdm_psk_exchange_request_mine_t *)spdm_test_context->test_buffer; m_spdm_psk_exchange_request_size = spdm_test_context->test_buffer_size; @@ -264,15 +267,16 @@ void test_spdm_responder_psk_exchange_case4(void **State) spdm_context.local_context.psk_hint_size = sizeof(TEST_PSK_HINT_STRING); spdm_context.local_context.psk_hint = m_local_psk_hint; - opaque_psk_exchange_req_size = spdm_get_opaque_data_supported_version_data_size(&spdm_context); + opaque_psk_exchange_req_size = + libspdm_get_opaque_data_supported_version_data_size(&spdm_context); ptr = m_spdm_psk_exchange_request.psk_hint; copy_mem_s(ptr, sizeof(m_spdm_psk_exchange_request.psk_hint), &spdm_context.local_context.psk_hint, spdm_context.local_context.psk_hint_size); ptr += m_spdm_psk_exchange_request.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request.context_length; - spdm_build_opaque_data_supported_version_data(&spdm_context, &opaque_psk_exchange_req_size, - ptr); + libspdm_build_opaque_data_supported_version_data(&spdm_context, &opaque_psk_exchange_req_size, + ptr); ptr += opaque_psk_exchange_req_size; response_size = sizeof(response); @@ -284,7 +288,7 @@ void test_spdm_responder_psk_exchange_case4(void **State) void test_spdm_responder_psk_exchange_case5(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t spdm_context; + libspdm_context_t spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data; @@ -296,7 +300,7 @@ void test_spdm_responder_psk_exchange_case5(void **State) uintn opaque_psk_exchange_req_size; spdm_test_context = *State; - spdm_context = *(spdm_context_t *)spdm_test_context->spdm_context; + spdm_context = *(libspdm_context_t *)spdm_test_context->spdm_context; m_spdm_psk_exchange_request = *(spdm_psk_exchange_request_mine_t *)spdm_test_context->test_buffer; m_spdm_psk_exchange_request_size = spdm_test_context->test_buffer_size; @@ -331,15 +335,16 @@ void test_spdm_responder_psk_exchange_case5(void **State) spdm_context.local_context.psk_hint_size = sizeof(TEST_PSK_HINT_STRING); spdm_context.local_context.psk_hint = m_local_psk_hint; - opaque_psk_exchange_req_size = spdm_get_opaque_data_supported_version_data_size(&spdm_context); + opaque_psk_exchange_req_size = + libspdm_get_opaque_data_supported_version_data_size(&spdm_context); ptr = m_spdm_psk_exchange_request.psk_hint; copy_mem_s(ptr, sizeof(m_spdm_psk_exchange_request.psk_hint), &spdm_context.local_context.psk_hint, spdm_context.local_context.psk_hint_size); ptr += m_spdm_psk_exchange_request.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request.context_length; - spdm_build_opaque_data_supported_version_data(&spdm_context, &opaque_psk_exchange_req_size, - ptr); + libspdm_build_opaque_data_supported_version_data(&spdm_context, &opaque_psk_exchange_req_size, + ptr); ptr += opaque_psk_exchange_req_size; response_size = sizeof(response); diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_psk_finish_rsp/psk_finish_rsp.c b/unit_test/fuzzing/test_responder/test_spdm_responder_psk_finish_rsp/psk_finish_rsp.c index e9a37294576..aea867fcd8e 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_psk_finish_rsp/psk_finish_rsp.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_psk_finish_rsp/psk_finish_rsp.c @@ -40,7 +40,7 @@ static void spdm_secured_message_set_request_finished_key(void *spdm_secured_mes void test_spdm_responder_psk_finish_rsp_case1(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data1; @@ -48,7 +48,7 @@ void test_spdm_responder_psk_finish_rsp_case1(void **State) static uint8_t m_dummy_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_local_psk_hint[32]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; @@ -83,7 +83,7 @@ void test_spdm_responder_psk_finish_rsp_case1(void **State) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key(session_info->secured_message_context, @@ -102,17 +102,17 @@ void test_spdm_responder_psk_finish_rsp_case2(void **State) spdm_test_context_t *spdm_test_context; spdm_psk_finish_request_mine_t m_spdm_psk_finish_request; uintn m_spdm_psk_finish_request_size; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; void *data1; uintn data_size1; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; static uint8_t m_dummy_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_local_psk_hint[32]; uint8_t *ptr; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -150,7 +150,7 @@ void test_spdm_responder_psk_finish_rsp_case2(void **State) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key(session_info->secured_message_context, @@ -161,13 +161,14 @@ void test_spdm_responder_psk_finish_rsp_case2(void **State) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request, + sizeof(spdm_psk_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, + ptr); m_spdm_psk_finish_request_size = sizeof(spdm_psk_finish_request_t) + hmac_size; response_size = sizeof(response); diff --git a/unit_test/fuzzing/test_responder/test_spdm_responder_version/version.c b/unit_test/fuzzing/test_responder/test_spdm_responder_version/version.c index 71517c0439d..9613a6a7845 100644 --- a/unit_test/fuzzing/test_responder/test_spdm_responder_version/version.c +++ b/unit_test/fuzzing/test_responder/test_spdm_responder_version/version.c @@ -16,7 +16,7 @@ uintn get_max_buffer_size(void) void test_spdm_responder_version(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; diff --git a/unit_test/fuzzing/test_secured_message/test_spdm_decode_secured_message/spdm_decode_secured_message.c b/unit_test/fuzzing/test_secured_message/test_spdm_decode_secured_message/spdm_decode_secured_message.c index 456309126d0..071f996f4b3 100644 --- a/unit_test/fuzzing/test_secured_message/test_spdm_decode_secured_message/spdm_decode_secured_message.c +++ b/unit_test/fuzzing/test_secured_message/test_spdm_decode_secured_message/spdm_decode_secured_message.c @@ -18,11 +18,11 @@ uintn get_max_buffer_size(void) void test_libspdm_decode_secured_message(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn app_message_size; uint8_t app_message[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; libspdm_secured_message_callbacks_t spdm_secured_message_callbacks; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; bool is_requester; uint32_t session_id; spdm_secured_message_context_t *secured_message_context; @@ -41,7 +41,7 @@ void test_libspdm_decode_secured_message(void **State) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); secured_message_context = session_info->secured_message_context; secured_message_context->session_type = LIBSPDM_SESSION_TYPE_MAC_ONLY; secured_message_context->session_state = LIBSPDM_SESSION_STATE_HANDSHAKING; diff --git a/unit_test/fuzzing/test_secured_message/test_spdm_encode_secured_message/spdm_encode_secured_message.c b/unit_test/fuzzing/test_secured_message/test_spdm_encode_secured_message/spdm_encode_secured_message.c index b19de1a2122..591d1cfbab4 100644 --- a/unit_test/fuzzing/test_secured_message/test_spdm_encode_secured_message/spdm_encode_secured_message.c +++ b/unit_test/fuzzing/test_secured_message/test_spdm_encode_secured_message/spdm_encode_secured_message.c @@ -18,11 +18,11 @@ uintn get_max_buffer_size(void) void test_libspdm_encode_secured_message(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn secured_message_size; uint8_t secured_message[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; libspdm_secured_message_callbacks_t spdm_secured_message_callbacks; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; bool is_requester; uint32_t session_id; spdm_secured_message_context_t *secured_message_context; @@ -41,7 +41,7 @@ void test_libspdm_encode_secured_message(void **State) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); secured_message_context = session_info->secured_message_context; secured_message_context->session_type = LIBSPDM_SESSION_TYPE_MAC_ONLY; secured_message_context->session_state = LIBSPDM_SESSION_STATE_HANDSHAKING; diff --git a/unit_test/fuzzing/test_transport/test_spdm_transport_mctp_decode_message/spdm_transport_mctp_decode_message.c b/unit_test/fuzzing/test_transport/test_spdm_transport_mctp_decode_message/spdm_transport_mctp_decode_message.c index b08901d8a9e..607c6494f64 100644 --- a/unit_test/fuzzing/test_transport/test_spdm_transport_mctp_decode_message/spdm_transport_mctp_decode_message.c +++ b/unit_test/fuzzing/test_transport/test_spdm_transport_mctp_decode_message/spdm_transport_mctp_decode_message.c @@ -17,7 +17,7 @@ uintn get_max_buffer_size(void) void test_spdm_transport_mctp_decode_message(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn transport_message_size; uint8_t transport_message[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; bool is_app_message; diff --git a/unit_test/fuzzing/test_transport/test_spdm_transport_mctp_encode_message/transport_mctp_encode_message.c b/unit_test/fuzzing/test_transport/test_spdm_transport_mctp_encode_message/transport_mctp_encode_message.c index b4b65adea06..f2fdb8c9591 100644 --- a/unit_test/fuzzing/test_transport/test_spdm_transport_mctp_encode_message/transport_mctp_encode_message.c +++ b/unit_test/fuzzing/test_transport/test_spdm_transport_mctp_encode_message/transport_mctp_encode_message.c @@ -18,7 +18,7 @@ uintn get_max_buffer_size(void) void test_spdm_transport_mctp_encode_message(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn transport_message_size; uint8_t transport_message[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; bool is_app_message; diff --git a/unit_test/fuzzing/test_transport/test_spdm_transport_pci_doe_decode_message/spdm_transport_pci_doe_decode_message.c b/unit_test/fuzzing/test_transport/test_spdm_transport_pci_doe_decode_message/spdm_transport_pci_doe_decode_message.c index 2f3af2f8773..2a425cda636 100644 --- a/unit_test/fuzzing/test_transport/test_spdm_transport_pci_doe_decode_message/spdm_transport_pci_doe_decode_message.c +++ b/unit_test/fuzzing/test_transport/test_spdm_transport_pci_doe_decode_message/spdm_transport_pci_doe_decode_message.c @@ -17,7 +17,7 @@ uintn get_max_buffer_size(void) void test_spdm_transport_pci_doe_decode_message(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn transport_message_size; uint8_t transport_message[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; bool is_app_message; diff --git a/unit_test/fuzzing/test_transport/test_spdm_transport_pci_doe_encode_message/spdm_transport_pci_doe_encode_message.c b/unit_test/fuzzing/test_transport/test_spdm_transport_pci_doe_encode_message/spdm_transport_pci_doe_encode_message.c index f1a92ed4c6e..3960e44d57e 100644 --- a/unit_test/fuzzing/test_transport/test_spdm_transport_pci_doe_encode_message/spdm_transport_pci_doe_encode_message.c +++ b/unit_test/fuzzing/test_transport/test_spdm_transport_pci_doe_encode_message/spdm_transport_pci_doe_encode_message.c @@ -18,7 +18,7 @@ uintn get_max_buffer_size(void) void test_spdm_transport_pci_doe_encode_message(void **State) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn transport_message_size; uint8_t transport_message[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; bool is_app_message; diff --git a/unit_test/test_crypt/aead_verify.c b/unit_test/test_crypt/aead_verify.c index f8b284422da..562aefc0127 100644 --- a/unit_test/test_crypt/aead_verify.c +++ b/unit_test/test_crypt/aead_verify.c @@ -6,7 +6,7 @@ #include "test_crypt.h" -void internal_dump_data(const uint8_t *data, uintn size); +void libspdm_internal_dump_data(const uint8_t *data, uintn size); /* AES-GCM test data from NIST public test vectors */ diff --git a/unit_test/test_spdm_common/context_data.c b/unit_test/test_spdm_common/context_data.c index 96d5f4115e8..21579efdadc 100644 --- a/unit_test/test_spdm_common/context_data.c +++ b/unit_test/test_spdm_common/context_data.c @@ -17,7 +17,7 @@ static void test_spdm_common_context_data_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *data = (void *)&opaque_data; void *return_data = NULL; uintn data_return_size = 0; @@ -50,7 +50,7 @@ static void test_spdm_common_context_data_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *data = (void *)&opaque_data; void *return_data = NULL; void *current_return_data = NULL; @@ -101,7 +101,7 @@ static void test_spdm_common_context_data_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *data = NULL; void *return_data = NULL; void *current_return_data = NULL; @@ -154,7 +154,7 @@ static void test_spdm_common_context_data_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *data = (void *)&opaque_data; void *return_data = NULL; uintn data_return_size = 0; @@ -188,10 +188,10 @@ static void test_spdm_common_context_data_case4(void **state) * Test 5: There is no root cert. * Expected Behavior: Return true result. **/ -void test_spdm_verify_peer_cert_chain_buffer_case5(void **state) +void test_libspdm_verify_peer_cert_chain_buffer_case5(void **state) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *data; uintn data_size; void *hash; @@ -229,8 +229,8 @@ void test_spdm_verify_peer_cert_chain_buffer_case5(void **state) spdm_context->local_context.peer_root_cert_provision_size[root_cert_index] = 0; spdm_context->local_context.peer_root_cert_provision[root_cert_index] = NULL; } - result = spdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, - &trust_anchor_size); + result = libspdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, + &trust_anchor_size); assert_int_equal (result, true); free(data); @@ -243,10 +243,10 @@ void test_spdm_verify_peer_cert_chain_buffer_case5(void **state) * there is one match root cert; return false * there is one mismatch root cert; return true, and the return trust_anchor is root cert. **/ -void test_spdm_verify_peer_cert_chain_buffer_case6(void **state) +void test_libspdm_verify_peer_cert_chain_buffer_case6(void **state) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *data; uintn data_size; void *hash; @@ -303,15 +303,15 @@ void test_spdm_verify_peer_cert_chain_buffer_case6(void **state) /*case: match root cert case*/ spdm_context->local_context.peer_root_cert_provision_size[0] =root_cert_size_test; spdm_context->local_context.peer_root_cert_provision[0] = root_cert_test; - result = spdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, - &trust_anchor_size); + result = libspdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, + &trust_anchor_size); assert_int_equal (result, false); /*case: mismatch root cert case*/ spdm_context->local_context.peer_root_cert_provision_size[0] =root_cert_size; spdm_context->local_context.peer_root_cert_provision[0] = root_cert; - result = spdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, - &trust_anchor_size); + result = libspdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, + &trust_anchor_size); assert_int_equal (result, true); assert_ptr_equal (trust_anchor, root_cert); @@ -327,10 +327,10 @@ void test_spdm_verify_peer_cert_chain_buffer_case6(void **state) * there is one match root cert in the end; return true, and the return trust_anchor is root cert. * there is one match root cert in the middle; return true, and the return trust_anchor is root cert. **/ -void test_spdm_verify_peer_cert_chain_buffer_case7(void **state) +void test_libspdm_verify_peer_cert_chain_buffer_case7(void **state) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *data; uintn data_size; void *hash; @@ -391,8 +391,8 @@ void test_spdm_verify_peer_cert_chain_buffer_case7(void **state) root_cert_size_test; spdm_context->local_context.peer_root_cert_provision[root_cert_index] = root_cert_test; } - result = spdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, - &trust_anchor_size); + result = libspdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, + &trust_anchor_size); assert_int_equal (result, false); /*case: there is no match root cert in the end*/ @@ -400,8 +400,8 @@ void test_spdm_verify_peer_cert_chain_buffer_case7(void **state) 1] =root_cert_size; spdm_context->local_context.peer_root_cert_provision[LIBSPDM_MAX_ROOT_CERT_SUPPORT / 2 - 1] = root_cert; - result = spdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, - &trust_anchor_size); + result = libspdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, + &trust_anchor_size); assert_int_equal (result, true); assert_ptr_equal (trust_anchor, root_cert); @@ -410,8 +410,8 @@ void test_spdm_verify_peer_cert_chain_buffer_case7(void **state) 4] =root_cert_size; spdm_context->local_context.peer_root_cert_provision[LIBSPDM_MAX_ROOT_CERT_SUPPORT / 4] = root_cert; - result = spdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, - &trust_anchor_size); + result = libspdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, + &trust_anchor_size); assert_int_equal (result, true); assert_ptr_equal (trust_anchor, root_cert); @@ -428,10 +428,10 @@ void test_spdm_verify_peer_cert_chain_buffer_case7(void **state) * there is one match root cert in the end; return true, and the return trust_anchor is root cert. * there is one match root cert in the middle; return true, and the return trust_anchor is root cert. **/ -void test_spdm_verify_peer_cert_chain_buffer_case8(void **state) +void test_libspdm_verify_peer_cert_chain_buffer_case8(void **state) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *data; uintn data_size; void *hash; @@ -485,8 +485,8 @@ void test_spdm_verify_peer_cert_chain_buffer_case8(void **state) root_cert_size_test; spdm_context->local_context.peer_root_cert_provision[root_cert_index] = root_cert_test; } - result = spdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, - &trust_anchor_size); + result = libspdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, + &trust_anchor_size); assert_int_equal (result, false); /*case: there is no match root cert in the end*/ @@ -494,8 +494,8 @@ void test_spdm_verify_peer_cert_chain_buffer_case8(void **state) 1] =root_cert_size; spdm_context->local_context.peer_root_cert_provision[LIBSPDM_MAX_ROOT_CERT_SUPPORT - 1] = root_cert; - result = spdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, - &trust_anchor_size); + result = libspdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, + &trust_anchor_size); assert_int_equal (result, true); assert_ptr_equal (trust_anchor, root_cert); @@ -509,8 +509,8 @@ void test_spdm_verify_peer_cert_chain_buffer_case8(void **state) 2] =root_cert_size; spdm_context->local_context.peer_root_cert_provision[LIBSPDM_MAX_ROOT_CERT_SUPPORT / 2] = root_cert; - result = spdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, - &trust_anchor_size); + result = libspdm_verify_peer_cert_chain_buffer(spdm_context, data, data_size, &trust_anchor, + &trust_anchor_size); assert_int_equal (result, true); assert_ptr_equal (trust_anchor, root_cert); @@ -529,7 +529,7 @@ static void test_libspdm_set_data_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; void *data; uintn data_size; @@ -590,10 +590,10 @@ int spdm_common_context_data_test_main(void) cmocka_unit_test(test_spdm_common_context_data_case3), cmocka_unit_test(test_spdm_common_context_data_case4), - cmocka_unit_test(test_spdm_verify_peer_cert_chain_buffer_case5), - cmocka_unit_test(test_spdm_verify_peer_cert_chain_buffer_case6), - cmocka_unit_test(test_spdm_verify_peer_cert_chain_buffer_case7), - cmocka_unit_test(test_spdm_verify_peer_cert_chain_buffer_case8), + cmocka_unit_test(test_libspdm_verify_peer_cert_chain_buffer_case5), + cmocka_unit_test(test_libspdm_verify_peer_cert_chain_buffer_case6), + cmocka_unit_test(test_libspdm_verify_peer_cert_chain_buffer_case7), + cmocka_unit_test(test_libspdm_verify_peer_cert_chain_buffer_case8), cmocka_unit_test(test_libspdm_set_data_case9), }; diff --git a/unit_test/test_spdm_requester/challenge.c b/unit_test/test_spdm_requester/challenge.c index 64d5045de51..bb31442a9cb 100644 --- a/unit_test/test_spdm_requester/challenge.c +++ b/unit_test/test_spdm_requester/challenge.c @@ -115,15 +115,15 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + @@ -140,9 +140,9 @@ return_status spdm_requester_challenge_test_receive_message( ptr = (void *)(spdm_response + 1); libspdm_hash_all( m_use_hash_algo, - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context.local_cert_chain_provision[0], - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context .local_cert_chain_provision_size[0], ptr); @@ -160,12 +160,12 @@ return_status spdm_requester_challenge_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, @@ -195,15 +195,15 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + @@ -220,9 +220,9 @@ return_status spdm_requester_challenge_test_receive_message( ptr = (void *)(spdm_response + 1); libspdm_hash_all( m_use_hash_algo, - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context.local_cert_chain_provision[0], - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context .local_cert_chain_provision_size[0], ptr); @@ -315,16 +315,16 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain( m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context .local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = @@ -343,10 +343,10 @@ return_status spdm_requester_challenge_test_receive_message( ptr = (void *)(spdm_response + 1); libspdm_hash_all( m_use_hash_algo, - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context .local_cert_chain_provision[0], - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context .local_cert_chain_provision_size[0], ptr); @@ -457,16 +457,16 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain( m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context .local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = @@ -485,10 +485,10 @@ return_status spdm_requester_challenge_test_receive_message( ptr = (void *)(spdm_response + 1); libspdm_hash_all( m_use_hash_algo, - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context .local_cert_chain_provision[0], - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->local_context .local_cert_chain_provision_size[0], ptr); @@ -541,11 +541,13 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain (m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = + m_use_asym_algo; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = + m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + libspdm_get_hash_size (m_use_hash_algo) + SPDM_NONCE_SIZE + @@ -560,9 +562,9 @@ return_status spdm_requester_challenge_test_receive_message( spdm_response->header.param2 = (1 << 0); Ptr = (void *)(spdm_response + 1); libspdm_hash_all (m_use_hash_algo, - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ 0], - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ 0], Ptr); free(data); @@ -623,11 +625,13 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain (m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = + m_use_asym_algo; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = + m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + libspdm_get_hash_size (m_use_hash_algo) + SPDM_NONCE_SIZE + @@ -642,9 +646,9 @@ return_status spdm_requester_challenge_test_receive_message( spdm_response->header.param2 = (1 << 0); Ptr = (void *)(spdm_response + 1); libspdm_hash_all (m_use_hash_algo, - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ 0], - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ 0], Ptr); free(data); @@ -687,11 +691,13 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain (m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = + m_use_asym_algo; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = + m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + libspdm_get_hash_size (m_use_hash_algo) + SPDM_NONCE_SIZE + @@ -706,9 +712,9 @@ return_status spdm_requester_challenge_test_receive_message( spdm_response->header.param2 = (1 << 0); Ptr = (void *)(spdm_response + 1); libspdm_hash_all (m_use_hash_algo, - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ 0], - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ 0], Ptr); free(data); @@ -751,11 +757,13 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain (m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = + m_use_asym_algo; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = + m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + libspdm_get_hash_size (m_use_hash_algo) + SPDM_NONCE_SIZE + @@ -770,9 +778,9 @@ return_status spdm_requester_challenge_test_receive_message( spdm_response->header.param2 = (1 << 1); /*wrong slot number*/ Ptr = (void *)(spdm_response + 1); libspdm_hash_all (m_use_hash_algo, - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ 0], - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ 0], Ptr); free(data); @@ -815,11 +823,13 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain (m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = + m_use_asym_algo; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = + m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + libspdm_get_hash_size (m_use_hash_algo) + SPDM_NONCE_SIZE + @@ -834,9 +844,9 @@ return_status spdm_requester_challenge_test_receive_message( spdm_response->header.param2 = (1 << 0); Ptr = (void *)(spdm_response + 1); libspdm_hash_all (m_use_hash_algo, - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ 0], - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ 0], Ptr); free(data); @@ -879,11 +889,13 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain (m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = + m_use_asym_algo; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = + m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + libspdm_get_hash_size (m_use_hash_algo) + SPDM_NONCE_SIZE + @@ -898,9 +910,9 @@ return_status spdm_requester_challenge_test_receive_message( spdm_response->header.param2 = (1 << 0); Ptr = (void *)(spdm_response + 1); libspdm_hash_all (m_use_hash_algo, - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ 0], - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ 0], Ptr); free(data); @@ -945,11 +957,13 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain (m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = + m_use_asym_algo; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = + m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + libspdm_get_hash_size (m_use_hash_algo) + SPDM_NONCE_SIZE + @@ -964,9 +978,9 @@ return_status spdm_requester_challenge_test_receive_message( spdm_response->header.param2 = (1 << 0); Ptr = (void *)(spdm_response + 1); libspdm_hash_all (m_use_hash_algo, - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ 0], - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ 0], Ptr); free(data); @@ -1012,11 +1026,13 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain (m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = + m_use_asym_algo; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = + m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + libspdm_get_hash_size (m_use_hash_algo) + SPDM_NONCE_SIZE + @@ -1030,9 +1046,9 @@ return_status spdm_requester_challenge_test_receive_message( spdm_response->header.param2 = (1 << 0); Ptr = (void *)(spdm_response + 1); libspdm_hash_all (m_use_hash_algo, - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ 0], - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ 0], Ptr); free(data); @@ -1106,11 +1122,13 @@ return_status spdm_requester_challenge_test_receive_message( read_responder_public_certificate_chain (m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[0] = data_size; - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = m_use_hash_algo; + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[0] = data; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_asym_algo = + m_use_asym_algo; + ((libspdm_context_t*)spdm_context)->connection_info.algorithm.base_hash_algo = + m_use_hash_algo; temp_buf_size = sizeof(spdm_challenge_auth_response_t) + libspdm_get_hash_size (m_use_hash_algo) + SPDM_NONCE_SIZE + @@ -1124,9 +1142,9 @@ return_status spdm_requester_challenge_test_receive_message( spdm_response->header.param2 = 0x71; /*multiple slot numbers */ ptr = (void *)(spdm_response + 1); libspdm_hash_all (m_use_hash_algo, - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision[ 0], - ((spdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ + ((libspdm_context_t*)spdm_context)->local_context.local_cert_chain_provision_size[ 0], ptr); free(data); @@ -1167,7 +1185,7 @@ void test_spdm_requester_challenge_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1245,7 +1263,7 @@ void test_spdm_requester_challenge_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1321,7 +1339,7 @@ void test_spdm_requester_challenge_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1392,7 +1410,7 @@ void test_spdm_requester_challenge_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1463,7 +1481,7 @@ void test_spdm_requester_challenge_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1534,7 +1552,7 @@ void test_spdm_requester_challenge_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1603,7 +1621,7 @@ void test_spdm_requester_challenge_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1676,7 +1694,7 @@ void test_spdm_requester_challenge_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1748,7 +1766,7 @@ void test_spdm_requester_challenge_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1817,7 +1835,7 @@ void test_spdm_requester_challenge_case9(void **state) void test_spdm_requester_challenge_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1878,7 +1896,7 @@ void test_spdm_requester_challenge_case10(void **state) { void test_spdm_requester_challenge_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1937,7 +1955,7 @@ void test_spdm_requester_challenge_case11(void **state) { void test_spdm_requester_challenge_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -1997,7 +2015,7 @@ void test_spdm_requester_challenge_case12(void **state) { void test_spdm_requester_challenge_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -2056,7 +2074,7 @@ void test_spdm_requester_challenge_case13(void **state) { void test_spdm_requester_challenge_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -2128,7 +2146,7 @@ void test_spdm_requester_challenge_case15(void **state) { void test_spdm_requester_challenge_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -2194,7 +2212,7 @@ void test_spdm_requester_challenge_case16(void **state) { void test_spdm_requester_challenge_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -2260,7 +2278,7 @@ void test_spdm_requester_challenge_case17(void **state) { void test_spdm_requester_challenge_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -2327,7 +2345,7 @@ void test_spdm_requester_challenge_case18(void **state) { void test_spdm_requester_challenge_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -2388,7 +2406,7 @@ void test_spdm_requester_challenge_case19(void **state) { void test_spdm_requester_challenge_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; @@ -2468,7 +2486,7 @@ void test_spdm_requester_challenge_case20(void **state) { void test_spdm_requester_challenge_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; void *data; uintn data_size; diff --git a/unit_test/test_spdm_requester/end_session.c b/unit_test/test_spdm_requester/end_session.c index 6bf0ada465b..05a0098ab8b 100644 --- a/unit_test/test_spdm_requester/end_session.c +++ b/unit_test/test_spdm_requester/end_session.c @@ -90,7 +90,7 @@ return_status spdm_requester_end_session_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_end_session_response_t); @@ -123,7 +123,7 @@ return_status spdm_requester_end_session_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_end_session_response_t); @@ -153,7 +153,7 @@ return_status spdm_requester_end_session_test_receive_message( case 0x4: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -180,7 +180,7 @@ return_status spdm_requester_end_session_test_receive_message( case 0x5: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -209,7 +209,7 @@ return_status spdm_requester_end_session_test_receive_message( if (sub_index1 == 0) { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = @@ -237,7 +237,7 @@ return_status spdm_requester_end_session_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_end_session_response_t); @@ -270,7 +270,7 @@ return_status spdm_requester_end_session_test_receive_message( case 0x7: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -297,7 +297,7 @@ return_status spdm_requester_end_session_test_receive_message( case 0x8: { spdm_error_response_data_response_not_ready_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -332,7 +332,7 @@ return_status spdm_requester_end_session_test_receive_message( spdm_error_response_data_response_not_ready_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = @@ -366,7 +366,7 @@ return_status spdm_requester_end_session_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_end_session_response_t); @@ -402,7 +402,7 @@ return_status spdm_requester_end_session_test_receive_message( spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -438,7 +438,7 @@ return_status spdm_requester_end_session_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_end_session_response_t); @@ -468,7 +468,7 @@ return_status spdm_requester_end_session_test_receive_message( case 0xC: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -501,13 +501,13 @@ void test_spdm_requester_end_session_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -556,7 +556,7 @@ void test_spdm_requester_end_session_case1(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -570,13 +570,13 @@ void test_spdm_requester_end_session_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -625,7 +625,7 @@ void test_spdm_requester_end_session_case2(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -666,13 +666,13 @@ void test_spdm_requester_end_session_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -721,7 +721,7 @@ void test_spdm_requester_end_session_case3(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -758,13 +758,13 @@ void test_spdm_requester_end_session_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -813,7 +813,7 @@ void test_spdm_requester_end_session_case4(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -850,13 +850,13 @@ void test_spdm_requester_end_session_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -905,7 +905,7 @@ void test_spdm_requester_end_session_case5(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -942,13 +942,13 @@ void test_spdm_requester_end_session_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -997,7 +997,7 @@ void test_spdm_requester_end_session_case6(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -1038,13 +1038,13 @@ void test_spdm_requester_end_session_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1093,7 +1093,7 @@ void test_spdm_requester_end_session_case7(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -1132,13 +1132,13 @@ void test_spdm_requester_end_session_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1187,7 +1187,7 @@ void test_spdm_requester_end_session_case8(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -1224,13 +1224,13 @@ void test_spdm_requester_end_session_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1279,7 +1279,7 @@ void test_spdm_requester_end_session_case9(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -1319,13 +1319,13 @@ void test_spdm_requester_end_session_case9(void **state) void test_spdm_requester_end_session_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint16_t error_code; spdm_test_context = *state; @@ -1365,7 +1365,7 @@ void test_spdm_requester_end_session_case10(void **state) { session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init (spdm_context, session_info, session_id, true); + libspdm_session_info_init (spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state (session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); set_mem (m_dummy_key_buffer, @@ -1412,13 +1412,13 @@ void test_spdm_requester_end_session_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1467,7 +1467,7 @@ void test_spdm_requester_end_session_case11(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -1531,13 +1531,13 @@ void test_spdm_requester_end_session_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1586,7 +1586,7 @@ void test_spdm_requester_end_session_case12(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); diff --git a/unit_test/test_spdm_requester/finish.c b/unit_test/test_spdm_requester/finish.c index bd818d9bbea..a855cdd07fe 100644 --- a/unit_test/test_spdm_requester/finish.c +++ b/unit_test/test_spdm_requester/finish.c @@ -172,21 +172,21 @@ return_status spdm_requester_finish_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); @@ -207,19 +207,19 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; free(data); @@ -241,21 +241,21 @@ return_status spdm_requester_finish_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); @@ -276,19 +276,19 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; free(data); @@ -356,21 +356,21 @@ return_status spdm_requester_finish_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm .measurement_hash_algo = m_use_measurement_hash_algo; @@ -395,23 +395,23 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain( m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, - LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, + LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, - hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, + hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); libspdm_hmac_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; free(data); @@ -491,21 +491,21 @@ return_status spdm_requester_finish_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm .measurement_hash_algo = m_use_measurement_hash_algo; @@ -530,23 +530,23 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain( m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, - LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, + LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, - hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, + hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); libspdm_hmac_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; free(data); @@ -599,21 +599,21 @@ return_status spdm_requester_finish_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); @@ -634,19 +634,19 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; free(data); @@ -668,21 +668,21 @@ return_status spdm_requester_finish_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); @@ -703,19 +703,19 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; free(data); @@ -737,21 +737,21 @@ return_status spdm_requester_finish_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); @@ -772,19 +772,19 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; free(data); @@ -806,21 +806,21 @@ return_status spdm_requester_finish_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); @@ -842,19 +842,19 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; free(data); @@ -876,21 +876,21 @@ return_status spdm_requester_finish_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); @@ -911,19 +911,19 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; free(data); @@ -946,24 +946,24 @@ return_status spdm_requester_finish_test_receive_message( uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; uint8_t req_cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.req_base_asym_alg = m_use_req_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); @@ -984,7 +984,7 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, @@ -997,15 +997,15 @@ return_status spdm_requester_finish_test_receive_message( libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, req_cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, req_cert_buffer_hash, - hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, req_cert_buffer_hash, + hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; free(data); @@ -1024,19 +1024,19 @@ return_status spdm_requester_finish_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.req_base_asym_alg = m_use_req_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hmac_size = libspdm_get_hash_size(m_use_hash_algo); @@ -1068,19 +1068,19 @@ return_status spdm_requester_finish_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.req_base_asym_alg = m_use_req_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); @@ -1117,24 +1117,24 @@ return_status spdm_requester_finish_test_receive_message( uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; uint8_t req_cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.req_base_asym_alg = m_use_req_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); @@ -1156,7 +1156,7 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, @@ -1169,15 +1169,15 @@ return_status spdm_requester_finish_test_receive_message( libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, req_cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, req_cert_buffer_hash, - hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, req_cert_buffer_hash, + hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); copy_mem_s(ptr, sizeof(temp_buf) - (ptr - temp_buf), ptr + hmac_size, hmac_size); /* 2x HMAC size*/ @@ -1202,24 +1202,24 @@ return_status spdm_requester_finish_test_receive_message( uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; uint8_t req_cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t response_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.req_base_asym_alg = m_use_req_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); @@ -1241,7 +1241,7 @@ return_status spdm_requester_finish_test_receive_message( read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, @@ -1254,15 +1254,15 @@ return_status spdm_requester_finish_test_receive_message( libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, req_cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, req_cert_buffer_hash, - hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, req_cert_buffer_hash, + hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); set_mem(response_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size/2; /* half HMAC size*/ set_mem(ptr, hmac_size/2, (uint8_t) 0x00); @@ -1304,14 +1304,14 @@ void test_spdm_requester_finish_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1367,7 +1367,7 @@ void test_spdm_requester_finish_case1(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -1398,14 +1398,14 @@ void test_spdm_requester_finish_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1461,7 +1461,7 @@ void test_spdm_requester_finish_case2(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -1495,14 +1495,14 @@ void test_spdm_requester_finish_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1558,7 +1558,7 @@ void test_spdm_requester_finish_case3(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -1588,14 +1588,14 @@ void test_spdm_requester_finish_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1651,7 +1651,7 @@ void test_spdm_requester_finish_case4(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -1682,14 +1682,14 @@ void test_spdm_requester_finish_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1745,7 +1745,7 @@ void test_spdm_requester_finish_case5(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -1776,14 +1776,14 @@ void test_spdm_requester_finish_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1839,7 +1839,7 @@ void test_spdm_requester_finish_case6(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -1874,14 +1874,14 @@ void test_spdm_requester_finish_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1937,7 +1937,7 @@ void test_spdm_requester_finish_case7(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -1969,14 +1969,14 @@ void test_spdm_requester_finish_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -2032,7 +2032,7 @@ void test_spdm_requester_finish_case8(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -2063,14 +2063,14 @@ void test_spdm_requester_finish_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -2126,7 +2126,7 @@ void test_spdm_requester_finish_case9(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -2162,14 +2162,14 @@ void test_spdm_requester_finish_case9(void **state) void test_spdm_requester_finish_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint16_t error_code; spdm_test_context = *state; @@ -2224,7 +2224,7 @@ void test_spdm_requester_finish_case10(void **state) { libspdm_reset_message_a(spdm_context); session_info = &spdm_context->session_info[0]; - spdm_session_info_init (spdm_context, session_info, session_id, false); + libspdm_session_info_init (spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size (m_use_hash_algo); set_mem (m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key (session_info->secured_message_context, @@ -2259,14 +2259,14 @@ void test_spdm_requester_finish_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -2322,7 +2322,7 @@ void test_spdm_requester_finish_case11(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -2378,14 +2378,14 @@ void test_spdm_requester_finish_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -2442,7 +2442,7 @@ void test_spdm_requester_finish_case12(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -2474,14 +2474,14 @@ void test_spdm_requester_finish_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -2537,7 +2537,7 @@ void test_spdm_requester_finish_case13(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -2567,14 +2567,14 @@ void test_spdm_requester_finish_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -2630,7 +2630,7 @@ void test_spdm_requester_finish_case14(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -2661,14 +2661,14 @@ void test_spdm_requester_finish_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -2724,7 +2724,7 @@ void test_spdm_requester_finish_case15(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -2755,14 +2755,14 @@ void test_spdm_requester_finish_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -2829,7 +2829,7 @@ void test_spdm_requester_finish_case16(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -2864,14 +2864,14 @@ void test_spdm_requester_finish_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -2938,7 +2938,7 @@ void test_spdm_requester_finish_case17(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -2969,14 +2969,14 @@ void test_spdm_requester_finish_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -3043,7 +3043,7 @@ void test_spdm_requester_finish_case18(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -3075,14 +3075,14 @@ void test_spdm_requester_finish_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -3149,7 +3149,7 @@ void test_spdm_requester_finish_case19(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -3181,14 +3181,14 @@ void test_spdm_requester_finish_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -3255,7 +3255,7 @@ void test_spdm_requester_finish_case20(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( @@ -3285,14 +3285,14 @@ void test_spdm_requester_finish_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t req_slot_id_param; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -3348,7 +3348,7 @@ void test_spdm_requester_finish_case21(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_response_finished_key( diff --git a/unit_test/test_spdm_requester/get_capabilities.c b/unit_test/test_spdm_requester/get_capabilities.c index bba05d5875a..07a5c4137ca 100644 --- a/unit_test/test_spdm_requester/get_capabilities.c +++ b/unit_test/test_spdm_requester/get_capabilities.c @@ -756,7 +756,7 @@ void test_spdm_requester_get_capabilities_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -776,7 +776,7 @@ void test_spdm_requester_get_capabilities_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -807,7 +807,7 @@ void test_spdm_requester_get_capabilities_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -827,7 +827,7 @@ void test_spdm_requester_get_capabilities_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -847,7 +847,7 @@ void test_spdm_requester_get_capabilities_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -867,7 +867,7 @@ void test_spdm_requester_get_capabilities_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -891,7 +891,7 @@ void test_spdm_requester_get_capabilities_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -913,7 +913,7 @@ void test_spdm_requester_get_capabilities_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -933,7 +933,7 @@ void test_spdm_requester_get_capabilities_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -955,7 +955,7 @@ void test_spdm_requester_get_capabilities_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -983,7 +983,7 @@ void test_spdm_requester_get_capabilities_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1012,7 +1012,7 @@ void test_spdm_requester_get_capabilities_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1036,7 +1036,7 @@ void test_spdm_requester_get_capabilities_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1056,7 +1056,7 @@ void test_spdm_requester_get_capabilities_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1076,7 +1076,7 @@ void test_spdm_requester_get_capabilities_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1096,7 +1096,7 @@ void test_spdm_requester_get_capabilities_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1121,7 +1121,7 @@ void test_spdm_requester_get_capabilities_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1144,7 +1144,7 @@ void test_spdm_requester_get_capabilities_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1167,7 +1167,7 @@ void test_spdm_requester_get_capabilities_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1191,7 +1191,7 @@ void test_spdm_requester_get_capabilities_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1215,7 +1215,7 @@ void test_spdm_requester_get_capabilities_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1239,7 +1239,7 @@ void test_spdm_requester_get_capabilities_case22(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1263,7 +1263,7 @@ void test_spdm_requester_get_capabilities_case23(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1287,7 +1287,7 @@ void test_spdm_requester_get_capabilities_case24(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1311,7 +1311,7 @@ void test_spdm_requester_get_capabilities_case25(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1335,7 +1335,7 @@ void test_spdm_requester_get_capabilities_case26(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1359,7 +1359,7 @@ void test_spdm_requester_get_capabilities_case27(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1381,7 +1381,7 @@ void test_spdm_requester_get_capabilities_case28(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1402,7 +1402,7 @@ void test_spdm_requester_get_capabilities_case28(void **state) void test_spdm_requester_get_capabilities_case29(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint16_t error_code; spdm_test_context = *state; @@ -1439,7 +1439,7 @@ void test_spdm_requester_get_capabilities_case30(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1459,7 +1459,7 @@ void test_spdm_requester_get_capabilities_case31(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; diff --git a/unit_test/test_spdm_requester/get_certificate.c b/unit_test/test_spdm_requester/get_certificate.c index 5b9b0ca2f34..28ac3b87786 100644 --- a/unit_test/test_spdm_requester/get_certificate.c +++ b/unit_test/test_spdm_requester/get_certificate.c @@ -1473,7 +1473,7 @@ void test_spdm_requester_get_certificate_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -1530,7 +1530,7 @@ void test_spdm_requester_get_certificate_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -1559,7 +1559,7 @@ void test_spdm_requester_get_certificate_case2(void **state) data_size - sizeof(spdm_cert_chain_t) - hash_size, 0, &root_cert, &root_cert_size); DEBUG((DEBUG_INFO, "root cert data :\n")); - internal_dump_hex( + libspdm_internal_dump_hex( root_cert, root_cert_size); spdm_context->local_context.peer_root_cert_provision_size[0] = @@ -1604,7 +1604,7 @@ void test_spdm_requester_get_certificate_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -1661,7 +1661,7 @@ void test_spdm_requester_get_certificate_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -1718,7 +1718,7 @@ void test_spdm_requester_get_certificate_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -1775,7 +1775,7 @@ void test_spdm_requester_get_certificate_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -1839,7 +1839,7 @@ void test_spdm_requester_get_certificate_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -1898,7 +1898,7 @@ void test_spdm_requester_get_certificate_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -1952,7 +1952,7 @@ void test_spdm_requester_get_certificate_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2017,7 +2017,7 @@ void test_spdm_requester_get_certificate_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2082,7 +2082,7 @@ void test_spdm_requester_get_certificate_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2151,7 +2151,7 @@ void test_spdm_requester_get_certificate_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2224,7 +2224,7 @@ void test_spdm_requester_get_certificate_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2293,7 +2293,7 @@ void test_spdm_requester_get_certificate_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2368,7 +2368,7 @@ void test_spdm_requester_get_certificate_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2444,7 +2444,7 @@ void test_spdm_requester_get_certificate_case15(void **state) void test_spdm_requester_get_certificate_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2512,7 +2512,7 @@ void test_spdm_requester_get_certificate_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2566,7 +2566,7 @@ void test_spdm_requester_get_certificate_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2620,7 +2620,7 @@ void test_spdm_requester_get_certificate_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2690,7 +2690,7 @@ void test_spdm_requester_get_certificate_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2716,7 +2716,7 @@ void test_spdm_requester_get_certificate_case20(void **state) data_size - sizeof(spdm_cert_chain_t) - hash_size, 0, &root_cert, &root_cert_size); DEBUG((DEBUG_INFO, "root cert data :\n")); - internal_dump_hex( + libspdm_internal_dump_hex( root_cert, root_cert_size); spdm_context->local_context.peer_root_cert_provision_size[0] = @@ -2748,7 +2748,7 @@ void test_spdm_requester_get_certificate_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2774,7 +2774,7 @@ void test_spdm_requester_get_certificate_case21(void **state) data_size - sizeof(spdm_cert_chain_t) - hash_size, 0, &root_cert, &root_cert_size); DEBUG((DEBUG_INFO, "root cert data :\n")); - internal_dump_hex( + libspdm_internal_dump_hex( root_cert, root_cert_size); spdm_context->local_context.peer_root_cert_provision_size[0] = @@ -2808,7 +2808,7 @@ void test_spdm_requester_get_certificate_case22(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn cert_chain_size; uint8_t cert_chain[LIBSPDM_MAX_CERT_CHAIN_SIZE]; void *data; @@ -2834,7 +2834,7 @@ void test_spdm_requester_get_certificate_case22(void **state) data_size - sizeof(spdm_cert_chain_t) - hash_size, 0, &root_cert, &root_cert_size); DEBUG((DEBUG_INFO, "root cert data :\n")); - internal_dump_hex( + libspdm_internal_dump_hex( root_cert, root_cert_size); spdm_context->local_context.peer_root_cert_provision_size[0] = diff --git a/unit_test/test_spdm_requester/get_digests.c b/unit_test/test_spdm_requester/get_digests.c index 4e3c8effeca..28aaf0c4cb3 100644 --- a/unit_test/test_spdm_requester/get_digests.c +++ b/unit_test/test_spdm_requester/get_digests.c @@ -85,7 +85,7 @@ return_status spdm_requester_get_digests_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = sizeof(spdm_digest_response_t) + @@ -120,7 +120,7 @@ return_status spdm_requester_get_digests_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = sizeof(spdm_digest_response_t) + @@ -197,7 +197,7 @@ return_status spdm_requester_get_digests_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = sizeof(spdm_digest_response_t) + @@ -290,7 +290,7 @@ return_status spdm_requester_get_digests_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = sizeof(spdm_digest_response_t) + @@ -331,7 +331,7 @@ return_status spdm_requester_get_digests_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = 2; @@ -355,7 +355,7 @@ return_status spdm_requester_get_digests_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = sizeof(spdm_digest_response_t) + @@ -405,7 +405,7 @@ return_status spdm_requester_get_digests_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = sizeof(spdm_digest_response_t) + @@ -437,7 +437,7 @@ return_status spdm_requester_get_digests_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = sizeof(spdm_digest_response_t) + @@ -472,7 +472,7 @@ return_status spdm_requester_get_digests_test_receive_message( uintn temp_buf_size; uintn index; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; digest_count = 4; @@ -510,7 +510,7 @@ return_status spdm_requester_get_digests_test_receive_message( uintn temp_buf_size; uintn index; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; digest_count = 4; @@ -553,7 +553,7 @@ return_status spdm_requester_get_digests_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = 5; @@ -577,7 +577,7 @@ return_status spdm_requester_get_digests_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; temp_buf_size = sizeof(spdm_message_header_t) + @@ -647,7 +647,7 @@ void test_spdm_requester_get_digests_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -687,7 +687,7 @@ void test_spdm_requester_get_digests_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -738,7 +738,7 @@ void test_spdm_requester_get_digests_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -778,7 +778,7 @@ void test_spdm_requester_get_digests_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -818,7 +818,7 @@ void test_spdm_requester_get_digests_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -859,7 +859,7 @@ void test_spdm_requester_get_digests_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -905,7 +905,7 @@ void test_spdm_requester_get_digests_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -948,7 +948,7 @@ void test_spdm_requester_get_digests_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -986,7 +986,7 @@ void test_spdm_requester_get_digests_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1032,7 +1032,7 @@ void test_spdm_requester_get_digests_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1071,7 +1071,7 @@ void test_spdm_requester_get_digests_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1113,7 +1113,7 @@ void test_spdm_requester_get_digests_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1154,7 +1154,7 @@ void test_spdm_requester_get_digests_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1195,7 +1195,7 @@ void test_spdm_requester_get_digests_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1236,7 +1236,7 @@ void test_spdm_requester_get_digests_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1280,7 +1280,7 @@ void test_spdm_requester_get_digests_case16(void **state) uint8_t slot_mask; #endif spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; spdm_test_context = *state; @@ -1322,7 +1322,7 @@ void test_spdm_requester_get_digests_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1362,7 +1362,7 @@ void test_spdm_requester_get_digests_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1403,7 +1403,7 @@ void test_spdm_requester_get_digests_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1443,7 +1443,7 @@ void test_spdm_requester_get_digests_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1485,7 +1485,7 @@ void test_spdm_requester_get_digests_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; @@ -1529,7 +1529,7 @@ void test_spdm_requester_get_digests_case21(void **state) void test_spdm_requester_get_digests_case22(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t slot_mask; uint8_t total_digest_buffer[LIBSPDM_MAX_HASH_SIZE * SPDM_MAX_SLOT_COUNT]; uint16_t error_code; diff --git a/unit_test/test_spdm_requester/get_measurements.c b/unit_test/test_spdm_requester/get_measurements.c index 662740623a0..74798262b39 100644 --- a/unit_test/test_spdm_requester/get_measurements.c +++ b/unit_test/test_spdm_requester/get_measurements.c @@ -70,7 +70,7 @@ return_status spdm_requester_get_measurements_test_send_message( uintn header_size; uintn message_size; uint32_t *session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; bool is_app_message; uint8_t app_message[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn app_message_size; @@ -385,7 +385,7 @@ return_status spdm_requester_get_measurements_test_send_message( request_size - header_size); DEBUG((DEBUG_INFO, "Request (0x%x):\n", request_size)); - internal_dump_hex(request, request_size); + libspdm_internal_dump_hex(request, request_size); spdm_transport_test_decode_message( spdm_context, &session_id, &is_app_message, false, request_size, (uint8_t *)request, @@ -424,13 +424,13 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; measurment_sig_size = @@ -480,12 +480,12 @@ return_status spdm_requester_get_measurements_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, @@ -512,13 +512,13 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; measurment_sig_size = @@ -568,12 +568,12 @@ return_status spdm_requester_get_measurements_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, @@ -646,13 +646,13 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm .measurement_hash_algo = m_use_measurement_hash_algo; @@ -706,12 +706,12 @@ return_status spdm_requester_get_measurements_test_receive_message( ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); libspdm_responder_data_sign( @@ -800,13 +800,13 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm .measurement_hash_algo = m_use_measurement_hash_algo; @@ -860,12 +860,12 @@ return_status spdm_requester_get_measurements_test_receive_message( ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); libspdm_responder_data_sign( @@ -920,7 +920,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint8_t *ptr; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -979,13 +979,13 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; @@ -1050,13 +1050,13 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; measurment_sig_size = @@ -1106,12 +1106,12 @@ return_status spdm_requester_get_measurements_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); libspdm_get_random_number(sig_size, ptr); ptr += sig_size; @@ -1129,13 +1129,13 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -1186,13 +1186,13 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; measurment_sig_size = @@ -1243,12 +1243,12 @@ return_status spdm_requester_get_measurements_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, @@ -1275,13 +1275,13 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; measurment_sig_size = @@ -1331,12 +1331,12 @@ return_status spdm_requester_get_measurements_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, @@ -1362,7 +1362,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uintn temp_buf_size; temp_buf_size = sizeof(spdm_measurements_response_t); - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; spdm_response = (void *)temp_buf; @@ -1447,7 +1447,7 @@ return_status spdm_requester_get_measurements_test_receive_message( (uint8_t *)malloc(sizeof(spdm_measurements_response_t) + LARGE_MEASUREMENT_SIZE); - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t); @@ -1489,7 +1489,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -1536,7 +1536,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -1583,7 +1583,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -1631,7 +1631,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint8_t *ptr; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -1686,7 +1686,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -1748,7 +1748,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -1815,13 +1815,13 @@ return_status spdm_requester_get_measurements_test_receive_message( uintn temp_buf_size; uint16_t opaque_size_test = SPDM_MAX_OPAQUE_DATA_SIZE; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; measurment_sig_size = @@ -1875,12 +1875,12 @@ return_status spdm_requester_get_measurements_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, @@ -1912,13 +1912,13 @@ return_status spdm_requester_get_measurements_test_receive_message( sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); MissingBytes = sig_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; measurment_sig_size = @@ -1973,12 +1973,12 @@ return_status spdm_requester_get_measurements_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_MEASUREMENTS, @@ -2009,13 +2009,13 @@ return_status spdm_requester_get_measurements_test_receive_message( sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); MissingBytes = sig_size + 1; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; measurment_sig_size = @@ -2070,12 +2070,12 @@ return_status spdm_requester_get_measurements_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_MEASUREMENTS, @@ -2105,13 +2105,13 @@ return_status spdm_requester_get_measurements_test_receive_message( sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; measurment_sig_size = @@ -2165,12 +2165,12 @@ return_status spdm_requester_get_measurements_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_MEASUREMENTS, @@ -2195,7 +2195,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uint16_t opaque_size_test = SPDM_MAX_OPAQUE_DATA_SIZE / 2; uint16_t opaque_informed_size = opaque_size_test - 1; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -2259,7 +2259,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uint16_t opaque_size_test = MAX_UINT16; uint16_t opaque_informed_size = SPDM_MAX_OPAQUE_DATA_SIZE / 2; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -2321,7 +2321,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uintn temp_buf_size; uint16_t opaque_size_test = MAX_UINT16; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -2382,7 +2382,7 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint8_t *ptr; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; temp_buf_size = sizeof(spdm_measurements_response_t) + @@ -2479,16 +2479,16 @@ return_status spdm_requester_get_measurements_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; measurment_sig_size = @@ -2538,12 +2538,12 @@ return_status spdm_requester_get_measurements_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, m_local_buffer, m_local_buffer_size, hash_data); DEBUG((DEBUG_INFO, "HashDataSize (0x%x):\n", libspdm_get_hash_size(m_use_hash_algo))); - internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); sig_size = libspdm_get_asym_signature_size(m_use_asym_algo); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, @@ -2581,7 +2581,7 @@ void test_spdm_requester_get_measurements_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -2655,7 +2655,7 @@ void test_spdm_requester_get_measurements_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -2729,7 +2729,7 @@ void test_spdm_requester_get_measurements_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -2802,7 +2802,7 @@ void test_spdm_requester_get_measurements_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -2875,7 +2875,7 @@ void test_spdm_requester_get_measurements_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -2948,7 +2948,7 @@ void test_spdm_requester_get_measurements_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -3021,7 +3021,7 @@ void test_spdm_requester_get_measurements_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -3096,7 +3096,7 @@ void test_spdm_requester_get_measurements_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -3166,7 +3166,7 @@ void test_spdm_requester_get_measurements_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -3239,7 +3239,7 @@ void test_spdm_requester_get_measurements_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_blocks; uint8_t request_attribute; void *data; @@ -3312,7 +3312,7 @@ void test_spdm_requester_get_measurements_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -3390,7 +3390,7 @@ void test_spdm_requester_get_measurements_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -3464,7 +3464,7 @@ void test_spdm_requester_get_measurements_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -3538,7 +3538,7 @@ void test_spdm_requester_get_measurements_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -3612,7 +3612,7 @@ void test_spdm_requester_get_measurements_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -3686,7 +3686,7 @@ void test_spdm_requester_get_measurements_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -3777,7 +3777,7 @@ void test_spdm_requester_get_measurements_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_blocks; uint8_t request_attribute; void *data; @@ -3853,7 +3853,7 @@ void test_spdm_requester_get_measurements_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -3929,7 +3929,7 @@ void test_spdm_requester_get_measurements_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4002,7 +4002,7 @@ void test_spdm_requester_get_measurements_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4075,7 +4075,7 @@ void test_spdm_requester_get_measurements_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4148,7 +4148,7 @@ void test_spdm_requester_get_measurements_case22(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4245,7 +4245,7 @@ void test_spdm_requester_get_measurements_case23(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4325,7 +4325,7 @@ void test_spdm_requester_get_measurements_case24(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4399,7 +4399,7 @@ void test_spdm_requester_get_measurements_case25(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4473,7 +4473,7 @@ void test_spdm_requester_get_measurements_case26(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4548,7 +4548,7 @@ void test_spdm_requester_get_measurements_case27(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4623,7 +4623,7 @@ void test_spdm_requester_get_measurements_case28(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4701,7 +4701,7 @@ void test_spdm_requester_get_measurements_case29(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4782,7 +4782,7 @@ void test_spdm_requester_get_measurements_case30(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4861,7 +4861,7 @@ void test_spdm_requester_get_measurements_case31(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -4940,7 +4940,7 @@ void test_spdm_requester_get_measurements_case32(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -5022,7 +5022,7 @@ void test_spdm_requester_get_measurements_case32(void **state) void test_spdm_requester_get_measurements_case33(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -5103,9 +5103,9 @@ void test_spdm_requester_get_measurements_case34(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t number_of_block; uint32_t measurement_record_length; uint8_t measurement_record[LIBSPDM_MAX_MEASUREMENT_RECORD_SIZE]; @@ -5149,7 +5149,7 @@ void test_spdm_requester_get_measurements_case34(void **state) spdm_context->local_context.psk_hint = m_local_psk_hint; session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); diff --git a/unit_test/test_spdm_requester/get_version.c b/unit_test/test_spdm_requester/get_version.c index 64074484b2f..127ec292e2b 100644 --- a/unit_test/test_spdm_requester/get_version.c +++ b/unit_test/test_spdm_requester/get_version.c @@ -401,7 +401,7 @@ void test_spdm_requester_get_version_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -419,7 +419,7 @@ void test_spdm_requester_get_version_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -437,7 +437,7 @@ void test_spdm_requester_get_version_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -455,7 +455,7 @@ void test_spdm_requester_get_version_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -473,7 +473,7 @@ void test_spdm_requester_get_version_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -492,7 +492,7 @@ void test_spdm_requester_get_version_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -513,7 +513,7 @@ void test_spdm_requester_get_version_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -535,7 +535,7 @@ void test_spdm_requester_get_version_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -556,7 +556,7 @@ void test_spdm_requester_get_version_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -577,7 +577,7 @@ void test_spdm_requester_get_version_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -596,7 +596,7 @@ void test_spdm_requester_get_version_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -615,7 +615,7 @@ void test_spdm_requester_get_version_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -635,7 +635,7 @@ void test_spdm_requester_get_version_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -656,7 +656,7 @@ void test_spdm_requester_get_version_case13(void **state) void test_spdm_requester_get_version_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint16_t error_code; spdm_test_context = *state; @@ -692,7 +692,7 @@ void test_spdm_requester_get_version_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; diff --git a/unit_test/test_spdm_requester/heartbeat.c b/unit_test/test_spdm_requester/heartbeat.c index 78b6a883233..b229f4ecddf 100644 --- a/unit_test/test_spdm_requester/heartbeat.c +++ b/unit_test/test_spdm_requester/heartbeat.c @@ -91,7 +91,7 @@ return_status spdm_requester_heartbeat_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_heartbeat_response_t); @@ -124,7 +124,7 @@ return_status spdm_requester_heartbeat_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_heartbeat_response_t); @@ -154,7 +154,7 @@ return_status spdm_requester_heartbeat_test_receive_message( case 0x4: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -181,7 +181,7 @@ return_status spdm_requester_heartbeat_test_receive_message( case 0x5: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -210,7 +210,7 @@ return_status spdm_requester_heartbeat_test_receive_message( if (sub_index1 == 0) { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = @@ -238,7 +238,7 @@ return_status spdm_requester_heartbeat_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_heartbeat_response_t); @@ -271,7 +271,7 @@ return_status spdm_requester_heartbeat_test_receive_message( case 0x7: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -298,7 +298,7 @@ return_status spdm_requester_heartbeat_test_receive_message( case 0x8: { spdm_error_response_data_response_not_ready_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -333,7 +333,7 @@ return_status spdm_requester_heartbeat_test_receive_message( spdm_error_response_data_response_not_ready_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = @@ -367,7 +367,7 @@ return_status spdm_requester_heartbeat_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_heartbeat_response_t); @@ -403,7 +403,7 @@ return_status spdm_requester_heartbeat_test_receive_message( spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -439,7 +439,7 @@ return_status spdm_requester_heartbeat_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_heartbeat_response_t); @@ -470,7 +470,7 @@ return_status spdm_requester_heartbeat_test_receive_message( case 0xC: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -503,13 +503,13 @@ void test_spdm_requester_heartbeat_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -558,7 +558,7 @@ void test_spdm_requester_heartbeat_case1(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -572,13 +572,13 @@ void test_spdm_requester_heartbeat_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -627,7 +627,7 @@ void test_spdm_requester_heartbeat_case2(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -664,13 +664,13 @@ void test_spdm_requester_heartbeat_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -719,7 +719,7 @@ void test_spdm_requester_heartbeat_case3(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -756,13 +756,13 @@ void test_spdm_requester_heartbeat_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -811,7 +811,7 @@ void test_spdm_requester_heartbeat_case4(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -848,13 +848,13 @@ void test_spdm_requester_heartbeat_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -903,7 +903,7 @@ void test_spdm_requester_heartbeat_case5(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -940,13 +940,13 @@ void test_spdm_requester_heartbeat_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -995,7 +995,7 @@ void test_spdm_requester_heartbeat_case6(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -1032,13 +1032,13 @@ void test_spdm_requester_heartbeat_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1087,7 +1087,7 @@ void test_spdm_requester_heartbeat_case7(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -1126,13 +1126,13 @@ void test_spdm_requester_heartbeat_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1181,7 +1181,7 @@ void test_spdm_requester_heartbeat_case8(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -1218,13 +1218,13 @@ void test_spdm_requester_heartbeat_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1273,7 +1273,7 @@ void test_spdm_requester_heartbeat_case9(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -1309,13 +1309,13 @@ void test_spdm_requester_heartbeat_case9(void **state) void test_spdm_requester_heartbeat_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint16_t error_code; spdm_test_context = *state; @@ -1356,7 +1356,7 @@ void test_spdm_requester_heartbeat_case10(void **state) { session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init (spdm_context, session_info, session_id, true); + libspdm_session_info_init (spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state (session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); set_mem (m_dummy_key_buffer, @@ -1403,13 +1403,13 @@ void test_spdm_requester_heartbeat_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1458,7 +1458,7 @@ void test_spdm_requester_heartbeat_case11(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -1518,13 +1518,13 @@ void test_spdm_requester_heartbeat_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1573,7 +1573,7 @@ void test_spdm_requester_heartbeat_case12(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); diff --git a/unit_test/test_spdm_requester/key_exchange.c b/unit_test/test_spdm_requester/key_exchange.c index f816f042ce6..a224a4e5aee 100644 --- a/unit_test/test_spdm_requester/key_exchange.c +++ b/unit_test/test_spdm_requester/key_exchange.c @@ -354,7 +354,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -368,18 +368,18 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context)->connection_info.secured_message_version = + ((libspdm_context_t *)spdm_context)->connection_info.secured_message_version = SPDM_MESSAGE_VERSION_11 << SPDM_VERSION_NUMBER_SHIFT_BIT; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -387,7 +387,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); temp_buf_size = sizeof(spdm_key_exchange_response_t) + dhe_key_size + 0 + sizeof(uint16_t) + @@ -400,7 +400,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -423,7 +423,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -436,35 +436,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -486,8 +486,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -515,7 +515,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -529,16 +529,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -546,7 +546,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); temp_buf_size = sizeof(spdm_key_exchange_response_t) + dhe_key_size + 0 + sizeof(uint16_t) + @@ -559,7 +559,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -582,7 +582,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -595,35 +595,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -645,8 +645,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -720,7 +720,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -734,16 +734,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm .measurement_hash_algo = m_use_measurement_hash_algo; @@ -754,7 +754,7 @@ return_status spdm_requester_key_exchange_test_receive_message( dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); temp_buf_size = sizeof(spdm_key_exchange_response_t) + dhe_key_size + 0 + sizeof(uint16_t) + @@ -768,7 +768,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -791,7 +791,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; @@ -806,40 +806,40 @@ return_status spdm_requester_key_exchange_test_receive_message( ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, - LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, + LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, - hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, + hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; libspdm_hash_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, @@ -867,8 +867,8 @@ return_status spdm_requester_key_exchange_test_receive_message( bin_str7, bin_str7_size, response_finished_key, hash_size); libspdm_hmac_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -955,7 +955,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -969,16 +969,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm .measurement_hash_algo = m_use_measurement_hash_algo; @@ -989,7 +989,7 @@ return_status spdm_requester_key_exchange_test_receive_message( dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); temp_buf_size = sizeof(spdm_key_exchange_response_t) + dhe_key_size + 0 + sizeof(uint16_t) + @@ -1003,7 +1003,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -1026,7 +1026,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; @@ -1041,40 +1041,40 @@ return_status spdm_requester_key_exchange_test_receive_message( ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, - LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, + LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, - hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, + hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; libspdm_hash_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, @@ -1102,8 +1102,8 @@ return_status spdm_requester_key_exchange_test_receive_message( bin_str7, bin_str7_size, response_finished_key, hash_size); libspdm_hmac_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -1161,7 +1161,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -1175,16 +1175,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -1192,7 +1192,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); temp_buf_size = sizeof(spdm_key_exchange_response_t) + dhe_key_size + 0 + sizeof(uint16_t) + @@ -1205,7 +1205,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -1228,7 +1228,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -1241,35 +1241,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -1291,8 +1291,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -1321,7 +1321,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -1335,16 +1335,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -1353,7 +1353,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -1367,7 +1367,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -1395,7 +1395,7 @@ return_status spdm_requester_key_exchange_test_receive_message( ptr += measurement_hash_size; *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -1408,35 +1408,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -1458,8 +1458,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -1489,7 +1489,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -1503,16 +1503,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -1521,7 +1521,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -1535,7 +1535,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -1562,7 +1562,7 @@ return_status spdm_requester_key_exchange_test_receive_message( ptr += measurement_hash_size; *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -1575,35 +1575,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -1625,8 +1625,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -1656,7 +1656,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -1670,16 +1670,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -1688,7 +1688,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -1702,7 +1702,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -1730,7 +1730,7 @@ return_status spdm_requester_key_exchange_test_receive_message( ptr += measurement_hash_size; *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -1743,35 +1743,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -1793,8 +1793,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -1822,7 +1822,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -1836,16 +1836,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -1853,7 +1853,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -1867,7 +1867,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -1890,7 +1890,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -1903,35 +1903,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -1953,8 +1953,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -1982,7 +1982,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -1996,16 +1996,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -2013,7 +2013,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -2027,7 +2027,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -2050,7 +2050,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -2063,35 +2063,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -2113,8 +2113,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -2144,7 +2144,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -2158,16 +2158,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -2176,7 +2176,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -2190,7 +2190,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -2218,7 +2218,7 @@ return_status spdm_requester_key_exchange_test_receive_message( ptr += measurement_hash_size; *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -2231,35 +2231,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -2281,8 +2281,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -2311,7 +2311,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -2325,16 +2325,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -2343,7 +2343,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -2357,7 +2357,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -2379,7 +2379,7 @@ return_status spdm_requester_key_exchange_test_receive_message( *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -2392,37 +2392,37 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size-1; *ptr ^= 0xFF; ptr++; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -2444,8 +2444,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -2473,20 +2473,20 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -2494,7 +2494,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = 0; dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -2508,7 +2508,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -2531,7 +2531,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -2544,32 +2544,32 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; spdm_transport_test_encode_message(spdm_context, NULL, false, @@ -2596,7 +2596,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -2610,16 +2610,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -2627,7 +2627,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -2641,7 +2641,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 5; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -2664,7 +2664,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -2677,35 +2677,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -2727,8 +2727,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -2756,7 +2756,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -2770,16 +2770,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -2787,7 +2787,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -2801,7 +2801,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 5; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -2824,7 +2824,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -2837,35 +2837,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -2887,8 +2887,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -2916,7 +2916,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -2930,16 +2930,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -2947,7 +2947,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -2961,7 +2961,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = 0; spdm_response->req_slot_id_param = 0; libspdm_get_random_number(SPDM_RANDOM_DATA_SIZE, @@ -2984,7 +2984,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -2997,35 +2997,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -3047,8 +3047,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -3076,7 +3076,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -3090,16 +3090,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -3107,7 +3107,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -3121,7 +3121,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = SPDM_KEY_EXCHANGE_RESPONSE_MUT_AUTH_REQUESTED; spdm_response->req_slot_id_param = 0xF; @@ -3145,7 +3145,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -3158,35 +3158,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -3208,8 +3208,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -3237,7 +3237,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -3251,16 +3251,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -3268,7 +3268,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -3282,7 +3282,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = SPDM_KEY_EXCHANGE_RESPONSE_MUT_AUTH_REQUESTED_WITH_ENCAP_REQUEST; spdm_response->req_slot_id_param = 0xF; @@ -3306,7 +3306,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -3319,35 +3319,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -3369,8 +3369,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -3398,7 +3398,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -3412,16 +3412,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -3429,7 +3429,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -3443,7 +3443,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = SPDM_KEY_EXCHANGE_RESPONSE_MUT_AUTH_REQUESTED_WITH_GET_DIGESTS; spdm_response->req_slot_id_param = 0xF; @@ -3467,7 +3467,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -3480,35 +3480,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -3530,8 +3530,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -3559,7 +3559,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -3573,16 +3573,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -3590,7 +3590,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -3604,7 +3604,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = SPDM_KEY_EXCHANGE_RESPONSE_MUT_AUTH_REQUESTED | SPDM_KEY_EXCHANGE_RESPONSE_MUT_AUTH_REQUESTED_WITH_ENCAP_REQUEST; @@ -3629,7 +3629,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -3642,35 +3642,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -3692,8 +3692,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -3721,7 +3721,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -3735,16 +3735,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -3752,7 +3752,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -3766,7 +3766,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = SPDM_KEY_EXCHANGE_RESPONSE_MUT_AUTH_REQUESTED | SPDM_KEY_EXCHANGE_RESPONSE_MUT_AUTH_REQUESTED_WITH_GET_DIGESTS; @@ -3791,7 +3791,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -3804,35 +3804,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -3854,8 +3854,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -3883,7 +3883,7 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t THCurrHashData[64]; uint8_t bin_str0[128]; uintn bin_str0_size; @@ -3897,16 +3897,16 @@ return_status spdm_requester_key_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; signature_size = libspdm_get_asym_signature_size(m_use_asym_algo); @@ -3914,7 +3914,7 @@ return_status spdm_requester_key_exchange_test_receive_message( hmac_size = libspdm_get_hash_size(m_use_hash_algo); dhe_key_size = libspdm_get_dhe_pub_key_size(m_use_dhe_algo); opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); zero_mem(temp_buf,LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); temp_buf_size = sizeof(spdm_key_exchange_response_t) + @@ -3928,7 +3928,7 @@ return_status spdm_requester_key_exchange_test_receive_message( SPDM_KEY_EXCHANGE_RSP; spdm_response->header.param1 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->mut_auth_requested = SPDM_KEY_EXCHANGE_RESPONSE_MUT_AUTH_REQUESTED_WITH_ENCAP_REQUEST | SPDM_KEY_EXCHANGE_RESPONSE_MUT_AUTH_REQUESTED_WITH_GET_DIGESTS; @@ -3953,7 +3953,7 @@ return_status spdm_requester_key_exchange_test_receive_message( * ptr += hash_size;*/ *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_rsp_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_key_exchange_rsp_size, ptr); ptr += opaque_key_exchange_rsp_size; read_responder_public_certificate_chain(m_use_hash_algo, @@ -3966,35 +3966,35 @@ return_status spdm_requester_key_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); libspdm_responder_data_sign( spdm_response->header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_KEY_EXCHANGE_RSP, m_use_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), ptr, + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &signature_size); copy_mem_s(&m_local_buffer[m_local_buffer_size], sizeof(m_local_buffer) - (&m_local_buffer[m_local_buffer_size] - m_local_buffer), ptr, signature_size); m_local_buffer_size += signature_size; - append_managed_buffer(&th_curr, ptr, signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, signature_size); ptr += signature_size; - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), THCurrHashData); bin_str0_size = sizeof(bin_str0); libspdm_bin_concat(SPDM_BIN_STR_0_LABEL, sizeof(SPDM_BIN_STR_0_LABEL) - 1, @@ -4016,8 +4016,8 @@ return_status spdm_requester_key_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -4037,7 +4037,7 @@ void test_spdm_requester_key_exchange_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4104,7 +4104,7 @@ void test_spdm_requester_key_exchange_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4181,7 +4181,7 @@ void test_spdm_requester_key_exchange_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4250,7 +4250,7 @@ void test_spdm_requester_key_exchange_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4319,7 +4319,7 @@ void test_spdm_requester_key_exchange_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4388,7 +4388,7 @@ void test_spdm_requester_key_exchange_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4462,7 +4462,7 @@ void test_spdm_requester_key_exchange_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4533,7 +4533,7 @@ void test_spdm_requester_key_exchange_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4602,7 +4602,7 @@ void test_spdm_requester_key_exchange_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4675,7 +4675,7 @@ void test_spdm_requester_key_exchange_case9(void **state) void test_spdm_requester_key_exchange_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4753,7 +4753,7 @@ void test_spdm_requester_key_exchange_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4846,7 +4846,7 @@ void test_spdm_requester_key_exchange_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -4934,7 +4934,7 @@ void test_spdm_requester_key_exchange_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5022,7 +5022,7 @@ void test_spdm_requester_key_exchange_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5110,7 +5110,7 @@ void test_spdm_requester_key_exchange_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5189,7 +5189,7 @@ void test_spdm_requester_key_exchange_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5268,7 +5268,7 @@ void test_spdm_requester_key_exchange_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5347,7 +5347,7 @@ void test_spdm_requester_key_exchange_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5426,7 +5426,7 @@ void test_spdm_requester_key_exchange_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5515,7 +5515,7 @@ void test_spdm_requester_key_exchange_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5595,7 +5595,7 @@ void test_spdm_requester_key_exchange_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5691,7 +5691,7 @@ void test_spdm_requester_key_exchange_case22(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5789,7 +5789,7 @@ void test_spdm_requester_key_exchange_case23(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5887,7 +5887,7 @@ void test_spdm_requester_key_exchange_case24(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -5985,7 +5985,7 @@ void test_spdm_requester_key_exchange_case25(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -6083,7 +6083,7 @@ void test_spdm_requester_key_exchange_case26(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -6173,7 +6173,7 @@ void test_spdm_requester_key_exchange_case27(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -6263,7 +6263,7 @@ void test_spdm_requester_key_exchange_case28(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; diff --git a/unit_test/test_spdm_requester/key_update.c b/unit_test/test_spdm_requester/key_update.c index 3f4e5eaaa0c..ff53609777a 100644 --- a/unit_test/test_spdm_requester/key_update.c +++ b/unit_test/test_spdm_requester/key_update.c @@ -14,13 +14,13 @@ static uint8_t my_last_rsp_salt[LIBSPDM_MAX_AEAD_IV_SIZE]; static uint64_t my_last_rsp_sequence_number; static void spdm_set_standard_key_update_test_state( - spdm_context_t *spdm_context, uint32_t *session_id) + libspdm_context_t *spdm_context, uint32_t *session_id) { void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_context->connection_info.connection_state = LIBSPDM_CONNECTION_STATE_NEGOTIATED; @@ -58,7 +58,7 @@ static void spdm_set_standard_key_update_test_state( *session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, *session_id, true); + libspdm_session_info_init(spdm_context, session_info, *session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -145,7 +145,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -185,7 +185,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -228,7 +228,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -271,7 +271,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -314,7 +314,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -360,7 +360,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -412,7 +412,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -452,7 +452,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -497,7 +497,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -541,7 +541,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -578,7 +578,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -618,7 +618,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -661,7 +661,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -704,7 +704,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -750,7 +750,7 @@ return_status spdm_requester_key_update_test_send_message( uint32_t session_id; uint32_t *message_session_id; bool is_app_message; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; message_session_id = NULL; session_id = 0xFFFFFFFF; @@ -808,7 +808,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -849,7 +849,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -888,7 +888,7 @@ return_status spdm_requester_key_update_test_receive_message( case 0x4: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -916,7 +916,7 @@ return_status spdm_requester_key_update_test_receive_message( case 0x5: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -945,7 +945,7 @@ return_status spdm_requester_key_update_test_receive_message( static uintn sub_index = 0; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1019,7 +1019,7 @@ return_status spdm_requester_key_update_test_receive_message( case 0x7: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1047,7 +1047,7 @@ return_status spdm_requester_key_update_test_receive_message( case 0x8: { spdm_error_response_data_response_not_ready_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1081,7 +1081,7 @@ return_status spdm_requester_key_update_test_receive_message( static uintn sub_index = 0; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1163,7 +1163,7 @@ return_status spdm_requester_key_update_test_receive_message( static uint16_t error_code = SPDM_ERROR_CODE_RESERVED_00; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1217,7 +1217,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -1258,7 +1258,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -1300,7 +1300,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -1341,7 +1341,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -1382,7 +1382,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -1424,7 +1424,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -1465,7 +1465,7 @@ return_status spdm_requester_key_update_test_receive_message( static uintn sub_index = 0; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1521,7 +1521,7 @@ return_status spdm_requester_key_update_test_receive_message( static uintn sub_index = 0; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1577,7 +1577,7 @@ return_status spdm_requester_key_update_test_receive_message( static uintn sub_index = 0; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1654,7 +1654,7 @@ return_status spdm_requester_key_update_test_receive_message( static uintn sub_index = 0; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1710,7 +1710,7 @@ return_status spdm_requester_key_update_test_receive_message( static uintn sub_index = 0; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1771,7 +1771,7 @@ return_status spdm_requester_key_update_test_receive_message( static uintn sub_index = 0; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1853,7 +1853,7 @@ return_status spdm_requester_key_update_test_receive_message( static uint16_t error_code = SPDM_ERROR_CODE_RESERVED_00; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -1931,7 +1931,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -1977,7 +1977,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -2019,7 +2019,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -2061,7 +2061,7 @@ return_status spdm_requester_key_update_test_receive_message( spdm_key_update_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -2103,7 +2103,7 @@ return_status spdm_requester_key_update_test_receive_message( case 0x1C: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uint8_t curr_rsp_enc_key[LIBSPDM_MAX_AEAD_KEY_SIZE]; @@ -2174,7 +2174,7 @@ return_status spdm_requester_key_update_test_receive_message( case 0x1D: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uint8_t curr_rsp_enc_key[LIBSPDM_MAX_AEAD_KEY_SIZE]; @@ -2249,7 +2249,7 @@ return_status spdm_requester_key_update_test_receive_message( static uintn sub_index = 0; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; @@ -2365,7 +2365,7 @@ return_status spdm_requester_key_update_test_receive_message( case 0x1F: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uint8_t curr_rsp_enc_key[LIBSPDM_MAX_AEAD_KEY_SIZE]; @@ -2436,7 +2436,7 @@ return_status spdm_requester_key_update_test_receive_message( case 0x20: { spdm_error_response_data_response_not_ready_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uint8_t curr_rsp_enc_key[LIBSPDM_MAX_AEAD_KEY_SIZE]; @@ -2513,7 +2513,7 @@ return_status spdm_requester_key_update_test_receive_message( static uintn sub_index = 0; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; @@ -2637,7 +2637,7 @@ return_status spdm_requester_key_update_test_receive_message( static uint16_t error_code = SPDM_ERROR_CODE_RESERVED_00; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_error_response_t spdm_response; @@ -2732,7 +2732,7 @@ return_status spdm_requester_key_update_test_receive_message( case 0x23: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; session_info = libspdm_get_session_info_via_session_id( @@ -2772,9 +2772,9 @@ void test_spdm_requester_key_update_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -2811,9 +2811,9 @@ void test_spdm_requester_key_update_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -2866,9 +2866,9 @@ void test_spdm_requester_key_update_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -2909,9 +2909,9 @@ void test_spdm_requester_key_update_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -2960,9 +2960,9 @@ void test_spdm_requester_key_update_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3013,9 +3013,9 @@ void test_spdm_requester_key_update_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3070,9 +3070,9 @@ void test_spdm_requester_key_update_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3112,9 +3112,9 @@ void test_spdm_requester_key_update_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3165,9 +3165,9 @@ void test_spdm_requester_key_update_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3225,9 +3225,9 @@ void test_spdm_requester_key_update_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint16_t error_code; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3293,9 +3293,9 @@ void test_spdm_requester_key_update_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3369,9 +3369,9 @@ void test_spdm_requester_key_update_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3426,9 +3426,9 @@ void test_spdm_requester_key_update_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3478,9 +3478,9 @@ void test_spdm_requester_key_update_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3535,9 +3535,9 @@ void test_spdm_requester_key_update_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3587,9 +3587,9 @@ void test_spdm_requester_key_update_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3638,9 +3638,9 @@ void test_spdm_requester_key_update_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3695,9 +3695,9 @@ void test_spdm_requester_key_update_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3753,9 +3753,9 @@ void test_spdm_requester_key_update_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3810,9 +3810,9 @@ void test_spdm_requester_key_update_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3852,9 +3852,9 @@ void test_spdm_requester_key_update_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3909,9 +3909,9 @@ void test_spdm_requester_key_update_case22(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -3969,9 +3969,9 @@ void test_spdm_requester_key_update_case23(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint16_t error_code; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4048,9 +4048,9 @@ void test_spdm_requester_key_update_case24(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4105,9 +4105,9 @@ void test_spdm_requester_key_update_case25(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4162,9 +4162,9 @@ void test_spdm_requester_key_update_case26(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4218,9 +4218,9 @@ void test_spdm_requester_key_update_case27(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4278,9 +4278,9 @@ void test_spdm_requester_key_update_case28(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4345,9 +4345,9 @@ void test_spdm_requester_key_update_case29(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4413,9 +4413,9 @@ void test_spdm_requester_key_update_case30(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4489,9 +4489,9 @@ void test_spdm_requester_key_update_case31(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4546,9 +4546,9 @@ void test_spdm_requester_key_update_case32(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4614,9 +4614,9 @@ void test_spdm_requester_key_update_case33(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4693,9 +4693,9 @@ void test_spdm_requester_key_update_case34(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint16_t error_code; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; @@ -4780,9 +4780,9 @@ void test_spdm_requester_key_update_case35(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint8_t m_req_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; uint8_t m_rsp_secret_buffer[LIBSPDM_MAX_HASH_SIZE]; diff --git a/unit_test/test_spdm_requester/negotiate_algorithms.c b/unit_test/test_spdm_requester/negotiate_algorithms.c index 73f2e2c284b..7d3db16b2f0 100644 --- a/unit_test/test_spdm_requester/negotiate_algorithms.c +++ b/unit_test/test_spdm_requester/negotiate_algorithms.c @@ -1041,7 +1041,7 @@ void test_spdm_requester_negotiate_algorithms_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1067,7 +1067,7 @@ void test_spdm_requester_negotiate_algorithms_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1095,7 +1095,7 @@ void test_spdm_requester_negotiate_algorithms_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1121,7 +1121,7 @@ void test_spdm_requester_negotiate_algorithms_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1147,7 +1147,7 @@ void test_spdm_requester_negotiate_algorithms_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1173,7 +1173,7 @@ void test_spdm_requester_negotiate_algorithms_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1201,7 +1201,7 @@ void test_spdm_requester_negotiate_algorithms_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1229,7 +1229,7 @@ void test_spdm_requester_negotiate_algorithms_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1252,7 +1252,7 @@ void test_spdm_requester_negotiate_algorithms_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1278,7 +1278,7 @@ void test_spdm_requester_negotiate_algorithms_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1309,7 +1309,7 @@ void test_spdm_requester_negotiate_algorithms_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1341,7 +1341,7 @@ void test_spdm_requester_negotiate_algorithms_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1368,7 +1368,7 @@ void test_spdm_requester_negotiate_algorithms_case12(void **state) void test_spdm_requester_negotiate_algorithms_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1388,7 +1388,7 @@ void test_spdm_requester_negotiate_algorithms_case13(void **state) { void test_spdm_requester_negotiate_algorithms_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1408,7 +1408,7 @@ void test_spdm_requester_negotiate_algorithms_case14(void **state) { void test_spdm_requester_negotiate_algorithms_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1428,7 +1428,7 @@ void test_spdm_requester_negotiate_algorithms_case15(void **state) { void test_spdm_requester_negotiate_algorithms_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1448,7 +1448,7 @@ void test_spdm_requester_negotiate_algorithms_case16(void **state) { void test_spdm_requester_negotiate_algorithms_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1468,7 +1468,7 @@ void test_spdm_requester_negotiate_algorithms_case17(void **state) { void test_spdm_requester_negotiate_algorithms_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1488,7 +1488,7 @@ void test_spdm_requester_negotiate_algorithms_case18(void **state) { void test_spdm_requester_negotiate_algorithms_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1508,7 +1508,7 @@ void test_spdm_requester_negotiate_algorithms_case19(void **state) { void test_spdm_requester_negotiate_algorithms_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1528,7 +1528,7 @@ void test_spdm_requester_negotiate_algorithms_case20(void **state) { void test_spdm_requester_negotiate_algorithms_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1548,7 +1548,7 @@ void test_spdm_requester_negotiate_algorithms_case21(void **state) { void test_spdm_requester_negotiate_algorithms_case22(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1568,7 +1568,7 @@ void test_spdm_requester_negotiate_algorithms_case22(void **state) { void test_spdm_requester_negotiate_algorithms_case23(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1618,7 +1618,7 @@ void test_spdm_requester_negotiate_algorithms_case23(void **state) { void test_spdm_requester_negotiate_algorithms_case24(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1662,7 +1662,7 @@ void test_spdm_requester_negotiate_algorithms_case24(void **state) { void test_spdm_requester_negotiate_algorithms_case25(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1706,7 +1706,7 @@ void test_spdm_requester_negotiate_algorithms_case25(void **state) { void test_spdm_requester_negotiate_algorithms_case26(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1750,7 +1750,7 @@ void test_spdm_requester_negotiate_algorithms_case26(void **state) { void test_spdm_requester_negotiate_algorithms_case27(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1794,7 +1794,7 @@ void test_spdm_requester_negotiate_algorithms_case27(void **state) { void test_spdm_requester_negotiate_algorithms_case28(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1838,7 +1838,7 @@ void test_spdm_requester_negotiate_algorithms_case28(void **state) { void test_spdm_requester_negotiate_algorithms_case29(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1882,7 +1882,7 @@ void test_spdm_requester_negotiate_algorithms_case29(void **state) { void test_spdm_requester_negotiate_algorithms_case30(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1926,7 +1926,7 @@ void test_spdm_requester_negotiate_algorithms_case30(void **state) { void test_spdm_requester_negotiate_algorithms_case31(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; diff --git a/unit_test/test_spdm_requester/psk_exchange.c b/unit_test/test_spdm_requester/psk_exchange.c index aa7f980ee0d..a3ba5744332 100644 --- a/unit_test/test_spdm_requester/psk_exchange.c +++ b/unit_test/test_spdm_requester/psk_exchange.c @@ -185,7 +185,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t bin_str2[128]; uintn bin_str2_size; uint8_t bin_str7[128]; @@ -195,24 +195,24 @@ return_status spdm_requester_psk_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context)->connection_info.secured_message_version = + ((libspdm_context_t *)spdm_context)->connection_info.secured_message_version = SPDM_MESSAGE_VERSION_11 << SPDM_VERSION_NUMBER_SHIFT_BIT; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); opaque_psk_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); temp_buf_size = sizeof(spdm_psk_exchange_response_t) + 0 + LIBSPDM_PSK_CONTEXT_LENGTH + @@ -225,7 +225,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( spdm_response->header.param1 = 0; spdm_response->header.param2 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->reserved = 0; spdm_response->context_length = LIBSPDM_PSK_CONTEXT_LENGTH; spdm_response->opaque_length = @@ -235,7 +235,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( * ptr += hash_size;*/ libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += LIBSPDM_PSK_CONTEXT_LENGTH; - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_psk_exchange_rsp_size, ptr); ptr += opaque_psk_exchange_rsp_size; copy_mem_s(&m_local_buffer[m_local_buffer_size], @@ -245,8 +245,8 @@ return_status spdm_requester_psk_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); @@ -257,10 +257,10 @@ return_status spdm_requester_psk_exchange_test_receive_message( libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); bin_str2_size = sizeof(bin_str2); libspdm_bin_concat(SPDM_BIN_STR_2_LABEL, sizeof(SPDM_BIN_STR_2_LABEL) - 1, @@ -282,8 +282,8 @@ return_status spdm_requester_psk_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -306,7 +306,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t bin_str2[128]; uintn bin_str2_size; uint8_t bin_str7[128]; @@ -316,22 +316,22 @@ return_status spdm_requester_psk_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); opaque_psk_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); temp_buf_size = sizeof(spdm_psk_exchange_response_t) + 0 + LIBSPDM_PSK_CONTEXT_LENGTH + @@ -344,7 +344,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( spdm_response->header.param1 = 0; spdm_response->header.param2 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->reserved = 0; spdm_response->context_length = LIBSPDM_PSK_CONTEXT_LENGTH; spdm_response->opaque_length = @@ -354,7 +354,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( * ptr += hash_size;*/ libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += LIBSPDM_PSK_CONTEXT_LENGTH; - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_psk_exchange_rsp_size, ptr); ptr += opaque_psk_exchange_rsp_size; copy_mem_s(&m_local_buffer[m_local_buffer_size], @@ -364,8 +364,8 @@ return_status spdm_requester_psk_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); @@ -376,10 +376,10 @@ return_status spdm_requester_psk_exchange_test_receive_message( libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); bin_str2_size = sizeof(bin_str2); libspdm_bin_concat(SPDM_BIN_STR_2_LABEL, sizeof(SPDM_BIN_STR_2_LABEL) - 1, @@ -401,8 +401,8 @@ return_status spdm_requester_psk_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -471,7 +471,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t bin_str2[128]; uintn bin_str2_size; uint8_t bin_str7[128]; @@ -481,23 +481,23 @@ return_status spdm_requester_psk_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm .measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); opaque_psk_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); temp_buf_size = sizeof(spdm_psk_exchange_response_t) + 0 + LIBSPDM_PSK_CONTEXT_LENGTH + @@ -512,7 +512,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( spdm_response->header.param1 = 0; spdm_response->header.param2 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->reserved = 0; spdm_response->context_length = LIBSPDM_PSK_CONTEXT_LENGTH; spdm_response->opaque_length = @@ -522,7 +522,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( * ptr += hash_size;*/ libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += LIBSPDM_PSK_CONTEXT_LENGTH; - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_psk_exchange_rsp_size, ptr); ptr += opaque_psk_exchange_rsp_size; @@ -534,9 +534,9 @@ return_status spdm_requester_psk_exchange_test_receive_message( ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, - LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, + LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); read_responder_public_certificate_chain( m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); @@ -548,11 +548,11 @@ return_status spdm_requester_psk_exchange_test_receive_message( libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); bin_str2_size = sizeof(bin_str2); @@ -579,8 +579,8 @@ return_status spdm_requester_psk_exchange_test_receive_message( bin_str7, bin_str7_size, response_finished_key, hash_size); libspdm_hmac_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -662,7 +662,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t bin_str2[128]; uintn bin_str2_size; uint8_t bin_str7[128]; @@ -672,23 +672,23 @@ return_status spdm_requester_psk_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm .measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); opaque_psk_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); temp_buf_size = sizeof(spdm_psk_exchange_response_t) + 0 + LIBSPDM_PSK_CONTEXT_LENGTH + @@ -703,7 +703,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( spdm_response->header.param1 = 0; spdm_response->header.param2 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->reserved = 0; spdm_response->context_length = LIBSPDM_PSK_CONTEXT_LENGTH; spdm_response->opaque_length = @@ -713,7 +713,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( * ptr += hash_size;*/ libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += LIBSPDM_PSK_CONTEXT_LENGTH; - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_psk_exchange_rsp_size, ptr); ptr += opaque_psk_exchange_rsp_size; @@ -725,9 +725,9 @@ return_status spdm_requester_psk_exchange_test_receive_message( ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, - LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, + LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); read_responder_public_certificate_chain( m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); @@ -739,11 +739,11 @@ return_status spdm_requester_psk_exchange_test_receive_message( libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); libspdm_hash_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); bin_str2_size = sizeof(bin_str2); @@ -770,8 +770,8 @@ return_status spdm_requester_psk_exchange_test_receive_message( bin_str7, bin_str7_size, response_finished_key, hash_size); libspdm_hmac_all(m_use_hash_algo, - get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -825,7 +825,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t bin_str2[128]; uintn bin_str2_size; uint8_t bin_str7[128]; @@ -835,22 +835,22 @@ return_status spdm_requester_psk_exchange_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_asym_algo = m_use_asym_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.base_hash_algo = m_use_hash_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.dhe_named_group = m_use_dhe_algo; - ((spdm_context_t *)spdm_context) + ((libspdm_context_t *)spdm_context) ->connection_info.algorithm.measurement_hash_algo = m_use_measurement_hash_algo; hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); opaque_psk_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size( + libspdm_get_opaque_data_version_selection_data_size( spdm_context); temp_buf_size = sizeof(spdm_psk_exchange_response_t) + 0 + LIBSPDM_PSK_CONTEXT_LENGTH + @@ -863,7 +863,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( spdm_response->header.param1 = 0; spdm_response->header.param2 = 0; spdm_response->rsp_session_id = - spdm_allocate_rsp_session_id(spdm_context); + libspdm_allocate_rsp_session_id(spdm_context); spdm_response->reserved = 0; spdm_response->context_length = LIBSPDM_PSK_CONTEXT_LENGTH; spdm_response->opaque_length = @@ -873,7 +873,7 @@ return_status spdm_requester_psk_exchange_test_receive_message( * ptr += hash_size;*/ libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += LIBSPDM_PSK_CONTEXT_LENGTH; - spdm_build_opaque_data_version_selection_data( + libspdm_build_opaque_data_version_selection_data( spdm_context, &opaque_psk_exchange_rsp_size, ptr); ptr += opaque_psk_exchange_rsp_size; copy_mem_s(&m_local_buffer[m_local_buffer_size], @@ -883,8 +883,8 @@ return_status spdm_requester_psk_exchange_test_receive_message( m_local_buffer_size += ((uintn)ptr - (uintn)spdm_response); DEBUG((DEBUG_INFO, "m_local_buffer_size (0x%x):\n", m_local_buffer_size)); - internal_dump_hex(m_local_buffer, m_local_buffer_size); - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_internal_dump_hex(m_local_buffer, m_local_buffer_size); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); read_responder_public_certificate_chain(m_use_hash_algo, m_use_asym_algo, &data, &data_size, NULL, NULL); @@ -895,10 +895,10 @@ return_status spdm_requester_psk_exchange_test_receive_message( libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, m_local_buffer, - m_local_buffer_size); - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), hash_data); + libspdm_append_managed_buffer(&th_curr, m_local_buffer, + m_local_buffer_size); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), hash_data); free(data); bin_str2_size = sizeof(bin_str2); libspdm_bin_concat(SPDM_BIN_STR_2_LABEL, sizeof(SPDM_BIN_STR_2_LABEL) - 1, @@ -920,8 +920,8 @@ return_status spdm_requester_psk_exchange_test_receive_message( libspdm_hkdf_expand(m_use_hash_algo, response_handshake_secret, hash_size, bin_str7, bin_str7_size, response_finished_key, hash_size); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), response_finished_key, hash_size, ptr); ptr += hmac_size; @@ -941,7 +941,7 @@ void test_spdm_requester_psk_exchange_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -1001,7 +1001,7 @@ void test_spdm_requester_psk_exchange_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -1069,7 +1069,7 @@ void test_spdm_requester_psk_exchange_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -1129,7 +1129,7 @@ void test_spdm_requester_psk_exchange_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -1189,7 +1189,7 @@ void test_spdm_requester_psk_exchange_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -1249,7 +1249,7 @@ void test_spdm_requester_psk_exchange_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -1314,7 +1314,7 @@ void test_spdm_requester_psk_exchange_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -1376,7 +1376,7 @@ void test_spdm_requester_psk_exchange_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -1436,7 +1436,7 @@ void test_spdm_requester_psk_exchange_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -1500,7 +1500,7 @@ void test_spdm_requester_psk_exchange_case9(void **state) void test_spdm_requester_psk_exchange_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -1568,7 +1568,7 @@ void test_spdm_requester_psk_exchange_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; uint8_t heartbeat_period; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; diff --git a/unit_test/test_spdm_requester/psk_finish.c b/unit_test/test_spdm_requester/psk_finish.c index a2095733041..fd9950b3c0a 100644 --- a/unit_test/test_spdm_requester/psk_finish.c +++ b/unit_test/test_spdm_requester/psk_finish.c @@ -108,7 +108,7 @@ return_status spdm_requester_psk_finish_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_psk_finish_response_t); @@ -141,7 +141,7 @@ return_status spdm_requester_psk_finish_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_psk_finish_response_t); @@ -171,7 +171,7 @@ return_status spdm_requester_psk_finish_test_receive_message( case 0x4: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -198,7 +198,7 @@ return_status spdm_requester_psk_finish_test_receive_message( case 0x5: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -227,7 +227,7 @@ return_status spdm_requester_psk_finish_test_receive_message( if (sub_index1 == 0) { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = @@ -255,7 +255,7 @@ return_status spdm_requester_psk_finish_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_psk_finish_response_t); @@ -288,7 +288,7 @@ return_status spdm_requester_psk_finish_test_receive_message( case 0x7: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -315,7 +315,7 @@ return_status spdm_requester_psk_finish_test_receive_message( case 0x8: { spdm_error_response_data_response_not_ready_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = SPDM_MESSAGE_VERSION_11; @@ -350,7 +350,7 @@ return_status spdm_requester_psk_finish_test_receive_message( spdm_error_response_data_response_not_ready_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; spdm_response.header.spdm_version = @@ -384,7 +384,7 @@ return_status spdm_requester_psk_finish_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_psk_finish_response_t); @@ -420,7 +420,7 @@ return_status spdm_requester_psk_finish_test_receive_message( spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -456,7 +456,7 @@ return_status spdm_requester_psk_finish_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_psk_finish_response_t); @@ -489,7 +489,7 @@ return_status spdm_requester_psk_finish_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_psk_finish_response_t); @@ -522,7 +522,7 @@ return_status spdm_requester_psk_finish_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_psk_finish_response_t); @@ -555,7 +555,7 @@ return_status spdm_requester_psk_finish_test_receive_message( uint8_t temp_buf[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uintn temp_buf_size; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; temp_buf_size = sizeof(spdm_psk_finish_response_t); @@ -586,7 +586,7 @@ return_status spdm_requester_psk_finish_test_receive_message( case 0xF: { spdm_error_response_t spdm_response; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; session_id = 0xFFFFFFFF; @@ -625,13 +625,13 @@ void test_spdm_requester_psk_finish_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -680,7 +680,7 @@ void test_spdm_requester_psk_finish_case1(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -700,13 +700,13 @@ void test_spdm_requester_psk_finish_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -755,7 +755,7 @@ void test_spdm_requester_psk_finish_case2(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -802,13 +802,13 @@ void test_spdm_requester_psk_finish_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -857,7 +857,7 @@ void test_spdm_requester_psk_finish_case3(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -900,13 +900,13 @@ void test_spdm_requester_psk_finish_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -955,7 +955,7 @@ void test_spdm_requester_psk_finish_case4(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -999,13 +999,13 @@ void test_spdm_requester_psk_finish_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1054,7 +1054,7 @@ void test_spdm_requester_psk_finish_case5(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -1099,13 +1099,13 @@ void test_spdm_requester_psk_finish_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1154,7 +1154,7 @@ void test_spdm_requester_psk_finish_case6(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -1202,13 +1202,13 @@ void test_spdm_requester_psk_finish_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1257,7 +1257,7 @@ void test_spdm_requester_psk_finish_case7(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -1302,13 +1302,13 @@ void test_spdm_requester_psk_finish_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1357,7 +1357,7 @@ void test_spdm_requester_psk_finish_case8(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -1402,13 +1402,13 @@ void test_spdm_requester_psk_finish_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1457,7 +1457,7 @@ void test_spdm_requester_psk_finish_case9(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -1506,13 +1506,13 @@ void test_spdm_requester_psk_finish_case9(void **state) void test_spdm_requester_psk_finish_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint16_t error_code; spdm_test_context = *state; @@ -1552,7 +1552,7 @@ void test_spdm_requester_psk_finish_case10(void **state) { session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init (spdm_context, session_info, session_id, true); + libspdm_session_info_init (spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state (session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); set_mem (m_dummy_key_buffer, @@ -1598,13 +1598,13 @@ void test_spdm_requester_psk_finish_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1654,7 +1654,7 @@ void test_spdm_requester_psk_finish_case11(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -1722,13 +1722,13 @@ void test_spdm_requester_psk_finish_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1778,7 +1778,7 @@ void test_spdm_requester_psk_finish_case12(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -1821,13 +1821,13 @@ void test_spdm_requester_psk_finish_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1877,7 +1877,7 @@ void test_spdm_requester_psk_finish_case13(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); @@ -1921,13 +1921,13 @@ void test_spdm_requester_psk_finish_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -1977,7 +1977,7 @@ void test_spdm_requester_psk_finish_case14(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_NOT_STARTED); @@ -2019,13 +2019,13 @@ void test_spdm_requester_psk_finish_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; void *data; uintn data_size; void *hash; uintn hash_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_test_context = *state; spdm_context = spdm_test_context->spdm_context; @@ -2074,7 +2074,7 @@ void test_spdm_requester_psk_finish_case15(void **state) session_id = 0xFFFFFFFF; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_HANDSHAKING); diff --git a/unit_test/test_spdm_responder/algorithms.c b/unit_test/test_spdm_responder/algorithms.c index 3c2e4df5544..3af08fc2818 100644 --- a/unit_test/test_spdm_responder/algorithms.c +++ b/unit_test/test_spdm_responder/algorithms.c @@ -707,7 +707,7 @@ void test_spdm_responder_algorithms_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_t *spdm_response; @@ -738,7 +738,7 @@ void test_spdm_responder_algorithms_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_t *spdm_response; @@ -772,7 +772,7 @@ void test_spdm_responder_algorithms_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_t *spdm_response; @@ -808,7 +808,7 @@ void test_spdm_responder_algorithms_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_t *spdm_response; @@ -845,7 +845,7 @@ void test_spdm_responder_algorithms_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_t *spdm_response; @@ -888,7 +888,7 @@ void test_spdm_responder_algorithms_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_t *spdm_response; @@ -922,7 +922,7 @@ void test_spdm_responder_algorithms_case6(void **state) void test_spdm_responder_algorithms_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_mine_t *spdm_response; @@ -987,7 +987,7 @@ void test_spdm_responder_algorithms_case7(void **state) { void test_spdm_responder_algorithms_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_t *spdm_response; @@ -1045,7 +1045,7 @@ void test_spdm_responder_algorithms_case8(void **state) { void test_spdm_responder_algorithms_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_t *spdm_response; @@ -1103,7 +1103,7 @@ void test_spdm_responder_algorithms_case9(void **state) { void test_spdm_responder_algorithms_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_t *spdm_response; @@ -1161,7 +1161,7 @@ void test_spdm_responder_algorithms_case10(void **state) { void test_spdm_responder_algorithms_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_t *spdm_response; @@ -1219,7 +1219,7 @@ void test_spdm_responder_algorithms_case11(void **state) { void test_spdm_responder_algorithms_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_t *spdm_response; @@ -1277,7 +1277,7 @@ void test_spdm_responder_algorithms_case12(void **state) { void test_spdm_responder_algorithms_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -1329,7 +1329,7 @@ void test_spdm_responder_algorithms_case13(void **state) { void test_spdm_responder_algorithms_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -1355,7 +1355,7 @@ void test_spdm_responder_algorithms_case14(void **state) { void test_spdm_responder_algorithms_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -1404,7 +1404,7 @@ void test_spdm_responder_algorithms_case15(void **state) { void test_spdm_responder_algorithms_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_mine_t *spdm_response; @@ -1469,7 +1469,7 @@ void test_spdm_responder_algorithms_case16(void **state) { void test_spdm_responder_algorithms_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_mine_t *spdm_response; @@ -1534,7 +1534,7 @@ void test_spdm_responder_algorithms_case17(void **state) { void test_spdm_responder_algorithms_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_mine_t *spdm_response; @@ -1589,7 +1589,7 @@ void test_spdm_responder_algorithms_case18(void **state) { void test_spdm_responder_algorithms_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_mine_t *spdm_response; @@ -1655,7 +1655,7 @@ void test_spdm_responder_algorithms_case19(void **state) { void test_spdm_responder_algorithms_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_algorithms_response_mine_t *spdm_response; diff --git a/unit_test/test_spdm_responder/capabilities.c b/unit_test/test_spdm_responder/capabilities.c index 2c2de6fecee..b75ef937b50 100644 --- a/unit_test/test_spdm_responder/capabilities.c +++ b/unit_test/test_spdm_responder/capabilities.c @@ -428,7 +428,7 @@ void test_spdm_responder_capabilities_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -466,7 +466,7 @@ void test_spdm_responder_capabilities_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -497,7 +497,7 @@ void test_spdm_responder_capabilities_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -530,7 +530,7 @@ void test_spdm_responder_capabilities_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -565,7 +565,7 @@ void test_spdm_responder_capabilities_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -606,7 +606,7 @@ void test_spdm_responder_capabilities_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -638,7 +638,7 @@ void test_spdm_responder_capabilities_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -670,7 +670,7 @@ void test_spdm_responder_capabilities_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -700,7 +700,7 @@ void test_spdm_responder_capabilities_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -730,7 +730,7 @@ void test_spdm_responder_capabilities_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -761,7 +761,7 @@ void test_spdm_responder_capabilities_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -792,7 +792,7 @@ void test_spdm_responder_capabilities_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -822,7 +822,7 @@ void test_spdm_responder_capabilities_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -853,7 +853,7 @@ void test_spdm_responder_capabilities_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -884,7 +884,7 @@ void test_spdm_responder_capabilities_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -915,7 +915,7 @@ void test_spdm_responder_capabilities_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -946,7 +946,7 @@ void test_spdm_responder_capabilities_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -977,7 +977,7 @@ void test_spdm_responder_capabilities_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -1010,7 +1010,7 @@ void test_spdm_responder_capabilities_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -1041,7 +1041,7 @@ void test_spdm_responder_capabilities_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -1072,7 +1072,7 @@ void test_spdm_responder_capabilities_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; @@ -1103,7 +1103,7 @@ void test_spdm_responder_capabilities_case22(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_capabilities_response_t *spdm_response; diff --git a/unit_test/test_spdm_responder/certificate.c b/unit_test/test_spdm_responder/certificate.c index 2423ac9d312..b8793e1e9dd 100644 --- a/unit_test/test_spdm_responder/certificate.c +++ b/unit_test/test_spdm_responder/certificate.c @@ -47,7 +47,7 @@ void test_spdm_responder_certificate_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; @@ -107,7 +107,7 @@ void test_spdm_responder_certificate_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; @@ -156,7 +156,7 @@ void test_spdm_responder_certificate_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; @@ -207,7 +207,7 @@ void test_spdm_responder_certificate_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; @@ -259,7 +259,7 @@ void test_spdm_responder_certificate_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; @@ -317,7 +317,7 @@ void test_spdm_responder_certificate_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; @@ -367,7 +367,7 @@ void test_spdm_responder_certificate_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; @@ -443,7 +443,7 @@ void test_spdm_responder_certificate_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; @@ -540,7 +540,7 @@ void test_spdm_responder_certificate_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; @@ -673,7 +673,7 @@ void test_spdm_responder_certificate_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; @@ -788,7 +788,7 @@ void test_spdm_responder_certificate_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; @@ -897,7 +897,7 @@ void test_spdm_responder_certificate_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; diff --git a/unit_test/test_spdm_responder/challenge_auth.c b/unit_test/test_spdm_responder/challenge_auth.c index 4ad282f4003..a4f450547b8 100644 --- a/unit_test/test_spdm_responder/challenge_auth.c +++ b/unit_test/test_spdm_responder/challenge_auth.c @@ -57,7 +57,7 @@ void test_spdm_responder_challenge_auth_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -130,7 +130,7 @@ void test_spdm_responder_challenge_auth_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -193,7 +193,7 @@ void test_spdm_responder_challenge_auth_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -258,7 +258,7 @@ void test_spdm_responder_challenge_auth_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -324,7 +324,7 @@ void test_spdm_responder_challenge_auth_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -397,7 +397,7 @@ void test_spdm_responder_challenge_auth_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -460,7 +460,7 @@ void test_spdm_responder_challenge_auth_case6(void **state) void test_spdm_responder_challenge_auth_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -511,7 +511,7 @@ void test_spdm_responder_challenge_auth_case7(void **state) { void test_spdm_responder_challenge_auth_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -562,7 +562,7 @@ void test_spdm_responder_challenge_auth_case8(void **state) { void test_spdm_responder_challenge_auth_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -615,7 +615,7 @@ void test_spdm_responder_challenge_auth_case9(void **state) { void test_spdm_responder_challenge_auth_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -666,7 +666,7 @@ void test_spdm_responder_challenge_auth_case10(void **state) { void test_spdm_responder_challenge_auth_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -720,7 +720,7 @@ void test_spdm_responder_challenge_auth_case11(void **state) { void test_spdm_responder_challenge_auth_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -775,7 +775,7 @@ void test_spdm_responder_challenge_auth_case12(void **state) { void test_spdm_responder_challenge_auth_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; @@ -831,7 +831,7 @@ void test_spdm_responder_challenge_auth_case13(void **state) { void test_spdm_responder_challenge_auth_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; diff --git a/unit_test/test_spdm_responder/digests.c b/unit_test/test_spdm_responder/digests.c index abcb37786d8..0f8879ca814 100644 --- a/unit_test/test_spdm_responder/digests.c +++ b/unit_test/test_spdm_responder/digests.c @@ -35,7 +35,7 @@ void test_spdm_responder_digests_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; @@ -91,7 +91,7 @@ void test_spdm_responder_digests_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; @@ -139,7 +139,7 @@ void test_spdm_responder_digests_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; @@ -188,7 +188,7 @@ void test_spdm_responder_digests_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; @@ -238,7 +238,7 @@ void test_spdm_responder_digests_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; @@ -295,7 +295,7 @@ void test_spdm_responder_digests_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; @@ -343,7 +343,7 @@ void test_spdm_responder_digests_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT @@ -398,7 +398,7 @@ void test_spdm_responder_digests_case7(void **state) void test_spdm_responder_digests_case8(void **state) { spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; @@ -457,7 +457,7 @@ void test_spdm_responder_digests_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; diff --git a/unit_test/test_spdm_responder/end_session.c b/unit_test/test_spdm_responder/end_session.c index ef564d68505..afcda9c01e6 100644 --- a/unit_test/test_spdm_responder/end_session.c +++ b/unit_test/test_spdm_responder/end_session.c @@ -24,13 +24,13 @@ void test_spdm_responder_end_session_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_end_session_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -80,7 +80,7 @@ void test_spdm_responder_end_session_case1(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -102,13 +102,13 @@ void test_spdm_responder_end_session_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_end_session_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -158,7 +158,7 @@ void test_spdm_responder_end_session_case2(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -183,13 +183,13 @@ void test_spdm_responder_end_session_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_end_session_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -240,7 +240,7 @@ void test_spdm_responder_end_session_case3(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -266,13 +266,13 @@ void test_spdm_responder_end_session_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_end_session_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -323,7 +323,7 @@ void test_spdm_responder_end_session_case4(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -350,13 +350,13 @@ void test_spdm_responder_end_session_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_end_session_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_error_data_response_not_ready_t *error_data; @@ -408,7 +408,7 @@ void test_spdm_responder_end_session_case5(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -440,13 +440,13 @@ void test_spdm_responder_end_session_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_end_session_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -497,7 +497,7 @@ void test_spdm_responder_end_session_case6(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -522,13 +522,13 @@ void test_spdm_responder_end_session_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_end_session_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -578,7 +578,7 @@ void test_spdm_responder_end_session_case7(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); diff --git a/unit_test/test_spdm_responder/finish.c b/unit_test/test_spdm_responder/finish.c index b06d2766ef4..6bf78f008cd 100644 --- a/unit_test/test_spdm_responder/finish.c +++ b/unit_test/test_spdm_responder/finish.c @@ -61,7 +61,7 @@ void test_spdm_responder_finish_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -71,9 +71,9 @@ void test_spdm_responder_finish_case1(void **state) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -117,7 +117,7 @@ void test_spdm_responder_finish_case1(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -134,19 +134,19 @@ void test_spdm_responder_finish_case1(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request1.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, + sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_finish_request1_size = sizeof(spdm_finish_request_t) + hmac_size; response_size = sizeof(response); @@ -172,7 +172,7 @@ void test_spdm_responder_finish_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -182,9 +182,9 @@ void test_spdm_responder_finish_case2(void **state) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; @@ -227,7 +227,7 @@ void test_spdm_responder_finish_case2(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -243,19 +243,19 @@ void test_spdm_responder_finish_case2(void **state) SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HANDSHAKE_IN_THE_CLEAR_CAP; hash_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request2.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request2, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request2, + sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); response_size = sizeof(response); status = spdm_get_response_finish(spdm_context, @@ -283,7 +283,7 @@ void test_spdm_responder_finish_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -293,9 +293,9 @@ void test_spdm_responder_finish_case3(void **state) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -340,7 +340,7 @@ void test_spdm_responder_finish_case3(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -357,19 +357,19 @@ void test_spdm_responder_finish_case3(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request1.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, + sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_finish_request1_size = sizeof(spdm_finish_request_t) + hmac_size; response_size = sizeof(response); @@ -399,7 +399,7 @@ void test_spdm_responder_finish_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -409,9 +409,9 @@ void test_spdm_responder_finish_case4(void **state) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -456,7 +456,7 @@ void test_spdm_responder_finish_case4(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -473,19 +473,19 @@ void test_spdm_responder_finish_case4(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request1.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, + sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_finish_request1_size = sizeof(spdm_finish_request_t) + hmac_size; response_size = sizeof(response); @@ -516,7 +516,7 @@ void test_spdm_responder_finish_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -526,9 +526,9 @@ void test_spdm_responder_finish_case5(void **state) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -574,7 +574,7 @@ void test_spdm_responder_finish_case5(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -591,19 +591,19 @@ void test_spdm_responder_finish_case5(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request1.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, + sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_finish_request1_size = sizeof(spdm_finish_request_t) + hmac_size; response_size = sizeof(response); @@ -641,7 +641,7 @@ void test_spdm_responder_finish_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -651,9 +651,9 @@ void test_spdm_responder_finish_case6(void **state) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -698,7 +698,7 @@ void test_spdm_responder_finish_case6(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -715,19 +715,19 @@ void test_spdm_responder_finish_case6(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request1.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, + sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_finish_request1_size = sizeof(spdm_finish_request_t) + hmac_size; response_size = sizeof(response); @@ -750,7 +750,7 @@ void test_spdm_responder_finish_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -760,9 +760,9 @@ void test_spdm_responder_finish_case7(void **state) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -806,7 +806,7 @@ void test_spdm_responder_finish_case7(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -823,7 +823,7 @@ void test_spdm_responder_finish_case7(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request1.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT @@ -842,13 +842,13 @@ void test_spdm_responder_finish_case7(void **state) libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, + sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_finish_request1_size = sizeof(spdm_finish_request_t) + hmac_size; response_size = sizeof(response); @@ -884,7 +884,7 @@ void test_spdm_responder_finish_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -897,9 +897,9 @@ void test_spdm_responder_finish_case8(void **state) uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; uint8_t req_cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -972,7 +972,7 @@ void test_spdm_responder_finish_case8(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -992,7 +992,7 @@ void test_spdm_responder_finish_case8(void **state) req_asym_signature_size = libspdm_get_req_asym_signature_size(m_use_req_asym_algo); ptr = m_spdm_finish_request3.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, @@ -1002,22 +1002,22 @@ void test_spdm_responder_finish_case8(void **state) libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, req_cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, req_cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request3, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, req_cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request3, + sizeof(spdm_finish_request_t)); libspdm_requester_data_sign( m_spdm_finish_request3.header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_FINISH, m_use_req_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &req_asym_signature_size); - append_managed_buffer(&th_curr, ptr, req_asym_signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, req_asym_signature_size); ptr += req_asym_signature_size; set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_finish_request3_size = sizeof(spdm_finish_request_t) + req_asym_signature_size + hmac_size; @@ -1046,7 +1046,7 @@ void test_spdm_responder_finish_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -1056,9 +1056,9 @@ void test_spdm_responder_finish_case9(void **state) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1103,7 +1103,7 @@ void test_spdm_responder_finish_case9(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1120,19 +1120,19 @@ void test_spdm_responder_finish_case9(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request1.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, + sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_finish_request1_size = sizeof(spdm_finish_request_t) + hmac_size; response_size = sizeof(response); @@ -1162,7 +1162,7 @@ void test_spdm_responder_finish_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -1172,9 +1172,9 @@ void test_spdm_responder_finish_case10(void **state) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1218,7 +1218,7 @@ void test_spdm_responder_finish_case10(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1235,19 +1235,19 @@ void test_spdm_responder_finish_case10(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request1.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, + sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_finish_request1_size = sizeof(spdm_finish_request_t) + hmac_size; response_size = sizeof(response); @@ -1276,14 +1276,14 @@ void test_spdm_responder_finish_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1327,7 +1327,7 @@ void test_spdm_responder_finish_case11(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1372,7 +1372,7 @@ void test_spdm_responder_finish_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -1381,7 +1381,7 @@ void test_spdm_responder_finish_case12(void **state) uint8_t *ptr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t zero_data[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1425,7 +1425,7 @@ void test_spdm_responder_finish_case12(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1474,7 +1474,7 @@ void test_spdm_responder_finish_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -1484,9 +1484,9 @@ void test_spdm_responder_finish_case13(void **state) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1530,7 +1530,7 @@ void test_spdm_responder_finish_case13(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1547,19 +1547,19 @@ void test_spdm_responder_finish_case13(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request1.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, + sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); copy_mem_s(ptr, sizeof(m_spdm_finish_request1.signature), ptr + hmac_size, hmac_size); /* 2x HMAC size*/ @@ -1590,7 +1590,7 @@ void test_spdm_responder_finish_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -1600,9 +1600,9 @@ void test_spdm_responder_finish_case14(void **state) uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1646,7 +1646,7 @@ void test_spdm_responder_finish_case14(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1663,19 +1663,19 @@ void test_spdm_responder_finish_case14(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_finish_request1.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request1, + sizeof(spdm_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); set_mem(ptr + hmac_size/2, hmac_size/2, (uint8_t) 0x00); /* half HMAC size*/ m_spdm_finish_request1_size = sizeof(spdm_finish_request_t) + hmac_size/2; @@ -1705,7 +1705,7 @@ void test_spdm_responder_finish_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -1718,9 +1718,9 @@ void test_spdm_responder_finish_case15(void **state) uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; uint8_t req_cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1780,7 +1780,7 @@ void test_spdm_responder_finish_case15(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1800,7 +1800,7 @@ void test_spdm_responder_finish_case15(void **state) req_asym_signature_size = libspdm_get_req_asym_signature_size(m_use_req_asym_algo); ptr = m_spdm_finish_request3.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, @@ -1810,22 +1810,22 @@ void test_spdm_responder_finish_case15(void **state) libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, req_cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, req_cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request3, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, req_cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request3, + sizeof(spdm_finish_request_t)); libspdm_requester_data_sign( m_spdm_finish_request3.header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_FINISH, m_use_req_asym_algo, m_use_hash_algo, - false, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), + false, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), ptr, &req_asym_signature_size); - append_managed_buffer(&th_curr, ptr, req_asym_signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, req_asym_signature_size); ptr += req_asym_signature_size; set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); set_mem(m_spdm_finish_request3.signature, req_asym_signature_size, (uint8_t) 0x00); /*zero signature*/ @@ -1858,7 +1858,7 @@ void test_spdm_responder_finish_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; @@ -1872,9 +1872,9 @@ void test_spdm_responder_finish_case16(void **state) uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; uint8_t req_cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; uint8_t random_buffer[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1934,7 +1934,7 @@ void test_spdm_responder_finish_case16(void **state) session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, false); + libspdm_session_info_init(spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1954,7 +1954,7 @@ void test_spdm_responder_finish_case16(void **state) req_asym_signature_size = libspdm_get_req_asym_signature_size(m_use_req_asym_algo); ptr = m_spdm_finish_request3.signature; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data1; cert_buffer_size = data_size1; libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, @@ -1964,23 +1964,23 @@ void test_spdm_responder_finish_case16(void **state) libspdm_hash_all(m_use_hash_algo, cert_buffer, cert_buffer_size, req_cert_buffer_hash); /* transcript.message_a size is 0*/ - append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, cert_buffer_hash, hash_size); /* session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, req_cert_buffer_hash, hash_size); - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request3, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, req_cert_buffer_hash, hash_size); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_finish_request3, + sizeof(spdm_finish_request_t)); /*randomize signature*/ - libspdm_hash_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), random_buffer); + libspdm_hash_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), random_buffer); libspdm_requester_data_sign( m_spdm_finish_request3.header.spdm_version << SPDM_VERSION_NUMBER_SHIFT_BIT, SPDM_FINISH, m_use_req_asym_algo, m_use_hash_algo, false, random_buffer, hash_size, ptr, &req_asym_signature_size); - append_managed_buffer(&th_curr, ptr, req_asym_signature_size); + libspdm_append_managed_buffer(&th_curr, ptr, req_asym_signature_size); ptr += req_asym_signature_size; set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_finish_request3_size = sizeof(spdm_finish_request_t) + req_asym_signature_size + hmac_size; diff --git a/unit_test/test_spdm_responder/heartbeat.c b/unit_test/test_spdm_responder/heartbeat.c index 9d73e1725dc..0405128ae09 100644 --- a/unit_test/test_spdm_responder/heartbeat.c +++ b/unit_test/test_spdm_responder/heartbeat.c @@ -24,13 +24,13 @@ void test_spdm_responder_heartbeat_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_heartbeat_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -80,7 +80,7 @@ void test_spdm_responder_heartbeat_case1(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -102,13 +102,13 @@ void test_spdm_responder_heartbeat_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_heartbeat_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -158,7 +158,7 @@ void test_spdm_responder_heartbeat_case2(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -183,13 +183,13 @@ void test_spdm_responder_heartbeat_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_heartbeat_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -240,7 +240,7 @@ void test_spdm_responder_heartbeat_case3(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -266,13 +266,13 @@ void test_spdm_responder_heartbeat_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_heartbeat_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -323,7 +323,7 @@ void test_spdm_responder_heartbeat_case4(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -350,13 +350,13 @@ void test_spdm_responder_heartbeat_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_heartbeat_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_error_data_response_not_ready_t *error_data; @@ -408,7 +408,7 @@ void test_spdm_responder_heartbeat_case5(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -440,13 +440,13 @@ void test_spdm_responder_heartbeat_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_heartbeat_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -497,7 +497,7 @@ void test_spdm_responder_heartbeat_case6(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -522,13 +522,13 @@ void test_spdm_responder_heartbeat_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_heartbeat_response_t *spdm_response; void *data1; uintn data_size1; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -578,7 +578,7 @@ void test_spdm_responder_heartbeat_case7(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); diff --git a/unit_test/test_spdm_responder/key_exchange.c b/unit_test/test_spdm_responder/key_exchange.c index 38ae019fe5e..3cde2baf4e2 100644 --- a/unit_test/test_spdm_responder/key_exchange.c +++ b/unit_test/test_spdm_responder/key_exchange.c @@ -75,7 +75,7 @@ void test_spdm_responder_key_exchange_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -130,10 +130,10 @@ void test_spdm_responder_key_exchange_case1(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -156,7 +156,7 @@ void test_spdm_responder_key_exchange_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -211,10 +211,10 @@ void test_spdm_responder_key_exchange_case2(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -236,7 +236,7 @@ void test_spdm_responder_key_exchange_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -292,10 +292,10 @@ void test_spdm_responder_key_exchange_case3(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -318,7 +318,7 @@ void test_spdm_responder_key_exchange_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -374,10 +374,10 @@ void test_spdm_responder_key_exchange_case4(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -401,7 +401,7 @@ void test_spdm_responder_key_exchange_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -458,10 +458,10 @@ void test_spdm_responder_key_exchange_case5(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -490,7 +490,7 @@ void test_spdm_responder_key_exchange_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -546,10 +546,10 @@ void test_spdm_responder_key_exchange_case6(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -571,7 +571,7 @@ void test_spdm_responder_key_exchange_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -638,10 +638,10 @@ void test_spdm_responder_key_exchange_case7(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -671,7 +671,7 @@ void test_spdm_responder_key_exchange_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -736,10 +736,10 @@ void test_spdm_responder_key_exchange_case8(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -756,7 +756,7 @@ void test_spdm_responder_key_exchange_case8(void **state) SPDM_KEY_EXCHANGE_RSP); assert_int_equal(spdm_response->rsp_session_id, 0xFFFF); - measurement_summary_hash_size = spdm_get_measurement_summary_hash_size( + measurement_summary_hash_size = libspdm_get_measurement_summary_hash_size( spdm_context, false, m_spdm_key_exchange_request3.header.param1); libspdm_generate_measurement_summary_hash( spdm_context->connection_info.version, @@ -780,7 +780,7 @@ void test_spdm_responder_key_exchange_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; uint8_t measurement_hash[LIBSPDM_MAX_HASH_SIZE]; @@ -845,10 +845,10 @@ void test_spdm_responder_key_exchange_case9(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -865,7 +865,7 @@ void test_spdm_responder_key_exchange_case9(void **state) SPDM_KEY_EXCHANGE_RSP); assert_int_equal(spdm_response->rsp_session_id, 0xFFFF); - measurement_summary_hash_size = spdm_get_measurement_summary_hash_size( + measurement_summary_hash_size = libspdm_get_measurement_summary_hash_size( spdm_context, false, m_spdm_key_exchange_request4.header.param1); libspdm_generate_measurement_summary_hash( spdm_context->connection_info.version, @@ -889,7 +889,7 @@ void test_spdm_responder_key_exchange_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -952,10 +952,10 @@ void test_spdm_responder_key_exchange_case10(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -976,7 +976,7 @@ void test_spdm_responder_key_exchange_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -1043,10 +1043,10 @@ void test_spdm_responder_key_exchange_case11(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -1067,7 +1067,7 @@ void test_spdm_responder_key_exchange_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -1128,10 +1128,10 @@ void test_spdm_responder_key_exchange_case12(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -1152,7 +1152,7 @@ void test_spdm_responder_key_exchange_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -1214,10 +1214,10 @@ void test_spdm_responder_key_exchange_case13(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -1238,7 +1238,7 @@ void test_spdm_responder_key_exchange_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -1300,10 +1300,10 @@ void test_spdm_responder_key_exchange_case14(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); @@ -1326,7 +1326,7 @@ void test_spdm_responder_key_exchange_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; @@ -1394,17 +1394,17 @@ void test_spdm_responder_key_exchange_case15(void **state) ptr += dhe_key_size; libspdm_dhe_free(m_use_dhe_algo, dhe_context); opaque_key_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_key_exchange_req_size, ptr); ptr += opaque_key_exchange_req_size; response_size = sizeof(response); /* Required to compute response size independently */ opaque_key_exchange_rsp_size = - spdm_get_opaque_data_version_selection_data_size(spdm_context); + libspdm_get_opaque_data_version_selection_data_size(spdm_context); status = spdm_get_response_key_exchange( spdm_context, m_spdm_key_exchange_request1_size, diff --git a/unit_test/test_spdm_responder/key_update.c b/unit_test/test_spdm_responder/key_update.c index 91b8a344379..273ad4dd1fb 100644 --- a/unit_test/test_spdm_responder/key_update.c +++ b/unit_test/test_spdm_responder/key_update.c @@ -68,9 +68,9 @@ spdm_key_update_request_t m_spdm_key_update_request10 = { uintn m_spdm_key_update_request10_size = sizeof(m_spdm_key_update_request10); static void spdm_set_standard_key_update_test_state( - spdm_context_t *spdm_context, uint32_t *session_id) + libspdm_context_t *spdm_context, uint32_t *session_id) { - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_context->response_state = LIBSPDM_RESPONSE_STATE_NORMAL; spdm_context->connection_info.connection_state = @@ -103,7 +103,7 @@ static void spdm_set_standard_key_update_test_state( spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = *session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, *session_id, true); + libspdm_session_info_init(spdm_context, session_info, *session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); @@ -183,9 +183,9 @@ void test_spdm_responder_key_update_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -252,9 +252,9 @@ void test_spdm_responder_key_update_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -315,9 +315,9 @@ void test_spdm_responder_key_update_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -382,9 +382,9 @@ void test_spdm_responder_key_update_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -451,9 +451,9 @@ void test_spdm_responder_key_update_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -527,9 +527,9 @@ void test_spdm_responder_key_update_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -588,9 +588,9 @@ void test_spdm_responder_key_update_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -678,9 +678,9 @@ void test_spdm_responder_key_update_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -748,9 +748,9 @@ void test_spdm_responder_key_update_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -817,9 +817,9 @@ void test_spdm_responder_key_update_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -889,9 +889,9 @@ void test_spdm_responder_key_update_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -953,9 +953,9 @@ void test_spdm_responder_key_update_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -1041,9 +1041,9 @@ void test_spdm_responder_key_update_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -1128,9 +1128,9 @@ void test_spdm_responder_key_update_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -1230,9 +1230,9 @@ void test_spdm_responder_key_update_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -1331,9 +1331,9 @@ void test_spdm_responder_key_update_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -1397,9 +1397,9 @@ void test_spdm_responder_key_update_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -1484,9 +1484,9 @@ void test_spdm_responder_key_update_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -1586,9 +1586,9 @@ void test_spdm_responder_key_update_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -1659,9 +1659,9 @@ void test_spdm_responder_key_update_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -1761,9 +1761,9 @@ void test_spdm_responder_key_update_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -1850,9 +1850,9 @@ void test_spdm_responder_key_update_case22(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -1949,9 +1949,9 @@ void test_spdm_responder_key_update_case23(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -2036,9 +2036,9 @@ void test_spdm_responder_key_update_case24(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -2135,9 +2135,9 @@ void test_spdm_responder_key_update_case25(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; @@ -2204,9 +2204,9 @@ void test_spdm_responder_key_update_case26(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uint32_t session_id; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; spdm_secured_message_context_t *secured_message_context; uintn response_size; diff --git a/unit_test/test_spdm_responder/measurements.c b/unit_test/test_spdm_responder/measurements.c index 7ad4bc3df8f..63d76fefd29 100644 --- a/unit_test/test_spdm_responder/measurements.c +++ b/unit_test/test_spdm_responder/measurements.c @@ -106,7 +106,7 @@ void test_spdm_responder_measurements_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -163,7 +163,7 @@ void test_spdm_responder_measurements_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -216,7 +216,7 @@ void test_spdm_responder_measurements_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -271,7 +271,7 @@ void test_spdm_responder_measurements_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -327,7 +327,7 @@ void test_spdm_responder_measurements_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -390,7 +390,7 @@ void test_spdm_responder_measurements_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -444,7 +444,7 @@ void test_spdm_responder_measurements_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -500,7 +500,7 @@ void test_spdm_responder_measurements_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -557,7 +557,7 @@ void test_spdm_responder_measurements_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -610,7 +610,7 @@ void test_spdm_responder_measurements_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -671,7 +671,7 @@ void test_spdm_responder_measurements_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -738,7 +738,7 @@ void test_spdm_responder_measurements_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -815,7 +815,7 @@ void test_spdm_responder_measurements_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -885,7 +885,7 @@ void test_spdm_responder_measurements_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -955,7 +955,7 @@ void test_spdm_responder_measurements_case15(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -1010,7 +1010,7 @@ void test_spdm_responder_measurements_case16(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -1063,7 +1063,7 @@ void test_spdm_responder_measurements_case17(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -1119,7 +1119,7 @@ void test_spdm_responder_measurements_case18(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -1193,7 +1193,7 @@ void test_spdm_responder_measurements_case19(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -1247,7 +1247,7 @@ void test_spdm_responder_measurements_case20(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -1301,7 +1301,7 @@ void test_spdm_responder_measurements_case21(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -1354,7 +1354,7 @@ void test_spdm_responder_measurements_case22(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; @@ -1437,12 +1437,12 @@ void test_spdm_responder_measurements_case23(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; uintn measurment_sig_size; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; spdm_test_context = *state; @@ -1483,7 +1483,7 @@ void test_spdm_responder_measurements_case23(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); libspdm_secured_message_set_session_state( session_info->secured_message_context, LIBSPDM_SESSION_STATE_ESTABLISHED); diff --git a/unit_test/test_spdm_responder/psk_exchange.c b/unit_test/test_spdm_responder/psk_exchange.c index 9e91daeec7a..8b7fa2e2d7a 100644 --- a/unit_test/test_spdm_responder/psk_exchange.c +++ b/unit_test/test_spdm_responder/psk_exchange.c @@ -42,7 +42,7 @@ void test_spdm_responder_psk_exchange_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_exchange_response_t *spdm_response; @@ -96,7 +96,7 @@ void test_spdm_responder_psk_exchange_case1(void **state) (uint16_t)spdm_context->local_context.psk_hint_size; m_spdm_psk_exchange_request1.context_length = LIBSPDM_PSK_CONTEXT_LENGTH; opaque_psk_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); m_spdm_psk_exchange_request1.opaque_length = (uint16_t)opaque_psk_exchange_req_size; m_spdm_psk_exchange_request1.req_session_id = 0xFFFF; @@ -107,7 +107,7 @@ void test_spdm_responder_psk_exchange_case1(void **state) ptr += m_spdm_psk_exchange_request1.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request1.context_length; - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_psk_exchange_req_size, ptr); #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT spdm_context->transcript.message_m.buffer_size = @@ -138,7 +138,7 @@ void test_spdm_responder_psk_exchange_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_exchange_response_t *spdm_response; @@ -192,7 +192,7 @@ void test_spdm_responder_psk_exchange_case2(void **state) (uint16_t)spdm_context->local_context.psk_hint_size; m_spdm_psk_exchange_request2.context_length = LIBSPDM_PSK_CONTEXT_LENGTH; opaque_psk_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); m_spdm_psk_exchange_request2.opaque_length = (uint16_t)opaque_psk_exchange_req_size; m_spdm_psk_exchange_request2.req_session_id = 0xFFFF; @@ -203,7 +203,7 @@ void test_spdm_responder_psk_exchange_case2(void **state) ptr += m_spdm_psk_exchange_request2.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request2.context_length; - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_psk_exchange_req_size, ptr); ptr += opaque_psk_exchange_req_size; response_size = sizeof(response); @@ -225,7 +225,7 @@ void test_spdm_responder_psk_exchange_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_exchange_response_t *spdm_response; @@ -280,7 +280,7 @@ void test_spdm_responder_psk_exchange_case3(void **state) (uint16_t)spdm_context->local_context.psk_hint_size; m_spdm_psk_exchange_request1.context_length = LIBSPDM_PSK_CONTEXT_LENGTH; opaque_psk_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); m_spdm_psk_exchange_request1.opaque_length = (uint16_t)opaque_psk_exchange_req_size; m_spdm_psk_exchange_request1.req_session_id = 0xFFFF; @@ -291,7 +291,7 @@ void test_spdm_responder_psk_exchange_case3(void **state) ptr += m_spdm_psk_exchange_request1.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request1.context_length; - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_psk_exchange_req_size, ptr); ptr += opaque_psk_exchange_req_size; response_size = sizeof(response); @@ -314,7 +314,7 @@ void test_spdm_responder_psk_exchange_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_exchange_response_t *spdm_response; @@ -369,7 +369,7 @@ void test_spdm_responder_psk_exchange_case4(void **state) (uint16_t)spdm_context->local_context.psk_hint_size; m_spdm_psk_exchange_request1.context_length = LIBSPDM_PSK_CONTEXT_LENGTH; opaque_psk_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); m_spdm_psk_exchange_request1.opaque_length = (uint16_t)opaque_psk_exchange_req_size; m_spdm_psk_exchange_request1.req_session_id = 0xFFFF; @@ -380,7 +380,7 @@ void test_spdm_responder_psk_exchange_case4(void **state) ptr += m_spdm_psk_exchange_request1.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request1.context_length; - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_psk_exchange_req_size, ptr); ptr += opaque_psk_exchange_req_size; response_size = sizeof(response); @@ -404,7 +404,7 @@ void test_spdm_responder_psk_exchange_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_exchange_response_t *spdm_response; @@ -460,7 +460,7 @@ void test_spdm_responder_psk_exchange_case5(void **state) (uint16_t)spdm_context->local_context.psk_hint_size; m_spdm_psk_exchange_request1.context_length = LIBSPDM_PSK_CONTEXT_LENGTH; opaque_psk_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); m_spdm_psk_exchange_request1.opaque_length = (uint16_t)opaque_psk_exchange_req_size; m_spdm_psk_exchange_request1.req_session_id = 0xFFFF; @@ -471,7 +471,7 @@ void test_spdm_responder_psk_exchange_case5(void **state) ptr += m_spdm_psk_exchange_request1.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request1.context_length; - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_psk_exchange_req_size, ptr); ptr += opaque_psk_exchange_req_size; response_size = sizeof(response); @@ -500,7 +500,7 @@ void test_spdm_responder_psk_exchange_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_exchange_response_t *spdm_response; @@ -555,7 +555,7 @@ void test_spdm_responder_psk_exchange_case6(void **state) (uint16_t)spdm_context->local_context.psk_hint_size; m_spdm_psk_exchange_request1.context_length = LIBSPDM_PSK_CONTEXT_LENGTH; opaque_psk_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); m_spdm_psk_exchange_request1.opaque_length = (uint16_t)opaque_psk_exchange_req_size; m_spdm_psk_exchange_request1.req_session_id = 0xFFFF; @@ -566,7 +566,7 @@ void test_spdm_responder_psk_exchange_case6(void **state) ptr += m_spdm_psk_exchange_request1.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request1.context_length; - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_psk_exchange_req_size, ptr); ptr += opaque_psk_exchange_req_size; response_size = sizeof(response); @@ -588,7 +588,7 @@ void test_spdm_responder_psk_exchange_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_exchange_response_t *spdm_response; @@ -642,7 +642,7 @@ void test_spdm_responder_psk_exchange_case7(void **state) (uint16_t)spdm_context->local_context.psk_hint_size; m_spdm_psk_exchange_request1.context_length = LIBSPDM_PSK_CONTEXT_LENGTH; opaque_psk_exchange_req_size = - spdm_get_opaque_data_supported_version_data_size(spdm_context); + libspdm_get_opaque_data_supported_version_data_size(spdm_context); m_spdm_psk_exchange_request1.opaque_length = (uint16_t)opaque_psk_exchange_req_size; m_spdm_psk_exchange_request1.req_session_id = 0xFFFF; @@ -653,7 +653,7 @@ void test_spdm_responder_psk_exchange_case7(void **state) ptr += m_spdm_psk_exchange_request1.psk_hint_length; libspdm_get_random_number(LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request1.context_length; - spdm_build_opaque_data_supported_version_data( + libspdm_build_opaque_data_supported_version_data( spdm_context, &opaque_psk_exchange_req_size, ptr); ptr += opaque_psk_exchange_req_size; diff --git a/unit_test/test_spdm_responder/psk_finish.c b/unit_test/test_spdm_responder/psk_finish.c index 416345648e3..51817290d46 100644 --- a/unit_test/test_spdm_responder/psk_finish.c +++ b/unit_test/test_spdm_responder/psk_finish.c @@ -53,16 +53,16 @@ void test_spdm_responder_psk_finish_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -114,7 +114,7 @@ void test_spdm_responder_psk_finish_case1(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -127,14 +127,14 @@ void test_spdm_responder_psk_finish_case1(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request1.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* transcript.message_a size is 0 * session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, + sizeof(spdm_psk_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_psk_finish_request1_size = sizeof(spdm_psk_finish_request_t) + hmac_size; @@ -160,16 +160,16 @@ void test_spdm_responder_psk_finish_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; @@ -220,7 +220,7 @@ void test_spdm_responder_psk_finish_case2(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -232,14 +232,14 @@ void test_spdm_responder_psk_finish_case2(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request2.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* transcript.message_a size is 0 * session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request2, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request2, + sizeof(spdm_psk_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); response_size = sizeof(response); status = spdm_get_response_psk_finish(spdm_context, @@ -267,16 +267,16 @@ void test_spdm_responder_psk_finish_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -329,7 +329,7 @@ void test_spdm_responder_psk_finish_case3(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -342,14 +342,14 @@ void test_spdm_responder_psk_finish_case3(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request1.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* transcript.message_a size is 0 * session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, + sizeof(spdm_psk_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_psk_finish_request1_size = sizeof(spdm_psk_finish_request_t) + hmac_size; @@ -380,16 +380,16 @@ void test_spdm_responder_psk_finish_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -442,7 +442,7 @@ void test_spdm_responder_psk_finish_case4(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -455,14 +455,14 @@ void test_spdm_responder_psk_finish_case4(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request1.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* transcript.message_a size is 0 * session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, + sizeof(spdm_psk_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_psk_finish_request1_size = sizeof(spdm_psk_finish_request_t) + hmac_size; @@ -494,16 +494,16 @@ void test_spdm_responder_psk_finish_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -557,7 +557,7 @@ void test_spdm_responder_psk_finish_case5(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -570,14 +570,14 @@ void test_spdm_responder_psk_finish_case5(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request1.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* transcript.message_a size is 0 * session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, + sizeof(spdm_psk_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_psk_finish_request1_size = sizeof(spdm_psk_finish_request_t) + hmac_size; @@ -616,16 +616,16 @@ void test_spdm_responder_psk_finish_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -678,7 +678,7 @@ void test_spdm_responder_psk_finish_case6(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -691,14 +691,14 @@ void test_spdm_responder_psk_finish_case6(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request1.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* transcript.message_a size is 0 * session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, + sizeof(spdm_psk_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_psk_finish_request1_size = sizeof(spdm_psk_finish_request_t) + hmac_size; @@ -722,16 +722,16 @@ void test_spdm_responder_psk_finish_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -783,7 +783,7 @@ void test_spdm_responder_psk_finish_case7(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -796,11 +796,11 @@ void test_spdm_responder_psk_finish_case7(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request1.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* transcript.message_a size is 0 * session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, + sizeof(spdm_psk_finish_request_t)); #if LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT session_info->session_transcript.message_m.buffer_size = @@ -816,8 +816,8 @@ void test_spdm_responder_psk_finish_case7(void **state) #endif set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_psk_finish_request1_size = sizeof(spdm_psk_finish_request_t) + hmac_size; @@ -852,16 +852,16 @@ void test_spdm_responder_psk_finish_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -913,7 +913,7 @@ void test_spdm_responder_psk_finish_case8(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -926,14 +926,14 @@ void test_spdm_responder_psk_finish_case8(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request1.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* transcript.message_a size is 0 * session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, + sizeof(spdm_psk_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_psk_finish_request1_size = sizeof(spdm_psk_finish_request_t) + hmac_size; @@ -964,16 +964,16 @@ void test_spdm_responder_psk_finish_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1025,7 +1025,7 @@ void test_spdm_responder_psk_finish_case9(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1038,14 +1038,14 @@ void test_spdm_responder_psk_finish_case9(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request1.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* transcript.message_a size is 0 * session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, + sizeof(spdm_psk_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); m_spdm_psk_finish_request1_size = sizeof(spdm_psk_finish_request_t) + hmac_size; @@ -1075,14 +1075,14 @@ void test_spdm_responder_psk_finish_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1134,7 +1134,7 @@ void test_spdm_responder_psk_finish_case10(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1176,7 +1176,7 @@ void test_spdm_responder_psk_finish_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; @@ -1185,7 +1185,7 @@ void test_spdm_responder_psk_finish_case11(void **state) uint8_t *ptr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; uint8_t zero_data[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1237,7 +1237,7 @@ void test_spdm_responder_psk_finish_case11(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1283,16 +1283,16 @@ void test_spdm_responder_psk_finish_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1344,7 +1344,7 @@ void test_spdm_responder_psk_finish_case12(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1357,14 +1357,14 @@ void test_spdm_responder_psk_finish_case12(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request1.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* transcript.message_a size is 0 * session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, + sizeof(spdm_psk_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); copy_mem_s(ptr, sizeof(m_spdm_psk_finish_request1.verify_data), ptr + hmac_size, hmac_size); /* 2x HMAC size*/ @@ -1396,16 +1396,16 @@ void test_spdm_responder_psk_finish_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; void *data1; uintn data_size1; uint8_t *ptr; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -1457,7 +1457,7 @@ void test_spdm_responder_psk_finish_case13(void **state) spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init(spdm_context, session_info, session_id, true); + libspdm_session_info_init(spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size(m_use_hash_algo); set_mem(m_dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key( @@ -1470,14 +1470,14 @@ void test_spdm_responder_psk_finish_case13(void **state) hash_size = libspdm_get_hash_size(m_use_hash_algo); hmac_size = libspdm_get_hash_size(m_use_hash_algo); ptr = m_spdm_psk_finish_request1.verify_data; - init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer(&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* transcript.message_a size is 0 * session_transcript.message_k is 0*/ - append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer(&th_curr, (uint8_t *)&m_spdm_psk_finish_request1, + sizeof(spdm_psk_finish_request_t)); set_mem(request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all(m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, + libspdm_hmac_all(m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); set_mem(ptr + hmac_size/2, hmac_size/2, (uint8_t) 0x00); /* half HMAC size*/ m_spdm_psk_finish_request1_size = diff --git a/unit_test/test_spdm_responder/respond_if_ready.c b/unit_test/test_spdm_responder/respond_if_ready.c index d1661836c47..17c4d4034d3 100644 --- a/unit_test/test_spdm_responder/respond_if_ready.c +++ b/unit_test/test_spdm_responder/respond_if_ready.c @@ -290,7 +290,7 @@ static void spdm_secured_message_set_request_finished_key( void test_spdm_responder_respond_if_ready_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; /*response to the original request (DIGESTS)*/ @@ -354,7 +354,7 @@ void test_spdm_responder_respond_if_ready_case1(void **state) { void test_spdm_responder_respond_if_ready_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_certificate_response_t *spdm_response; /*response to the original request (CERTIFICATE)*/ @@ -423,7 +423,7 @@ void test_spdm_responder_respond_if_ready_case2(void **state) { void test_spdm_responder_respond_if_ready_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_challenge_auth_response_t *spdm_response; /*response to the original request (CHALLENGE_AUTH)*/ @@ -497,7 +497,7 @@ void test_spdm_responder_respond_if_ready_case3(void **state) { void test_spdm_responder_respond_if_ready_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_measurements_response_t *spdm_response; /*response to the original request (MEASUREMENTS)*/ @@ -562,7 +562,7 @@ void test_spdm_responder_respond_if_ready_case4(void **state) { void test_spdm_responder_respond_if_ready_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_key_exchange_response_t *spdm_response; /*response to the original request (KEY_EXCHANGE_RSP)*/ @@ -610,11 +610,12 @@ void test_spdm_responder_respond_if_ready_case5(void **state) { libspdm_dhe_generate_key (m_use_dhe_algo, dhe_context, ptr, &dhe_key_size); ptr += dhe_key_size; libspdm_dhe_free (m_use_dhe_algo, dhe_context); - opaque_key_exchange_req_size = spdm_get_opaque_data_supported_version_data_size (spdm_context); + opaque_key_exchange_req_size = + libspdm_get_opaque_data_supported_version_data_size (spdm_context); *(uint16_t *)ptr = (uint16_t)opaque_key_exchange_req_size; ptr += sizeof(uint16_t); - spdm_build_opaque_data_supported_version_data (spdm_context, &opaque_key_exchange_req_size, - ptr); + libspdm_build_opaque_data_supported_version_data (spdm_context, &opaque_key_exchange_req_size, + ptr); ptr += opaque_key_exchange_req_size; spdm_context->last_spdm_request_size = m_spdm_key_exchange_request_size; @@ -636,7 +637,7 @@ void test_spdm_responder_respond_if_ready_case5(void **state) { &m_spdm_respond_if_ready_request5, &response_size, response); assert_int_equal (status, RETURN_SUCCESS); - assert_int_equal (response_size, sizeof(spdm_key_exchange_response_t) + dhe_key_size + 2 + spdm_get_opaque_data_version_selection_data_size( + assert_int_equal (response_size, sizeof(spdm_key_exchange_response_t) + dhe_key_size + 2 + libspdm_get_opaque_data_version_selection_data_size( spdm_context) + libspdm_get_asym_signature_size (m_use_asym_algo) + libspdm_get_hash_size (m_use_hash_algo)); assert_int_equal (libspdm_secured_message_get_session_state (spdm_context->session_info[0]. @@ -662,7 +663,7 @@ void test_spdm_responder_respond_if_ready_case5(void **state) { void test_spdm_responder_respond_if_ready_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_finish_response_t *spdm_response; /*response to the original request (FINISH_RSP)*/ @@ -673,9 +674,9 @@ void test_spdm_responder_respond_if_ready_case6(void **state) { uint8_t *cert_buffer; uintn cert_buffer_size; uint8_t cert_buffer_hash[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -716,7 +717,7 @@ void test_spdm_responder_respond_if_ready_case6(void **state) { session_id = 0xFFFFFFFF; spdm_context->latest_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init (spdm_context, session_info, session_id, false); + libspdm_session_info_init (spdm_context, session_info, session_id, false); hash_size = libspdm_get_hash_size (m_use_hash_algo); set_mem (dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key (session_info->secured_message_context, @@ -727,18 +728,19 @@ void test_spdm_responder_respond_if_ready_case6(void **state) { hash_size = libspdm_get_hash_size (m_use_hash_algo); hmac_size = libspdm_get_hash_size (m_use_hash_algo); ptr = m_spdm_finish_request.signature; - init_managed_buffer (&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer (&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); cert_buffer = (uint8_t *)data; cert_buffer_size = data_size; libspdm_hash_all (m_use_hash_algo, cert_buffer, cert_buffer_size, cert_buffer_hash); /* Transcript.MessageA size is 0*/ - append_managed_buffer (&th_curr, cert_buffer_hash, hash_size); + libspdm_append_managed_buffer (&th_curr, cert_buffer_hash, hash_size); /* SessionTranscript.MessageK is 0*/ - append_managed_buffer (&th_curr, (uint8_t *)&m_spdm_finish_request, - sizeof(spdm_finish_request_t)); + libspdm_append_managed_buffer (&th_curr, (uint8_t *)&m_spdm_finish_request, + sizeof(spdm_finish_request_t)); set_mem (request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all (m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); + libspdm_hmac_all (m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size( + &th_curr), request_finished_key, hash_size, ptr); spdm_context->last_spdm_request_size = sizeof(spdm_finish_request_t) + hmac_size; copy_mem_s(spdm_context->last_spdm_request, sizeof(spdm_context->last_spdm_request), @@ -779,7 +781,7 @@ void test_spdm_responder_respond_if_ready_case6(void **state) { void test_spdm_responder_respond_if_ready_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_exchange_response_t *spdm_response; /*response to the original request (PSK_EXCHANGE_RSP)*/ @@ -825,7 +827,7 @@ void test_spdm_responder_respond_if_ready_case7(void **state) { m_spdm_psk_exchange_request.psk_hint_length = (uint16_t)spdm_context->local_context.psk_hint_size; m_spdm_psk_exchange_request.requester_context_length = LIBSPDM_PSK_CONTEXT_LENGTH; - OpaquePskExchangeReqSize = spdm_get_opaque_data_supported_version_data_size (spdm_context); + OpaquePskExchangeReqSize = libspdm_get_opaque_data_supported_version_data_size (spdm_context); m_spdm_psk_exchange_request.opaque_length = (uint16_t)OpaquePskExchangeReqSize; m_spdm_psk_exchange_request.req_session_id = 0xFFFF; ptr = m_spdm_psk_exchange_request.psk_hint; @@ -834,7 +836,7 @@ void test_spdm_responder_respond_if_ready_case7(void **state) { ptr += m_spdm_psk_exchange_request.psk_hint_length; libspdm_get_random_number (LIBSPDM_PSK_CONTEXT_LENGTH, ptr); ptr += m_spdm_psk_exchange_request.requester_context_length; - spdm_build_opaque_data_supported_version_data (spdm_context, &OpaquePskExchangeReqSize, ptr); + libspdm_build_opaque_data_supported_version_data (spdm_context, &OpaquePskExchangeReqSize, ptr); ptr += OpaquePskExchangeReqSize; spdm_context->last_spdm_request_size = m_spdm_psk_exchange_request_size; @@ -856,7 +858,7 @@ void test_spdm_responder_respond_if_ready_case7(void **state) { &m_spdm_respond_if_ready_request7, &response_size, response); assert_int_equal (status, RETURN_SUCCESS); - assert_int_equal (response_size, sizeof(spdm_psk_exchange_response_t) + LIBSPDM_PSK_CONTEXT_LENGTH + spdm_get_opaque_data_version_selection_data_size( + assert_int_equal (response_size, sizeof(spdm_psk_exchange_response_t) + LIBSPDM_PSK_CONTEXT_LENGTH + libspdm_get_opaque_data_version_selection_data_size( spdm_context) + libspdm_get_hash_size (m_use_hash_algo)); assert_int_equal (libspdm_secured_message_get_session_state (spdm_context->session_info[0]. secured_message_context), @@ -879,7 +881,7 @@ void test_spdm_responder_respond_if_ready_case7(void **state) { void test_spdm_responder_respond_if_ready_case8(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_psk_finish_response_t *spdm_response; /*response to the original request (FINISH_PSK_RSP)*/ @@ -888,9 +890,9 @@ void test_spdm_responder_respond_if_ready_case8(void **state) { uint8_t *ptr; uint8_t local_psk_hint[32]; uint8_t dummy_buffer[LIBSPDM_MAX_HASH_SIZE]; - large_managed_buffer_t th_curr; + libspdm_large_managed_buffer_t th_curr; uint8_t request_finished_key[LIBSPDM_MAX_HASH_SIZE]; - spdm_session_info_t *session_info; + libspdm_session_info_t *session_info; uint32_t session_id; uint32_t hash_size; uint32_t hmac_size; @@ -936,7 +938,7 @@ void test_spdm_responder_respond_if_ready_case8(void **state) { spdm_context->last_spdm_request_session_id_valid = true; spdm_context->last_spdm_request_session_id = session_id; session_info = &spdm_context->session_info[0]; - spdm_session_info_init (spdm_context, session_info, session_id, true); + libspdm_session_info_init (spdm_context, session_info, session_id, true); hash_size = libspdm_get_hash_size (m_use_hash_algo); set_mem (dummy_buffer, hash_size, (uint8_t)(0xFF)); spdm_secured_message_set_request_finished_key (session_info->secured_message_context, @@ -947,14 +949,15 @@ void test_spdm_responder_respond_if_ready_case8(void **state) { hash_size = libspdm_get_hash_size (m_use_hash_algo); hmac_size = libspdm_get_hash_size (m_use_hash_algo); ptr = m_spdm_psk_finish_request.verify_data; - init_managed_buffer (&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); + libspdm_init_managed_buffer (&th_curr, LIBSPDM_MAX_MESSAGE_BUFFER_SIZE); /* Transcript.MessageA size is 0 * SessionTranscript.MessageK is 0*/ - append_managed_buffer (&th_curr, (uint8_t *)&m_spdm_psk_finish_request, - sizeof(spdm_psk_finish_request_t)); + libspdm_append_managed_buffer (&th_curr, (uint8_t *)&m_spdm_psk_finish_request, + sizeof(spdm_psk_finish_request_t)); set_mem (request_finished_key, LIBSPDM_MAX_HASH_SIZE, (uint8_t)(0xFF)); - libspdm_hmac_all (m_use_hash_algo, get_managed_buffer(&th_curr), - get_managed_buffer_size(&th_curr), request_finished_key, hash_size, ptr); + libspdm_hmac_all (m_use_hash_algo, libspdm_get_managed_buffer(&th_curr), + libspdm_get_managed_buffer_size( + &th_curr), request_finished_key, hash_size, ptr); spdm_context->last_spdm_request_size = sizeof(spdm_psk_finish_request_t) + hmac_size; copy_mem_s(spdm_context->last_spdm_request, sizeof(spdm_context->last_spdm_request), @@ -994,7 +997,7 @@ void test_spdm_responder_respond_if_ready_case8(void **state) { void test_spdm_responder_respond_if_ready_case9(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; /*response to the original request (DIGESTS)*/ @@ -1051,7 +1054,7 @@ void test_spdm_responder_respond_if_ready_case9(void **state) { void test_spdm_responder_respond_if_ready_case10(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; /*response to the original request (DIGESTS)*/ @@ -1109,7 +1112,7 @@ void test_spdm_responder_respond_if_ready_case10(void **state) { void test_spdm_responder_respond_if_ready_case11(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; /*response to the original request (DIGESTS)*/ @@ -1168,7 +1171,7 @@ void test_spdm_responder_respond_if_ready_case11(void **state) { void test_spdm_responder_respond_if_ready_case12(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; /*response to the original request (DIGESTS)*/ @@ -1232,7 +1235,7 @@ void test_spdm_responder_respond_if_ready_case12(void **state) { void test_spdm_responder_respond_if_ready_case13(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; /*response to the original request (DIGESTS)*/ @@ -1289,7 +1292,7 @@ void test_spdm_responder_respond_if_ready_case13(void **state) { void test_spdm_responder_respond_if_ready_case14(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_digest_response_t *spdm_response; /*response to the original request (DIGESTS)*/ diff --git a/unit_test/test_spdm_responder/version.c b/unit_test/test_spdm_responder/version.c index 353ae8e9753..739321803af 100644 --- a/unit_test/test_spdm_responder/version.c +++ b/unit_test/test_spdm_responder/version.c @@ -59,7 +59,7 @@ void test_spdm_responder_version_case1(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_version_response_t *spdm_response; @@ -93,7 +93,7 @@ void test_spdm_responder_version_case2(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_version_response_t *spdm_response; @@ -127,7 +127,7 @@ void test_spdm_responder_version_case3(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_version_response_t *spdm_response; @@ -163,7 +163,7 @@ void test_spdm_responder_version_case4(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_version_response_t *spdm_response; @@ -200,7 +200,7 @@ void test_spdm_responder_version_case5(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_version_response_t *spdm_response; @@ -244,7 +244,7 @@ void test_spdm_responder_version_case6(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_version_response_t *spdm_response; @@ -279,7 +279,7 @@ void test_spdm_responder_version_case7(void **state) { return_status status; spdm_test_context_t *spdm_test_context; - spdm_context_t *spdm_context; + libspdm_context_t *spdm_context; uintn response_size; uint8_t response[LIBSPDM_MAX_MESSAGE_BUFFER_SIZE]; spdm_version_response_t *spdm_response;