ta/wallet_ta.c
/** Wrapper of aes_xts_internal() for a command of the CA.
  * \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.
  */
Wrapper of aes_xts_internal() for a command of the CA.
\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.
Wrapper of aes_xts_internal () for a command of the CA . \ 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 aes_xts(Session_data * session_data, uint32_t param_types, TEE_Param params[4])
{
    TEE_Result result = TEE_SUCCESS;
	uint32_t exp_param_types;
	TEE_OperationMode mode;
	exp_param_types = TEE_PARAM_TYPES(
							TEE_PARAM_TYPE_MEMREF_INOUT,
							TEE_PARAM_TYPE_MEMREF_INOUT,
							TEE_PARAM_TYPE_VALUE_INPUT,
							TEE_PARAM_TYPE_NONE);
	if (param_types != exp_param_types
	 || params[0].memref.buffer == NULL
	 || params[1].memref.buffer == NULL)
		return TEE_ERROR_BAD_PARAMETERS;
	if (params[2].value.a == (uint32_t)0)
		mode = TEE_MODE_ENCRYPT;
	else
		mode = TEE_MODE_DECRYPT;
	result = aes_xts_internal(
				session_data,
				mode,
				(uint8_t*)(params[0].memref.buffer),
				(uint32_t)(params[0].memref.size),
				(uint8_t*)(params[1].memref.buffer),
				(uint32_t)(params[1].memref.size));
	return result;
}
static TEE_Result aes_xts ( Session_data * session_data , uint32_t param_types , TEE_Param params [ 4 ] ) { TEE_Result result = TEE_SUCCESS ; uint32_t exp_param_types ; TEE_OperationMode mode ; exp_param_types = TEE_PARAM_TYPES ( TEE_PARAM_TYPE_MEMREF_INOUT , TEE_PARAM_TYPE_MEMREF_INOUT , TEE_PARAM_TYPE_VALUE_INPUT , TEE_PARAM_TYPE_NONE ) ; if ( param_types != exp_param_types || params [ 0 ] . memref . buffer == NULL || params [ 1 ] . memref . buffer == NULL ) return TEE_ERROR_BAD_PARAMETERS ; if ( params [ 2 ] . value . a == ( uint32_t ) 0 ) mode = TEE_MODE_ENCRYPT ; else mode = TEE_MODE_DECRYPT ; result = aes_xts_internal ( session_data , mode , ( uint8_t * ) ( params [ 0 ] . memref . buffer ) , ( uint32_t ) ( params [ 0 ] . memref . size ) , ( uint8_t * ) ( params [ 1 ] . memref . buffer ) , ( uint32_t ) ( params [ 1 ] . memref . size ) ) ; return result ; }
Wrapper of aes_xts_internal() for a command of the CA.
Wrapper of aes_xts_internal () for a command of the CA .
/*
     * Expected:
     * [IO]  params[0].memref.buffer -> Source data to encrypt or decrypt.
     * [IO]  params[0].memref.size   -> Size of the source data.
     * [IO]  params[1].memref.buffer -> Destination data of the encryption or
     *                                  decryption.
     * [IO]  params[1].memref.size   -> Size of destination data.
     * [IN]  params[2].value.a       -> Mode of operation (encryption or
     *                                  decryption).
     */ /* Some sanity checks */ /* Check the operation mode */ /* Call the internal function to perform the operation */