[libntl] 06/07: merge patched into master

Julien Puydt julien.puydt at laposte.net
Fri Aug 15 08:23:03 UTC 2014


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

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

commit e66c2a5fcabfdcb26ebb20b8221954326a9b3671
Merge: d152f6a 2e2a20e
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Sun Aug 10 15:24:52 2014 +0200

    merge patched into master

 README                                             |   4 +-
 debian/.git-dpm                                    |   6 +-
 debian/patches/0001-gcc-4.5-mips.patch             |   6 +-
 debian/patches/0002-a-callback-for-sage.patch      |  12 +-
 .../patches/0003-replace-md5-implementation.patch  |   6 +-
 doc/GF2.txt                                        |  28 +
 doc/GF2EX.txt                                      | 135 ++-
 doc/GF2X.txt                                       | 128 ++-
 doc/ZZ.txt                                         |  14 +
 doc/ZZX.txt                                        | 136 ++-
 doc/ZZ_pEX.txt                                     | 138 ++-
 doc/ZZ_pX.txt                                      | 134 ++-
 doc/config.txt                                     |  21 +
 doc/conversions.txt                                | 154 ++--
 doc/copying.txt                                    |   2 +-
 doc/lzz_p.txt                                      |  12 +
 doc/lzz_pEX.txt                                    | 131 ++-
 doc/lzz_pX.txt                                     | 132 ++-
 doc/mat_GF2E.txt                                   |   6 +-
 doc/mat_RR.txt                                     |   4 +-
 doc/mat_ZZ.txt                                     |   4 +-
 doc/mat_ZZ_p.txt                                   |   5 +-
 doc/mat_ZZ_pE.txt                                  |   5 +-
 doc/mat_lzz_p.txt                                  |   5 +-
 doc/mat_lzz_pE.txt                                 |   5 +-
 doc/matrix.txt                                     | 106 +--
 doc/pair.txt                                       |  60 +-
 doc/tools.txt                                      |   1 +
 doc/tour-changes.html                              |  91 ++
 doc/tour-ex1.html                                  |  36 +-
 doc/tour-ex2.html                                  |  84 +-
 doc/tour-ex3.html                                  |  46 +-
 doc/tour-ex4.html                                  |  77 +-
 doc/tour-ex5.html                                  |   2 +-
 doc/tour-modules.html                              |  27 +-
 doc/tour-stdcxx.html                               |  55 +-
 doc/tour-struct.html                               | 102 +--
 doc/vec_GF2.txt                                    | 108 +--
 doc/vec_GF2E.txt                                   |   7 +-
 doc/vec_RR.txt                                     |   7 +-
 doc/vec_ZZ.txt                                     |   7 +-
 doc/vec_ZZ_p.txt                                   |   7 +-
 doc/vec_ZZ_pE.txt                                  |   8 +-
 doc/vec_lzz_p.txt                                  |   8 +-
 doc/vec_lzz_pE.txt                                 |   8 +-
 doc/vector.txt                                     | 137 +--
 include/NTL/FFT.h                                  | 140 ++-
 include/NTL/FacVec.h                               |   2 +-
 include/NTL/GF2.h                                  | 431 +++++++--
 include/NTL/GF2E.h                                 |  19 +-
 include/NTL/GF2EX.h                                |  38 +-
 include/NTL/GF2X.h                                 |  47 +-
 include/NTL/RR.h                                   |  12 +
 include/NTL/WordVector.h                           |   6 +-
 include/NTL/ZZ.h                                   |  61 +-
 include/NTL/ZZX.h                                  |  31 +-
 include/NTL/ZZ_p.h                                 |  23 +
 include/NTL/ZZ_pE.h                                |  12 +
 include/NTL/ZZ_pEX.h                               |  36 +-
 include/NTL/ZZ_pX.h                                |  28 +-
 include/NTL/c_lip.h                                |   5 +
 include/NTL/def_config.h                           |  43 +-
 include/NTL/g_lip.h                                |   3 +
 include/NTL/lzz_p.h                                |  31 +-
 include/NTL/lzz_pE.h                               |  11 +
 include/NTL/lzz_pEX.h                              |  36 +-
 include/NTL/lzz_pX.h                               |  42 +-
 include/NTL/mat_GF2.h                              |  80 +-
 include/NTL/mat_GF2E.h                             |   4 +-
 include/NTL/mat_RR.h                               |   4 +-
 include/NTL/mat_ZZ.h                               |   4 +-
 include/NTL/mat_ZZ_p.h                             |   4 +-
 include/NTL/mat_ZZ_pE.h                            |   6 +-
 include/NTL/mat_lzz_p.h                            |   4 +-
 include/NTL/mat_lzz_pE.h                           |   6 +-
 include/NTL/matrix.h                               | 394 +++++----
 include/NTL/pair.h                                 | 162 ++--
 include/NTL/pair_GF2EX_long.h                      |   9 +-
 include/NTL/pair_GF2X_long.h                       |   9 +-
 include/NTL/pair_ZZX_long.h                        |   9 +-
 include/NTL/pair_ZZ_pEX_long.h                     |  10 +-
 include/NTL/pair_ZZ_pX_long.h                      |   9 +-
 include/NTL/pair_lzz_pEX_long.h                    |  10 +-
 include/NTL/pair_lzz_pX_long.h                     |   9 +-
 include/NTL/quad_float.h                           |  13 +
 include/NTL/tools.h                                |  56 ++
 include/NTL/vec_GF2.h                              | 128 +--
 include/NTL/vec_GF2E.h                             |   7 +-
 include/NTL/vec_GF2XVec.h                          |   2 +-
 include/NTL/vec_RR.h                               |   6 +-
 include/NTL/vec_ZZ.h                               |   6 +-
 include/NTL/vec_ZZVec.h                            |   2 +-
 include/NTL/vec_ZZ_p.h                             |   5 +-
 include/NTL/vec_ZZ_pE.h                            |   6 +-
 include/NTL/vec_double.h                           |   6 +-
 include/NTL/vec_long.h                             |   6 +-
 include/NTL/vec_lzz_p.h                            |   6 +-
 include/NTL/vec_lzz_pE.h                           |   6 +-
 include/NTL/vec_quad_float.h                       |   6 +-
 include/NTL/vec_ulong.h                            |   6 +-
 include/NTL/vec_vec_GF2.h                          |   6 +-
 include/NTL/vec_vec_GF2E.h                         |   6 +-
 include/NTL/vec_vec_RR.h                           |   6 +-
 include/NTL/vec_vec_ZZ.h                           |   6 +-
 include/NTL/vec_vec_ZZ_p.h                         |   6 +-
 include/NTL/vec_vec_ZZ_pE.h                        |   6 +-
 include/NTL/vec_vec_long.h                         |   6 +-
 include/NTL/vec_vec_lzz_p.h                        |   6 +-
 include/NTL/vec_vec_lzz_pE.h                       |   6 +-
 include/NTL/vec_vec_ulong.h                        |   6 +-
 include/NTL/vec_xdouble.h                          |   5 +-
 include/NTL/vector.h                               | 877 ++++++++++---------
 include/NTL/version.h                              |   8 +-
 include/NTL/xdouble.h                              |  13 +
 src/DIRNAME                                        |   2 +-
 src/DispSettings.c                                 |   9 +-
 src/DoConfig                                       |   4 +-
 src/FFT.c                                          | 970 ++++++++++++++++++---
 src/FacVec.c                                       |   2 -
 src/GF2.c                                          |  35 +-
 src/GF2EX.c                                        |  32 +-
 src/GF2EXFactoring.c                               |   2 +-
 src/GF2X.c                                         |  78 +-
 src/GF2X1.c                                        |  41 +-
 src/NOTES                                          |   5 +-
 src/Poly1TimeTest.c                                |  36 +-
 src/QuickTest.c                                    |  11 +
 src/RR.c                                           |  24 +-
 src/RemoveProg                                     |   9 +-
 src/TestScript                                     |  16 +-
 src/VERSION_INFO                                   |   2 +-
 src/WINDIR                                         |   2 +-
 src/Wizard                                         |   1 -
 src/WizardAux                                      |  72 +-
 src/ZZX1.c                                         |  11 +-
 src/ZZXFactoring.c                                 |   2 +-
 src/ZZ_pEX.c                                       |  29 +-
 src/ZZ_pEXFactoring.c                              |   2 +-
 src/ZZ_pX.c                                        |  70 +-
 src/ZZ_pX1.c                                       |  11 +-
 src/ZZ_pXFactoring.c                               |   2 +-
 src/c_lip_impl.h                                   |  12 +-
 src/cfile                                          |  43 +-
 src/def_makefile                                   |  47 +-
 src/g_lip_impl.h                                   |  48 +-
 src/lzz_p.c                                        |  55 +-
 src/lzz_pEX.c                                      |  30 +-
 src/lzz_pEXFactoring.c                             |   2 +-
 src/lzz_pX.c                                       | 196 ++---
 src/lzz_pX1.c                                      |  11 +-
 src/lzz_pXFactoring.c                              |   2 +-
 src/mat_GF2.c                                      | 127 +--
 src/mat_GF2E.c                                     |   5 -
 src/mat_RR.c                                       |   5 -
 src/mat_ZZ.c                                       |   5 -
 src/mat_ZZ_p.c                                     |   7 -
 src/mat_ZZ_pE.c                                    |   7 -
 src/mat_lzz_p.c                                    |   5 -
 src/mat_lzz_pE.c                                   |   7 -
 src/mfile                                          |  43 +-
 src/pair_GF2EX_long.c                              |  16 -
 src/pair_GF2X_long.c                               |  16 -
 src/pair_ZZX_long.c                                |  16 -
 src/pair_ZZ_pEX_long.c                             |  17 -
 src/pair_ZZ_pX_long.c                              |  16 -
 src/pair_lzz_pEX_long.c                            |  16 -
 src/pair_lzz_pX_long.c                             |  16 -
 src/vec_GF2.c                                      |  18 +-
 src/vec_GF2E.c                                     |  14 -
 src/vec_GF2XVec.c                                  |  10 -
 src/vec_RR.c                                       |   7 -
 src/vec_ZZ.c                                       |   8 -
 src/vec_ZZVec.c                                    |  10 -
 src/vec_ZZ_p.c                                     |   9 -
 src/vec_ZZ_pE.c                                    |   8 -
 src/vec_double.c                                   |  21 -
 src/vec_long.c                                     |  21 -
 src/vec_lzz_p.c                                    |   8 -
 src/vec_lzz_pE.c                                   |   9 -
 src/vec_quad_float.c                               |  15 -
 src/vec_ulong.c                                    |  21 -
 src/vec_vec_GF2.c                                  |  16 -
 src/vec_vec_GF2E.c                                 |  14 -
 src/vec_vec_RR.c                                   |  15 -
 src/vec_vec_ZZ.c                                   |  15 -
 src/vec_vec_ZZ_p.c                                 |  14 -
 src/vec_vec_ZZ_pE.c                                |  14 -
 src/vec_vec_long.c                                 |  15 -
 src/vec_vec_lzz_p.c                                |  14 -
 src/vec_vec_lzz_pE.c                               |  14 -
 src/vec_vec_ulong.c                                |  15 -
 src/vec_xdouble.c                                  |  14 -
 192 files changed, 4591 insertions(+), 3235 deletions(-)

