diff options
author | Kevin B Kenny <kennykb@acm.org> | 2005-09-26 16:31:55 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2005-09-26 16:31:55 (GMT) |
commit | 36537913f69228c5a11335a42637feba36c96677 (patch) | |
tree | e0c3d30912f2b67d620d935f3dead47ac4f3533d /libtommath/bn_mp_karatsuba_sqr.c | |
parent | d2b645df1ab7b43093f7553808c64fedaa3b3a49 (diff) | |
download | tcl-36537913f69228c5a11335a42637feba36c96677.zip tcl-36537913f69228c5a11335a42637feba36c96677.tar.gz tcl-36537913f69228c5a11335a42637feba36c96677.tar.bz2 |
Import of libtommath 0.36
Diffstat (limited to 'libtommath/bn_mp_karatsuba_sqr.c')
-rw-r--r-- | libtommath/bn_mp_karatsuba_sqr.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index 315ceab..3bfe157 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -80,8 +80,8 @@ int mp_karatsuba_sqr (mp_int * a, mp_int * b) if (mp_sqr (&x1, &x1x1) != MP_OKAY) goto X1X1; /* x1x1 = x1*x1 */ - /* now calc (x1-x0)**2 */ - if (mp_sub (&x1, &x0, &t1) != MP_OKAY) + /* now calc (x1+x0)**2 */ + if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) goto X1X1; /* t1 = x1 - x0 */ if (mp_sqr (&t1, &t1) != MP_OKAY) goto X1X1; /* t1 = (x1 - x0) * (x1 - x0) */ @@ -89,8 +89,8 @@ int mp_karatsuba_sqr (mp_int * a, mp_int * b) /* add x0y0 */ if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY) goto X1X1; /* t2 = x0x0 + x1x1 */ - if (mp_sub (&t2, &t1, &t1) != MP_OKAY) - goto X1X1; /* t1 = x0x0 + x1x1 - (x1-x0)*(x1-x0) */ + if (s_mp_sub (&t1, &t2, &t1) != MP_OKAY) + goto X1X1; /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */ /* shift by B */ if (mp_lshd (&t1, B) != MP_OKAY) @@ -115,3 +115,7 @@ ERR: return err; } #endif + +/* $Source: /root/tcl/repos-to-convert/tcl/libtommath/bn_mp_karatsuba_sqr.c,v $ */ +/* $Revision: 1.1.1.2 $ */ +/* $Date: 2005/09/26 16:31:56 $ */ |