From 440956f8d433a636f4b4adba6f780248fcdb8991 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 11 May 2016 08:47:30 -0700 Subject: [PATCH] Fixed new issue with ecc_projective_add_point not free'ing the local x, y, z if fast math was disabled. Formatting cleanup in integer.c. --- wolfcrypt/src/ecc.c | 4 ++++ wolfcrypt/src/integer.c | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 9167eac36..d7ef57bae 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -527,6 +527,10 @@ int ecc_projective_add_point(ecc_point* P, ecc_point* Q, ecc_point* R, err = mp_copy(y, R->y); if (err == MP_OKAY) err = mp_copy(z, R->z); + + mp_clear(x); + mp_clear(y); + mp_clear(z); #endif #ifndef USE_FAST_MATH diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index 045effb9f..8c5ff2db6 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -279,8 +279,7 @@ int mp_init_copy (mp_int * a, mp_int * b) /* copy, b = a */ -int -mp_copy (mp_int * a, mp_int * b) +int mp_copy (mp_int * a, mp_int * b) { int res, n; @@ -1806,7 +1805,7 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, /* init first cell */ if ((err = mp_init(&M[1])) != MP_OKAY) { #ifdef WOLFSSL_SMALL_STACK - XFREE(M, NULL, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(M, NULL, DYNAMIC_TYPE_TMP_BUFFER); #endif return err;