ta/wallet_ta.c
/**
  * Writes in the wallet storage meaning that writes in 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 inputBuffer A pointer to the buffer that contains the data to be
  *                    written.
  * \param length The amount of bytes to write in the wallet storage.
  * \param address Byte offset specifying where in the partition to
  *                start writing to.
  * \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.
  */
Writes in the wallet storage meaning that writes in 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 inputBuffer A pointer to the buffer that contains the data to be
written.
\param length The amount of bytes to write in the wallet storage.
\param address Byte offset specifying where in the partition to
start writing to.
\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.
Writes in the wallet storage meaning that writes in 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 inputBuffer A pointer to the buffer that contains the data to be written . \ param length The amount of bytes to write in the wallet storage . \ param address Byte offset specifying where in the partition to start writing to . \ 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 write_wallet_storage_internal(Session_data * session_data, uint8_t * inputBuffer, size_t length, int32_t address)
{
	TEE_Result result = TEE_SUCCESS;
	if (inputBuffer == 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 writing: 0x%x", result);
    	#endif
    	goto cleanup1;
    }
    result = TEE_WriteObjectData(*(session_data->wallet_handle),
			    				(uint8_t*)inputBuffer,
			    				(size_t)length);
    if (result != TEE_SUCCESS)
    {
    	#ifdef OP_TEE_TA
    	DMSG("Failed to write in the wallet storage: 0x%x", result);
    	#endif
    }
    cleanup1:
		return result;
}
static TEE_Result write_wallet_storage_internal ( Session_data * session_data , uint8_t * inputBuffer , size_t length , int32_t address ) { TEE_Result result = TEE_SUCCESS ; if ( inputBuffer == 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_WriteObjectData ( * ( session_data -> wallet_handle ) , ( uint8_t * ) inputBuffer , ( size_t ) length ) ; if ( result != TEE_SUCCESS ) { #ifdef OP_TEE_TA DMSG ( " " , result ) ; #endif } cleanup1 : return result ; }
Writes in the wallet storage meaning that writes in the data stream of the
 persistent object that is considerate the wallet storage.
Writes in the wallet storage meaning that writes in the data stream of the persistent object that is considerate the wallet storage .
/* Do some sanity checks */ /*
	 * Set the position of the data stream to the address indicated at
	 * the address (SET the address as a offset from the beginning of the
	 * data stream).
	 */ /*
     * Write the data in the data stream. The data to be written is pointed by
     * inputBuffer.
     */ /* Resource cleanup */