Document mutex invariant for CTR_DRBG
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/library/ctr_drbg.c b/library/ctr_drbg.c
index 64b536a..e275f1a 100644
--- a/library/ctr_drbg.c
+++ b/library/ctr_drbg.c
@@ -99,6 +99,7 @@
return;
#if defined(MBEDTLS_THREADING_C)
+ /* The mutex is initialized iff f_entropy is set. */
if( ctx->f_entropy != NULL )
mbedtls_mutex_free( &ctx->mutex );
#endif
@@ -376,6 +377,7 @@
memset( key, 0, MBEDTLS_CTR_DRBG_KEYSIZE );
+ /* The mutex is initialized iff f_entropy is set. */
#if defined(MBEDTLS_THREADING_C)
mbedtls_mutex_init( &ctx->mutex );
#endif