ta/wallet_ta.c
/**
  * Reads from the wallet storage meaning that reads from the data stream of the
  * persistent object that is considerate the wallet storage. This function is
  * only used by the TA itself.
  * \param session_data A data pointer to a session context.
  * \param outputBuffer A pointer to the buffer were the read data will be
  *                    written to.
  * \param length The amount of bytes to read from the wallet storage.
  * \param address Byte offset specifying where in the partition to
  *                start reading from.
  * \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 from the wallet storage meaning that reads from the data stream of the
persistent object that is considerate the wallet storage. This function is
only used by the TA itself.
\param session_data A data pointer to a session context.
\param outputBuffer A pointer to the buffer were the read data will be
written to.
\param length The amount of bytes to read from the wallet storage.
\param address Byte offset specifying where in the partition to
start reading from.
\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 from the wallet storage meaning that reads from the data stream of the persistent object that is considerate the wallet storage . This function is only used by the TA itself . \ param session_data A data pointer to a session context . \ param outputBuffer A pointer to the buffer were the read data will be written to . \ param length The amount of bytes to read from the wallet storage . \ param address Byte offset specifying where in the partition to start reading from . \ 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 read_wallet_storage_internal(Session_data * session_data, uint8_t * outputBuffer, uint32_t length, int32_t address)
{
	TEE_Result result = TEE_SUCCESS;
	size_t count = 0;
	if (outputBuffer == NULL)
		return TEE_ERROR_BAD_PARAMETERS;
	if (session_data->is_storage_open == false)
		return TEE_ERROR_BAD_STATE;
    result = TEE_SeekObjectData(*(session_data->wallet_handle),
				    			(int32_t)address,
				    			TEE_DATA_SEEK_SET);
    if (result != TEE_SUCCESS)
    {
    	#ifdef OP_TEE_TA
    	DMSG("Failed to seek while reading: 0x%x", result);
    	#endif
    	goto cleanup1;
    }
    result = TEE_ReadObjectData(*(session_data->wallet_handle),
			    				(uint8_t*)outputBuffer,
			    				(size_t)length,
			    				&count);
    if (result != TEE_SUCCESS)
    {
    	#ifdef OP_TEE_TA
    	DMSG("Failed to read from the wallet storage: 0x%x", result);
    	#endif
    }
    cleanup1:
		return result;
}
static TEE_Result read_wallet_storage_internal ( Session_data * session_data , uint8_t * outputBuffer , uint32_t length , int32_t address ) { TEE_Result result = TEE_SUCCESS ; size_t count = 0 ; if ( outputBuffer == NULL ) return TEE_ERROR_BAD_PARAMETERS ; if ( session_data -> is_storage_open == false ) return TEE_ERROR_BAD_STATE ; result = TEE_SeekObjectData ( * ( session_data -> wallet_handle ) , ( int32_t ) address , TEE_DATA_SEEK_SET ) ; if ( result != TEE_SUCCESS ) { #ifdef OP_TEE_TA DMSG ( " " , result ) ; #endif goto cleanup1 ; } result = TEE_ReadObjectData ( * ( session_data -> wallet_handle ) , ( uint8_t * ) outputBuffer , ( size_t ) length , & count ) ; if ( result != TEE_SUCCESS ) { #ifdef OP_TEE_TA DMSG ( " " , result ) ; #endif } cleanup1 : return result ; }
Reads from the wallet storage meaning that reads from the data stream of the
 persistent object that is considerate the wallet storage.
Reads from the wallet storage meaning that reads from the data stream of the persistent object that is considerate the wallet storage .
/* Do some sanity checks */ /* Check if the wallet storage is open */ /*
	 * Set the position of the data stream to the address indicated at
	 * address (SET the address as a offset from the beginning of the
	 * data stream).
	 */ /*
     * Write the data read in the outputBuffer.
     */ /* Resource cleanup */