r46278 - in /packages/gmp/trunk/debian: changelog control patches/mpn_sbpi1_div.patch patches/series
smr at users.alioth.debian.org
smr at users.alioth.debian.org
Sat Sep 14 18:56:26 UTC 2013
Author: smr
Date: Sat Sep 14 18:56:25 2013
New Revision: 46278
URL: http://svn.debian.org/wsvn/debian-science/?sc=1&rev=46278
Log:
Bug fix. Removal of libgmp32* packages.
Added:
packages/gmp/trunk/debian/patches/mpn_sbpi1_div.patch
Modified:
packages/gmp/trunk/debian/changelog
packages/gmp/trunk/debian/control
packages/gmp/trunk/debian/patches/series
Modified: packages/gmp/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/debian-science/packages/gmp/trunk/debian/changelog?rev=46278&op=diff
==============================================================================
--- packages/gmp/trunk/debian/changelog (original)
+++ packages/gmp/trunk/debian/changelog Sat Sep 14 18:56:25 2013
@@ -1,3 +1,12 @@
+gmp (2:5.1.2+dfsg-3) unstable; urgency=low
+
+ * patches/mpn_sbpi1_div.patch: New. Upstream patch to fix computation
+ of mpn_sbpi1_div_qr_sec and mpn_sbpi1_div_r_sec.
+
+ * Remove lib32gmp* packages. Closes: #714998.
+
+ -- Steve M. Robbins <smr at debian.org> Sat, 14 Sep 2013 13:52:27 -0500
+
gmp (2:5.1.2+dfsg-2) unstable; urgency=low
* rules: Install gmp.h into multi-arch include directory. For
Modified: packages/gmp/trunk/debian/control
URL: http://svn.debian.org/wsvn/debian-science/packages/gmp/trunk/debian/control?rev=46278&op=diff
==============================================================================
--- packages/gmp/trunk/debian/control (original)
+++ packages/gmp/trunk/debian/control Sat Sep 14 18:56:25 2013
@@ -63,54 +63,6 @@
The MPFR library (multiple-precision floating-point) used to be
included, but has since been moved to package libmpfr-dev.
-Package: lib32gmp10
-Section: libs
-Priority: optional
-Architecture: amd64 ppc64 kfreebsd-amd64
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Conflicts: libc6-i386 (<= 2.9-18)
-Description: Multiprecision arithmetic library (32bit)
- GNU MP is a programmer's library for arbitrary precision
- arithmetic (ie, a bignum package). It can operate on signed
- integer, rational, and floating point numeric types. This
- package includes a 32 bit version of the shared library.
- .
- It has a rich set of functions, and the functions have a regular
- interface.
-
-Package: lib32gmpxx4
-Section: libs
-Priority: optional
-Architecture: amd64 ppc64 kfreebsd-amd64
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Conflicts: libc6-i386 (<= 2.9-18)
-Description: Multiprecision arithmetic library (C++ bindings, 32bit)
- GNU MP is a programmer's library for arbitrary precision
- arithmetic (ie, a bignum package). It can operate on signed
- integer, rational, and floating point numeric types. This
- package includes a 32 bit version of the shared library.
-
-Package: lib32gmp-dev
-Section: libdevel
-Priority: optional
-Architecture: amd64 ppc64 kfreebsd-amd64
-Depends: libgmp-dev (= ${binary:Version}), lib32gmp10 (= ${binary:Version}), lib32gmpxx4 (= ${binary:Version}), ${misc:Depends}
-Provides: lib32gmp10-dev, lib32gmp3-dev
-Suggests: libgmp10-doc, libmpfr-dev
-Conflicts: libc6-i386 (<= 2.9-18), lib32gmp3-dev, lib32gmp10-dev
-Replaces: lib32gmp3-dev, lib32gmp10-dev
-Description: Multiprecision arithmetic library developers tools (32bit)
- This development package provides the header files and the symbolic
- links to allow compilation and linking of programs that use the
- libraries provided in the libgmp10 package. This package includes 32
- bit versions of the link libraries.
- .
- Both C and C++ bindings are present in this package. Package
- libstdc++-dev is required to use the C++ bindings.
- .
- The MPFR library (multiple-precision floating-point) used to be
- included, but has since been moved to package libmpfr-dev.
-
Package: libgmp10-doc
Section: doc
Priority: optional
Added: packages/gmp/trunk/debian/patches/mpn_sbpi1_div.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmp/trunk/debian/patches/mpn_sbpi1_div.patch?rev=46278&op=file
==============================================================================
--- packages/gmp/trunk/debian/patches/mpn_sbpi1_div.patch (added)
+++ packages/gmp/trunk/debian/patches/mpn_sbpi1_div.patch Sat Sep 14 18:56:25 2013
@@ -0,0 +1,167 @@
+
+# HG changeset patch
+# User Torbjorn Granlund <tege at gmplib.org>
+# Date 1373624469 -7200
+# Node ID a447c0c537891ed23edf180594a89616364ee633
+# Parent 6540e0b2925ead29f7158bb182e4fabfb9441433
+Partial rewrite.
+
+diff -r 6540e0b2925e -r a447c0c53789 mpn/generic/sbpi1_div_sec.c
+--- a/mpn/generic/sbpi1_div_sec.c Mon Jul 01 19:16:32 2013 +0200
++++ b/mpn/generic/sbpi1_div_sec.c Fri Jul 12 12:21:09 2013 +0200
+@@ -8,7 +8,7 @@
+ SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
+ GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
+
+-Copyright 2011, 2012 Free Software Foundation, Inc.
++Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
+
+ This file is part of the GNU MP Library.
+
+@@ -29,6 +29,28 @@
+ #include "gmp-impl.h"
+ #include "longlong.h"
+
++/* This side-channel silent division algorithm reduces the partial remainder by
++ GMP_NUMB_BITS/2 bits at a time, compared to GMP_NUMB_BITS for the main
++ division algorithm. We do not insists on reducing by exactly
++ GMP_NUMB_BITS/2, but may leave a partial remainder that is D*B^i to 3D*B^i
++ too large (B is the limb base, D is the divisor, and i is the induction
++ variable); the subsequent step will handle the extra partial remainder bits.
++
++ WIth that partial remainder reduction, each step generates a quotient "half
++ limb". The outer loop generates two quotient half limbs, an upper (q1h) and
++ a lower (q0h) which are stored sparsely in separate limb arrays. These
++ arrays are added at the end; using separate arrays avoids data-dependent
++ carry propagation which could else pose a side-channel leakage problem.
++
++ The quotient half limbs may be between -3 to 0 from the accurate value
++ ("accurate" being the one which corresponds to a reduction to a principal
++ partial remainder). Too small quotient half limbs correspond to too large
++ remainders, which we reduce later, as described above.
++
++ In order to keep quotients from getting too big, corresponding to a negative
++ partial remainder, we use an inverse which is sligtly smaller than usually.
++*/
++
+ #if OPERATION_sbpi1_div_qr_sec
+ /* Needs (dn + 1) + (nn - dn) + (nn - dn) = 2nn - dn + 1 limbs at tp. */
+ #define FNAME mpn_sbpi1_div_qr_sec
+@@ -49,7 +71,7 @@
+ mp_limb_t dinv,
+ mp_ptr tp)
+ {
+- mp_limb_t nh, cy, q1h, q0h, dummy, h;
++ mp_limb_t nh, cy, q1h, q0h, dummy, cnd;
+ mp_size_t i;
+ mp_ptr hp;
+ #if OPERATION_sbpi1_div_qr_sec
+@@ -72,77 +94,69 @@
+ #endif
+ }
+
++ /* Decremenet inverse to keep quotient half limbs from being too large. */
++ dinv -= dinv != 0; /* FIXME: cmp-to-int */
++
+ /* Create a divisor copy shifted half a limb. */
+ hp = tp; /* (dn + 1) limbs */
+- cy = mpn_lshift (hp, dp, dn, GMP_NUMB_BITS / 2);
+- hp[dn] = dp[dn - 1] >> GMP_NUMB_BITS / 2;
++ hp[dn] = mpn_lshift (hp, dp, dn, GMP_NUMB_BITS / 2);
+
+ #if OPERATION_sbpi1_div_qr_sec
+ qlp = tp + (dn + 1); /* (nn - dn) limbs */
+ qhp = tp + (nn + 1); /* (nn - dn) limbs */
+ #endif
+
+- np += nn;
++ np += nn - dn;
++ nh = 0;
+
+- /* Main loop. Develop one full limb per iteration, but do it in two steps in
+- order to avoid conditionals. Quotient bits will be either correct or
+- underestimates. When a quotient is underestimated, the next quotient will
+- compensate, since quotients are to be added at consecutive weight distance
+- GMP_NUMB_BITS/2. We make two quotient arrays, each with GMP_NUMB_BITS/2+2
+- bits per entry. The arrays are added late after the loop. Separate
+- arrays avoid data-dependent carry propagation. */
+- nh = 0;
+ for (i = nn - dn - 1; i >= 0; i--)
+ {
+ np--;
+
+- nh = (nh << GMP_NUMB_BITS/2) + (np[0] >> GMP_NUMB_BITS/2);
++ nh = (nh << GMP_NUMB_BITS/2) + (np[dn] >> GMP_NUMB_BITS/2);
+ umul_ppmm (q1h, dummy, nh, dinv);
+ q1h += nh;
+ #if OPERATION_sbpi1_div_qr_sec
+ qhp[i] = q1h;
+ #endif
+- cy = mpn_submul_1 (np - dn, hp, dn + 1, q1h);
++ mpn_submul_1 (np, hp, dn + 1, q1h);
+
+- nh = np[0];
++ nh = np[dn];
+ umul_ppmm (q0h, dummy, nh, dinv);
+ q0h += nh;
+ #if OPERATION_sbpi1_div_qr_sec
+ qlp[i] = q0h;
+ #endif
+- cy = mpn_submul_1 (np - dn, dp, dn, q0h);
+-
+- nh -= cy;
++ nh -= mpn_submul_1 (np, dp, dn, q0h);
+ }
+
+- np[0] = nh;
++ /* 1st adjustment depends on extra high remainder limb. */
++ cnd = nh != 0; /* FIXME: cmp-to-int */
++#if OPERATION_sbpi1_div_qr_sec
++ qlp[0] += cnd;
++#endif
++ nh -= mpn_subcnd_n (np, np, dp, dn, cnd);
+
+- np -= dn;
+-
+- /* 1st adjustment depends on extra high remainder limb. */
+- h = np[dn];
+-#if OPERATION_sbpi1_div_qr_sec
+- qlp[0] += h;
+-#endif
+- h -= mpn_subcnd_n (np, np, dp, dn, h);
+-
+- /* 2nd adjustment depends on remainder/divisor comparision as well as whether
++ /* 2nd adjustment depends on remainder/divisor comparison as well as whether
+ extra remainder limb was nullified by previous subtract. */
+ cy = mpn_sub_n (np, np, dp, dn);
+- cy = cy == h; /* FIXME: might leak on some archs */
++ cy = cy - nh;
+ #if OPERATION_sbpi1_div_qr_sec
+- qlp[0] += cy;
++ qlp[0] += 1 - cy;
+ #endif
+- mpn_addcnd_n (np, np, dp, dn, 1 - cy);
++ mpn_addcnd_n (np, np, dp, dn, cy);
+
++ /* 3rd adjustment depends on remainder/divisor comparison. */
++ cy = mpn_sub_n (np, np, dp, dn);
++#if OPERATION_sbpi1_div_qr_sec
++ qlp[0] += 1 - cy;
++#endif
++ mpn_addcnd_n (np, np, dp, dn, cy);
++
++#if OPERATION_sbpi1_div_qr_sec
+ /* Combine quotient halves into final quotient. */
+-#if OPERATION_sbpi1_div_qr_sec
+- qh = 0;
+- if (nn - dn != 0)
+- {
+- qh = mpn_lshift (qhp, qhp, nn - dn, GMP_NUMB_BITS/2);
+- qh += mpn_add_n (qp, qhp, qlp, nn - dn);
+- }
++ qh = mpn_lshift (qhp, qhp, nn - dn, GMP_NUMB_BITS/2);
++ qh += mpn_add_n (qp, qhp, qlp, nn - dn);
+
+ return qh;
+ #else
+
Modified: packages/gmp/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/debian-science/packages/gmp/trunk/debian/patches/series?rev=46278&op=diff
==============================================================================
--- packages/gmp/trunk/debian/patches/series (original)
+++ packages/gmp/trunk/debian/patches/series Sat Sep 14 18:56:25 2013
@@ -1 +1,3 @@
preserve-ia64-registers.patch
+mpn_sbpi1_div.patch
+
More information about the debian-science-commits
mailing list