From 5521b4ce37b2b7768a66c3a2b5a2fcff200ca11a Mon Sep 17 00:00:00 2001 From: Agathiyan Bragadeesh Date: Mon, 31 Jul 2023 16:15:56 +0100 Subject: [PATCH] Assign have_rng in declaration of ecp_mul_mxz Signed-off-by: Agathiyan Bragadeesh --- library/ecp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/ecp.c b/library/ecp.c index 1cf242ae2d80..5b60291cc80f 100644 --- a/library/ecp.c +++ b/library/ecp.c @@ -2593,7 +2593,7 @@ static int ecp_mul_mxz(mbedtls_ecp_group *grp, mbedtls_ecp_point *R, void *p_rng) { int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; - int have_rng; + int have_rng = 1; size_t i; unsigned char b; mbedtls_ecp_point RP; @@ -2626,9 +2626,8 @@ static int ecp_mul_mxz(mbedtls_ecp_group *grp, mbedtls_ecp_point *R, /* RP.X might be slightly larger than P, so reduce it */ MOD_ADD(RP.X); - /* Randomize coordinates of the starting point */ - have_rng = 1; #if defined(MBEDTLS_ECP_NO_INTERNAL_RNG) + /* Derandomize coordinates of the starting point */ if (f_rng == NULL) { have_rng = 0; }