ta/wallet_ta.c
/**
  * Called when a TA is invoked. sess_ctx hold that value that was
  * assigned by TA_OpenSessionEntryPoint(). The rest of the parameters
  * comes from normal world.
  * \param sess_ctx A data pointer to a session context.
  * \param cmd_id A Trusted Application-specific code that identifies the
  *               command to be invoked.
  * \param param_types The types of the four parameters.
  * \param params A pointer to an array of four parameters.
  * \return TEE_ERROR_BAD_PARAMETERS when the parameters send are not correct.
  *         Or returns the function invoked return.
  */
Called when a TA is invoked. sess_ctx hold that value that was
assigned by TA_OpenSessionEntryPoint(). The rest of the parameters
comes from normal world.
\param sess_ctx A data pointer to a session context.
\param cmd_id A Trusted Application-specific code that identifies the
command to be invoked.
\param param_types The types of the four parameters.
\param params A pointer to an array of four parameters.
\return TEE_ERROR_BAD_PARAMETERS when the parameters send are not correct.
Or returns the function invoked return.
Called when a TA is invoked . sess_ctx hold that value that was assigned by TA_OpenSessionEntryPoint () . The rest of the parameters comes from normal world . \ param sess_ctx A data pointer to a session context . \ param cmd_id A Trusted Application - specific code that identifies the command to be invoked . \ param param_types The types of the four parameters . \ param params A pointer to an array of four parameters . \ return TEE_ERROR_BAD_PARAMETERS when the parameters send are not correct . Or returns the function invoked return .
TEE_Result TA_InvokeCommandEntryPoint(void *sess_ctx, uint32_t cmd_id, uint32_t param_types, TEE_Param params[4])
{
	switch (cmd_id)
	{
		case CMD_INITIALIZE_HANDLERS:
			return initialize_handlers((Session_data *)sess_ctx, param_types, params);
		case CMD_FINALIZE_HANDLERS:
			return finalize_handlers((Session_data *)sess_ctx, param_types, params);
		case CMD_CREATE_WALLET_STORAGE:
			return create_wallet_storage((Session_data *)sess_ctx, param_types, params);
		case CMD_OPEN_WALLET_STORAGE:
			return open_wallet_storage((Session_data *)sess_ctx, param_types, params);
		case CMD_CLOSE_WALLET_STORAGE:
			return close_wallet_storage((Session_data *)sess_ctx, param_types, params);
		case CMD_DELETE_WALLET_STORAGE:
			return delete_wallet_storage((Session_data *)sess_ctx, param_types, params);
		case CMD_SEEK_WALLET_STORAGE:
			return seek_wallet_storage((Session_data *)sess_ctx, param_types, params);
		case CMD_WRITE1_WALLET_STORAGE:
			return write1_wallet_storage((Session_data *)sess_ctx, param_types, params);
		case CMD_READ1_WALLET_STORAGE:
			return read1_wallet_storage((Session_data *)sess_ctx, param_types, params);
		case CMD_WRITE_WALLET_STORAGE:
			return write_cache_wallet_storage((Session_data *)sess_ctx, param_types, params);
		case CMD_READ_WALLET_STORAGE:
			return read_cache_wallet_storage((Session_data *)sess_ctx, param_types, params);
		case CMD_FLUSH_WALLET_STORAGE:
			return flush_wallet_storage((Session_data *)sess_ctx, param_types, params);
		case CMD_UPDATE_WALLET_VERSION:
			return update_wallet_version((Session_data *)sess_ctx, param_types, params);
		case CMD_WRITE_CURRENT_WALLET:
			return write_current_wallet_record((Session_data *)sess_ctx, param_types, params);
		case CMD_READ_WALLET_RECORD:
			return read_wallet_record((Session_data *)sess_ctx, param_types, params);
		case CMD_GET_NUM_ADDRESSES:
			return get_number_addresses((Session_data *)sess_ctx, param_types, params);
		case CMD_CHANGE_ENCRYPTION_KEY:
			return change_encryption_key((Session_data *)sess_ctx, param_types, params);
		case CMD_UNINIT_WALLET:
			return uninit_wallet((Session_data *)sess_ctx, param_types, params);
		case CMD_INIT_WALLET:
			return init_wallet((Session_data *)sess_ctx, param_types, params);
		case CMD_GENERATE_RANDOM:
			return generate_random_bytes((Session_data *)sess_ctx, param_types, params);
		case CMD_SET_HMAC_SHA512_KEY:
			return set_hmac_sha512_key((Session_data *)sess_ctx, param_types, params);
		case CMD_SET_HMAC_SHA256_KEY:
			return set_hmac_sha256_key((Session_data *)sess_ctx, param_types, params);
		case CMD_RIPEMD_160:
			return ripemd_160((Session_data *)sess_ctx, param_types, params);
		case CMD_HMAC_SHA512:
			return hmac_sha512((Session_data *)sess_ctx, param_types, params);
		case CMD_HMAC_SHA256:
			return hmac_sha256((Session_data *)sess_ctx, param_types, params);
		case CMD_GENERATE_PASSWORD_BASED_KEY:
			return pbkdf2((Session_data *)sess_ctx, param_types, params);
		case CMD_DERIVE_AND_SET_ENCRYPTION_KEY:
			return derive_and_set_encryption_key((Session_data *)sess_ctx, param_types, params);
		case CMD_SHA256_INIT:
			return sha256_init((Session_data *)sess_ctx, param_types, params);
		case CMD_SHA256_UPDATE:
			return sha256_update((Session_data *)sess_ctx, param_types, params);
		case CMD_SHA256_FINAL:
			return sha256_final((Session_data *)sess_ctx, param_types, params);
		case CMD_SHA256_FINAL_DOUBLE:
			return sha256_final_double((Session_data *)sess_ctx, param_types, params);
		case CMD_GET_WALLET_INFO:
			return get_wallet_info((Session_data *)sess_ctx, param_types, params);
		case CMD_CHANGE_WALLET_NAME:
			return change_wallet_name((Session_data *)sess_ctx, param_types, params);
		case CMD_NEW_WALLET:
			return new_wallet((Session_data *)sess_ctx, param_types, params);
		case CMD_GET_SEED:
			return get_seed((Session_data *)sess_ctx, param_types, params);
		case CMD_GET_ADDRESS_AND_PUB_KEY:
			return get_address_and_public_key((Session_data *)sess_ctx, param_types, params);
		case CMD_SET_TO_G_TEST:
			return set_to_g_test((Session_data *)sess_ctx, param_types, params);
		case CMD_GET_MASTER_PUB_KEY:
			return get_master_public_key((Session_data *)sess_ctx, param_types, params);
		case CMD_MAKE_NEW_ADDRESS:
			return make_new_address((Session_data *)sess_ctx, param_types, params);
		case CMD_ECDSA_SIGN:
			return ecdsa_sign((Session_data *)sess_ctx, param_types, params);
		case CMD_ECDSA_SIGN_TEST:
			return ecdsa_sign_test((Session_data *)sess_ctx, param_types, params);
		case CMD_GENERATE_D256:
			return generate_deterministic256((Session_data *)sess_ctx, param_types, params);
		case CMD_GENERATE_D256_TEST:
			return generate_deterministic256_test((Session_data *)sess_ctx, param_types, params);
		case CMD_GENERATE_D_PUB_KEY_TEST:
			return generate_deterministic_public_key_test((Session_data *)sess_ctx, param_types, params);
		case CMD_SET_ENTROPY_POOL:
			return set_entropy_pool((Session_data *)sess_ctx, param_types, params);
        case CMD_GET_ENTROPY_POOL:
            return get_entropy_pool((Session_data *)sess_ctx, param_types, params);
		case CMD_CLEAR_PRT_PUB_CACHE:
			return clear_parent_public_key_cache((Session_data *)sess_ctx, param_types, params);
		case CMD_GET_PRIVATE_KEY_TEST:
			return get_private_key_test((Session_data *)sess_ctx, param_types, params);
		case CMD_AES_XTS:
			return aes_xts((Session_data *)sess_ctx, param_types, params);
		case CMD_POINT_MULTIPLY_TEST:
			return point_multiply_test((Session_data *)sess_ctx, param_types, params);
		case CMD_ECDSA_SERIALISE:
			return ecdsa_serialise((Session_data *)sess_ctx, param_types, params);
		case CMD_TEST_CALL:
			return test_function((Session_data *)sess_ctx, param_types, params);
		default:
			return TEE_ERROR_BAD_PARAMETERS;
	}
}
TEE_Result TA_InvokeCommandEntryPoint ( void * sess_ctx , uint32_t cmd_id , uint32_t param_types , TEE_Param params [ 4 ] ) { switch ( cmd_id ) { case CMD_INITIALIZE_HANDLERS : return initialize_handlers ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_FINALIZE_HANDLERS : return finalize_handlers ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_CREATE_WALLET_STORAGE : return create_wallet_storage ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_OPEN_WALLET_STORAGE : return open_wallet_storage ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_CLOSE_WALLET_STORAGE : return close_wallet_storage ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_DELETE_WALLET_STORAGE : return delete_wallet_storage ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_SEEK_WALLET_STORAGE : return seek_wallet_storage ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_WRITE1_WALLET_STORAGE : return write1_wallet_storage ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_READ1_WALLET_STORAGE : return read1_wallet_storage ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_WRITE_WALLET_STORAGE : return write_cache_wallet_storage ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_READ_WALLET_STORAGE : return read_cache_wallet_storage ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_FLUSH_WALLET_STORAGE : return flush_wallet_storage ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_UPDATE_WALLET_VERSION : return update_wallet_version ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_WRITE_CURRENT_WALLET : return write_current_wallet_record ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_READ_WALLET_RECORD : return read_wallet_record ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GET_NUM_ADDRESSES : return get_number_addresses ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_CHANGE_ENCRYPTION_KEY : return change_encryption_key ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_UNINIT_WALLET : return uninit_wallet ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_INIT_WALLET : return init_wallet ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GENERATE_RANDOM : return generate_random_bytes ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_SET_HMAC_SHA512_KEY : return set_hmac_sha512_key ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_SET_HMAC_SHA256_KEY : return set_hmac_sha256_key ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_RIPEMD_160 : return ripemd_160 ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_HMAC_SHA512 : return hmac_sha512 ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_HMAC_SHA256 : return hmac_sha256 ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GENERATE_PASSWORD_BASED_KEY : return pbkdf2 ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_DERIVE_AND_SET_ENCRYPTION_KEY : return derive_and_set_encryption_key ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_SHA256_INIT : return sha256_init ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_SHA256_UPDATE : return sha256_update ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_SHA256_FINAL : return sha256_final ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_SHA256_FINAL_DOUBLE : return sha256_final_double ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GET_WALLET_INFO : return get_wallet_info ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_CHANGE_WALLET_NAME : return change_wallet_name ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_NEW_WALLET : return new_wallet ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GET_SEED : return get_seed ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GET_ADDRESS_AND_PUB_KEY : return get_address_and_public_key ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_SET_TO_G_TEST : return set_to_g_test ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GET_MASTER_PUB_KEY : return get_master_public_key ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_MAKE_NEW_ADDRESS : return make_new_address ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_ECDSA_SIGN : return ecdsa_sign ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_ECDSA_SIGN_TEST : return ecdsa_sign_test ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GENERATE_D256 : return generate_deterministic256 ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GENERATE_D256_TEST : return generate_deterministic256_test ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GENERATE_D_PUB_KEY_TEST : return generate_deterministic_public_key_test ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_SET_ENTROPY_POOL : return set_entropy_pool ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GET_ENTROPY_POOL : return get_entropy_pool ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_CLEAR_PRT_PUB_CACHE : return clear_parent_public_key_cache ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_GET_PRIVATE_KEY_TEST : return get_private_key_test ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_AES_XTS : return aes_xts ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_POINT_MULTIPLY_TEST : return point_multiply_test ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_ECDSA_SERIALISE : return ecdsa_serialise ( ( Session_data * ) sess_ctx , param_types , params ) ; case CMD_TEST_CALL : return test_function ( ( Session_data * ) sess_ctx , param_types , params ) ; default : return TEE_ERROR_BAD_PARAMETERS ; } }
Called when a TA is invoked.
Called when a TA is invoked .