From: Niels Möller Date: Tue, 18 Jul 2017 18:52:30 +0000 (+0200) Subject: Fix for in-place ecc_add_eh. X-Git-Tag: nettle_3.4rc1~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcda81d796de2f4a16fd7e9e7a5d07baa288f147;p=thirdparty%2Fnettle.git Fix for in-place ecc_add_eh. * ecc-add-eh.c (ecc_add_eh): Fix in-place operation by reordering two multiplies. Previously, in-place operation resulted in an invalid call to mpn_mul with overlapping operands. Reported by Sergei Trofimovich. --- diff --git a/ChangeLog b/ChangeLog index 6cdbe451..de6fc6dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-07-18 Niels Möller + + * ecc-add-eh.c (ecc_add_eh): Fix in-place operation by reordering + two multiplies. Previously, in-place operation resulted in an + invalid call to mpn_mul with overlapping operands. Reported by + Sergei Trofimovich. + 2017-06-09 Niels Möller * pss.c (pss_verify_mgf1): Check for m being too large, fixing an diff --git a/ecc-add-eh.c b/ecc-add-eh.c index a16be4cb..c07ff49a 100644 --- a/ecc-add-eh.c +++ b/ecc-add-eh.c @@ -98,8 +98,8 @@ ecc_add_eh (const struct ecc_curve *ecc, ecc_modp_mul (ecc, x3, B, z1); /* y3 */ - ecc_modp_mul (ecc, B, F, C); /* ! */ - ecc_modp_mul (ecc, y3, B, z1); + ecc_modp_mul (ecc, B, F, z1); /* ! */ + ecc_modp_mul (ecc, y3, B, C); /* Clobbers z1 in case r == p. */ /* z3 */ ecc_modp_mul (ecc, B, F, G);