summaryrefslogtreecommitdiffstats
path: root/libtommath/bn_mp_exteuclid.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtommath/bn_mp_exteuclid.c')
-rw-r--r--libtommath/bn_mp_exteuclid.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c
index 2e69ce1..fbbd92c 100644
--- a/libtommath/bn_mp_exteuclid.c
+++ b/libtommath/bn_mp_exteuclid.c
@@ -1,4 +1,4 @@
-#include <tommath.h>
+#include <tommath_private.h>
#ifdef BN_MP_EXTEUCLID_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
@@ -12,10 +12,10 @@
* The library is free for all purposes without any express
* guarantee it works.
*
- * Tom St Denis, tomstdenis@gmail.com, http://math.libtomcrypt.com
+ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/
-/* Extended euclidean algorithm of (a, b) produces
+/* Extended euclidean algorithm of (a, b) produces
a*u1 + b*u2 = u3
*/
int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3)
@@ -61,9 +61,9 @@ int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3)
/* make sure U3 >= 0 */
if (u3.sign == MP_NEG) {
- mp_neg(&u1, &u1);
- mp_neg(&u2, &u2);
- mp_neg(&u3, &u3);
+ if ((err = mp_neg(&u1, &u1)) != MP_OKAY) { goto _ERR; }
+ if ((err = mp_neg(&u2, &u2)) != MP_OKAY) { goto _ERR; }
+ if ((err = mp_neg(&u3, &u3)) != MP_OKAY) { goto _ERR; }
}
/* copy result out */
@@ -76,3 +76,7 @@ _ERR: mp_clear_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL
return err;
}
#endif
+
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */