summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--mpi-patches/add-mp-hash12
2 files changed, 15 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index b0dd92ec..2ce096bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-04-09 Kaz Kylheku <kaz@kylheku.com>
+
+ * mpi-patches/add-mp-hash (mp_hash): Fix incorrect
+ code on platforms where mp_digit is smaller than long.
+ This was left shifting a mp_digit by MP_DIGIT_BIT.
+ It was found by compiling on NetBSD with a gcc 4.1.3
+ which has a broken__int128_t, forcing us to use 32 bit
+ mp_digit with a 64 bit mp_word.
+
2012-04-08 Kaz Kylheku <kaz@kylheku.com>
* arith.c (bignum): Previously static function now exposed as external.
diff --git a/mpi-patches/add-mp-hash b/mpi-patches/add-mp-hash
index 63b137e9..bd5e9bfa 100644
--- a/mpi-patches/add-mp-hash
+++ b/mpi-patches/add-mp-hash
@@ -1,7 +1,7 @@
Index: mpi-1.8.6/mpi.c
===================================================================
---- mpi-1.8.6.orig/mpi.c 2012-03-04 08:51:51.607484757 -0800
-+++ mpi-1.8.6/mpi.c 2012-03-04 11:49:32.456841257 -0800
+--- mpi-1.8.6.orig/mpi.c 2012-04-05 16:26:22.206340007 -0700
++++ mpi-1.8.6/mpi.c 2012-04-09 08:59:09.673643507 -0700
@@ -1960,6 +1960,34 @@
/* }}} */
@@ -13,8 +13,8 @@ Index: mpi-1.8.6/mpi.c
+ int ix;
+
+ if (USED(a) >= 2 * SIZEOF_LONG / MP_DIGIT_SIZE) {
-+ mp_digit omega = 0;
-+ mp_digit alpha = 0;
++ unsigned long omega = 0;
++ unsigned long alpha = 0;
+ for (ix = 0; ix < SIZEOF_LONG / MP_DIGIT_SIZE; ix++)
+ omega = (omega << MP_DIGIT_BIT) | DIGIT(a, ix);
+ for (ix = USED(a) - SIZEOF_LONG / MP_DIGIT_SIZE; ix < USED(a); ix++)
@@ -39,8 +39,8 @@ Index: mpi-1.8.6/mpi.c
Index: mpi-1.8.6/mpi.h
===================================================================
---- mpi-1.8.6.orig/mpi.h 2012-03-04 08:51:51.607484757 -0800
-+++ mpi-1.8.6/mpi.h 2012-03-04 11:49:32.196695007 -0800
+--- mpi-1.8.6.orig/mpi.h 2012-04-05 16:26:22.206340007 -0700
++++ mpi-1.8.6/mpi.h 2012-04-09 08:58:17.100087507 -0700
@@ -165,6 +165,8 @@
int mp_isodd(mp_int *a);
int mp_iseven(mp_int *a);