[libntl] 01/03: Remove all patches

Julien Puydt julien.puydt at laposte.net
Mon Aug 24 17:21:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository libntl.

commit 0e42bede8fb3716d0251f1bba53b4d1a01428203
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Mon Aug 24 12:45:13 2015 +0200

    Remove all patches
---
 debian/patches/0001-gcc-4.5-mips.patch             |  48 ---
 debian/patches/0002-a-callback-for-sage.patch      |  77 ----
 .../patches/0003-replace-md5-implementation.patch  | 402 ---------------------
 debian/patches/series                              |   3 -
 include/NTL/SPMM_ASM.h                             |   9 +-
 include/NTL/tools.h                                |   6 -
 src/ZZ.c                                           | 316 +++++++++-------
 src/tools.c                                        |  27 --
 8 files changed, 187 insertions(+), 701 deletions(-)

diff --git a/debian/patches/0001-gcc-4.5-mips.patch b/debian/patches/0001-gcc-4.5-mips.patch
deleted file mode 100644
index cac901f..0000000
--- a/debian/patches/0001-gcc-4.5-mips.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 25e20161828a9f83623051ddd2c048b45b2ff979 Mon Sep 17 00:00:00 2001
-From: Aurelien Jarno <aurel32 at debian.org>
-Date: Sun, 17 Apr 2011 23:41:31 +0200
-Subject: gcc-4.5-mips
-
-Bug-Debian: 623162
-
-Since GCC 4.4 it's not possible anymore to use the 'h' constraints for
-MIPS inline assembly code when doing a multiplication. That's why sprng
-fails to build from source on mips and mipsel.
-
-That said GCC supports 32x32 => 64 multiplication on 32-bit architecture
-for a lot of time, so there is no need to use assembly code for that.
-The patch below fixes the problem by using standard multiplication
-instead of assembly code. I have also included the code for MIPS64 using
-128-bit hints for reference (the second hunk), though it is not used in
-Debian.
----
- include/NTL/SPMM_ASM.h | 9 +++++----
- 1 file changed, 5 insertions(+), 4 deletions(-)
-
-diff --git a/include/NTL/SPMM_ASM.h b/include/NTL/SPMM_ASM.h
-index dc0bfb9..9ff7942 100644
---- a/include/NTL/SPMM_ASM.h
-+++ b/include/NTL/SPMM_ASM.h
-@@ -147,8 +147,8 @@ static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
- 
- static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
- {
--   unsigned long hi, lo;
--   __asm__ ("multu %2,%3" : "=l" (lo), "=h" (hi) : "d" (a), "d" (b));
-+   unsigned long hi;
-+   hi = ((unsigned long long) a * b) >> 32;
-    return hi;
- } 
- 
-@@ -159,8 +159,9 @@ static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
- 
- static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
- {
--   unsigned long hi, lo;
--   __asm__ ("dmultu %2,%3" : "=l" (lo), "=h" (hi) : "d" (a), "d" (b));
-+   typedef unsigned int uint128_t __attribute__((mode(TI)));
-+   unsigned long hi;
-+   hi = ((uint128_t) a * b) >> 64;
-    return hi;
- }
- 
diff --git a/debian/patches/0002-a-callback-for-sage.patch b/debian/patches/0002-a-callback-for-sage.patch
deleted file mode 100644
index 2cbf6e5..0000000
--- a/debian/patches/0002-a-callback-for-sage.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-From 55fce221fee2063e886e2a1c516842b0fc738053 Mon Sep 17 00:00:00 2001
-From: Felix Salfelder <salfelder at em.cs.uni-frankfurt.de>
-Date: Thu, 26 Jan 2012 21:34:21 +0100
-Subject: a callback for sage
-
-(from sage-4.7.tar/spkg/ntl/dist/debian)
-
- We add a SetErrorCallbackFunction(). This sets a global callback function _function_,
- which gets called with parameter _context_ and an error message string whenever Error()
- gets called.
-
- Note that if the custom error handler *returns*, then NTL will dump the error message
- back to stderr and abort() as it habitually does.
-
- -- David Harvey (2008-04-12)
----
- include/NTL/tools.h |  6 ++++++
- src/tools.c         | 27 +++++++++++++++++++++++++++
- 2 files changed, 33 insertions(+)
-
-diff --git a/include/NTL/tools.h b/include/NTL/tools.h
-index d79ea43..ca41173 100644
---- a/include/NTL/tools.h
-+++ b/include/NTL/tools.h
-@@ -310,6 +310,12 @@ long CharToIntVal(long c);
- char IntValToChar(long a);
- 
- 
-+/*
-+  This function is not present in vanilla NTL 5.4.2.
-+  See tools.c for documentation.
-+ */
-+void SetErrorCallbackFunction(void (*func)(const char *s, void *context), void *context);
-+
- 
- void Error(const char *s);
- 
-diff --git a/src/tools.c b/src/tools.c
-index 36c956b..f05f557 100644
---- a/src/tools.c
-+++ b/src/tools.c
-@@ -18,8 +18,35 @@ NTL_START_IMPL
- NTL_THREAD_LOCAL void (*ErrorCallback)() = 0;
- 
- 
-+/*
-+   The following code differs from vanilla NTL 5.4.2.
-+
-+   We add a SetErrorCallbackFunction(). This sets a global callback function _function_,
-+   which gets called with parameter _context_ and an error message string whenever Error()
-+   gets called.
-+
-+   Note that if the custom error handler *returns*, then NTL will dump the error message
-+   back to stderr and abort() as it habitually does.
-+
-+   -- David Harvey (2008-04-12)
-+*/
-+
-+void (*ErrorCallbackFunction)(const char*, void*) = NULL;
-+void *ErrorCallbackContext = NULL;
-+
-+
-+void SetErrorCallbackFunction(void (*function)(const char*, void*), void *context)
-+{
-+   ErrorCallbackFunction = function;
-+   ErrorCallbackContext = context;
-+}
-+
-+
- void Error(const char *s)
- {
-+   if (ErrorCallbackFunction != NULL)
-+      ErrorCallbackFunction(s, ErrorCallbackContext);
-+
-    cerr << s << "\n";
-    _ntl_abort();
- }
diff --git a/debian/patches/0003-replace-md5-implementation.patch b/debian/patches/0003-replace-md5-implementation.patch
deleted file mode 100644
index 2163733..0000000
--- a/debian/patches/0003-replace-md5-implementation.patch
+++ /dev/null
@@ -1,402 +0,0 @@
-From a30639584ce76b2b2aa6b237a61d31744fd3f748 Mon Sep 17 00:00:00 2001
-From: "Bernhard R. Link" <brlink at debian.org>
-Date: Sat, 11 Feb 2012 10:35:46 +0100
-Subject: replace md5 implementation
-
-Replace RSA's md5 implementation with a public domain one to
-get rid of the advertisement clause.
----
- src/ZZ.c | 316 +++++++++++++++++++++++++++------------------------------------
- 1 file changed, 133 insertions(+), 183 deletions(-)
-
-diff --git a/src/ZZ.c b/src/ZZ.c
-index 054259b..4af7952 100644
---- a/src/ZZ.c
-+++ b/src/ZZ.c
-@@ -1331,207 +1331,157 @@ long power_long(long a, long e)
- // which I've modified to work on 64-bit machines
- 
- 
-+#ifndef uint32
-+# if NTL_BITS_PER_INT == 32
-+typedef unsigned int uint32;
-+# elif NTL_BITS_PER_LONG == 32
-+typedef unsigned long uint32;
-+# else
-+#  error unable to find 32 bit type
-+# endif
-+#endif
- /*
-- *  BEGIN RSA's md5 stuff
-+ *  BEGIN md5 stuff
-  *
-  */
- 
- /*
-- **********************************************************************
-- ** md5.c                                                            **
-- ** RSA Data Security, Inc. MD5 Message Digest Algorithm             **
-- ** Created: 2/17/90 RLR                                             **
-- ** Revised: 1/91 SRD,AJ,BSK,JT Reference C Version                  **
-- **********************************************************************
-+ * This code implements the MD5 message-digest algorithm.
-+ * The algorithm is due to Ron Rivest.  This code was
-+ * written by Colin Plumb in 1993, no copyright is claimed.
-+ * This code is in the public domain; do with it what you wish.
-+ *
-+ * Equivalent code is available from RSA Data Security, Inc.
-+ * This code has been tested against that, and is equivalent,
-+ * except that you don't need to include two pages of legalese
-+ * with every copy.
-+ *
-+ Modified to only contain the functions needed here.
-  */
- 
- /*
-- **********************************************************************
-- ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
-- **                                                                  **
-- ** License to copy and use this software is granted provided that   **
-- ** it is identified as the "RSA Data Security, Inc. MD5 Message     **
-- ** Digest Algorithm" in all material mentioning or referencing this **
-- ** software or this function.                                       **
-- **                                                                  **
-- ** License is also granted to make and use derivative works         **
-- ** provided that such works are identified as "derived from the RSA **
-- ** Data Security, Inc. MD5 Message Digest Algorithm" in all         **
-- ** material mentioning or referencing the derived work.             **
-- **                                                                  **
-- ** RSA Data Security, Inc. makes no representations concerning      **
-- ** either the merchantability of this software or the suitability   **
-- ** of this software for any particular purpose.  It is provided "as **
-- ** is" without express or implied warranty of any kind.             **
-- **                                                                  **
-- ** These notices must be retained in any copies of any part of this **
-- ** documentation and/or software.                                   **
-- **********************************************************************
-+ * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
-+ * initialization constants.
-  */
--
--
--#if (NTL_BITS_PER_LONG <= 32)
--#define TRUNC32(x) (x)
--#else
--#define TRUNC32(x) ((x) & ((1UL << 32)-1UL))
--#endif
--
--/* F, G and H are basic MD5 functions: selection, majority, parity */
--#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
--#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
--#define H(x, y, z) ((x) ^ (y) ^ (z))
--#define I(x, y, z) (TRUNC32((y) ^ ((x) | (~z)))) 
--
--/* ROTATE_LEFT rotates x left n bits */
--#define ROTATE_LEFT(x, n) (TRUNC32(((x) << (n)) | ((x) >> (32-(n)))))
--
--/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */
--/* Rotation is separate from addition to prevent recomputation */
--#define FF(a, b, c, d, x, s, ac) \
--  {(a) = TRUNC32((a) + F((b), (c), (d)) + (x) + (ac)); \
--   (a) = ROTATE_LEFT((a), (s)); \
--   (a) = TRUNC32((a) + (b)); \
--  }
--#define GG(a, b, c, d, x, s, ac) \
--  {(a) = TRUNC32((a) + G((b), (c), (d)) + (x) + (ac)); \
--   (a) = ROTATE_LEFT((a), (s)); \
--   (a) = TRUNC32((a) + (b)); \
--  }
--#define HH(a, b, c, d, x, s, ac) \
--  {(a) = TRUNC32((a) + H((b), (c), (d)) + (x) + (ac)); \
--   (a) = ROTATE_LEFT((a), (s)); \
--   (a) = TRUNC32((a) + (b)); \
--  }
--#define II(a, b, c, d, x, s, ac) \
--  {(a) = TRUNC32((a) + I((b), (c), (d)) + (x) + (ac)); \
--   (a) = ROTATE_LEFT((a), (s)); \
--   (a) = TRUNC32((a) + (b)); \
--  }
--
--
--
- static
--void MD5_default_IV(unsigned long *buf)
-+void MD5Init(uint32 buf[4])
- {
--   buf[0] = 0x67452301UL;
--   buf[1] = 0xefcdab89UL;
--   buf[2] = 0x98badcfeUL;
--   buf[3] = 0x10325476UL;
-+    buf[0] = 0x67452301U;
-+    buf[1] = 0xefcdab89U;
-+    buf[2] = 0x98badcfeU;
-+    buf[3] = 0x10325476U;
- }
- 
-+/* The four core functions - F1 is optimized somewhat */
- 
-+/* #define F1(x, y, z) (x & y | ~x & z) */
-+#define F1(x, y, z) (z ^ (x & (y ^ z)))
-+#define F2(x, y, z) F1(z, x, y)
-+#define F3(x, y, z) (x ^ y ^ z)
-+#define F4(x, y, z) (y ^ (x | ~z))
- 
--/* Basic MD5 step. Transform buf based on in.
-- */
-+/* This is the central step in the MD5 algorithm. */
-+#define MD5STEP(f, w, x, y, z, data, s) \
-+	( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
- 
-+/*
-+ * The core of the MD5 algorithm, this alters an existing MD5 hash to
-+ * reflect the addition of 16 longwords of new data.  MD5Update blocks
-+ * the data and converts bytes into longwords for this routine.
-+ */
- static
--void MD5_compress(unsigned long *buf, unsigned long *in)
--{
--  unsigned long a = buf[0], b = buf[1], c = buf[2], d = buf[3];
--
--  /* Round 1 */
--#define S11 7
--#define S12 12
--#define S13 17
--#define S14 22
--  FF ( a, b, c, d, in[ 0], S11, 3614090360UL); /* 1 */
--  FF ( d, a, b, c, in[ 1], S12, 3905402710UL); /* 2 */
--  FF ( c, d, a, b, in[ 2], S13,  606105819UL); /* 3 */
--  FF ( b, c, d, a, in[ 3], S14, 3250441966UL); /* 4 */
--  FF ( a, b, c, d, in[ 4], S11, 4118548399UL); /* 5 */
--  FF ( d, a, b, c, in[ 5], S12, 1200080426UL); /* 6 */
--  FF ( c, d, a, b, in[ 6], S13, 2821735955UL); /* 7 */
--  FF ( b, c, d, a, in[ 7], S14, 4249261313UL); /* 8 */
--  FF ( a, b, c, d, in[ 8], S11, 1770035416UL); /* 9 */
--  FF ( d, a, b, c, in[ 9], S12, 2336552879UL); /* 10 */
--  FF ( c, d, a, b, in[10], S13, 4294925233UL); /* 11 */
--  FF ( b, c, d, a, in[11], S14, 2304563134UL); /* 12 */
--  FF ( a, b, c, d, in[12], S11, 1804603682UL); /* 13 */
--  FF ( d, a, b, c, in[13], S12, 4254626195UL); /* 14 */
--  FF ( c, d, a, b, in[14], S13, 2792965006UL); /* 15 */
--  FF ( b, c, d, a, in[15], S14, 1236535329UL); /* 16 */
--
--  /* Round 2 */
--#define S21 5
--#define S22 9
--#define S23 14
--#define S24 20
--  GG ( a, b, c, d, in[ 1], S21, 4129170786UL); /* 17 */
--  GG ( d, a, b, c, in[ 6], S22, 3225465664UL); /* 18 */
--  GG ( c, d, a, b, in[11], S23,  643717713UL); /* 19 */
--  GG ( b, c, d, a, in[ 0], S24, 3921069994UL); /* 20 */
--  GG ( a, b, c, d, in[ 5], S21, 3593408605UL); /* 21 */
--  GG ( d, a, b, c, in[10], S22,   38016083UL); /* 22 */
--  GG ( c, d, a, b, in[15], S23, 3634488961UL); /* 23 */
--  GG ( b, c, d, a, in[ 4], S24, 3889429448UL); /* 24 */
--  GG ( a, b, c, d, in[ 9], S21,  568446438UL); /* 25 */
--  GG ( d, a, b, c, in[14], S22, 3275163606UL); /* 26 */
--  GG ( c, d, a, b, in[ 3], S23, 4107603335UL); /* 27 */
--  GG ( b, c, d, a, in[ 8], S24, 1163531501UL); /* 28 */
--  GG ( a, b, c, d, in[13], S21, 2850285829UL); /* 29 */
--  GG ( d, a, b, c, in[ 2], S22, 4243563512UL); /* 30 */
--  GG ( c, d, a, b, in[ 7], S23, 1735328473UL); /* 31 */
--  GG ( b, c, d, a, in[12], S24, 2368359562UL); /* 32 */
--
--  /* Round 3 */
--#define S31 4
--#define S32 11
--#define S33 16
--#define S34 23
--  HH ( a, b, c, d, in[ 5], S31, 4294588738UL); /* 33 */
--  HH ( d, a, b, c, in[ 8], S32, 2272392833UL); /* 34 */
--  HH ( c, d, a, b, in[11], S33, 1839030562UL); /* 35 */
--  HH ( b, c, d, a, in[14], S34, 4259657740UL); /* 36 */
--  HH ( a, b, c, d, in[ 1], S31, 2763975236UL); /* 37 */
--  HH ( d, a, b, c, in[ 4], S32, 1272893353UL); /* 38 */
--  HH ( c, d, a, b, in[ 7], S33, 4139469664UL); /* 39 */
--  HH ( b, c, d, a, in[10], S34, 3200236656UL); /* 40 */
--  HH ( a, b, c, d, in[13], S31,  681279174UL); /* 41 */
--  HH ( d, a, b, c, in[ 0], S32, 3936430074UL); /* 42 */
--  HH ( c, d, a, b, in[ 3], S33, 3572445317UL); /* 43 */
--  HH ( b, c, d, a, in[ 6], S34,   76029189UL); /* 44 */
--  HH ( a, b, c, d, in[ 9], S31, 3654602809UL); /* 45 */
--  HH ( d, a, b, c, in[12], S32, 3873151461UL); /* 46 */
--  HH ( c, d, a, b, in[15], S33,  530742520UL); /* 47 */
--  HH ( b, c, d, a, in[ 2], S34, 3299628645UL); /* 48 */
--
--  /* Round 4 */
--#define S41 6
--#define S42 10
--#define S43 15
--#define S44 21
--  II ( a, b, c, d, in[ 0], S41, 4096336452UL); /* 49 */
--  II ( d, a, b, c, in[ 7], S42, 1126891415UL); /* 50 */
--  II ( c, d, a, b, in[14], S43, 2878612391UL); /* 51 */
--  II ( b, c, d, a, in[ 5], S44, 4237533241UL); /* 52 */
--  II ( a, b, c, d, in[12], S41, 1700485571UL); /* 53 */
--  II ( d, a, b, c, in[ 3], S42, 2399980690UL); /* 54 */
--  II ( c, d, a, b, in[10], S43, 4293915773UL); /* 55 */
--  II ( b, c, d, a, in[ 1], S44, 2240044497UL); /* 56 */
--  II ( a, b, c, d, in[ 8], S41, 1873313359UL); /* 57 */
--  II ( d, a, b, c, in[15], S42, 4264355552UL); /* 58 */
--  II ( c, d, a, b, in[ 6], S43, 2734768916UL); /* 59 */
--  II ( b, c, d, a, in[13], S44, 1309151649UL); /* 60 */
--  II ( a, b, c, d, in[ 4], S41, 4149444226UL); /* 61 */
--  II ( d, a, b, c, in[11], S42, 3174756917UL); /* 62 */
--  II ( c, d, a, b, in[ 2], S43,  718787259UL); /* 63 */
--  II ( b, c, d, a, in[ 9], S44, 3951481745UL); /* 64 */
--
--  buf[0] = TRUNC32(buf[0] + a);
--  buf[1] = TRUNC32(buf[1] + b);
--  buf[2] = TRUNC32(buf[2] + c);
--  buf[3] = TRUNC32(buf[3] + d);
-+void MD5Transform(uint32 buf[4], uint32 const in[16])
-+{
-+    register uint32 a, b, c, d;
-+
-+    a = buf[0];
-+    b = buf[1];
-+    c = buf[2];
-+    d = buf[3];
-+
-+    MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478U, 7);
-+    MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756U, 12);
-+    MD5STEP(F1, c, d, a, b, in[2] + 0x242070dbU, 17);
-+    MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceeeU, 22);
-+    MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0fafU, 7);
-+    MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62aU, 12);
-+    MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613U, 17);
-+    MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501U, 22);
-+    MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8U, 7);
-+    MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7afU, 12);
-+    MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1U, 17);
-+    MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7beU, 22);
-+    MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122U, 7);
-+    MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193U, 12);
-+    MD5STEP(F1, c, d, a, b, in[14] + 0xa679438eU, 17);
-+    MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821U, 22);
-+
-+    MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562U, 5);
-+    MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340U, 9);
-+    MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51U, 14);
-+    MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aaU, 20);
-+    MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105dU, 5);
-+    MD5STEP(F2, d, a, b, c, in[10] + 0x02441453U, 9);
-+    MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
-+    MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8U, 20);
-+    MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6U, 5);
-+    MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6U, 9);
-+    MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87U, 14);
-+    MD5STEP(F2, b, c, d, a, in[8] + 0x455a14edU, 20);
-+    MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905U, 5);
-+    MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8U, 9);
-+    MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9U, 14);
-+    MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8aU, 20);
-+
-+    MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942U, 4);
-+    MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681U, 11);
-+    MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122U, 16);
-+    MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380cU, 23);
-+    MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44U, 4);
-+    MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9U, 11);
-+    MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60U, 16);
-+    MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70U, 23);
-+    MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6U, 4);
-+    MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127faU, 11);
-+    MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085U, 16);
-+    MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05U, 23);
-+    MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039U, 4);
-+    MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5U, 11);
-+    MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8U, 16);
-+    MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665U, 23);
-+
-+    MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244U, 6);
-+    MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97U, 10);
-+    MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7U, 15);
-+    MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039U, 21);
-+    MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3U, 6);
-+    MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92U, 10);
-+    MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47dU, 15);
-+    MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1U, 21);
-+    MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4fU, 6);
-+    MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0U, 10);
-+    MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314U, 15);
-+    MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1U, 21);
-+    MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82U, 6);
-+    MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235U, 10);
-+    MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bbU, 15);
-+    MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391U, 21);
-+
-+    buf[0] += a;
-+    buf[1] += b;
-+    buf[2] += c;
-+    buf[3] += d;
- }
- 
- 
- /*
-- *  END RSA's md5 stuff
-+ *  END md5 stuff
-  *
-  */
- 
- 
- static
--void words_from_bytes(unsigned long *txtl, const unsigned char *txtc, long n)
-+void words_from_bytes(uint32 *txtl, unsigned char *txtc, long n)
- {
-    long i;
-    unsigned long v;
-@@ -1546,7 +1496,7 @@ void words_from_bytes(unsigned long *txtl, const unsigned char *txtc, long n)
- }
- 
- static 
--void bytes_from_words(unsigned char *txtc, const unsigned long *txtl, long n)
-+void bytes_from_words(unsigned char *txtc, uint32 *txtl, long n)
- {
-    long i;
-    unsigned long v;
-@@ -1565,9 +1515,9 @@ void bytes_from_words(unsigned char *txtc, const unsigned long *txtl, long n)
- 
- 
- static
--void MD5_compress1(unsigned long *buf, unsigned char *in, long n)
-+void MD5_compress1(uint32 *buf, unsigned char *in, long n)
- {
--   unsigned long txtl[16];
-+   uint32 txtl[16];
-    unsigned char txtc[64]; 
-    long i, j, k;
- 
-@@ -1582,7 +1532,7 @@ void MD5_compress1(unsigned long *buf, unsigned char *in, long n)
-       for (; j < 64; j++)
-          txtc[j] = 0;
-       words_from_bytes(txtl, txtc, 16);
--      MD5_compress(buf, txtl);
-+      MD5Transform(buf, txtl);
-       i += k;
-    }
- }
-@@ -1667,7 +1617,7 @@ void arc4(unsigned char *buffer_ptr, long buffer_len, _ZZ_arc4_key *key)
- NTL_THREAD_LOCAL static long ran_initialized = 0;
- NTL_THREAD_LOCAL static _ZZ_arc4_key ran_key;
- 
--static const unsigned long default_md5_tab[16] = {
-+static uint32 default_md5_tab[16] = {
- 744663023UL, 1011602954UL, 3163087192UL, 3383838527UL, 
- 3305324122UL, 3197458079UL, 2266495600UL, 2760303563UL, 
- 346234297UL, 1919920720UL, 1896169861UL, 2192176675UL, 
-@@ -1691,11 +1641,11 @@ void build_arc4_tab(unsigned char *seed_bytes, const ZZ& s)
- 
-    bytes_from_words(txt + nb + 4, default_md5_tab, 16);
- 
--   unsigned long buf[4];
-+   uint32 buf[4];
- 
--   unsigned long i;
-+   uint32 i;
-    for (i = 0; i < 16; i++) {
--      MD5_default_IV(buf);
-+      MD5Init(buf);
-       bytes_from_words(txt, &i, 1);
- 
-       MD5_compress1(buf, txt, nb + 68);
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index 6c5f433..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1,3 +0,0 @@
-0001-gcc-4.5-mips.patch
-0002-a-callback-for-sage.patch
-0003-replace-md5-implementation.patch
diff --git a/include/NTL/SPMM_ASM.h b/include/NTL/SPMM_ASM.h
index 9ff7942..dc0bfb9 100644
--- a/include/NTL/SPMM_ASM.h
+++ b/include/NTL/SPMM_ASM.h
@@ -147,8 +147,8 @@ static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
 
 static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
 {
-   unsigned long hi;
-   hi = ((unsigned long long) a * b) >> 32;
+   unsigned long hi, lo;
+   __asm__ ("multu %2,%3" : "=l" (lo), "=h" (hi) : "d" (a), "d" (b));
    return hi;
 } 
 
@@ -159,9 +159,8 @@ static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
 
 static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
 {
-   typedef unsigned int uint128_t __attribute__((mode(TI)));
-   unsigned long hi;
-   hi = ((uint128_t) a * b) >> 64;
+   unsigned long hi, lo;
+   __asm__ ("dmultu %2,%3" : "=l" (lo), "=h" (hi) : "d" (a), "d" (b));
    return hi;
 }
 
diff --git a/include/NTL/tools.h b/include/NTL/tools.h
index ca41173..d79ea43 100644
--- a/include/NTL/tools.h
+++ b/include/NTL/tools.h
@@ -310,12 +310,6 @@ long CharToIntVal(long c);
 char IntValToChar(long a);
 
 
-/*
-  This function is not present in vanilla NTL 5.4.2.
-  See tools.c for documentation.
- */
-void SetErrorCallbackFunction(void (*func)(const char *s, void *context), void *context);
-
 
 void Error(const char *s);
 
diff --git a/src/ZZ.c b/src/ZZ.c
index 4af7952..054259b 100644
--- a/src/ZZ.c
+++ b/src/ZZ.c
@@ -1331,157 +1331,207 @@ long power_long(long a, long e)
 // which I've modified to work on 64-bit machines
 
 
-#ifndef uint32
-# if NTL_BITS_PER_INT == 32
-typedef unsigned int uint32;
-# elif NTL_BITS_PER_LONG == 32
-typedef unsigned long uint32;
-# else
-#  error unable to find 32 bit type
-# endif
-#endif
 /*
- *  BEGIN md5 stuff
+ *  BEGIN RSA's md5 stuff
  *
  */
 
 /*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest.  This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- Modified to only contain the functions needed here.
+ **********************************************************************
+ ** md5.c                                                            **
+ ** RSA Data Security, Inc. MD5 Message Digest Algorithm             **
+ ** Created: 2/17/90 RLR                                             **
+ ** Revised: 1/91 SRD,AJ,BSK,JT Reference C Version                  **
+ **********************************************************************
  */
 
 /*
- * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
- * initialization constants.
+ **********************************************************************
+ ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
+ **                                                                  **
+ ** License to copy and use this software is granted provided that   **
+ ** it is identified as the "RSA Data Security, Inc. MD5 Message     **
+ ** Digest Algorithm" in all material mentioning or referencing this **
+ ** software or this function.                                       **
+ **                                                                  **
+ ** License is also granted to make and use derivative works         **
+ ** provided that such works are identified as "derived from the RSA **
+ ** Data Security, Inc. MD5 Message Digest Algorithm" in all         **
+ ** material mentioning or referencing the derived work.             **
+ **                                                                  **
+ ** RSA Data Security, Inc. makes no representations concerning      **
+ ** either the merchantability of this software or the suitability   **
+ ** of this software for any particular purpose.  It is provided "as **
+ ** is" without express or implied warranty of any kind.             **
+ **                                                                  **
+ ** These notices must be retained in any copies of any part of this **
+ ** documentation and/or software.                                   **
+ **********************************************************************
  */
+
+
+#if (NTL_BITS_PER_LONG <= 32)
+#define TRUNC32(x) (x)
+#else
+#define TRUNC32(x) ((x) & ((1UL << 32)-1UL))
+#endif
+
+/* F, G and H are basic MD5 functions: selection, majority, parity */
+#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
+#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+#define I(x, y, z) (TRUNC32((y) ^ ((x) | (~z)))) 
+
+/* ROTATE_LEFT rotates x left n bits */
+#define ROTATE_LEFT(x, n) (TRUNC32(((x) << (n)) | ((x) >> (32-(n)))))
+
+/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */
+/* Rotation is separate from addition to prevent recomputation */
+#define FF(a, b, c, d, x, s, ac) \
+  {(a) = TRUNC32((a) + F((b), (c), (d)) + (x) + (ac)); \
+   (a) = ROTATE_LEFT((a), (s)); \
+   (a) = TRUNC32((a) + (b)); \
+  }
+#define GG(a, b, c, d, x, s, ac) \
+  {(a) = TRUNC32((a) + G((b), (c), (d)) + (x) + (ac)); \
+   (a) = ROTATE_LEFT((a), (s)); \
+   (a) = TRUNC32((a) + (b)); \
+  }
+#define HH(a, b, c, d, x, s, ac) \
+  {(a) = TRUNC32((a) + H((b), (c), (d)) + (x) + (ac)); \
+   (a) = ROTATE_LEFT((a), (s)); \
+   (a) = TRUNC32((a) + (b)); \
+  }
+#define II(a, b, c, d, x, s, ac) \
+  {(a) = TRUNC32((a) + I((b), (c), (d)) + (x) + (ac)); \
+   (a) = ROTATE_LEFT((a), (s)); \
+   (a) = TRUNC32((a) + (b)); \
+  }
+
+
+
 static
-void MD5Init(uint32 buf[4])
+void MD5_default_IV(unsigned long *buf)
 {
-    buf[0] = 0x67452301U;
-    buf[1] = 0xefcdab89U;
-    buf[2] = 0x98badcfeU;
-    buf[3] = 0x10325476U;
+   buf[0] = 0x67452301UL;
+   buf[1] = 0xefcdab89UL;
+   buf[2] = 0x98badcfeUL;
+   buf[3] = 0x10325476UL;
 }
 
-/* The four core functions - F1 is optimized somewhat */
 
-/* #define F1(x, y, z) (x & y | ~x & z) */
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define F2(x, y, z) F1(z, x, y)
-#define F3(x, y, z) (x ^ y ^ z)
-#define F4(x, y, z) (y ^ (x | ~z))
 
-/* This is the central step in the MD5 algorithm. */
-#define MD5STEP(f, w, x, y, z, data, s) \
-	( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
-
-/*
- * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data.  MD5Update blocks
- * the data and converts bytes into longwords for this routine.
+/* Basic MD5 step. Transform buf based on in.
  */
+
 static
-void MD5Transform(uint32 buf[4], uint32 const in[16])
-{
-    register uint32 a, b, c, d;
-
-    a = buf[0];
-    b = buf[1];
-    c = buf[2];
-    d = buf[3];
-
-    MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478U, 7);
-    MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756U, 12);
-    MD5STEP(F1, c, d, a, b, in[2] + 0x242070dbU, 17);
-    MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceeeU, 22);
-    MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0fafU, 7);
-    MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62aU, 12);
-    MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613U, 17);
-    MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501U, 22);
-    MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8U, 7);
-    MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7afU, 12);
-    MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1U, 17);
-    MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7beU, 22);
-    MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122U, 7);
-    MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193U, 12);
-    MD5STEP(F1, c, d, a, b, in[14] + 0xa679438eU, 17);
-    MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821U, 22);
-
-    MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562U, 5);
-    MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340U, 9);
-    MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51U, 14);
-    MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aaU, 20);
-    MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105dU, 5);
-    MD5STEP(F2, d, a, b, c, in[10] + 0x02441453U, 9);
-    MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
-    MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8U, 20);
-    MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6U, 5);
-    MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6U, 9);
-    MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87U, 14);
-    MD5STEP(F2, b, c, d, a, in[8] + 0x455a14edU, 20);
-    MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905U, 5);
-    MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8U, 9);
-    MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9U, 14);
-    MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8aU, 20);
-
-    MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942U, 4);
-    MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681U, 11);
-    MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122U, 16);
-    MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380cU, 23);
-    MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44U, 4);
-    MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9U, 11);
-    MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60U, 16);
-    MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70U, 23);
-    MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6U, 4);
-    MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127faU, 11);
-    MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085U, 16);
-    MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05U, 23);
-    MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039U, 4);
-    MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5U, 11);
-    MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8U, 16);
-    MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665U, 23);
-
-    MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244U, 6);
-    MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97U, 10);
-    MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7U, 15);
-    MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039U, 21);
-    MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3U, 6);
-    MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92U, 10);
-    MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47dU, 15);
-    MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1U, 21);
-    MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4fU, 6);
-    MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0U, 10);
-    MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314U, 15);
-    MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1U, 21);
-    MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82U, 6);
-    MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235U, 10);
-    MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bbU, 15);
-    MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391U, 21);
-
-    buf[0] += a;
-    buf[1] += b;
-    buf[2] += c;
-    buf[3] += d;
+void MD5_compress(unsigned long *buf, unsigned long *in)
+{
+  unsigned long a = buf[0], b = buf[1], c = buf[2], d = buf[3];
+
+  /* Round 1 */
+#define S11 7
+#define S12 12
+#define S13 17
+#define S14 22
+  FF ( a, b, c, d, in[ 0], S11, 3614090360UL); /* 1 */
+  FF ( d, a, b, c, in[ 1], S12, 3905402710UL); /* 2 */
+  FF ( c, d, a, b, in[ 2], S13,  606105819UL); /* 3 */
+  FF ( b, c, d, a, in[ 3], S14, 3250441966UL); /* 4 */
+  FF ( a, b, c, d, in[ 4], S11, 4118548399UL); /* 5 */
+  FF ( d, a, b, c, in[ 5], S12, 1200080426UL); /* 6 */
+  FF ( c, d, a, b, in[ 6], S13, 2821735955UL); /* 7 */
+  FF ( b, c, d, a, in[ 7], S14, 4249261313UL); /* 8 */
+  FF ( a, b, c, d, in[ 8], S11, 1770035416UL); /* 9 */
+  FF ( d, a, b, c, in[ 9], S12, 2336552879UL); /* 10 */
+  FF ( c, d, a, b, in[10], S13, 4294925233UL); /* 11 */
+  FF ( b, c, d, a, in[11], S14, 2304563134UL); /* 12 */
+  FF ( a, b, c, d, in[12], S11, 1804603682UL); /* 13 */
+  FF ( d, a, b, c, in[13], S12, 4254626195UL); /* 14 */
+  FF ( c, d, a, b, in[14], S13, 2792965006UL); /* 15 */
+  FF ( b, c, d, a, in[15], S14, 1236535329UL); /* 16 */
+
+  /* Round 2 */
+#define S21 5
+#define S22 9
+#define S23 14
+#define S24 20
+  GG ( a, b, c, d, in[ 1], S21, 4129170786UL); /* 17 */
+  GG ( d, a, b, c, in[ 6], S22, 3225465664UL); /* 18 */
+  GG ( c, d, a, b, in[11], S23,  643717713UL); /* 19 */
+  GG ( b, c, d, a, in[ 0], S24, 3921069994UL); /* 20 */
+  GG ( a, b, c, d, in[ 5], S21, 3593408605UL); /* 21 */
+  GG ( d, a, b, c, in[10], S22,   38016083UL); /* 22 */
+  GG ( c, d, a, b, in[15], S23, 3634488961UL); /* 23 */
+  GG ( b, c, d, a, in[ 4], S24, 3889429448UL); /* 24 */
+  GG ( a, b, c, d, in[ 9], S21,  568446438UL); /* 25 */
+  GG ( d, a, b, c, in[14], S22, 3275163606UL); /* 26 */
+  GG ( c, d, a, b, in[ 3], S23, 4107603335UL); /* 27 */
+  GG ( b, c, d, a, in[ 8], S24, 1163531501UL); /* 28 */
+  GG ( a, b, c, d, in[13], S21, 2850285829UL); /* 29 */
+  GG ( d, a, b, c, in[ 2], S22, 4243563512UL); /* 30 */
+  GG ( c, d, a, b, in[ 7], S23, 1735328473UL); /* 31 */
+  GG ( b, c, d, a, in[12], S24, 2368359562UL); /* 32 */
+
+  /* Round 3 */
+#define S31 4
+#define S32 11
+#define S33 16
+#define S34 23
+  HH ( a, b, c, d, in[ 5], S31, 4294588738UL); /* 33 */
+  HH ( d, a, b, c, in[ 8], S32, 2272392833UL); /* 34 */
+  HH ( c, d, a, b, in[11], S33, 1839030562UL); /* 35 */
+  HH ( b, c, d, a, in[14], S34, 4259657740UL); /* 36 */
+  HH ( a, b, c, d, in[ 1], S31, 2763975236UL); /* 37 */
+  HH ( d, a, b, c, in[ 4], S32, 1272893353UL); /* 38 */
+  HH ( c, d, a, b, in[ 7], S33, 4139469664UL); /* 39 */
+  HH ( b, c, d, a, in[10], S34, 3200236656UL); /* 40 */
+  HH ( a, b, c, d, in[13], S31,  681279174UL); /* 41 */
+  HH ( d, a, b, c, in[ 0], S32, 3936430074UL); /* 42 */
+  HH ( c, d, a, b, in[ 3], S33, 3572445317UL); /* 43 */
+  HH ( b, c, d, a, in[ 6], S34,   76029189UL); /* 44 */
+  HH ( a, b, c, d, in[ 9], S31, 3654602809UL); /* 45 */
+  HH ( d, a, b, c, in[12], S32, 3873151461UL); /* 46 */
+  HH ( c, d, a, b, in[15], S33,  530742520UL); /* 47 */
+  HH ( b, c, d, a, in[ 2], S34, 3299628645UL); /* 48 */
+
+  /* Round 4 */
+#define S41 6
+#define S42 10
+#define S43 15
+#define S44 21
+  II ( a, b, c, d, in[ 0], S41, 4096336452UL); /* 49 */
+  II ( d, a, b, c, in[ 7], S42, 1126891415UL); /* 50 */
+  II ( c, d, a, b, in[14], S43, 2878612391UL); /* 51 */
+  II ( b, c, d, a, in[ 5], S44, 4237533241UL); /* 52 */
+  II ( a, b, c, d, in[12], S41, 1700485571UL); /* 53 */
+  II ( d, a, b, c, in[ 3], S42, 2399980690UL); /* 54 */
+  II ( c, d, a, b, in[10], S43, 4293915773UL); /* 55 */
+  II ( b, c, d, a, in[ 1], S44, 2240044497UL); /* 56 */
+  II ( a, b, c, d, in[ 8], S41, 1873313359UL); /* 57 */
+  II ( d, a, b, c, in[15], S42, 4264355552UL); /* 58 */
+  II ( c, d, a, b, in[ 6], S43, 2734768916UL); /* 59 */
+  II ( b, c, d, a, in[13], S44, 1309151649UL); /* 60 */
+  II ( a, b, c, d, in[ 4], S41, 4149444226UL); /* 61 */
+  II ( d, a, b, c, in[11], S42, 3174756917UL); /* 62 */
+  II ( c, d, a, b, in[ 2], S43,  718787259UL); /* 63 */
+  II ( b, c, d, a, in[ 9], S44, 3951481745UL); /* 64 */
+
+  buf[0] = TRUNC32(buf[0] + a);
+  buf[1] = TRUNC32(buf[1] + b);
+  buf[2] = TRUNC32(buf[2] + c);
+  buf[3] = TRUNC32(buf[3] + d);
 }
 
 
 /*
- *  END md5 stuff
+ *  END RSA's md5 stuff
  *
  */
 
 
 static
