Calculate hashes of ssl encryption and decryption keys

Optimize the key switching mechanism to set the key only if 
a different operation is performed with the context.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
Andrzej Kurek 2020-09-19 07:56:06 +02:00
parent d81351b047
commit a793237998
No known key found for this signature in database
GPG key ID: 89A90840DC388527
12 changed files with 142 additions and 44 deletions

View file

@ -442,6 +442,20 @@ struct tm *mbedtls_platform_gmtime_r( const mbedtls_time_t *tt,
}
#endif /* MBEDTLS_HAVE_TIME_DATE && MBEDTLS_PLATFORM_GMTIME_R_ALT */
#if defined(MBEDTLS_VALIDATE_AES_KEYS_INTEGRITY) || defined(MBEDTLS_VALIDATE_SSL_KEYS_INTEGRITY)
uint32_t mbedtls_hash( const void *data, size_t data_len_bytes )
{
uint32_t result = 0;
size_t i;
/* data_len_bytes - only multiples of 4 are considered, rest is truncated */
for( i = 0; i < data_len_bytes >> 2; i++ )
{
result ^= ( (uint32_t*) data )[i];
}
return result;
}
#endif
unsigned char* mbedtls_platform_put_uint32_be( unsigned char *buf,
size_t num )
{