diff --cc debian/.git-dpm
index 76d14eb,0000000..3ffd6e1
mode 100644,000000..100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@@ -1,8 -1,0 +1,8 @@@
 +# see git-dpm(1) from git-dpm package
- 0f2b338f9fafa054732b30a3296eb93262b53645
- 0f2b338f9fafa054732b30a3296eb93262b53645
- 234ecb0054229e0458d9bfaa3c8672e84ff8f477
++2e2a20eb19d4ce4c18869a9bd6f1cb6df247a717
++2e2a20eb19d4ce4c18869a9bd6f1cb6df247a717
++53cb09d8670135484776c9ee2fc83b1323c88ae7
 +53cb09d8670135484776c9ee2fc83b1323c88ae7
 +ntl_6.1.0.orig.tar.gz
 +91fa69e71ee964dc94c107eb762a97425776ac2c
 +715439
diff --cc debian/patches/0001-gcc-4.5-mips.patch
index e196c05,0000000..121d3e1
mode 100644,000000..100644
--- a/debian/patches/0001-gcc-4.5-mips.patch
+++ b/debian/patches/0001-gcc-4.5-mips.patch
@@@ -1,48 -1,0 +1,48 @@@
- From 167bf8e15c7475babc0782c2fe8b3af5bcf1ddbd Mon Sep 17 00:00:00 2001
++From 9e42f8558d9f3c8f8999b1dd420607ccb83a8939 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 files changed, 5 insertions(+), 4 deletions(-)
++ 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 --cc debian/patches/0002-a-callback-for-sage.patch
index 8f9beb3,0000000..36cd122
mode 100644,000000..100644
--- a/debian/patches/0002-a-callback-for-sage.patch
+++ b/debian/patches/0002-a-callback-for-sage.patch
@@@ -1,77 -1,0 +1,77 @@@
- From 657ad2a8f5e44518df3907208157303dae478898 Mon Sep 17 00:00:00 2001
++From f34dcd16ce4ceb60726e486b4a864014f237809e 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(+), 0 deletions(-)
++ 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 3f32fe7..c4708e8 100644
++index f1f09ea..a300b86 100644
 +--- a/include/NTL/tools.h
 ++++ b/include/NTL/tools.h