-void words_from_bytes(uint32 *txtl, unsigned char *txtc, long n)
+void words_from_bytes(unsigned long *txtl, const unsigned char *txtc, long n)
 {
    long i;
    unsigned long v;
@@ -1496,7 +1546,7 @@ void words_from_bytes(uint32 *txtl, unsigned char *txtc, long n)
 }
 
 static 
-void bytes_from_words(unsigned char *txtc, uint32 *txtl, long n)
+void bytes_from_words(unsigned char *txtc, const unsigned long *txtl, long n)
 {
    long i;
    unsigned long v;
@@ -1515,9 +1565,9 @@ void bytes_from_words(unsigned char *txtc, uint32 *txtl, long n)
 
 
 static
-void MD5_compress1(uint32 *buf, unsigned char *in, long n)
+void MD5_compress1(unsigned long *buf, unsigned char *in, long n)
 {
-   uint32 txtl[16];
+   unsigned long txtl[16];
    unsigned char txtc[64]; 
    long i, j, k;
 
@@ -1532,7 +1582,7 @@ void MD5_compress1(uint32 *buf, unsigned char *in, long n)
       for (; j < 64; j++)
          txtc[j] = 0;
       words_from_bytes(txtl, txtc, 16);
-      MD5Transform(buf, txtl);
+      MD5_compress(buf, txtl);
       i += k;
    }
 }
