Changed every memcpy to SCA equivalent mbedtls_platform_memcpy
This makes physical attacks more difficult.
diff --git a/library/hmac_drbg.c b/library/hmac_drbg.c
index b51e9b1..27806f3 100644
--- a/library/hmac_drbg.c
+++ b/library/hmac_drbg.c
@@ -213,7 +213,7 @@
/* 1. Concatenate entropy and additional data if any */
if( additional != NULL && len != 0 )
{
- memcpy( seed + seedlen, additional, len );
+ mbedtls_platform_memcpy( seed + seedlen, additional, len );
seedlen += len;
}
@@ -375,7 +375,7 @@
if( ( ret = mbedtls_md_hmac_finish( &ctx->md_ctx, ctx->V ) ) != 0 )
goto exit;
- memcpy( out, ctx->V, use_len );
+ mbedtls_platform_memcpy( out, ctx->V, use_len );
out += use_len;
left -= use_len;
}
@@ -547,7 +547,7 @@
unsigned char *buf, size_t len )
{
const unsigned char *p = data;
- memcpy( buf, p + test_offset, len );
+ mbedtls_platform_memcpy( buf, p + test_offset, len );
test_offset += len;
return( 0 );
}