Changed every memcmp to SCA equivalent mbedtls_platform_memcmp
This makes physical attacks more difficult.
Selftest memcmp functions were not changed.
diff --git a/library/gcm.c b/library/gcm.c
index 675926a..95586ea 100644
--- a/library/gcm.c
+++ b/library/gcm.c
@@ -823,7 +823,7 @@
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 @@
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 @@
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 @@
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;