ta/wallet_ta.c
/**
  * Reads one byte from the wallet storage at the position that data stream is
  * currently at.
  * \param session_data A data pointer to a session context.
  * \param param_types The types of the four parameters.
  * \param params A pointer to an array of four parameters.
  * \return TEE_SUCCESS in case of success otherwise returns the result
  *         received from the failed operation. The information about all
  *         possible returns is present in TEE Client API Specification - 4.4.2
  *         published by GlobalPlatform.
  */
Reads one byte from the wallet storage at the position that data stream is
currently at.
\param session_data A data pointer to a session context.
\param param_types The types of the four parameters.
\param params A pointer to an array of four parameters.
\return TEE_SUCCESS in case of success otherwise returns the result
received from the failed operation. The information about all
possible returns is present in TEE Client API Specification - 4.4.2
published by GlobalPlatform.
Reads one byte from the wallet storage at the position that data stream is currently at . \ param session_data A data pointer to a session context . \ param param_types The types of the four parameters . \ param params A pointer to an array of four parameters . \ return TEE_SUCCESS in case of success otherwise returns the result received from the failed operation . The information about all possible returns is present in TEE Client API Specification - 4 . 4 . 2 published by GlobalPlatform .
static TEE_Result read1_wallet_storage(Session_data * session_data, uint32_t param_types, TEE_Param params[4])
{
	TEE_Result result = TEE_SUCCESS;
	uint32_t exp_param_types;
	size_t count = 0;
	exp_param_types = TEE_PARAM_TYPES(
							TEE_PARAM_TYPE_MEMREF_OUTPUT,
							TEE_PARAM_TYPE_NONE,
							TEE_PARAM_TYPE_NONE,
							TEE_PARAM_TYPE_NONE);
	if (param_types != exp_param_types || params[0].memref.buffer == NULL)
		return TEE_ERROR_BAD_PARAMETERS;
	if (session_data->is_storage_open == false)
		return TEE_ERROR_BAD_STATE;
    result = TEE_ReadObjectData(
    				*(session_data->wallet_handle),
    				(uint8_t*)(params[0].memref.buffer),
    				(size_t)(params[0].memref.size),
    				&count);
    if (result != TEE_SUCCESS)
    {
    	#ifdef OP_TEE_TA
    	DMSG("Failed to read from the wallet storage: 0x%x", result);
    	#endif
    }
	return result;
}
static TEE_Result read1_wallet_storage ( Session_data * session_data , uint32_t param_types , TEE_Param params [ 4 ] ) { TEE_Result result = TEE_SUCCESS ; uint32_t exp_param_types ; size_t count = 0 ; exp_param_types = TEE_PARAM_TYPES ( TEE_PARAM_TYPE_MEMREF_OUTPUT , TEE_PARAM_TYPE_NONE , TEE_PARAM_TYPE_NONE , TEE_PARAM_TYPE_NONE ) ; if ( param_types != exp_param_types || params [ 0 ] . memref . buffer == NULL ) return TEE_ERROR_BAD_PARAMETERS ; if ( session_data -> is_storage_open == false ) return TEE_ERROR_BAD_STATE ; result = TEE_ReadObjectData ( * ( session_data -> wallet_handle ) , ( uint8_t * ) ( params [ 0 ] . memref . buffer ) , ( size_t ) ( params [ 0 ] . memref . size ) , & count ) ; if ( result != TEE_SUCCESS ) { #ifdef OP_TEE_TA DMSG ( " " , result ) ; #endif } return result ; }
Reads one byte from the wallet storage at the position that data stream is
 currently at.
Reads one byte from the wallet storage at the position that data stream is currently at .
/*
	 * Expected:
	 * [OUT] params[0].memref.buffer -> Buffer to write the data read.
	 * [OUT] params[0].memref.size   -> Size of the data to be read.
	 */ /*
	 * When the parameters received are different from the ones expected or
	 * when the pointer to buffer were the data read will be written
	 * (params[0].memref.buffer) is NULL return TEE_ERROR_BAD_PARAMETERS.
	 */ /* Check if the storage is open */ /*
     * Write the data read in params[0].memref.buffer.
     */