From 7b09e3867d1705d3d223ae5383297ee336f03149 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 17 Nov 2016 13:18:17 +0000 Subject: Restore bn_mp_add_d.c to exact copy of libtommath-1.0 version: Since the mp_clamp() function already restores the sign of it's argument to positive if c->used ==0, it is not necessary to do that twice. Therefore, the original version of the code is correct. --- libtommath/bn_mp_add_d.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index 26a165b..4d4e1df 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -37,9 +37,8 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) /* c = |a| - b */ res = mp_sub_d(a, b, c); - /* fix signs */ - a->sign = MP_NEG; - c->sign = (c->used) ? MP_NEG : MP_ZPOS; + /* fix sign */ + a->sign = c->sign = MP_NEG; /* clamp */ mp_clamp(c); -- cgit v0.12