зеркало из https://github.com/Azure/azure-utpm-c.git
Update references to renamed macros from macro_utils.h (#21)
This commit is contained in:
Родитель
fac5194ee4
Коммит
a7b086dc84
|
@ -1 +1 @@
|
|||
Subproject commit bc83cba1230e98988ae5cd2328f4dcf8c49d5866
|
||||
Subproject commit 7b21145c02432f44fb5cb0fba31d863b627a04d6
|
|
@ -20,7 +20,7 @@ extern "C" {
|
|||
TPM_COMM_TYPE_WINDOW, \
|
||||
TPM_COMM_TYPE_LINUX
|
||||
|
||||
DEFINE_ENUM(TPM_COMM_TYPE, TPM_COMM_TYPE_VALUES);
|
||||
MU_DEFINE_ENUM(TPM_COMM_TYPE, TPM_COMM_TYPE_VALUES);
|
||||
|
||||
typedef struct TPM_COMM_INFO_TAG* TPM_COMM_HANDLE;
|
||||
|
||||
|
|
|
@ -93,26 +93,26 @@ static int load_key(TPM_SAMPLE_INFO* tpm_info, TPM_HANDLE request_handle, TPMI_D
|
|||
else if (tpm_result != TPM_RC_HANDLE)
|
||||
{
|
||||
(void)printf("Failed calling TPM2_ReadPublic 0%x", tpm_result);
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TSS_CreatePrimary(&tpm_info->tpm_device, &NullPwSession, hierarchy, inPub, &tpm_info->tpm_handle, outPub) != TPM_RC_SUCCESS)
|
||||
{
|
||||
(void)printf("Failed calling TSS_CreatePrimary");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TPM2_EvictControl(&tpm_info->tpm_device, &NullPwSession, TPM_RH_OWNER, tpm_info->tpm_handle, request_handle) != TPM_RC_SUCCESS)
|
||||
{
|
||||
(void)printf("Failed calling TSS_CreatePrimary");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (TPM2_FlushContext(&tpm_info->tpm_device, tpm_info->tpm_handle) != TPM_RC_SUCCESS)
|
||||
{
|
||||
(void)printf("Failed calling TSS_CreatePrimary");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ static int power_on_simulator(TPM_COMM_INFO* tpm_comm_info)
|
|||
if ((platform_conn = tpm_socket_create(tpm_comm_info->socket_ip, TPM_SIMULATOR_PLATFORM_PORT) ) == NULL)
|
||||
{
|
||||
LogError("Failure: connecting to tpm simulator platform interface.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ static int power_on_simulator(TPM_COMM_INFO* tpm_comm_info)
|
|||
if (tpm_socket_send(platform_conn, (const unsigned char*)&power_on_cmd, sizeof(power_on_cmd) ) != 0)
|
||||
{
|
||||
LogError("Failure sending remote handshake.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -119,35 +119,35 @@ static int power_on_simulator(TPM_COMM_INFO* tpm_comm_info)
|
|||
if (tpm_socket_read(platform_conn, (unsigned char*)&ack_value, sizeof(uint32_t)) != 0)
|
||||
{
|
||||
LogError("Failure sending remote handshake.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (htonl(ack_value) != 0)
|
||||
{
|
||||
LogError("Failure reading cmd sync.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tpm_socket_send(platform_conn, (const unsigned char*)&signal_nv_cmd, sizeof(signal_nv_cmd) ) != 0)
|
||||
{
|
||||
LogError("Failure sending remote handshake.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tpm_socket_read(platform_conn, (unsigned char*)&ack_value, sizeof(uint32_t)) != 0)
|
||||
{
|
||||
LogError("Failure sending remote handshake.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (htonl(ack_value) != 0)
|
||||
{
|
||||
LogError("Failure reading cmd sync.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -174,39 +174,39 @@ static int execute_simulator_setup(TPM_COMM_INFO* tpm_comm_info)
|
|||
if (send_sync_cmd(tpm_comm_info, REMOTE_HANDSHAKE_CMD) != 0)
|
||||
{
|
||||
LogError("Failure sending remote handshake.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
// Send desired protocol version
|
||||
else if (send_sync_cmd(tpm_comm_info, tmp_client_version) != 0)
|
||||
{
|
||||
LogError("Failure sending client version.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (read_sync_cmd(tpm_comm_info, &tmp_server_version) != 0)
|
||||
{
|
||||
LogError("Failure reading cmd sync.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (tmp_client_version != tmp_server_version)
|
||||
{
|
||||
LogError("Failure client and server version does not match.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (read_sync_cmd(tpm_comm_info, &tpm_info) != 0)
|
||||
{
|
||||
LogError("Failure reading cmd sync.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
// GetAck
|
||||
else if (!is_ack_ok(tpm_comm_info))
|
||||
{
|
||||
LogError("Failure ack byte from tpm is invalid.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (power_on_simulator(tpm_comm_info) != 0)
|
||||
{
|
||||
LogError("Failure powering on simulator.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (handle == NULL || cmd_bytes == NULL || response == NULL || resp_len == NULL)
|
||||
{
|
||||
LogError("Invalid argument specified handle: %p, cmd_bytes: %p, response: %p, resp_len: %p.", handle, cmd_bytes, response, resp_len);
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -291,22 +291,22 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (send_sync_cmd(handle, Remote_SendCommand) != 0)
|
||||
{
|
||||
LogError("Failure preparing sending Remote Command");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (send_sync_bytes(handle, (const unsigned char*)&locality, 1) != 0)
|
||||
{
|
||||
LogError("Failure setting locality to TPM");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (send_sync_cmd(handle, bytes_len) != 0)
|
||||
{
|
||||
LogError("Failure writing command bit to tpm");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (send_sync_bytes(handle, cmd_bytes, bytes_len))
|
||||
{
|
||||
LogError("Failure writing data to tpm");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -315,12 +315,12 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (read_sync_cmd(handle, &length_byte) != 0)
|
||||
{
|
||||
LogError("Failure reading length data from tpm");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (length_byte > *resp_len)
|
||||
{
|
||||
LogError("Bytes read are greater then bytes expected len_bytes:%u expected: %u", length_byte, *resp_len);
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -328,7 +328,7 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (read_sync_bytes(handle, response, &length_byte) != 0)
|
||||
{
|
||||
LogError("Failure reading bytes");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -337,7 +337,7 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (read_sync_cmd(handle, &ack_cmd) != 0 || ack_cmd != 0)
|
||||
{
|
||||
LogError("Failure reading tpm ack");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ static int write_data_to_tpm(TPM_COMM_INFO* tpm_info, const unsigned char* tpm_b
|
|||
if (resp_len != (int)bytes_len)
|
||||
{
|
||||
LogError("Failure writing data to tpm: %d:%s.", errno, strerror(errno));
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ static int read_data_from_tpm(TPM_COMM_INFO* tpm_info, unsigned char* tpm_bytes,
|
|||
if (len_read < MIN_TPM_RESPONSE_LENGTH)
|
||||
{
|
||||
LogError("Failure reading data from tpm: len: %d - %d:%s.", len_read, errno, strerror(errno));
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -148,12 +148,12 @@ static int tpm_usermode_resmgr_connect(TPM_COMM_INFO* handle)
|
|||
if (!(oldTrm || newTrm))
|
||||
{
|
||||
LogError("Failure: No user mode TRM found.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if ((handle->dev_info.socket_conn = tpm_socket_create(TPM_UM_RM_ADDRESS, TPM_UM_RM_PORT)) == NULL)
|
||||
{
|
||||
LogError("Failure: connecting to user mode TRM.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -175,12 +175,12 @@ static int send_old_um_trm_data(TPM_COMM_HANDLE handle)
|
|||
else if (send_sync_bytes(handle, (const unsigned char*)&debugMsgLevel, 1) != 0)
|
||||
{
|
||||
LogError("Failure setting debugMsgLevel to TRM");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (send_sync_bytes(handle, (const unsigned char*)&commandSent, 1) != 0)
|
||||
{
|
||||
LogError("Failure setting commandSent status to TRM");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -250,7 +250,7 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (handle == NULL || cmd_bytes == NULL || response == NULL || resp_len == NULL)
|
||||
{
|
||||
LogError("Invalid argument specified handle: %p, cmd_bytes: %p, response: %p, resp_len: %p.", handle, cmd_bytes, response, resp_len);
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (handle->conn_info & TCI_SYS_DEV)
|
||||
{
|
||||
|
@ -258,14 +258,14 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (write_data_to_tpm(handle, (const unsigned char*)cmd_bytes, bytes_len) != 0)
|
||||
{
|
||||
LogError("Failure setting locality to TPM");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (read_data_from_tpm(handle, response, resp_len) != 0)
|
||||
{
|
||||
LogError("Failure reading bytes from tpm");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -279,27 +279,27 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (send_sync_cmd(handle, REMOTE_SEND_COMMAND) != 0)
|
||||
{
|
||||
LogError("Failure preparing sending Remote Command");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (send_sync_bytes(handle, (const unsigned char*)&locality, 1) != 0)
|
||||
{
|
||||
LogError("Failure setting locality to TPM");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (send_old_um_trm_data(handle) != 0)
|
||||
{
|
||||
LogError("Failure communicating with old user mode TPM");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (send_sync_cmd(handle, bytes_len) != 0)
|
||||
{
|
||||
LogError("Failure writing command bit to tpm");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (send_sync_bytes(handle, cmd_bytes, bytes_len))
|
||||
{
|
||||
LogError("Failure writing data to tpm");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -308,12 +308,12 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (read_sync_cmd(handle, &length_byte) != 0)
|
||||
{
|
||||
LogError("Failure reading length data from tpm");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else if (length_byte > *resp_len)
|
||||
{
|
||||
LogError("Bytes read are greater then bytes expected len_bytes:%u expected: %u", length_byte, *resp_len);
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -321,7 +321,7 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (read_sync_bytes(handle, response, &length_byte) != 0)
|
||||
{
|
||||
LogError("Failure reading bytes");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -329,7 +329,7 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if ( !is_ack_ok(handle) )
|
||||
{
|
||||
LogError("Failure reading TRM ack");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -342,7 +342,7 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
else
|
||||
{
|
||||
LogError("Submitting command to an uninitialized TPM_COMM_HANDLE");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (handle == NULL || cmd_bytes == NULL || response == NULL || resp_len == NULL)
|
||||
{
|
||||
LogError("Invalid argument specified handle: %p, cmd_bytes: %p, response: %p, resp_len: %p.", handle, cmd_bytes, response, resp_len);
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ int tpm_comm_submit_command(TPM_COMM_HANDLE handle, const unsigned char* cmd_byt
|
|||
if (tbs_res != TBS_SUCCESS)
|
||||
{
|
||||
LogError("Failure sending command to tpm %s.", get_tbsi_error_msg(tbs_res));
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -61,7 +61,7 @@ static int add_to_buffer(TPM_SOCKET_INFO* socket_info, const unsigned char* byte
|
|||
}
|
||||
if (new_buff == NULL)
|
||||
{
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ static int send_socket_bytes(TPM_SOCKET_INFO* socket_info, const unsigned char*
|
|||
if (sent_bytes < (int)byte_len)
|
||||
{
|
||||
LogError("sent byte amoutn is less than desired send amount.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ static int read_socket_bytes(TPM_SOCKET_INFO* socket_info)
|
|||
if (data_len == -1)
|
||||
{
|
||||
LogError("Failure received bytes timed out.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ static int read_socket_bytes(TPM_SOCKET_INFO* socket_info)
|
|||
if (add_to_buffer(socket_info, (const unsigned char*)read_data, data_len) != 0)
|
||||
{
|
||||
LogError("Failure: adding bytes to buffer.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -231,12 +231,12 @@ int tpm_socket_read(TPM_SOCKET_HANDLE handle, unsigned char* tpm_bytes, uint32_t
|
|||
if (handle == NULL || tpm_bytes == NULL || bytes_len == 0)
|
||||
{
|
||||
LogError("Invalid argument specified handle: %p, tpm_bytes: %p, bytes_len: %d", handle, tpm_bytes, bytes_len);
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do we have enough bytes cached
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
for (size_t index = 0; index < 2; index++)
|
||||
{
|
||||
if (handle->recv_length >= bytes_len)
|
||||
|
@ -251,7 +251,7 @@ int tpm_socket_read(TPM_SOCKET_HANDLE handle, unsigned char* tpm_bytes, uint32_t
|
|||
if (read_socket_bytes(handle))
|
||||
{
|
||||
LogError("Failure reading socket bytes.");
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ int tpm_socket_send(TPM_SOCKET_HANDLE handle, const unsigned char* tpm_bytes, ui
|
|||
if (handle == NULL || tpm_bytes == NULL || bytes_len == 0)
|
||||
{
|
||||
LogError("Invalid argument specified handle: %p, tpm_bytes: %p, bytes_len: %d", handle, tpm_bytes, bytes_len);
|
||||
result = __FAILURE__;
|
||||
result = MU_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -74,7 +74,7 @@ static TPM2B_PUBLIC tpm_public_value = { 0, // size will be computed during ma
|
|||
{ 0 } // TPMU_PUBLIC_ID unique
|
||||
} };
|
||||
|
||||
DEFINE_ENUM_STRINGS(UMOCK_C_ERROR_CODE, UMOCK_C_ERROR_CODE_VALUES)
|
||||
MU_DEFINE_ENUM_STRINGS(UMOCK_C_ERROR_CODE, UMOCK_C_ERROR_CODE_VALUES)
|
||||
|
||||
static TPM_COMM_HANDLE my_tpm_comm_create(const char* endpoint)
|
||||
{
|
||||
|
@ -89,9 +89,7 @@ static void my_tpm_comm_destroy(TPM_COMM_HANDLE handle)
|
|||
|
||||
static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code)
|
||||
{
|
||||
char temp_str[256];
|
||||
(void)snprintf(temp_str, sizeof(temp_str), "umock_c reported error :%s", ENUM_TO_STRING(UMOCK_C_ERROR_CODE, error_code));
|
||||
ASSERT_FAIL(temp_str);
|
||||
ASSERT_FAIL("umock_c reported error :%s", MU_ENUM_TO_STRING(UMOCK_C_ERROR_CODE, error_code));
|
||||
}
|
||||
|
||||
static TEST_MUTEX_HANDLE g_testByTest;
|
||||
|
|
|
@ -86,16 +86,14 @@ static void* g_on_bytes_received_context = NULL;
|
|||
static bool g_send_was_last_called;
|
||||
static bool g_closing_xio = false;
|
||||
|
||||
DEFINE_ENUM_STRINGS(UMOCK_C_ERROR_CODE, UMOCK_C_ERROR_CODE_VALUES)
|
||||
MU_DEFINE_ENUM_STRINGS(UMOCK_C_ERROR_CODE, UMOCK_C_ERROR_CODE_VALUES)
|
||||
|
||||
TEST_DEFINE_ENUM_TYPE(TPM_COMM_TYPE, TPM_COMM_TYPE_VALUES);
|
||||
IMPLEMENT_UMOCK_C_ENUM_TYPE(TPM_COMM_TYPE, TPM_COMM_TYPE_VALUES);
|
||||
|
||||
static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code)
|
||||
{
|
||||
char temp_str[256];
|
||||
(void)snprintf(temp_str, sizeof(temp_str), "umock_c reported error :%s", ENUM_TO_STRING(UMOCK_C_ERROR_CODE, error_code));
|
||||
ASSERT_FAIL(temp_str);
|
||||
ASSERT_FAIL("umock_c reported error :%s", MU_ENUM_TO_STRING(UMOCK_C_ERROR_CODE, error_code));
|
||||
}
|
||||
|
||||
static int my_mallocAndStrcpy_s(char** destination, const char* source)
|
||||
|
|
|
@ -80,13 +80,11 @@ static TBS_RESULT my_Tbsip_Context_Close(TBS_HCONTEXT hContext)
|
|||
TEST_DEFINE_ENUM_TYPE(TPM_COMM_TYPE, TPM_COMM_TYPE_VALUES);
|
||||
IMPLEMENT_UMOCK_C_ENUM_TYPE(TPM_COMM_TYPE, TPM_COMM_TYPE_VALUES);
|
||||
|
||||
DEFINE_ENUM_STRINGS(UMOCK_C_ERROR_CODE, UMOCK_C_ERROR_CODE_VALUES)
|
||||
MU_DEFINE_ENUM_STRINGS(UMOCK_C_ERROR_CODE, UMOCK_C_ERROR_CODE_VALUES)
|
||||
|
||||
static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code)
|
||||
{
|
||||
char temp_str[256];
|
||||
(void)snprintf(temp_str, sizeof(temp_str), "umock_c reported error :%s", ENUM_TO_STRING(UMOCK_C_ERROR_CODE, error_code));
|
||||
ASSERT_FAIL(temp_str);
|
||||
ASSERT_FAIL("umock_c reported error :%s", MU_ENUM_TO_STRING(UMOCK_C_ERROR_CODE, error_code));
|
||||
}
|
||||
|
||||
static TEST_MUTEX_HANDLE g_testByTest;
|
||||
|
|
|
@ -52,16 +52,14 @@ extern "C"
|
|||
|
||||
#define BUFFER_LENGTH 10
|
||||
|
||||
DEFINE_ENUM_STRINGS(UMOCK_C_ERROR_CODE, UMOCK_C_ERROR_CODE_VALUES)
|
||||
MU_DEFINE_ENUM_STRINGS(UMOCK_C_ERROR_CODE, UMOCK_C_ERROR_CODE_VALUES)
|
||||
|
||||
//TEST_DEFINE_ENUM_TYPE(TPM_COMM_TYPE, TPM_COMM_TYPE_VALUES);
|
||||
//IMPLEMENT_UMOCK_C_ENUM_TYPE(TPM_COMM_TYPE, TPM_COMM_TYPE_VALUES);
|
||||
|
||||
static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code)
|
||||
{
|
||||
char temp_str[256];
|
||||
(void)snprintf(temp_str, sizeof(temp_str), "umock_c reported error :%s", ENUM_TO_STRING(UMOCK_C_ERROR_CODE, error_code));
|
||||
ASSERT_FAIL(temp_str);
|
||||
ASSERT_FAIL("umock_c reported error :%s", MU_ENUM_TO_STRING(UMOCK_C_ERROR_CODE, error_code));
|
||||
}
|
||||
|
||||
static TEST_MUTEX_HANDLE g_testByTest;
|
||||
|
|
Загрузка…
Ссылка в новой задаче