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 | 6285bbd18905331a696ae8d31942482672261433 (patch) | |
tree | 4ec07aa4ad5cdf752c1df248b9a54a4dd6cfb167 /libtommath/bn_mp_karatsuba_sqr.c | |
parent | 12cea33504df70df1758c94a2302e367e3855e43 (diff) | |
download | tcl-6285bbd18905331a696ae8d31942482672261433.zip tcl-6285bbd18905331a696ae8d31942482672261433.tar.gz tcl-6285bbd18905331a696ae8d31942482672261433.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 $ */ |