From a904cb8f3132ef191a2f3262e32ddd67e2cc82b0 Mon Sep 17 00:00:00 2001 From: manastasova Date: Mon, 13 Jan 2025 14:05:04 -0800 Subject: [PATCH 1/2] Init variable to avoid "may be used uninitialized" warning --- crypto/fipsmodule/ec/ec_montgomery.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crypto/fipsmodule/ec/ec_montgomery.c b/crypto/fipsmodule/ec/ec_montgomery.c index 92289a5ed4..83afca3ad0 100644 --- a/crypto/fipsmodule/ec/ec_montgomery.c +++ b/crypto/fipsmodule/ec/ec_montgomery.c @@ -335,7 +335,11 @@ void ec_GFp_mont_dbl(const EC_GROUP *group, EC_JACOBIAN *r, // Coq transcription and correctness proof: // // - EC_FELEM delta, gamma, beta, ftmp, ftmp2, tmptmp, alpha, fourbeta; + + // Initialize variables to avoid "may be used uninitialized" warning. + // https://github.com/aws/aws-lc/issues/1185 + EC_FELEM delta = {{0}}, gamma = {{0}}, beta = {{0}}, ftmp = {{0}}, ftmp2 = {{0}}, tmptmp = {{0}}, alpha = {{0}}, fourbeta = {{0}}; + // delta = z^2 ec_GFp_mont_felem_sqr(group, &delta, &a->Z); // gamma = y^2 From 48025561d65d5433f67439585f5962d4b5ebd841 Mon Sep 17 00:00:00 2001 From: manastasova Date: Tue, 14 Jan 2025 07:35:57 -0800 Subject: [PATCH 2/2] address comments --- crypto/fipsmodule/ec/ec_montgomery.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/fipsmodule/ec/ec_montgomery.c b/crypto/fipsmodule/ec/ec_montgomery.c index 83afca3ad0..896382b8e6 100644 --- a/crypto/fipsmodule/ec/ec_montgomery.c +++ b/crypto/fipsmodule/ec/ec_montgomery.c @@ -338,7 +338,8 @@ void ec_GFp_mont_dbl(const EC_GROUP *group, EC_JACOBIAN *r, // Initialize variables to avoid "may be used uninitialized" warning. // https://github.com/aws/aws-lc/issues/1185 - EC_FELEM delta = {{0}}, gamma = {{0}}, beta = {{0}}, ftmp = {{0}}, ftmp2 = {{0}}, tmptmp = {{0}}, alpha = {{0}}, fourbeta = {{0}}; + EC_FELEM delta = {{0}}, gamma = {{0}}, beta = {{0}}, ftmp = {{0}}; + EC_FELEM ftmp2 = {{0}}, tmptmp = {{0}}, alpha = {{0}}, fourbeta = {{0}}; // delta = z^2 ec_GFp_mont_felem_sqr(group, &delta, &a->Z);