summaryrefslogtreecommitdiffstats
path: root/libtommath
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-07 13:56:25 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-07 13:56:25 (GMT)
commitdd8793f10dce07f7111054c83df565e501e5f4f4 (patch)
tree0f64d1b2135d9e2d755b930f457b77035abf2bbd /libtommath
parent1a379fa9610094d9b0e8d7f07d659c0d624e4068 (diff)
downloadtcl-dd8793f10dce07f7111054c83df565e501e5f4f4.zip
tcl-dd8793f10dce07f7111054c83df565e501e5f4f4.tar.gz
tcl-dd8793f10dce07f7111054c83df565e501e5f4f4.tar.bz2
Deprecate mp_div_3(): Will be private function in future libtommath, not used in Tcl.
Deprecate mp_sqr() stub entry: Will be converted to macro calling mp_mul().
Diffstat (limited to 'libtommath')
-rw-r--r--libtommath/bn_mp_mul.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c
index c76b97d..c4890c5 100644
--- a/libtommath/bn_mp_mul.c
+++ b/libtommath/bn_mp_mul.c
@@ -12,7 +12,9 @@ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
digs = a->used + b->used + 1;
mp_sign neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG;
- if (MP_HAS(S_MP_BALANCE_MUL) &&
+ if (a == b) {
+ return mp_sqr(a,c);
+ } else if (MP_HAS(S_MP_BALANCE_MUL) &&
/* Check sizes. The smaller one needs to be larger than the Karatsuba cut-off.
* The bigger one needs to be at least about one MP_KARATSUBA_MUL_CUTOFF bigger
* to make some sense, but it depends on architecture, OS, position of the