From 584d8498f867d310a9a5b8374901c18c6ef7498c Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Thu, 16 Jan 2020 09:35:34 +1000 Subject: [PATCH] Fix for ecc and no cache resistance - set M[2] Need to have a value in order to maintain timing resistance. Small maths fails also. --- wolfcrypt/src/ecc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 5f2672322..942d67b33 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -2769,6 +2769,10 @@ int wc_ecc_mulmod_ex(mp_int* k, ecc_point *G, ecc_point *R, /* M[1] == 2G */ if (err == MP_OKAY) err = ecc_projective_dbl_point(tG, M[1], a, modulus, mp); +#ifdef WC_NO_CACHE_RESISTANT + if (err == MP_OKAY) + err = wc_ecc_copy_point(M[0], M[2]); +#endif /* setup sliding window */ mode = 0;