@@ -1617,7 +1667,7 @@ void arc4(unsigned char *buffer_ptr, long buffer_len, _ZZ_arc4_key *key)
 NTL_THREAD_LOCAL static long ran_initialized = 0;
 NTL_THREAD_LOCAL static _ZZ_arc4_key ran_key;
 
-static uint32 default_md5_tab[16] = {
+static const unsigned long default_md5_tab[16] = {
 744663023UL, 1011602954UL, 3163087192UL, 3383838527UL, 
 3305324122UL, 3197458079UL, 2266495600UL, 2760303563UL, 
 346234297UL, 1919920720UL, 1896169861UL, 2192176675UL, 
@@ -1641,11 +1691,11 @@ void build_arc4_tab(unsigned char *seed_bytes, const ZZ& s)
 
    bytes_from_words(txt + nb + 4, default_md5_tab, 16);
 
-   uint32 buf[4];
+   unsigned long buf[4];
 
-   uint32 i;
+   unsigned long i;
    for (i = 0; i < 16; i++) {
-      MD5Init(buf);
+      MD5_default_IV(buf);
       bytes_from_words(txt, &i, 1);
 
       MD5_compress1(buf, txt, nb + 68);
diff --git a/src/tools.c b/src/tools.c
index f05f557..36c956b 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -18,35 +18,8 @@ NTL_START_IMPL
 NTL_THREAD_LOCAL void (*ErrorCallback)() = 0;
 
 
-/*
-   The following code differs from vanilla NTL 5.4.2.
-
-   We add a SetErrorCallbackFunction(). This sets a global callback function _function_,
-   which gets called with parameter _context_ and an error message string whenever Error()
-   gets called.
-
-   Note that if the custom error handler *returns*, then NTL will dump the error message
-   back to stderr and abort() as it habitually does.
-
-   -- David Harvey (2008-04-12)
-*/
-
-void (*ErrorCallbackFunction)(const char*, void*) = NULL;
-void *ErrorCallbackContext = NULL;
-
-
-void SetErrorCallbackFunction(void (*function)(const char*, void*), void *context)
-{
-   ErrorCallbackFunction = function;
-   ErrorCallbackContext = context;
-}
-
-
 void Error(const char *s)
 {
-   if (ErrorCallbackFunction != NULL)
-      ErrorCallbackFunction(s, ErrorCallbackContext);
-
    cerr << s << "\n";
    _ntl_abort();
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libntl.git



More information about the debian-science-commits mailing list