- @@ -252,6 +252,12 @@ long CharToIntVal(long c);
++@@ -293,6 +293,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 c617ae1..86af374 100644
 +--- a/src/tools.c
 ++++ b/src/tools.c
 +@@ -18,8 +18,35 @@ NTL_START_IMPL
 + 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 --cc debian/patches/0003-replace-md5-implementation.patch
index e562b10,0000000..809fdb9
mode 100644,000000..100644
--- a/debian/patches/0003-replace-md5-implementation.patch
+++ b/debian/patches/0003-replace-md5-implementation.patch
@@@ -1,402 -1,0 +1,402 @@@
- From 0f2b338f9fafa054732b30a3296eb93262b53645 Mon Sep 17 00:00:00 2001
++From 2e2a20eb19d4ce4c18869a9bd6f1cb6df247a717 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 files changed, 133 insertions(+), 183 deletions(-)
++ src/ZZ.c | 316 +++++++++++++++++++++++++++------------------------------------
++ 1 file changed, 133 insertions(+), 183 deletions(-)
 +
 +diff --git a/src/ZZ.c b/src/ZZ.c
 +index 86340a7..3a38177 100644
 +--- a/src/ZZ.c
 ++++ b/src/ZZ.c
 +@@ -1353,207 +1353,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, unsigned char *txtc, long n)
 ++void words_from_bytes(uint32 *txtl, unsigned char *txtc, long n)
 + {
 +    long i;
 +    unsigned long v;
 +@@ -1568,7 +1518,7 @@ void words_from_bytes(unsigned long *txtl, unsigned char *txtc, long n)
 + }
 + 
 + static 
 +-void bytes_from_words(unsigned char *txtc, unsigned long *txtl, long n)
 ++void bytes_from_words(unsigned char *txtc, uint32 *txtl, long n)
 + {
 +    long i;
 +    unsigned long v;
 +@@ -1587,9 +1537,9 @@ void bytes_from_words(unsigned char *txtc, 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;
 + 
 +@@ -1604,7 +1554,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;
 +    }
 + }
 +@@ -1689,7 +1639,7 @@ void arc4(unsigned char *buffer_ptr, long buffer_len, _ZZ_arc4_key *key)
 + static long ran_initialized = 0;
 + static _ZZ_arc4_key ran_key;
 + 
 +-static unsigned long default_md5_tab[16] = {
 ++static uint32 default_md5_tab[16] = {
 + 744663023UL, 1011602954UL, 3163087192UL, 3383838527UL, 
 + 3305324122UL, 3197458079UL, 2266495600UL, 2760303563UL, 
 + 346234297UL, 1919920720UL, 1896169861UL, 2192176675UL, 
 +@@ -1713,11 +1663,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);

-- 
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