ta/wallet_ta.c
/**
  * Wrapper for generate_deterministic256_internal() for a CA command.
  * \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 for generate_deterministic256_internal() for a CA command.
\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 for generate_deterministic256_internal () for a CA command . \ 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 generate_deterministic256(Session_data * session_data, uint32_t param_types, TEE_Param params[4])
{
    TEE_Result result = TEE_SUCCESS;
	uint32_t exp_param_types;
	bool gd256_result;
	exp_param_types = TEE_PARAM_TYPES(
							TEE_PARAM_TYPE_MEMREF_OUTPUT,
							TEE_PARAM_TYPE_MEMREF_INPUT,
							TEE_PARAM_TYPE_VALUE_INOUT,
							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;
	gd256_result = generate_deterministic256_internal(
							session_data,
							(BigNum256)(params[0].memref.buffer),
							(uint8_t*)(params[1].memref.buffer),
							params[2].value.a,
							false,
							NULL,
							0);
	params[2].value.b = (uint32_t)gd256_result;
	return result;
}
static TEE_Result generate_deterministic256 ( Session_data * session_data , uint32_t param_types , TEE_Param params [ 4 ] ) { TEE_Result result = TEE_SUCCESS ; uint32_t exp_param_types ; bool gd256_result ; exp_param_types = TEE_PARAM_TYPES ( TEE_PARAM_TYPE_MEMREF_OUTPUT , TEE_PARAM_TYPE_MEMREF_INPUT , TEE_PARAM_TYPE_VALUE_INOUT , 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 ; gd256_result = generate_deterministic256_internal ( session_data , ( BigNum256 ) ( params [ 0 ] . memref . buffer ) , ( uint8_t * ) ( params [ 1 ] . memref . buffer ) , params [ 2 ] . value . a , false , NULL , 0 ) ; params [ 2 ] . value . b = ( uint32_t ) gd256_result ; return result ; }
Wrapper for generate_deterministic256_internal() for a CA command.
Wrapper for generate_deterministic256_internal () for a CA command .
/*
	 * Expected:
	 * [OUT] params[0].memref.buffer -> The generated 256 bit number.
	 * [OUT] params[0].memref.size   -> Size of the generated number.
	 * [IN]  params[1].memref.buffer -> The seed for the pseudo-random number
	 *									generator
	 * [IN]  params[1].memref.size   -> Length of the seed.
	 * [IN]  params[2].value.a   	 -> The counter.
	 * [OUT] params[2].value.b   	 -> Result.
	 */ /* Some sanity checks */