ta/wallet_ta.c
/**
  * Write the hash value into a byte array, respecting endianness. It is
  * to be used internally (only by the functions of the TA itself).
  * \param out The byte array which will receive the hash. This byte array
  *            must have space for at least 32 bytes, even if the hash
  *            function's result is smaller than 256 bits.
  * \param hs The hash state to read the hash value from.
  * \param do_write_big_endian Whether the hash should be written in a
  *                            big-endian way (useful for computing the first
  *                            hash of a double SHA-256 hash) instead of a
  *                            little-endian way (useful for sending off to a
  *                            signing function).
  * \warning The appropriate hash-specific finish function must be called before
  *			 this function.
  */
Write the hash value into a byte array, respecting endianness. It is
to be used internally (only by the functions of the TA itself).
\param out The byte array which will receive the hash. This byte array
must have space for at least 32 bytes, even if the hash
function's result is smaller than 256 bits.
\param hs The hash state to read the hash value from.
\param do_write_big_endian Whether the hash should be written in a
big-endian way (useful for computing the first
hash of a double SHA-256 hash) instead of a
little-endian way (useful for sending off to a
signing function).
\warning The appropriate hash-specific finish function must be called before
this function.
Write the hash value into a byte array respecting endianness . It is to be used internally ( only by the functions of the TA itself ) . \ param out The byte array which will receive the hash . This byte array must have space for at least 32 bytes even if the hash function ' s result is smaller than 256 bits . \ param hs The hash state to read the hash value from . \ param do_write_big_endian Whether the hash should be written in a big - endian way ( useful for computing the first hash of a double SHA - 256 hash ) instead of a little - endian way ( useful for sending off to a signing function ) . \ warning The appropriate hash - specific finish function must be called before this function .
static void write_hash_to_byte_array_internal(uint8_t * out, uint32_t * hash, bool do_write_big_endian)
{
	uint8_t i;
	if (do_write_big_endian)
	{
		for (i = 0; i < 8; i++)
			write_u32_big_endian_internal(&(out[i * 4]), hash[i]);
	}
	else
	{
		for (i = 0; i < 8; i++)
			write_u32_little_endian_internal(&(out[i * 4]), hash[7 - i]);
	}
}
static void write_hash_to_byte_array_internal ( uint8_t * out , uint32_t * hash , bool do_write_big_endian ) { uint8_t i ; if ( do_write_big_endian ) { for ( i = 0 ; i < 8 ; i ++ ) write_u32_big_endian_internal ( & ( out [ i * 4 ] ) , hash [ i ] ) ; } else { for ( i = 0 ; i < 8 ; i ++ ) write_u32_little_endian_internal ( & ( out [ i * 4 ] ) , hash [ 7 - i ] ) ; } }
Write the hash value into a byte array, respecting endianness.
Write the hash value into a byte array respecting endianness .