ta/wallet_ta.c
/** Finalizes the message digest operation and produces the message hash
  * (SHA-256). It is to be used internally (only by the functions of the TA
  * itself).
  * \param session_data A data pointer to a session context.
  * \param hash Output buffer filled with the message hash.
  * \param hash_len Length of hash.
  * \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.
  */
Finalizes the message digest operation and produces the message hash
(SHA-256). It is to be used internally (only by the functions of the TA
itself).
\param session_data A data pointer to a session context.
\param hash Output buffer filled with the message hash.
\param hash_len Length of hash.
\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.
Finalizes the message digest operation and produces the message hash ( SHA - 256 ) . It is to be used internally ( only by the functions of the TA itself ) . \ param session_data A data pointer to a session context . \ param hash Output buffer filled with the message hash . \ param hash_len Length of hash . \ 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 sha256_final_internal(Session_data * session_data, uint32_t * hash, uint32_t hash_len)
{
	TEE_Result result = TEE_SUCCESS;
	uint32_t written_hash_length = hash_len;
	uint8_t h[32];
	result = TEE_DigestDoFinal(*(session_data->sha_op_internal), NULL, 0, (uint8_t*)h, &written_hash_length);
	if(result != TEE_SUCCESS)
	{
		#ifdef OP_TEE_TA
		DMSG("Failed to finalize the hashing operation (SHA-256): 0x%x", result);
		#endif
		goto cleanup1;
	}
	convert_from8_to32_BE_internal(h, hash);
	cleanup1:
		return result;
}
static TEE_Result sha256_final_internal ( Session_data * session_data , uint32_t * hash , uint32_t hash_len ) { TEE_Result result = TEE_SUCCESS ; uint32_t written_hash_length = hash_len ; uint8_t h [ 32 ] ; result = TEE_DigestDoFinal ( * ( session_data -> sha_op_internal ) , NULL , 0 , ( uint8_t * ) h , & written_hash_length ) ; if ( result != TEE_SUCCESS ) { #ifdef OP_TEE_TA DMSG ( " " , result ) ; #endif goto cleanup1 ; } convert_from8_to32_BE_internal ( h , hash ) ; cleanup1 : return result ; }
Finalizes the message digest operation and produces the message hash
 (SHA-256).
Finalizes the message digest operation and produces the message hash ( SHA - 256 ) .
/*
	 * As the output need to be in an array of 32 bit unsigned integer in
	 * big-endian format it is needed a conversion
	 */