Changed every memcmp to SCA equivalent mbedtls_platform_memcmp

This makes physical attacks more difficult.
Selftest memcmp functions were not changed.
This commit is contained in:
Teppo Järvelin 2019-10-03 12:25:22 +03:00
parent 51f65e4b86
commit 61f412eb58
23 changed files with 60 additions and 60 deletions
library

View file

@ -823,7 +823,7 @@ int mbedtls_gcm_self_test( int verbose )
goto exit;
if ( memcmp( buf, ct[j * 6 + i], pt_len[i] ) != 0 ||
memcmp( tag_buf, tag[j * 6 + i], 16 ) != 0 )
memcmp( tag_buf, tag[j * 6 + i], 16 ) != 0 )
{
ret = 1;
goto exit;
@ -855,7 +855,7 @@ int mbedtls_gcm_self_test( int verbose )
goto exit;
if( memcmp( buf, pt[pt_index[i]], pt_len[i] ) != 0 ||
memcmp( tag_buf, tag[j * 6 + i], 16 ) != 0 )
memcmp( tag_buf, tag[j * 6 + i], 16 ) != 0 )
{
ret = 1;
goto exit;
@ -907,7 +907,7 @@ int mbedtls_gcm_self_test( int verbose )
goto exit;
if( memcmp( buf, ct[j * 6 + i], pt_len[i] ) != 0 ||
memcmp( tag_buf, tag[j * 6 + i], 16 ) != 0 )
memcmp( tag_buf, tag[j * 6 + i], 16 ) != 0 )
{
ret = 1;
goto exit;
@ -960,7 +960,7 @@ int mbedtls_gcm_self_test( int verbose )
goto exit;
if( memcmp( buf, pt[pt_index[i]], pt_len[i] ) != 0 ||
memcmp( tag_buf, tag[j * 6 + i], 16 ) != 0 )
memcmp( tag_buf, tag[j * 6 + i], 16 ) != 0 )
{
ret = 1;
goto exit;