hmac_drbg: change two variables to be volatile
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
diff --git a/library/hmac_drbg.c b/library/hmac_drbg.c
index 58750c8..1336c7e 100644
--- a/library/hmac_drbg.c
+++ b/library/hmac_drbg.c
@@ -210,7 +210,7 @@
size_t seedlen = 0;
size_t total_entropy_len;
int ret = MBEDTLS_ERR_PLATFORM_FAULT_DETECTED;
- volatile const unsigned char *additional_dup = additional;
+ const unsigned char * volatile additional_dup = additional;
volatile size_t len_dup = len;
int reseed_counter_backup = -1;
@@ -417,7 +417,7 @@
mbedtls_hmac_drbg_context *ctx = (mbedtls_hmac_drbg_context *) p_rng;
size_t md_len = mbedtls_md_get_size(
mbedtls_md_get_handle( &ctx->md_ctx ) );
- size_t left = out_len;
+ volatile size_t left = out_len;
unsigned char *out = output;
/* II. Check request length */
@@ -430,8 +430,8 @@
/* 1. (aka VII and IX) Check reseed counter and PR */
if( ctx->f_entropy != NULL && /* For no-reseeding instances */
- ( ctx->prediction_resistance == MBEDTLS_HMAC_DRBG_PR_ON ||
- ctx->reseed_counter > ctx->reseed_interval ) )
+ ( ctx->prediction_resistance == MBEDTLS_HMAC_DRBG_PR_ON ||
+ ctx->reseed_counter > ctx->reseed_interval ) )
{
if( ( ret = mbedtls_hmac_drbg_reseed( ctx, additional, add_len ) ) != 0 )
return( ret );