summaryrefslogtreecommitdiffstats
path: root/libtommath
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-11 14:26:50 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-11 14:26:50 (GMT)
commite512564f360551e1821bc646ce75314246b9a0ee (patch)
tree855d2542e38d1f5c55cb823745749f8ec7f3148c /libtommath
parent99cce0ea110b9e0d8eec550f8bcc125b75940031 (diff)
parentac7ef03d8e108d7c755c1f560808429d0f4a0ce2 (diff)
downloadtcl-e512564f360551e1821bc646ce75314246b9a0ee.zip
tcl-e512564f360551e1821bc646ce75314246b9a0ee.tar.gz
tcl-e512564f360551e1821bc646ce75314246b9a0ee.tar.bz2
Merge 8.7
Diffstat (limited to 'libtommath')
-rw-r--r--libtommath/bn_mp_mul.c4
-rw-r--r--libtommath/tommath_private.h6
2 files changed, 8 insertions, 2 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
diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h
index d06bab5..a0a7a42 100644
--- a/libtommath/tommath_private.h
+++ b/libtommath/tommath_private.h
@@ -11,7 +11,7 @@
# include "../compat/stdint.h"
#endif
#endif
-#include "tommath.h"
+#include "tclTomMath.h"
#include "tommath_class.h"
#include <limits.h>
@@ -270,6 +270,10 @@ MP_DEPRECATED(s_mp_reverse) void bn_reverse(unsigned char *s, int len);
MP_ZERO_DIGITS(a->dp + a->used, a->alloc - a->used); \
}
+#ifdef _MSC_VER
+/* Prevent false positive: unary minus operator applied to unsigned type, result still unsigned */
+#pragma warning(disable: 4146)
+#endif
#define MP_SET_SIGNED(name, uname, type, utype) \
void name(mp_int * a, type b) \
{ \