From 6ab0f519b8c9ede36b034e93fc191b14e8843891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 26 Aug 2025 11:31:52 +0200 Subject: [PATCH] dhm: remove unused variable (and improve comment) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Pégourié-Gonnard --- library/dhm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/library/dhm.c b/library/dhm.c index 3c65bc8076..941a89da80 100644 --- a/library/dhm.c +++ b/library/dhm.c @@ -345,9 +345,6 @@ static int dhm_update_blinding(mbedtls_dhm_context *ctx, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng) { int ret; - mbedtls_mpi R; - - mbedtls_mpi_init(&R); /* * Don't use any blinding the first time a particular X is used, @@ -382,13 +379,11 @@ static int dhm_update_blinding(mbedtls_dhm_context *ctx, /* Vi = random( 2, P-2 ) */ MBEDTLS_MPI_CHK(dhm_random_below(&ctx->Vi, &ctx->P, f_rng, p_rng)); - /* Vf = Vi^-X mod P */ + /* Vf = Vi^-X = (Vi^-1)^X mod P */ MBEDTLS_MPI_CHK(mbedtls_mpi_gcd_modinv_odd(NULL, &ctx->Vf, &ctx->Vi, &ctx->P)); MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&ctx->Vf, &ctx->Vf, &ctx->X, &ctx->P, &ctx->RP)); cleanup: - mbedtls_mpi_free(&R); - return ret; }