ta/wallet_ta.c
/** Calculate the entropy pool checksum of an entropy pool state.
  * Without integrity checks, an attacker with access to the persistent
  * entropy pool area (in non-volatile memory) could reduce the amount of
  * entropy in the persistent pool. Even if the persistent entropy pool is
  * encrypted, an attacker could reduce the amount of entropy in the pool down
  * to the amount of entropy in the encryption key, which is probably much
  * less than 256 bits.
  * If the persistent entropy pool is unencrypted, then the checksum provides
  * no additional security. In that case, the checksum is only used to check
  * that non-volatile memory is working as expected.
  * \param out The checksum will be written here. This must be a byte array\
  *            with space for #POOL_CHECKSUM_LENGTH bytes.
  * \param pool_state The entropy pool state to calculate the checksum of.
  *                   This must be a byte array of
  *                   length #ENTROPY_POOL_LENGTH.
  */
Calculate the entropy pool checksum of an entropy pool state.
Without integrity checks, an attacker with access to the persistent
entropy pool area (in non-volatile memory) could reduce the amount of
entropy in the persistent pool. Even if the persistent entropy pool is
encrypted, an attacker could reduce the amount of entropy in the pool down
to the amount of entropy in the encryption key, which is probably much
less than 256 bits.
If the persistent entropy pool is unencrypted, then the checksum provides
no additional security. In that case, the checksum is only used to check
that non-volatile memory is working as expected.
\param out The checksum will be written here. This must be a byte array\
with space for #POOL_CHECKSUM_LENGTH bytes.
\param pool_state The entropy pool state to calculate the checksum of.
This must be a byte array of
length #ENTROPY_POOL_LENGTH.
Calculate the entropy pool checksum of an entropy pool state . Without integrity checks an attacker with access to the persistent entropy pool area ( in non - volatile memory ) could reduce the amount of entropy in the persistent pool . Even if the persistent entropy pool is encrypted an attacker could reduce the amount of entropy in the pool down to the amount of entropy in the encryption key which is probably much less than 256 bits . If the persistent entropy pool is unencrypted then the checksum provides no additional security . In that case the checksum is only used to check that non - volatile memory is working as expected . \ param out The checksum will be written here . This must be a byte array \ with space for #POOL_CHECKSUM_LENGTH bytes . \ param pool_state The entropy pool state to calculate the checksum of . This must be a byte array of length #ENTROPY_POOL_LENGTH .
static void calculate_entropy_pool_checksum_internal(uint8_t *out, uint8_t *pool_state)
{
	uint32_t h[5];
    uint8_t hash[32];
    ripemd_160_internal(pool_state, ENTROPY_POOL_LENGTH, h);
    write_hash_to_byte_array_internal(hash, h, true);
    TEE_MemMove((uint8_t*)out, (uint8_t*)hash, POOL_CHECKSUM_LENGTH);
}
static void calculate_entropy_pool_checksum_internal ( uint8_t * out , uint8_t * pool_state ) { uint32_t h [ 5 ] ; uint8_t hash [ 32 ] ; ripemd_160_internal ( pool_state , ENTROPY_POOL_LENGTH , h ) ; write_hash_to_byte_array_internal ( hash , h , true ) ; TEE_MemMove ( ( uint8_t * ) out , ( uint8_t * ) hash , POOL_CHECKSUM_LENGTH ) ; }
Calculate the entropy pool checksum of an entropy pool state.
Calculate the entropy pool checksum of an entropy pool state .
/*
     * RIPEMD-160 is used instead of SHA-256 because SHA-256 is already used
     * by getRandom256() to generate output values from the pool state.
     */