1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Copyright (c) 2014, STMicroelectronics International N.V. 4 */ 5 6 #include "xtest_test.h" 7 #include <enc_fs_key_manager_test.h> 8 #include <pta_invoke_tests.h> 9 #include <ta_concurrent.h> 10 #include <ta_concurrent_large.h> 11 #include <ta_create_fail_test.h> 12 #include <ta_crypt.h> 13 #include <ta_large.h> 14 #include <ta_miss_test.h> 15 #include <ta_os_test.h> 16 #include <ta_rpc_test.h> 17 #include <ta_sdp_basic.h> 18 #include <ta_sims_keepalive_test.h> 19 #include <ta_sims_test.h> 20 #include <ta_socket.h> 21 #include <ta_storage_benchmark.h> 22 #include <ta_storage.h> 23 #include <ta_supp_plugin.h> 24 #include <ta_tpm_log_test.h> 25 #include <ta_arm_bti.h> 26 #include <ta_subkey1.h> 27 #include <ta_subkey2.h> 28 #include <tee_api_defines.h> 29 #include <tee_client_api.h> 30 #include <__tee_isocket_defines.h> 31 #include <__tee_tcpsocket_defines.h> 32 #include <__tee_udpsocket_defines.h> 33 34 ADBG_ENUM_TABLE_DEFINE_BEGIN(TEEC_Result) 35 ADBG_ENUM_TABLE_ENTRY(TEEC_SUCCESS), 36 ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_CORRUPT_OBJECT), 37 ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_CORRUPT_OBJECT_2), 38 ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_STORAGE_NOT_AVAILABLE), 39 ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_STORAGE_NOT_AVAILABLE_2), 40 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_GENERIC), 41 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_ACCESS_DENIED), 42 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_CANCEL), 43 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_ACCESS_CONFLICT), 44 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_EXCESS_DATA), 45 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_BAD_FORMAT), 46 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_BAD_PARAMETERS), 47 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_BAD_STATE), 48 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_ITEM_NOT_FOUND), 49 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_NOT_IMPLEMENTED), 50 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_NOT_SUPPORTED), 51 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_NO_DATA), 52 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_OUT_OF_MEMORY), 53 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_BUSY), 54 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_COMMUNICATION), 55 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_SECURITY), 56 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_SHORT_BUFFER), 57 ADBG_ENUM_TABLE_ENTRY(TEEC_ERROR_EXTERNAL_CANCEL), 58 ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_OVERFLOW), 59 ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_TARGET_DEAD), 60 ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_STORAGE_NO_SPACE), 61 ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_MAC_INVALID), 62 ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_SIGNATURE_INVALID), 63 ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_TIME_NOT_SET), 64 ADBG_ENUM_TABLE_ENTRY(TEE_ERROR_TIME_NEEDS_RESET), 65 ADBG_ENUM_TABLE_ENTRY(TEE_ISOCKET_ERROR_PROTOCOL), 66 ADBG_ENUM_TABLE_ENTRY(TEE_ISOCKET_ERROR_REMOTE_CLOSED), 67 ADBG_ENUM_TABLE_ENTRY(TEE_ISOCKET_ERROR_TIMEOUT), 68 ADBG_ENUM_TABLE_ENTRY(TEE_ISOCKET_ERROR_OUT_OF_RESOURCES), 69 ADBG_ENUM_TABLE_ENTRY(TEE_ISOCKET_ERROR_LARGE_BUFFER), 70 ADBG_ENUM_TABLE_ENTRY(TEE_ISOCKET_WARNING_PROTOCOL), 71 ADBG_ENUM_TABLE_ENTRY(TEE_ISOCKET_ERROR_HOSTNAME), 72 ADBG_ENUM_TABLE_ENTRY(TEE_ISOCKET_UDP_WARNING_UNKNOWN_OUT_OF_BAND) 73 ADBG_ENUM_TABLE_DEFINE_END(TEEC_Result); 74 75 ADBG_ENUM_TABLE_DEFINE_BEGIN(TEEC_ErrorOrigin) 76 ADBG_ENUM_TABLE_ENTRY(TEEC_ORIGIN_API), 77 ADBG_ENUM_TABLE_ENTRY(TEEC_ORIGIN_COMMS), 78 ADBG_ENUM_TABLE_ENTRY(TEEC_ORIGIN_TEE), 79 ADBG_ENUM_TABLE_ENTRY(TEEC_ORIGIN_TRUSTED_APP) 80 ADBG_ENUM_TABLE_DEFINE_END(TEEC_ErrorOrigin); 81 82 #ifdef CFG_PKCS11_TA 83 ADBG_ENUM_TABLE_DEFINE_BEGIN(CK_RV) 84 ADBG_ENUM_TABLE_ENTRY(CKR_OK), 85 ADBG_ENUM_TABLE_ENTRY(CKR_CANCEL), 86 ADBG_ENUM_TABLE_ENTRY(CKR_HOST_MEMORY), 87 ADBG_ENUM_TABLE_ENTRY(CKR_SLOT_ID_INVALID), 88 ADBG_ENUM_TABLE_ENTRY(CKR_GENERAL_ERROR), 89 ADBG_ENUM_TABLE_ENTRY(CKR_FUNCTION_FAILED), 90 ADBG_ENUM_TABLE_ENTRY(CKR_ARGUMENTS_BAD), 91 ADBG_ENUM_TABLE_ENTRY(CKR_NO_EVENT), 92 ADBG_ENUM_TABLE_ENTRY(CKR_NEED_TO_CREATE_THREADS), 93 ADBG_ENUM_TABLE_ENTRY(CKR_CANT_LOCK), 94 ADBG_ENUM_TABLE_ENTRY(CKR_ATTRIBUTE_READ_ONLY), 95 ADBG_ENUM_TABLE_ENTRY(CKR_ATTRIBUTE_SENSITIVE), 96 ADBG_ENUM_TABLE_ENTRY(CKR_ATTRIBUTE_TYPE_INVALID), 97 ADBG_ENUM_TABLE_ENTRY(CKR_ATTRIBUTE_VALUE_INVALID), 98 ADBG_ENUM_TABLE_ENTRY(CKR_ACTION_PROHIBITED), 99 ADBG_ENUM_TABLE_ENTRY(CKR_DATA_INVALID), 100 ADBG_ENUM_TABLE_ENTRY(CKR_DATA_LEN_RANGE), 101 ADBG_ENUM_TABLE_ENTRY(CKR_DEVICE_ERROR), 102 ADBG_ENUM_TABLE_ENTRY(CKR_DEVICE_MEMORY), 103 ADBG_ENUM_TABLE_ENTRY(CKR_DEVICE_REMOVED), 104 ADBG_ENUM_TABLE_ENTRY(CKR_ENCRYPTED_DATA_INVALID), 105 ADBG_ENUM_TABLE_ENTRY(CKR_ENCRYPTED_DATA_LEN_RANGE), 106 ADBG_ENUM_TABLE_ENTRY(CKR_FUNCTION_CANCELED), 107 ADBG_ENUM_TABLE_ENTRY(CKR_FUNCTION_NOT_PARALLEL), 108 ADBG_ENUM_TABLE_ENTRY(CKR_FUNCTION_NOT_SUPPORTED), 109 ADBG_ENUM_TABLE_ENTRY(CKR_KEY_HANDLE_INVALID), 110 ADBG_ENUM_TABLE_ENTRY(CKR_KEY_SIZE_RANGE), 111 ADBG_ENUM_TABLE_ENTRY(CKR_KEY_TYPE_INCONSISTENT), 112 ADBG_ENUM_TABLE_ENTRY(CKR_KEY_NOT_NEEDED), 113 ADBG_ENUM_TABLE_ENTRY(CKR_KEY_CHANGED), 114 ADBG_ENUM_TABLE_ENTRY(CKR_KEY_NEEDED), 115 ADBG_ENUM_TABLE_ENTRY(CKR_KEY_INDIGESTIBLE), 116 ADBG_ENUM_TABLE_ENTRY(CKR_KEY_FUNCTION_NOT_PERMITTED), 117 ADBG_ENUM_TABLE_ENTRY(CKR_KEY_NOT_WRAPPABLE), 118 ADBG_ENUM_TABLE_ENTRY(CKR_KEY_UNEXTRACTABLE), 119 ADBG_ENUM_TABLE_ENTRY(CKR_MECHANISM_INVALID), 120 ADBG_ENUM_TABLE_ENTRY(CKR_MECHANISM_PARAM_INVALID), 121 ADBG_ENUM_TABLE_ENTRY(CKR_OBJECT_HANDLE_INVALID), 122 ADBG_ENUM_TABLE_ENTRY(CKR_OPERATION_ACTIVE), 123 ADBG_ENUM_TABLE_ENTRY(CKR_OPERATION_NOT_INITIALIZED), 124 ADBG_ENUM_TABLE_ENTRY(CKR_PIN_INCORRECT), 125 ADBG_ENUM_TABLE_ENTRY(CKR_PIN_INVALID), 126 ADBG_ENUM_TABLE_ENTRY(CKR_PIN_LEN_RANGE), 127 ADBG_ENUM_TABLE_ENTRY(CKR_PIN_EXPIRED), 128 ADBG_ENUM_TABLE_ENTRY(CKR_PIN_LOCKED), 129 ADBG_ENUM_TABLE_ENTRY(CKR_SESSION_CLOSED), 130 ADBG_ENUM_TABLE_ENTRY(CKR_SESSION_COUNT), 131 ADBG_ENUM_TABLE_ENTRY(CKR_SESSION_HANDLE_INVALID), 132 ADBG_ENUM_TABLE_ENTRY(CKR_SESSION_PARALLEL_NOT_SUPPORTED), 133 ADBG_ENUM_TABLE_ENTRY(CKR_SESSION_READ_ONLY), 134 ADBG_ENUM_TABLE_ENTRY(CKR_SESSION_EXISTS), 135 ADBG_ENUM_TABLE_ENTRY(CKR_SESSION_READ_ONLY_EXISTS), 136 ADBG_ENUM_TABLE_ENTRY(CKR_SESSION_READ_WRITE_SO_EXISTS), 137 ADBG_ENUM_TABLE_ENTRY(CKR_SIGNATURE_INVALID), 138 ADBG_ENUM_TABLE_ENTRY(CKR_SIGNATURE_LEN_RANGE), 139 ADBG_ENUM_TABLE_ENTRY(CKR_TEMPLATE_INCOMPLETE), 140 ADBG_ENUM_TABLE_ENTRY(CKR_TEMPLATE_INCONSISTENT), 141 ADBG_ENUM_TABLE_ENTRY(CKR_TOKEN_NOT_PRESENT), 142 ADBG_ENUM_TABLE_ENTRY(CKR_TOKEN_NOT_RECOGNIZED), 143 ADBG_ENUM_TABLE_ENTRY(CKR_TOKEN_WRITE_PROTECTED), 144 ADBG_ENUM_TABLE_ENTRY(CKR_UNWRAPPING_KEY_HANDLE_INVALID), 145 ADBG_ENUM_TABLE_ENTRY(CKR_UNWRAPPING_KEY_SIZE_RANGE), 146 ADBG_ENUM_TABLE_ENTRY(CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT), 147 ADBG_ENUM_TABLE_ENTRY(CKR_USER_ALREADY_LOGGED_IN), 148 ADBG_ENUM_TABLE_ENTRY(CKR_USER_NOT_LOGGED_IN), 149 ADBG_ENUM_TABLE_ENTRY(CKR_USER_PIN_NOT_INITIALIZED), 150 ADBG_ENUM_TABLE_ENTRY(CKR_USER_TYPE_INVALID), 151 ADBG_ENUM_TABLE_ENTRY(CKR_USER_ANOTHER_ALREADY_LOGGED_IN), 152 ADBG_ENUM_TABLE_ENTRY(CKR_USER_TOO_MANY_TYPES), 153 ADBG_ENUM_TABLE_ENTRY(CKR_WRAPPED_KEY_INVALID), 154 ADBG_ENUM_TABLE_ENTRY(CKR_WRAPPED_KEY_LEN_RANGE), 155 ADBG_ENUM_TABLE_ENTRY(CKR_WRAPPING_KEY_HANDLE_INVALID), 156 ADBG_ENUM_TABLE_ENTRY(CKR_WRAPPING_KEY_SIZE_RANGE), 157 ADBG_ENUM_TABLE_ENTRY(CKR_WRAPPING_KEY_TYPE_INCONSISTENT), 158 ADBG_ENUM_TABLE_ENTRY(CKR_RANDOM_SEED_NOT_SUPPORTED), 159 ADBG_ENUM_TABLE_ENTRY(CKR_RANDOM_NO_RNG), 160 ADBG_ENUM_TABLE_ENTRY(CKR_DOMAIN_PARAMS_INVALID), 161 ADBG_ENUM_TABLE_ENTRY(CKR_CURVE_NOT_SUPPORTED), 162 ADBG_ENUM_TABLE_ENTRY(CKR_BUFFER_TOO_SMALL), 163 ADBG_ENUM_TABLE_ENTRY(CKR_SAVED_STATE_INVALID), 164 ADBG_ENUM_TABLE_ENTRY(CKR_INFORMATION_SENSITIVE), 165 ADBG_ENUM_TABLE_ENTRY(CKR_STATE_UNSAVEABLE), 166 ADBG_ENUM_TABLE_ENTRY(CKR_CRYPTOKI_NOT_INITIALIZED), 167 ADBG_ENUM_TABLE_ENTRY(CKR_CRYPTOKI_ALREADY_INITIALIZED), 168 ADBG_ENUM_TABLE_ENTRY(CKR_MUTEX_BAD), 169 ADBG_ENUM_TABLE_ENTRY(CKR_MUTEX_NOT_LOCKED), 170 ADBG_ENUM_TABLE_ENTRY(CKR_NEW_PIN_MODE), 171 ADBG_ENUM_TABLE_ENTRY(CKR_NEXT_OTP), 172 ADBG_ENUM_TABLE_ENTRY(CKR_EXCEEDED_MAX_ITERATIONS), 173 ADBG_ENUM_TABLE_ENTRY(CKR_FIPS_SELF_TEST_FAILED), 174 ADBG_ENUM_TABLE_ENTRY(CKR_LIBRARY_LOAD_FAILED), 175 ADBG_ENUM_TABLE_ENTRY(CKR_PIN_TOO_WEAK), 176 ADBG_ENUM_TABLE_ENTRY(CKR_PUBLIC_KEY_INVALID), 177 ADBG_ENUM_TABLE_ENTRY(CKR_FUNCTION_REJECTED), 178 ADBG_ENUM_TABLE_ENTRY(CKR_VENDOR_DEFINED) 179 ADBG_ENUM_TABLE_DEFINE_END(CK_RV); 180 #endif /*CFG_PKCS11_TA*/ 181 182 #define ECC_SELF_TEST_UUID \ 183 { 0xf34f4f3c, 0xab30, 0x4573, \ 184 { 0x91, 0xBF, 0x3C, 0x57, 0x02, 0x4D, 0x51, 0x99 } } 185 186 const TEEC_UUID crypt_user_ta_uuid = TA_CRYPT_UUID; 187 const TEEC_UUID os_test_ta_uuid = TA_OS_TEST_UUID; 188 const TEEC_UUID create_fail_test_ta_uuid = TA_CREATE_FAIL_TEST_UUID; 189 const TEEC_UUID ecc_test_ta_uuid = ECC_SELF_TEST_UUID; 190 const TEEC_UUID pta_invoke_tests_ta_uuid = PTA_INVOKE_TESTS_UUID; 191 const TEEC_UUID rpc_test_ta_uuid = TA_RPC_TEST_UUID; 192 const TEEC_UUID sims_test_ta_uuid = TA_SIMS_TEST_UUID; 193 const TEEC_UUID miss_test_ta_uuid = TA_MISS_TEST_UUID; 194 const TEEC_UUID sims_keepalive_test_ta_uuid = TA_SIMS_KEEP_ALIVE_TEST_UUID; 195 const TEEC_UUID storage_ta_uuid = TA_STORAGE_UUID; 196 const TEEC_UUID storage2_ta_uuid = TA_STORAGE2_UUID; 197 const TEEC_UUID enc_fs_key_manager_test_ta_uuid = ENC_FS_KEY_MANAGER_TEST_UUID; 198 const TEEC_UUID concurrent_ta_uuid = TA_CONCURRENT_UUID; 199 const TEEC_UUID concurrent_large_ta_uuid = TA_CONCURRENT_LARGE_UUID; 200 const TEEC_UUID storage_benchmark_ta_uuid = TA_STORAGE_BENCHMARK_UUID; 201 const TEEC_UUID socket_ta_uuid = TA_SOCKET_UUID; 202 const TEEC_UUID sdp_basic_ta_uuid = TA_SDP_BASIC_UUID; 203 const TEEC_UUID tpm_log_test_ta_uuid = TA_TPM_LOG_TEST_UUID; 204 const TEEC_UUID supp_plugin_test_ta_uuid = TA_SUPP_PLUGIN_UUID; 205 const TEEC_UUID large_ta_uuid = TA_LARGE_UUID; 206 const TEEC_UUID bti_test_ta_uuid = TA_BTI_UUID; 207 const TEEC_UUID subkey1_ta_uuid = TA_SUBKEY1_UUID; 208 const TEEC_UUID subkey2_ta_uuid = TA_SUBKEY2_UUID; 209