ta/wallet_ta.c
/** Finalize the hashing of a message by writing appropriate padding and
  * length bytes.
  * \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.
  */
Finalize the hashing of a message by writing appropriate padding and
length bytes.
\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.
Finalize the hashing of a message by writing appropriate padding and length bytes . \ 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 .
static void ripemd_160_finish_internal(HashState *hs)
{
	uint32_t length_bits;
	uint8_t i;
	uint8_t buffer[8];
	length_bits = hs->message_length << 3;
	ripemd_160_write_byte_internal(hs, (uint8_t)0x80);
	while ((hs->index_m != 14) || (hs->byte_position_m != 0))
		ripemd_160_write_byte_internal(hs, 0);
	TEE_MemFill((uint8_t*)buffer, 0, (uint32_t)8);
	write_u32_little_endian_internal(&(buffer[0]), length_bits);
	for (i = 0; i < 8; i++)
		ripemd_160_write_byte_internal(hs, buffer[i]);
	for	(i = 0; i < 5; i++)
		swap_endian_internal(&(hs->h[i]));
}
static void ripemd_160_finish_internal ( HashState * hs ) { uint32_t length_bits ; uint8_t i ; uint8_t buffer [ 8 ] ; length_bits = hs -> message_length << 3 ; ripemd_160_write_byte_internal ( hs , ( uint8_t ) 0x80 ) ; while ( ( hs -> index_m != 14 ) || ( hs -> byte_position_m != 0 ) ) ripemd_160_write_byte_internal ( hs , 0 ) ; TEE_MemFill ( ( uint8_t * ) buffer , 0 , ( uint32_t ) 8 ) ; write_u32_little_endian_internal ( & ( buffer [ 0 ] ) , length_bits ) ; for ( i = 0 ; i < 8 ; i ++ ) ripemd_160_write_byte_internal ( hs , buffer [ i ] ) ; for ( i = 0 ; i < 5 ; i ++ ) swap_endian_internal ( & ( hs -> h [ i ] ) ) ; }
Finalize the hashing of a message by writing appropriate padding and
 length bytes.
Finalize the hashing of a message by writing appropriate padding and length bytes .
/*
	 * Subsequent calls to ripemd_160_write_byte_internal() will keep incrementing
	 * message_length, so the calculation of length (in bits) must be
	 * done before padding.
	 */ /*
	 * Pad using a 1 bit followed by enough 0 bits to get the message buffer
	 * to exactly 448 bits full.
	 */ /* Write 64 bit length (in bits). */