From d71d0f2cb42df5bd8798f0c18ca84ce7dfb371c4 Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 9 May 2016 13:29:25 -0700 Subject: [PATCH] Fix with fast math disabled so ecc_projective_add_point uses temp local variable for x,y,z result. --- wolfcrypt/src/ecc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index cf5989344..9167eac36 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -281,7 +281,7 @@ int ecc_projective_add_point(ecc_point* P, ecc_point* Q, ecc_point* R, mp_int* modulus, mp_digit* mp) { mp_int t1, t2; -#ifdef ALT_ECC_SIZE +#if (defined(USE_FAST_MATH) && defined(ALT_ECC_SIZE)) || !defined(USE_FAST_MATH) mp_int rx, ry, rz; #endif mp_int *x, *y, *z; @@ -313,7 +313,7 @@ int ecc_projective_add_point(ecc_point* P, ecc_point* Q, ecc_point* R, return err; } -#ifdef ALT_ECC_SIZE +#if (defined(USE_FAST_MATH) && defined(ALT_ECC_SIZE)) || !defined(USE_FAST_MATH) /* Use local stack variable */ x = ℞ y = &ry; @@ -520,7 +520,7 @@ int ecc_projective_add_point(ecc_point* P, ecc_point* Q, ecc_point* R, if (err == MP_OKAY) err = mp_div_2(y, y); -#ifdef ALT_ECC_SIZE +#if (defined(USE_FAST_MATH) && defined(ALT_ECC_SIZE)) || !defined(USE_FAST_MATH) if (err == MP_OKAY) err = mp_copy(x, R->x); if (err == MP_OKAY)