ta/wallet_ta.c
/**
  * Executes the HMAC-SHA-512 operation.
  * \param session_data A data pointer to a session context.
  * \param out A byte array where the HMAC-SHA512 hash value will be written.
  *            This must have space for #SHA512_HASH_LENGTH bytes.
  * \param text A byte array containing the message to use in the HMAC-SHA512
  *             calculation. The message can be of any length.
  * \param text_length The length, in bytes, of the message.
  * \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.
  */
Executes the HMAC-SHA-512 operation.
\param session_data A data pointer to a session context.
\param out A byte array where the HMAC-SHA512 hash value will be written.
This must have space for #SHA512_HASH_LENGTH bytes.
\param text A byte array containing the message to use in the HMAC-SHA512
calculation. The message can be of any length.
\param text_length The length, in bytes, of the message.
\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.
Executes the HMAC - SHA - 512 operation . \ param session_data A data pointer to a session context . \ param out A byte array where the HMAC - SHA512 hash value will be written . This must have space for #SHA512_HASH_LENGTH bytes . \ param text A byte array containing the message to use in the HMAC - SHA512 calculation . The message can be of any length . \ param text_length The length in bytes of the message . \ 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 hmac_sha512_internal(Session_data * session_data, uint8_t *out, const uint8_t *text, const unsigned int text_length)
{
	TEE_Result result = TEE_SUCCESS;
	uint32_t hash_length;
    TEE_MACInit(*(session_data->hmac_op1_internal), NULL, 0);
    hash_length = SHA512_HASH_LENGTH;
    result = TEE_MACComputeFinal(*(session_data->hmac_op1_internal),
    							(uint8_t*)text,
    							(uint32_t)text_length,
    							(uint8_t*)out,
    							&hash_length);
    if (result != TEE_SUCCESS)
    {
    	#ifdef OP_TEE_TA
    	DMSG("Failed to finalize HMAC-SHA-512 operation: 0x%x", result);
    	#endif
	}
	return result;
}
static TEE_Result hmac_sha512_internal ( Session_data * session_data , uint8_t * out , const uint8_t * text , const unsigned int text_length ) { TEE_Result result = TEE_SUCCESS ; uint32_t hash_length ; TEE_MACInit ( * ( session_data -> hmac_op1_internal ) , NULL , 0 ) ; hash_length = SHA512_HASH_LENGTH ; result = TEE_MACComputeFinal ( * ( session_data -> hmac_op1_internal ) , ( uint8_t * ) text , ( uint32_t ) text_length , ( uint8_t * ) out , & hash_length ) ; if ( result != TEE_SUCCESS ) { #ifdef OP_TEE_TA DMSG ( " " , result ) ; #endif } return result ; }
Executes the HMAC-SHA-512 operation.
Executes the HMAC - SHA - 512 operation .
/* Initialize MAC operation */ /*
     * Here we could call TEE_MACUpdate but as we will use just one input message
     * it is not needed instead we could use TEE_MACComputeFinal to finalize and
     * accumulate the data.
     */ /* Define the hash size */ /* Finalize the MAC operation with a last chunk of message, and computes the MAC */