ta/wallet_ta.c
/** Add one more byte to the message buffer and call ripemd_160_block_internal()
  * if the message buffer is full.
  * \param hs The hash state to act on. The hash state must be one that has
  *           been initialized using ripemd_160_begin_internal() at some time in the
  *           past.
  * \param byte The byte to add.
  */
Add one more byte to the message buffer and call ripemd_160_block_internal()
if the message buffer is full.
\param hs The hash state to act on. The hash state must be one that has
been initialized using ripemd_160_begin_internal() at some time in the
past.
\param byte The byte to add.
Add one more byte to the message buffer and call ripemd_160_block_internal () if the message buffer is full . \ param hs The hash state to act on . The hash state must be one that has been initialized using ripemd_160_begin_internal () at some time in the past . \ param byte The byte to add .
static void ripemd_160_write_byte_internal(HashState *hs, uint8_t byte)
{
	uint8_t pos; 
	hs->message_length++;
	pos = (uint8_t)(3 - hs->byte_position_m);
	switch (pos)
	{
		case 0:
			hs->m[hs->index_m] |= ((uint32_t)byte << 24);
			break;
		case 1:
			hs->m[hs->index_m] |= ((uint32_t)byte << 16);
			break;
		case 2:
			hs->m[hs->index_m] |= ((uint32_t)byte << 8);
			break;
		case 3:
		default:
			hs->m[hs->index_m] |= ((uint32_t)byte);
			break;
	}
	if (hs->byte_position_m == 3)
		hs->index_m++;
	hs->byte_position_m = (uint8_t)((hs->byte_position_m + 1) & 3);
	if (hs->index_m == 16)
	{
		ripemd_160_block_internal(hs);
		hs->index_m = 0;
		hs->byte_position_m = 0;
		TEE_MemFill((uint32_t*)(hs->m), 0, (uint32_t)sizeof(hs->m));
	}
}
static void ripemd_160_write_byte_internal ( HashState * hs , uint8_t byte ) { uint8_t pos ; hs -> message_length ++ ; pos = ( uint8_t ) ( 3 - hs -> byte_position_m ) ; switch ( pos ) { case 0 : hs -> m [ hs -> index_m ] |= ( ( uint32_t ) byte << 24 ) ; break ; case 1 : hs -> m [ hs -> index_m ] |= ( ( uint32_t ) byte << 16 ) ; break ; case 2 : hs -> m [ hs -> index_m ] |= ( ( uint32_t ) byte << 8 ) ; break ; case 3 : default : hs -> m [ hs -> index_m ] |= ( ( uint32_t ) byte ) ; break ; } if ( hs -> byte_position_m == 3 ) hs -> index_m ++ ; hs -> byte_position_m = ( uint8_t ) ( ( hs -> byte_position_m + 1 ) & 3 ) ; if ( hs -> index_m == 16 ) { ripemd_160_block_internal ( hs ) ; hs -> index_m = 0 ; hs -> byte_position_m = 0 ; TEE_MemFill ( ( uint32_t * ) ( hs -> m ) , 0 , ( uint32_t ) sizeof ( hs -> m ) ) ; } }
Add one more byte to the message buffer and call ripemd_160_block_internal()
 if the message buffer is full.
Add one more byte to the message buffer and call ripemd_160_block_internal () if the message buffer is full .
/* corrected for endianness */ /* Total size of the message processed */ /* Get the byte position within 32-bit word */ /* Shift the byte accordingly to the position */ /* Block of 16B is full, clean the message parameters */