diff --git a/ChangeLog.d/fix-ctr-drbg-may-free-invalid-aes-context.txt b/ChangeLog.d/fix-ctr-drbg-may-free-invalid-aes-context.txt new file mode 100644 index 000000000..fe62c28ed --- /dev/null +++ b/ChangeLog.d/fix-ctr-drbg-may-free-invalid-aes-context.txt @@ -0,0 +1,4 @@ +Bugfix + * Fix mbedtls_ctr_drbg_free() on an initialized but unseeded context. When + MBEDTLS_AES_ALT is enabled, it could call mbedtls_aes_free() on an + uninitialized context. diff --git a/library/ctr_drbg.c b/library/ctr_drbg.c index 75103a399..8919c78a1 100644 --- a/library/ctr_drbg.c +++ b/library/ctr_drbg.c @@ -449,8 +449,6 @@ int mbedtls_ctr_drbg_seed( mbedtls_ctr_drbg_context *ctx, mbedtls_mutex_init( &ctx->mutex ); #endif - mbedtls_aes_init( &ctx->aes_ctx ); - ctx->f_entropy = f_entropy; ctx->p_entropy = p_entropy;