public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/, dev-libs/libgcrypt/files/
@ 2015-12-01  6:48 Alon Bar-Lev
  0 siblings, 0 replies; 10+ messages in thread
From: Alon Bar-Lev @ 2015-12-01  6:48 UTC (permalink / raw
  To: gentoo-commits

commit:     e2228cca960e4bbb1d292192c66426f3c9e4a2fc
Author:     Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  1 06:46:38 2015 +0000
Commit:     Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
CommitDate: Tue Dec  1 06:46:38 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2228cca

Revert "dev-libs/libgcrypt: cleanup"

This reverts commit 1519f072b810c69428badbe5fc54960f1a2a12b3.

 dev-libs/libgcrypt/Manifest                        |  1 +
 .../libgcrypt/files/libgcrypt-1.5.0-uscore.patch   | 33 +++++++++
 .../files/libgcrypt-1.5.4-clang-arm.patch          | 84 ++++++++++++++++++++++
 dev-libs/libgcrypt/libgcrypt-1.5.4-r1.ebuild       | 57 +++++++++++++++
 dev-libs/libgcrypt/libgcrypt-1.5.4-r100.ebuild     | 58 +++++++++++++++
 5 files changed, 233 insertions(+)

diff --git a/dev-libs/libgcrypt/Manifest b/dev-libs/libgcrypt/Manifest
index 79bf1a4..608b99b 100644
--- a/dev-libs/libgcrypt/Manifest
+++ b/dev-libs/libgcrypt/Manifest
@@ -1,2 +1,3 @@
+DIST libgcrypt-1.5.4.tar.bz2 1512982 SHA256 d5f88d9f41a46953dc250cdb8575129b37ee2208401b7fa338c897f667c7fb33 SHA512 fe7e1d07eb10ee4ea8054bc955c35dc4b2109db645a08a6fa7757bf1e77a612e03c0838f9766086f04270b3621f34ccae0d6333f117cff204ccad9018c8a7908 WHIRLPOOL 221082d028a90235a3ddcc774b1772a8b8daec989a24b341491849e653e2ecb5cb0e3c8989a3f426524e39b28ebbe1b48532d5d9de7c54f4bdc19b450e22e4dc
 DIST libgcrypt-1.6.3.tar.bz2 2494052 SHA256 41b4917b93ae34c6a0e2127378d7a4d66d805a2a86a09911d4f9bd871db7025f SHA512 09a84fcc4d3d755df21f46302a549af4ba788d829ff7fa0cf65eeec033bc3744503f8fe3f4be55a51cc17b1b1b487736c328d7d7bc909f13139600236298c549 WHIRLPOOL dd331afed5c8116df8a55742a7b559791c554a97c32983d64ab196a6d47c2d6bd7e15f8a63dda43947961bb269963185b98927ff0695c3f6d3b939face41e450
 DIST libgcrypt-1.6.4.tar.bz2 2549820 SHA256 c9bc2c7fe2e5f4ea13b0c74f9d24bcbb1ad889bb39297d8082aebf23f4336026 SHA512 d2abc81fc3e3acf58f3bf18db449bfb4bdbc28fe62f695276ddd35f34434996b0d686bb48a4724e5134c80ea6cab08ce04f4a0989cb9a72f2497ec833bb24df1 WHIRLPOOL 708de5d55845177aa38dc227920dd64eeef8105427d5c88b8196ca47978f577d57f3cd85cd4627af6574e6ab780b815c1cbc8c8ad02aaba72ef176810f7a8865

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.5.0-uscore.patch b/dev-libs/libgcrypt/files/libgcrypt-1.5.0-uscore.patch
new file mode 100644
index 0000000..1d4f650
--- /dev/null
+++ b/dev-libs/libgcrypt/files/libgcrypt-1.5.0-uscore.patch
@@ -0,0 +1,33 @@
+The version taken from GnuPG 1.4 assumes any cross-compiled package have
+prefixed underscores, which is not the case; by using libtool's own macro,
+we can avoid the whole issue.
+
+diff --git a/configure.ac b/configure.ac
+index ab160c3..6df49bf 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -886,7 +886,7 @@ fi
+ #
+ # Setup assembler stuff.
+ #
+-GNUPG_SYS_SYMBOL_UNDERSCORE()
++LT_SYS_SYMBOL_USCORE
+ AC_ARG_ENABLE(mpi-path,
+               AC_HELP_STRING([--enable-mpi-path=EXTRA_PATH],
+ 	      [prepend EXTRA_PATH to list of CPU specific optimizations]),
+diff --git a/mpi/config.links b/mpi/config.links
+index 7e910ee..9696828 100644
+--- a/mpi/config.links
++++ b/mpi/config.links
+@@ -291,7 +291,7 @@ fi
+ 
+ # Make sysdep.h
+ echo '/* created by config.links - do not edit */' >./mpi/sysdep.h
+-if test x$ac_cv_sys_symbol_underscore = xyes; then
++if test x$sys_symbol_underscore = xyes; then
+     cat <<EOF >>./mpi/sysdep.h
+ #if __STDC__
+ #define C_SYMBOL_NAME(name) _##name
+-- 
+1.7.6.1
+

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.5.4-clang-arm.patch b/dev-libs/libgcrypt/files/libgcrypt-1.5.4-clang-arm.patch
new file mode 100644
index 0000000..ab5d844
--- /dev/null
+++ b/dev-libs/libgcrypt/files/libgcrypt-1.5.4-clang-arm.patch
@@ -0,0 +1,84 @@
+fix from upstream
+
+From e67c67321ce240c93dd0fa2b21c649c0a8e233f7 Mon Sep 17 00:00:00 2001
+From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
+Date: Tue, 22 Oct 2013 17:07:53 +0300
+Subject: [PATCH] mpi: allow building with clang on ARM
+
+* mpi/longlong.h [__arm__] (add_ssaaaa, sub_ddmmss, umul_ppmm)
+(count_leading_zeros): Do not cast assembly output arguments.
+[__arm__] (umul_ppmm): Remove the extra '%' ahead of assembly comment.
+[_ARM_ARCH >= 4] (umul_ppmm): Use correct inputs and outputs instead of
+registers.
+--
+
+Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
+---
+ mpi/longlong.h | 27 +++++++++++++--------------
+ 1 file changed, 13 insertions(+), 14 deletions(-)
+
+diff --git a/mpi/longlong.h b/mpi/longlong.h
+index c2ab9c5..8c8260e 100644
+--- a/mpi/longlong.h
++++ b/mpi/longlong.h
+@@ -188,8 +188,8 @@ extern UDItype __udiv_qrnnd ();
+ #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+   __asm__ ("adds %1, %4, %5\n"                                          \
+ 	   "adc  %0, %2, %3"                                            \
+-	   : "=r" ((USItype)(sh)),                                      \
+-	     "=&r" ((USItype)(sl))                                      \
++	   : "=r" ((sh)),                                               \
++	     "=&r" ((sl))                                               \
+ 	   : "%r" ((USItype)(ah)),                                      \
+ 	     "rI" ((USItype)(bh)),                                      \
+ 	     "%r" ((USItype)(al)),                                      \
+@@ -197,15 +197,15 @@ extern UDItype __udiv_qrnnd ();
+ #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+   __asm__ ("subs %1, %4, %5\n"                                          \
+ 	   "sbc  %0, %2, %3"                                            \
+-	   : "=r" ((USItype)(sh)),                                      \
+-	     "=&r" ((USItype)(sl))                                      \
++	   : "=r" ((sh)),                                               \
++	     "=&r" ((sl))                                               \
+ 	   : "r" ((USItype)(ah)),                                       \
+ 	     "rI" ((USItype)(bh)),                                      \
+ 	     "r" ((USItype)(al)),                                       \
+ 	     "rI" ((USItype)(bl)))
+ #if defined __ARM_ARCH_2__ || defined __ARM_ARCH_3__
+ #define umul_ppmm(xh, xl, a, b) \
+-  __asm__ ("%@ Inlined umul_ppmm\n"                                     \
++  __asm__ ("@ Inlined umul_ppmm\n"                                      \
+ 	"mov	%|r0, %2, lsr #16		@ AAAA\n"               \
+ 	"mov	%|r2, %3, lsr #16		@ BBBB\n"               \
+ 	"bic	%|r1, %2, %|r0, lsl #16		@ aaaa\n"               \
+@@ -218,20 +218,19 @@ extern UDItype __udiv_qrnnd ();
+ 	"addcs	%|r2, %|r2, #65536\n"                                   \
+ 	"adds	%1, %|r1, %|r0, lsl #16\n"                              \
+ 	"adc	%0, %|r2, %|r0, lsr #16"                                \
+-	   : "=&r" ((USItype)(xh)),                                     \
+-	     "=r" ((USItype)(xl))                                       \
++	   : "=&r" ((xh)),                                              \
++	     "=r" ((xl))                                                \
+ 	   : "r" ((USItype)(a)),                                        \
+ 	     "r" ((USItype)(b))                                         \
+ 	   : "r0", "r1", "r2")
+ #else
+ #define umul_ppmm(xh, xl, a, b)                                         \
+-  __asm__ ("%@ Inlined umul_ppmm\n"                                     \
+-	   "umull %r1, %r0, %r2, %r3"                                   \
+-		   : "=&r" ((USItype)(xh)),                             \
+-		     "=r" ((USItype)(xl))                               \
++  __asm__ ("@ Inlined umul_ppmm\n"                                      \
++	   "umull %1, %0, %2, %3"                                       \
++		   : "=&r" ((xh)),                                      \
++		     "=r" ((xl))                                        \
+ 		   : "r" ((USItype)(a)),                                \
+-		     "r" ((USItype)(b))                                 \
+-		   : "r0", "r1")
++		     "r" ((USItype)(b)))
+ #endif
+ #define UMUL_TIME 20
+ #define UDIV_TIME 100
+-- 
+2.4.4
+

diff --git a/dev-libs/libgcrypt/libgcrypt-1.5.4-r1.ebuild b/dev-libs/libgcrypt/libgcrypt-1.5.4-r1.ebuild
new file mode 100644
index 0000000..fe222f9
--- /dev/null
+++ b/dev-libs/libgcrypt/libgcrypt-1.5.4-r1.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+AUTOTOOLS_AUTORECONF=1
+
+inherit autotools-multilib
+
+DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
+HOMEPAGE="http://www.gnupg.org/"
+SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1 MIT"
+SLOT="0/11" # subslot = soname major version
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="static-libs"
+
+RDEPEND=">=dev-libs/libgpg-error-1.12[${MULTILIB_USEDEP}]
+	!dev-libs/libgcrypt:11
+	abi_x86_32? (
+		!<=app-emulation/emul-linux-x86-baselibs-20131008-r19
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32]
+	)"
+DEPEND="${RDEPEND}"
+
+DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.5.0-uscore.patch
+	"${FILESDIR}"/${PN}-multilib-syspath.patch
+	"${FILESDIR}"/${P}-clang-arm.patch
+)
+
+MULTILIB_CHOST_TOOLS=(
+	/usr/bin/libgcrypt-config
+)
+
+src_configure() {
+	local myeconfargs=(
+		--disable-padlock-support # bug 201917
+		--disable-dependency-tracking
+		--enable-noexecstack
+		--disable-O-flag-munging
+		$(use_enable static-libs static)
+
+		# disabled due to various applications requiring privileges
+		# after libgcrypt drops them (bug #468616)
+		--without-capabilities
+
+		# http://trac.videolan.org/vlc/ticket/620
+		# causes bus-errors on sparc64-solaris
+		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
+		$([[ ${CHOST} == sparcv9-*-solaris* ]] && echo "--disable-asm")
+	)
+	autotools-multilib_src_configure
+}

diff --git a/dev-libs/libgcrypt/libgcrypt-1.5.4-r100.ebuild b/dev-libs/libgcrypt/libgcrypt-1.5.4-r100.ebuild
new file mode 100644
index 0000000..a0aad0c
--- /dev/null
+++ b/dev-libs/libgcrypt/libgcrypt-1.5.4-r100.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+AUTOTOOLS_AUTORECONF=1
+
+inherit autotools-multilib
+
+DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
+HOMEPAGE="http://www.gnupg.org/"
+SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1 MIT"
+SLOT="11/11" # subslot = soname major version
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE=""
+
+RDEPEND=">=dev-libs/libgpg-error-1.12[${MULTILIB_USEDEP}]
+	!dev-libs/libgcrypt:0/11
+	abi_x86_32? (
+		!<=app-emulation/emul-linux-x86-baselibs-20131008-r19
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32]
+	)"
+DEPEND="${RDEPEND}"
+
+DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.5.0-uscore.patch
+	"${FILESDIR}"/${PN}-multilib-syspath.patch
+	"${FILESDIR}"/${P}-clang-arm.patch
+)
+
+src_configure() {
+	local myeconfargs=(
+		--disable-padlock-support # bug 201917
+		--disable-dependency-tracking
+		--enable-noexecstack
+		--disable-O-flag-munging
+
+		# disabled due to various applications requiring privileges
+		# after libgcrypt drops them (bug #468616)
+		--without-capabilities
+
+		# http://trac.videolan.org/vlc/ticket/620
+		# causes bus-errors on sparc64-solaris
+		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
+		$([[ ${CHOST} == sparcv9-*-solaris* ]] && echo "--disable-asm")
+	)
+	autotools-multilib_src_configure
+}
+
+src_install() {
+	autotools-multilib_src_install
+
+	rm -r "${ED%/}"/usr/{bin,include,lib*/*.so,share} || die
+}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/, dev-libs/libgcrypt/files/
@ 2016-02-10 22:57 Kristian Fiskerstrand
  0 siblings, 0 replies; 10+ messages in thread
From: Kristian Fiskerstrand @ 2016-02-10 22:57 UTC (permalink / raw
  To: gentoo-commits

commit:     5715a323e4f467888f71be6ddc6bbbc8873fd914
Author:     Kristian Fiskerstrand <k_f <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 10 23:02:11 2016 +0000
Commit:     Kristian Fiskerstrand <k_f <AT> gentoo <DOT> org>
CommitDate: Wed Feb 10 23:03:10 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5715a323

dev-libs/libgcrypt: Add backported 1.5-branch fix for CVE-2015-7511

Package-Manager: portage-2.2.27

 .../files/libgcrypt-1.5.4-CVE-2015-7511.patch      | 326 +++++++++++++++++++++
 dev-libs/libgcrypt/libgcrypt-1.5.4-r101.ebuild     |  59 ++++
 dev-libs/libgcrypt/libgcrypt-1.5.4-r2.ebuild       |  58 ++++
 3 files changed, 443 insertions(+)

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.5.4-CVE-2015-7511.patch b/dev-libs/libgcrypt/files/libgcrypt-1.5.4-CVE-2015-7511.patch
new file mode 100644
index 0000000..9ab0b4c
--- /dev/null
+++ b/dev-libs/libgcrypt/files/libgcrypt-1.5.4-CVE-2015-7511.patch
@@ -0,0 +1,326 @@
+From fcbb9fcc2e6983ea61bf565b6ee2e29816b8cd57 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Wed, 10 Feb 2016 17:43:03 +0900
+Subject: [PATCH] ecc: Fix for chosen cipher text attacks.
+
+* src/mpi.h (_gcry_mpi_ec_curve_point): New internal function.
+* cipher/ecc.c (ecc_decrypt_raw): Validate input.  Remove duplicated
+point_free.
+* mpi/ec.c (_gcry_mpi_ec_mul_point):Use simple left-to-right binary
+method for when SCALAR is secure.
+(_gcry_mpi_ec_curve_point): New.
+
+--
+
+CVE-id: CVE-2015-7511
+
+Thanks to Daniel Genkin, Lev Pachmanov, Itamar Pipman, and Eran
+Tromer.   http://www.cs.tau.ac.IL/~tromer/ecdh/
+
+This could be an effective contermeasure to some chosen cipher text
+attacks.
+
+(backport from master
+ commit 88e1358962e902ff1cbec8d53ba3eee46407851a)
+(backport from LIBGCRYPT-1-6-BRANCH
+ commit 28eb424e4427b320ec1c9c4ce56af25d495230bd)
+
+Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
+---
+ cipher/ecc.c |  11 ++-
+ mpi/ec.c     | 226 +++++++++++++++++++++++++++++++++++------------------------
+ src/mpi.h    |   2 +-
+ 3 files changed, 145 insertions(+), 94 deletions(-)
+
+diff --git a/cipher/ecc.c b/cipher/ecc.c
+index b8487dc..80b67ae 100644
+--- a/cipher/ecc.c
++++ b/cipher/ecc.c
+@@ -1535,12 +1535,19 @@ ecc_decrypt_raw (int algo, gcry_mpi_t *result, gcry_mpi_t *data,
+ 
+   ctx = _gcry_mpi_ec_init (sk.E.p, sk.E.a);
+ 
++  if (!_gcry_mpi_ec_curve_point (&kG, sk.E.b, ctx))
++    {
++      point_free (&kG);
++      point_free (&sk.E.G);
++      point_free (&sk.Q);
++      _gcry_mpi_ec_free (ctx);
++      return GPG_ERR_INV_DATA;
++    }
++
+   /* R = dkG */
+   point_init (&R);
+   _gcry_mpi_ec_mul_point (&R, sk.d, &kG, ctx);
+ 
+-  point_free (&kG);
+-
+   /* The following is false: assert( mpi_cmp_ui( R.x, 1 )==0 );, so:  */
+   {
+     gcry_mpi_t x, y;
+diff --git a/mpi/ec.c b/mpi/ec.c
+index fa00818..bdb155a 100644
+--- a/mpi/ec.c
++++ b/mpi/ec.c
+@@ -612,110 +612,154 @@ _gcry_mpi_ec_mul_point (mpi_point_t *result,
+                         gcry_mpi_t scalar, mpi_point_t *point,
+                         mpi_ec_t ctx)
+ {
+-#if 0
+-  /* Simple left to right binary method.  GECC Algorithm 3.27 */
+-  unsigned int nbits;
+-  int i;
+-
+-  nbits = mpi_get_nbits (scalar);
+-  mpi_set_ui (result->x, 1);
+-  mpi_set_ui (result->y, 1);
+-  mpi_set_ui (result->z, 0);
+-
+-  for (i=nbits-1; i >= 0; i--)
++  if (mpi_is_secure(scalar))
+     {
+-      _gcry_mpi_ec_dup_point (result, result, ctx);
+-      if (mpi_test_bit (scalar, i) == 1)
+-        _gcry_mpi_ec_add_points (result, result, point, ctx);
+-    }
+-
+-#else
+-  gcry_mpi_t x1, y1, z1, k, h, yy;
+-  unsigned int i, loops;
+-  mpi_point_t p1, p2, p1inv;
+-
+-  x1 = mpi_alloc_like (ctx->p);
+-  y1 = mpi_alloc_like (ctx->p);
+-  h  = mpi_alloc_like (ctx->p);
+-  k  = mpi_copy (scalar);
+-  yy = mpi_copy (point->y);
++      /* Simple left to right binary method.  GECC Algorithm 3.27 */
++      unsigned int nbits;
++      int i;
++      mpi_point_t tmppnt;
+ 
+-  if ( mpi_is_neg (k) )
+-    {
+-      k->sign = 0;
+-      ec_invm (yy, yy, ctx);
+-    }
++      nbits = mpi_get_nbits (scalar);
++      mpi_set_ui (result->x, 1);
++      mpi_set_ui (result->y, 1);
++      mpi_set_ui (result->z, 0);
+ 
+-  if (!mpi_cmp_ui (point->z, 1))
+-    {
+-      mpi_set (x1, point->x);
+-      mpi_set (y1, yy);
++      point_init (&tmppnt);
++      for (i=nbits-1; i >= 0; i--)
++        {
++          _gcry_mpi_ec_dup_point (result, result, ctx);
++          _gcry_mpi_ec_add_points (&tmppnt, result, point, ctx);
++          if (mpi_test_bit (scalar, i) == 1)
++            point_set (result, &tmppnt);
++        }
++      point_free (&tmppnt);
+     }
+   else
+     {
+-      gcry_mpi_t z2, z3;
+-
+-      z2 = mpi_alloc_like (ctx->p);
+-      z3 = mpi_alloc_like (ctx->p);
+-      ec_mulm (z2, point->z, point->z, ctx);
+-      ec_mulm (z3, point->z, z2, ctx);
+-      ec_invm (z2, z2, ctx);
+-      ec_mulm (x1, point->x, z2, ctx);
+-      ec_invm (z3, z3, ctx);
+-      ec_mulm (y1, yy, z3, ctx);
+-      mpi_free (z2);
+-      mpi_free (z3);
+-    }
+-  z1 = mpi_copy (ctx->one);
++      gcry_mpi_t x1, y1, z1, k, h, yy;
++      unsigned int i, loops;
++      mpi_point_t p1, p2, p1inv;
+ 
+-  mpi_mul (h, k, ctx->three); /* h = 3k */
+-  loops = mpi_get_nbits (h);
+-  if (loops < 2)
+-    {
+-      /* If SCALAR is zero, the above mpi_mul sets H to zero and thus
+-         LOOPs will be zero.  To avoid an underflow of I in the main
+-         loop we set LOOP to 2 and the result to (0,0,0).  */
+-      loops = 2;
+-      mpi_clear (result->x);
+-      mpi_clear (result->y);
+-      mpi_clear (result->z);
+-    }
+-  else
+-    {
+-      mpi_set (result->x, point->x);
+-      mpi_set (result->y, yy);
+-      mpi_set (result->z, point->z);
+-    }
+-  mpi_free (yy); yy = NULL;
++      x1 = mpi_alloc_like (ctx->p);
++      y1 = mpi_alloc_like (ctx->p);
++      h  = mpi_alloc_like (ctx->p);
++      k  = mpi_copy (scalar);
++      yy = mpi_copy (point->y);
+ 
+-  p1.x = x1; x1 = NULL;
+-  p1.y = y1; y1 = NULL;
+-  p1.z = z1; z1 = NULL;
+-  point_init (&p2);
+-  point_init (&p1inv);
++      if ( mpi_is_neg (k) )
++        {
++          k->sign = 0;
++          ec_invm (yy, yy, ctx);
++        }
+ 
+-  for (i=loops-2; i > 0; i--)
+-    {
+-      _gcry_mpi_ec_dup_point (result, result, ctx);
+-      if (mpi_test_bit (h, i) == 1 && mpi_test_bit (k, i) == 0)
++      if (!mpi_cmp_ui (point->z, 1))
++        {
++          mpi_set (x1, point->x);
++          mpi_set (y1, yy);
++        }
++      else
+         {
+-          point_set (&p2, result);
+-          _gcry_mpi_ec_add_points (result, &p2, &p1, ctx);
++          gcry_mpi_t z2, z3;
++
++          z2 = mpi_alloc_like (ctx->p);
++          z3 = mpi_alloc_like (ctx->p);
++          ec_mulm (z2, point->z, point->z, ctx);
++          ec_mulm (z3, point->z, z2, ctx);
++          ec_invm (z2, z2, ctx);
++          ec_mulm (x1, point->x, z2, ctx);
++          ec_invm (z3, z3, ctx);
++          ec_mulm (y1, yy, z3, ctx);
++          mpi_free (z2);
++          mpi_free (z3);
+         }
+-      if (mpi_test_bit (h, i) == 0 && mpi_test_bit (k, i) == 1)
++      z1 = mpi_copy (ctx->one);
++
++      mpi_mul (h, k, ctx->three); /* h = 3k */
++      loops = mpi_get_nbits (h);
++      if (loops < 2)
+         {
+-          point_set (&p2, result);
+-          /* Invert point: y = p - y mod p  */
+-          point_set (&p1inv, &p1);
+-          ec_subm (p1inv.y, ctx->p, p1inv.y, ctx);
+-          _gcry_mpi_ec_add_points (result, &p2, &p1inv, ctx);
++          /* If SCALAR is zero, the above mpi_mul sets H to zero and thus
++             LOOPs will be zero.  To avoid an underflow of I in the main
++             loop we set LOOP to 2 and the result to (0,0,0).  */
++          loops = 2;
++          mpi_clear (result->x);
++          mpi_clear (result->y);
++          mpi_clear (result->z);
++        }
++      else
++        {
++          mpi_set (result->x, point->x);
++          mpi_set (result->y, yy);
++          mpi_set (result->z, point->z);
++        }
++      mpi_free (yy); yy = NULL;
++
++      p1.x = x1; x1 = NULL;
++      p1.y = y1; y1 = NULL;
++      p1.z = z1; z1 = NULL;
++      point_init (&p2);
++      point_init (&p1inv);
++
++      for (i=loops-2; i > 0; i--)
++        {
++          _gcry_mpi_ec_dup_point (result, result, ctx);
++          if (mpi_test_bit (h, i) == 1 && mpi_test_bit (k, i) == 0)
++            {
++              point_set (&p2, result);
++              _gcry_mpi_ec_add_points (result, &p2, &p1, ctx);
++            }
++          if (mpi_test_bit (h, i) == 0 && mpi_test_bit (k, i) == 1)
++            {
++              point_set (&p2, result);
++              /* Invert point: y = p - y mod p  */
++              point_set (&p1inv, &p1);
++              ec_subm (p1inv.y, ctx->p, p1inv.y, ctx);
++              _gcry_mpi_ec_add_points (result, &p2, &p1inv, ctx);
++            }
+         }
++
++      point_free (&p1);
++      point_free (&p2);
++      point_free (&p1inv);
++      mpi_free (h);
++      mpi_free (k);
+     }
++}
++
++
++/* Return true if POINT is on the curve described by CTX.  */
++int
++_gcry_mpi_ec_curve_point (mpi_point_t *point, gcry_mpi_t b, mpi_ec_t ctx)
++{
++  int res = 0;
++  gcry_mpi_t x, y, w;
++  gcry_mpi_t xxx;
++
++  x = mpi_new (0);
++  y = mpi_new (0);
++  w = mpi_new (0);
++  xxx = mpi_new (0);
++
++  if (_gcry_mpi_ec_get_affine (x, y, point, ctx))
++    goto leave;
++
++  /* y^2 == x^3 + a·x + b */
++  ec_mulm (y, y, y, ctx);
++
++  ec_mulm (xxx, x, x, ctx);
++  ec_mulm (xxx, xxx, x, ctx);
++  ec_mulm (w, ctx->a, x, ctx);
++  ec_addm (w, w, b, ctx);
++  ec_addm (w, w, xxx, ctx);
++
++  if (!mpi_cmp (y, w))
++    res = 1;
++
++ leave:
++  _gcry_mpi_release (xxx);
++  _gcry_mpi_release (w);
++  _gcry_mpi_release (x);
++  _gcry_mpi_release (y);
+ 
+-  point_free (&p1);
+-  point_free (&p2);
+-  point_free (&p1inv);
+-  mpi_free (h);
+-  mpi_free (k);
+-#endif
++  return res;
+ }
+diff --git a/src/mpi.h b/src/mpi.h
+index 65a4f97..adc65e2 100644
+--- a/src/mpi.h
++++ b/src/mpi.h
+@@ -257,7 +257,7 @@ void _gcry_mpi_ec_add_points (mpi_point_t *result,
+ void _gcry_mpi_ec_mul_point (mpi_point_t *result,
+                              gcry_mpi_t scalar, mpi_point_t *point,
+                              mpi_ec_t ctx);
+-
++int _gcry_mpi_ec_curve_point (mpi_point_t *point, gcry_mpi_t b, mpi_ec_t ctx);
+ 
+ 
+ #endif /*G10_MPI_H*/
+-- 
+2.1.4
+

diff --git a/dev-libs/libgcrypt/libgcrypt-1.5.4-r101.ebuild b/dev-libs/libgcrypt/libgcrypt-1.5.4-r101.ebuild
new file mode 100644
index 0000000..9848675
--- /dev/null
+++ b/dev-libs/libgcrypt/libgcrypt-1.5.4-r101.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+AUTOTOOLS_AUTORECONF=1
+
+inherit autotools-multilib
+
+DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
+HOMEPAGE="http://www.gnupg.org/"
+SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1 MIT"
+SLOT="11/11" # subslot = soname major version
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE=""
+
+RDEPEND=">=dev-libs/libgpg-error-1.12[${MULTILIB_USEDEP}]
+	!dev-libs/libgcrypt:0/11
+	abi_x86_32? (
+		!<=app-emulation/emul-linux-x86-baselibs-20131008-r19
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32]
+	)"
+DEPEND="${RDEPEND}"
+
+DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.5.0-uscore.patch
+	"${FILESDIR}"/${PN}-multilib-syspath.patch
+	"${FILESDIR}"/${P}-clang-arm.patch
+	"${FILESDIR}"/${P}-CVE-2015-7511.patch
+)
+
+src_configure() {
+	local myeconfargs=(
+		--disable-padlock-support # bug 201917
+		--disable-dependency-tracking
+		--enable-noexecstack
+		--disable-O-flag-munging
+
+		# disabled due to various applications requiring privileges
+		# after libgcrypt drops them (bug #468616)
+		--without-capabilities
+
+		# http://trac.videolan.org/vlc/ticket/620
+		# causes bus-errors on sparc64-solaris
+		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
+		$([[ ${CHOST} == sparcv9-*-solaris* ]] && echo "--disable-asm")
+	)
+	autotools-multilib_src_configure
+}
+
+src_install() {
+	autotools-multilib_src_install
+
+	rm -r "${ED%/}"/usr/{bin,include,lib*/*.so,share} || die
+}

diff --git a/dev-libs/libgcrypt/libgcrypt-1.5.4-r2.ebuild b/dev-libs/libgcrypt/libgcrypt-1.5.4-r2.ebuild
new file mode 100644
index 0000000..afc1b20
--- /dev/null
+++ b/dev-libs/libgcrypt/libgcrypt-1.5.4-r2.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+AUTOTOOLS_AUTORECONF=1
+
+inherit autotools-multilib
+
+DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
+HOMEPAGE="http://www.gnupg.org/"
+SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1 MIT"
+SLOT="0/11" # subslot = soname major version
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="static-libs"
+
+RDEPEND=">=dev-libs/libgpg-error-1.12[${MULTILIB_USEDEP}]
+	!dev-libs/libgcrypt:11
+	abi_x86_32? (
+		!<=app-emulation/emul-linux-x86-baselibs-20131008-r19
+		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32]
+	)"
+DEPEND="${RDEPEND}"
+
+DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.5.0-uscore.patch
+	"${FILESDIR}"/${PN}-multilib-syspath.patch
+	"${FILESDIR}"/${P}-clang-arm.patch
+	"${FILESDIR}"/${P}-CVE-2015-7511.patch
+)
+
+MULTILIB_CHOST_TOOLS=(
+	/usr/bin/libgcrypt-config
+)
+
+src_configure() {
+	local myeconfargs=(
+		--disable-padlock-support # bug 201917
+		--disable-dependency-tracking
+		--enable-noexecstack
+		--disable-O-flag-munging
+		$(use_enable static-libs static)
+
+		# disabled due to various applications requiring privileges
+		# after libgcrypt drops them (bug #468616)
+		--without-capabilities
+
+		# http://trac.videolan.org/vlc/ticket/620
+		# causes bus-errors on sparc64-solaris
+		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
+		$([[ ${CHOST} == sparcv9-*-solaris* ]] && echo "--disable-asm")
+	)
+	autotools-multilib_src_configure
+}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/, dev-libs/libgcrypt/files/
@ 2017-04-11  6:52 Alon Bar-Lev
  0 siblings, 0 replies; 10+ messages in thread
From: Alon Bar-Lev @ 2017-04-11  6:52 UTC (permalink / raw
  To: gentoo-commits

commit:     9d90879749a22548cb21093842352e242226bd3e
Author:     Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 11 06:48:19 2017 +0000
Commit:     Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
CommitDate: Tue Apr 11 06:49:27 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d908797

dev-libs/libgcrypt: cleanup

Bug: 613232

Package-Manager: Portage-2.3.3, Repoman-2.3.1

 dev-libs/libgcrypt/Manifest                        |   2 -
 .../files/libgcrypt-1.5.4-CVE-2015-7511.patch      | 326 ---------------------
 .../files/libgcrypt-1.7.5-fix-nehalem.patch        |  41 ---
 dev-libs/libgcrypt/libgcrypt-1.7.3.ebuild          |  71 -----
 dev-libs/libgcrypt/libgcrypt-1.7.5-r2.ebuild       |  75 -----
 5 files changed, 515 deletions(-)

diff --git a/dev-libs/libgcrypt/Manifest b/dev-libs/libgcrypt/Manifest
index 295b7fc4533..1a6b79eadc7 100644
--- a/dev-libs/libgcrypt/Manifest
+++ b/dev-libs/libgcrypt/Manifest
@@ -1,4 +1,2 @@
 DIST libgcrypt-1.5.6.tar.bz2 1548918 SHA256 301826b5e521c867056fd630aad6f0a60e176d18a017da6bc24b1695df3abe79 SHA512 2c16912de66bc83adfbf8f43a2a9f57e1afcc866b1774ec11a670e2a793a7c5f2029d134c0bda681c9cb95f7dcc166133782c124e520b7fbe246ec10a9e1c06a WHIRLPOOL d1d556268fafdf7cd19dc0442e25a24b732748b47ce4edd42ce03b039f42e0c409a4711af6759aa04bbcdd94d0dd1c64a20ede89731458d099ea7864c70c24b4
-DIST libgcrypt-1.7.3.tar.bz2 2861294 SHA256 ddac6111077d0a1612247587be238c5294dd0ee4d76dc7ba783cc55fb0337071 SHA512 55c5704e45167dc5adf1e5a92789a5d841dc27966212cc556abb374e724fddcd85c74b83e0cfa5f3ed2575e3fec9465e8a90d1c5bc8ab1f6697c9abfc2dcaa05 WHIRLPOOL c409710569cc2d9288622884826848eca3677c833c61de20b7e9e771e969a0565fea320d557e3df81024e3b8055deb5c6252ac7dabbfb88e0122dc66f03af0f6
-DIST libgcrypt-1.7.5.tar.bz2 2883968 SHA256 d1fea4128beef2bb30a470af6bafabccc503ced350534fb9dd8f5a53ffbae800 SHA512 575cc6cda3a7c3770e62089d5de1d26de3136a1360b9913814727fdef1c803890d77c57f61621687419d7e572ffd3bc11090cc8899cc4b6af2908ed38324405c WHIRLPOOL 42e790e956d0aeb9d07ce388c80262e34386d436714c7eb436a3c6cdb0d86f863bc42e3dd2fc8cd7e997716fa53002d6f49298015a98666444f47f22def6f5ed
 DIST libgcrypt-1.7.6.tar.bz2 2897695 SHA256 626aafee84af9d2ce253d2c143dc1c0902dda045780cc241f39970fc60be05bc SHA512 fb7e20c50280f2ca715c3fc9a457f1cc22224797812f8dfa3ec756471bd0049c2cf75ffe12daa543aefe6cdcd1b90b4b9f943f148c073ad99d3a7dee42a8173f WHIRLPOOL 30c0e6a61ad0c8d2251beeb46466a2aaec05e991fc097f54302af3cdd98c7456522df006d4e590fd9e95a13f1f8291bc3ea5cd0bb99baecadbc0df2a20f2e0e0

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.5.4-CVE-2015-7511.patch b/dev-libs/libgcrypt/files/libgcrypt-1.5.4-CVE-2015-7511.patch
deleted file mode 100644
index 9ab0b4c2e64..00000000000
--- a/dev-libs/libgcrypt/files/libgcrypt-1.5.4-CVE-2015-7511.patch
+++ /dev/null
@@ -1,326 +0,0 @@
-From fcbb9fcc2e6983ea61bf565b6ee2e29816b8cd57 Mon Sep 17 00:00:00 2001
-From: NIIBE Yutaka <gniibe@fsij.org>
-Date: Wed, 10 Feb 2016 17:43:03 +0900
-Subject: [PATCH] ecc: Fix for chosen cipher text attacks.
-
-* src/mpi.h (_gcry_mpi_ec_curve_point): New internal function.
-* cipher/ecc.c (ecc_decrypt_raw): Validate input.  Remove duplicated
-point_free.
-* mpi/ec.c (_gcry_mpi_ec_mul_point):Use simple left-to-right binary
-method for when SCALAR is secure.
-(_gcry_mpi_ec_curve_point): New.
-
---
-
-CVE-id: CVE-2015-7511
-
-Thanks to Daniel Genkin, Lev Pachmanov, Itamar Pipman, and Eran
-Tromer.   http://www.cs.tau.ac.IL/~tromer/ecdh/
-
-This could be an effective contermeasure to some chosen cipher text
-attacks.
-
-(backport from master
- commit 88e1358962e902ff1cbec8d53ba3eee46407851a)
-(backport from LIBGCRYPT-1-6-BRANCH
- commit 28eb424e4427b320ec1c9c4ce56af25d495230bd)
-
-Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
----
- cipher/ecc.c |  11 ++-
- mpi/ec.c     | 226 +++++++++++++++++++++++++++++++++++------------------------
- src/mpi.h    |   2 +-
- 3 files changed, 145 insertions(+), 94 deletions(-)
-
-diff --git a/cipher/ecc.c b/cipher/ecc.c
-index b8487dc..80b67ae 100644
---- a/cipher/ecc.c
-+++ b/cipher/ecc.c
-@@ -1535,12 +1535,19 @@ ecc_decrypt_raw (int algo, gcry_mpi_t *result, gcry_mpi_t *data,
- 
-   ctx = _gcry_mpi_ec_init (sk.E.p, sk.E.a);
- 
-+  if (!_gcry_mpi_ec_curve_point (&kG, sk.E.b, ctx))
-+    {
-+      point_free (&kG);
-+      point_free (&sk.E.G);
-+      point_free (&sk.Q);
-+      _gcry_mpi_ec_free (ctx);
-+      return GPG_ERR_INV_DATA;
-+    }
-+
-   /* R = dkG */
-   point_init (&R);
-   _gcry_mpi_ec_mul_point (&R, sk.d, &kG, ctx);
- 
--  point_free (&kG);
--
-   /* The following is false: assert( mpi_cmp_ui( R.x, 1 )==0 );, so:  */
-   {
-     gcry_mpi_t x, y;
-diff --git a/mpi/ec.c b/mpi/ec.c
-index fa00818..bdb155a 100644
---- a/mpi/ec.c
-+++ b/mpi/ec.c
-@@ -612,110 +612,154 @@ _gcry_mpi_ec_mul_point (mpi_point_t *result,
-                         gcry_mpi_t scalar, mpi_point_t *point,
-                         mpi_ec_t ctx)
- {
--#if 0
--  /* Simple left to right binary method.  GECC Algorithm 3.27 */
--  unsigned int nbits;
--  int i;
--
--  nbits = mpi_get_nbits (scalar);
--  mpi_set_ui (result->x, 1);
--  mpi_set_ui (result->y, 1);
--  mpi_set_ui (result->z, 0);
--
--  for (i=nbits-1; i >= 0; i--)
-+  if (mpi_is_secure(scalar))
-     {
--      _gcry_mpi_ec_dup_point (result, result, ctx);
--      if (mpi_test_bit (scalar, i) == 1)
--        _gcry_mpi_ec_add_points (result, result, point, ctx);
--    }
--
--#else
--  gcry_mpi_t x1, y1, z1, k, h, yy;
--  unsigned int i, loops;
--  mpi_point_t p1, p2, p1inv;
--
--  x1 = mpi_alloc_like (ctx->p);
--  y1 = mpi_alloc_like (ctx->p);
--  h  = mpi_alloc_like (ctx->p);
--  k  = mpi_copy (scalar);
--  yy = mpi_copy (point->y);
-+      /* Simple left to right binary method.  GECC Algorithm 3.27 */
-+      unsigned int nbits;
-+      int i;
-+      mpi_point_t tmppnt;
- 
--  if ( mpi_is_neg (k) )
--    {
--      k->sign = 0;
--      ec_invm (yy, yy, ctx);
--    }
-+      nbits = mpi_get_nbits (scalar);
-+      mpi_set_ui (result->x, 1);
-+      mpi_set_ui (result->y, 1);
-+      mpi_set_ui (result->z, 0);
- 
--  if (!mpi_cmp_ui (point->z, 1))
--    {
--      mpi_set (x1, point->x);
--      mpi_set (y1, yy);
-+      point_init (&tmppnt);
-+      for (i=nbits-1; i >= 0; i--)
-+        {
-+          _gcry_mpi_ec_dup_point (result, result, ctx);
-+          _gcry_mpi_ec_add_points (&tmppnt, result, point, ctx);
-+          if (mpi_test_bit (scalar, i) == 1)
-+            point_set (result, &tmppnt);
-+        }
-+      point_free (&tmppnt);
-     }
-   else
-     {
--      gcry_mpi_t z2, z3;
--
--      z2 = mpi_alloc_like (ctx->p);
--      z3 = mpi_alloc_like (ctx->p);
--      ec_mulm (z2, point->z, point->z, ctx);
--      ec_mulm (z3, point->z, z2, ctx);
--      ec_invm (z2, z2, ctx);
--      ec_mulm (x1, point->x, z2, ctx);
--      ec_invm (z3, z3, ctx);
--      ec_mulm (y1, yy, z3, ctx);
--      mpi_free (z2);
--      mpi_free (z3);
--    }
--  z1 = mpi_copy (ctx->one);
-+      gcry_mpi_t x1, y1, z1, k, h, yy;
-+      unsigned int i, loops;
-+      mpi_point_t p1, p2, p1inv;
- 
--  mpi_mul (h, k, ctx->three); /* h = 3k */
--  loops = mpi_get_nbits (h);
--  if (loops < 2)
--    {
--      /* If SCALAR is zero, the above mpi_mul sets H to zero and thus
--         LOOPs will be zero.  To avoid an underflow of I in the main
--         loop we set LOOP to 2 and the result to (0,0,0).  */
--      loops = 2;
--      mpi_clear (result->x);
--      mpi_clear (result->y);
--      mpi_clear (result->z);
--    }
--  else
--    {
--      mpi_set (result->x, point->x);
--      mpi_set (result->y, yy);
--      mpi_set (result->z, point->z);
--    }
--  mpi_free (yy); yy = NULL;
-+      x1 = mpi_alloc_like (ctx->p);
-+      y1 = mpi_alloc_like (ctx->p);
-+      h  = mpi_alloc_like (ctx->p);
-+      k  = mpi_copy (scalar);
-+      yy = mpi_copy (point->y);
- 
--  p1.x = x1; x1 = NULL;
--  p1.y = y1; y1 = NULL;
--  p1.z = z1; z1 = NULL;
--  point_init (&p2);
--  point_init (&p1inv);
-+      if ( mpi_is_neg (k) )
-+        {
-+          k->sign = 0;
-+          ec_invm (yy, yy, ctx);
-+        }
- 
--  for (i=loops-2; i > 0; i--)
--    {
--      _gcry_mpi_ec_dup_point (result, result, ctx);
--      if (mpi_test_bit (h, i) == 1 && mpi_test_bit (k, i) == 0)
-+      if (!mpi_cmp_ui (point->z, 1))
-+        {
-+          mpi_set (x1, point->x);
-+          mpi_set (y1, yy);
-+        }
-+      else
-         {
--          point_set (&p2, result);
--          _gcry_mpi_ec_add_points (result, &p2, &p1, ctx);
-+          gcry_mpi_t z2, z3;
-+
-+          z2 = mpi_alloc_like (ctx->p);
-+          z3 = mpi_alloc_like (ctx->p);
-+          ec_mulm (z2, point->z, point->z, ctx);
-+          ec_mulm (z3, point->z, z2, ctx);
-+          ec_invm (z2, z2, ctx);
-+          ec_mulm (x1, point->x, z2, ctx);
-+          ec_invm (z3, z3, ctx);
-+          ec_mulm (y1, yy, z3, ctx);
-+          mpi_free (z2);
-+          mpi_free (z3);
-         }
--      if (mpi_test_bit (h, i) == 0 && mpi_test_bit (k, i) == 1)
-+      z1 = mpi_copy (ctx->one);
-+
-+      mpi_mul (h, k, ctx->three); /* h = 3k */
-+      loops = mpi_get_nbits (h);
-+      if (loops < 2)
-         {
--          point_set (&p2, result);
--          /* Invert point: y = p - y mod p  */
--          point_set (&p1inv, &p1);
--          ec_subm (p1inv.y, ctx->p, p1inv.y, ctx);
--          _gcry_mpi_ec_add_points (result, &p2, &p1inv, ctx);
-+          /* If SCALAR is zero, the above mpi_mul sets H to zero and thus
-+             LOOPs will be zero.  To avoid an underflow of I in the main
-+             loop we set LOOP to 2 and the result to (0,0,0).  */
-+          loops = 2;
-+          mpi_clear (result->x);
-+          mpi_clear (result->y);
-+          mpi_clear (result->z);
-+        }
-+      else
-+        {
-+          mpi_set (result->x, point->x);
-+          mpi_set (result->y, yy);
-+          mpi_set (result->z, point->z);
-+        }
-+      mpi_free (yy); yy = NULL;
-+
-+      p1.x = x1; x1 = NULL;
-+      p1.y = y1; y1 = NULL;
-+      p1.z = z1; z1 = NULL;
-+      point_init (&p2);
-+      point_init (&p1inv);
-+
-+      for (i=loops-2; i > 0; i--)
-+        {
-+          _gcry_mpi_ec_dup_point (result, result, ctx);
-+          if (mpi_test_bit (h, i) == 1 && mpi_test_bit (k, i) == 0)
-+            {
-+              point_set (&p2, result);
-+              _gcry_mpi_ec_add_points (result, &p2, &p1, ctx);
-+            }
-+          if (mpi_test_bit (h, i) == 0 && mpi_test_bit (k, i) == 1)
-+            {
-+              point_set (&p2, result);
-+              /* Invert point: y = p - y mod p  */
-+              point_set (&p1inv, &p1);
-+              ec_subm (p1inv.y, ctx->p, p1inv.y, ctx);
-+              _gcry_mpi_ec_add_points (result, &p2, &p1inv, ctx);
-+            }
-         }
-+
-+      point_free (&p1);
-+      point_free (&p2);
-+      point_free (&p1inv);
-+      mpi_free (h);
-+      mpi_free (k);
-     }
-+}
-+
-+
-+/* Return true if POINT is on the curve described by CTX.  */
-+int
-+_gcry_mpi_ec_curve_point (mpi_point_t *point, gcry_mpi_t b, mpi_ec_t ctx)
-+{
-+  int res = 0;
-+  gcry_mpi_t x, y, w;
-+  gcry_mpi_t xxx;
-+
-+  x = mpi_new (0);
-+  y = mpi_new (0);
-+  w = mpi_new (0);
-+  xxx = mpi_new (0);
-+
-+  if (_gcry_mpi_ec_get_affine (x, y, point, ctx))
-+    goto leave;
-+
-+  /* y^2 == x^3 + a·x + b */
-+  ec_mulm (y, y, y, ctx);
-+
-+  ec_mulm (xxx, x, x, ctx);
-+  ec_mulm (xxx, xxx, x, ctx);
-+  ec_mulm (w, ctx->a, x, ctx);
-+  ec_addm (w, w, b, ctx);
-+  ec_addm (w, w, xxx, ctx);
-+
-+  if (!mpi_cmp (y, w))
-+    res = 1;
-+
-+ leave:
-+  _gcry_mpi_release (xxx);
-+  _gcry_mpi_release (w);
-+  _gcry_mpi_release (x);
-+  _gcry_mpi_release (y);
- 
--  point_free (&p1);
--  point_free (&p2);
--  point_free (&p1inv);
--  mpi_free (h);
--  mpi_free (k);
--#endif
-+  return res;
- }
-diff --git a/src/mpi.h b/src/mpi.h
-index 65a4f97..adc65e2 100644
---- a/src/mpi.h
-+++ b/src/mpi.h
-@@ -257,7 +257,7 @@ void _gcry_mpi_ec_add_points (mpi_point_t *result,
- void _gcry_mpi_ec_mul_point (mpi_point_t *result,
-                              gcry_mpi_t scalar, mpi_point_t *point,
-                              mpi_ec_t ctx);
--
-+int _gcry_mpi_ec_curve_point (mpi_point_t *point, gcry_mpi_t b, mpi_ec_t ctx);
- 
- 
- #endif /*G10_MPI_H*/
--- 
-2.1.4
-

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.7.5-fix-nehalem.patch b/dev-libs/libgcrypt/files/libgcrypt-1.7.5-fix-nehalem.patch
deleted file mode 100644
index 25633adae1e..00000000000
--- a/dev-libs/libgcrypt/files/libgcrypt-1.7.5-fix-nehalem.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From aada604594fd42224d366d3cb98f67fd3b989cd6 Mon Sep 17 00:00:00 2001
-From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
-Date: Wed, 4 Jan 2017 12:02:36 +0200
-Subject: [PATCH 1/1] rijndael-ssse3: fix counter operand from read-only to
- read/write
-
-* cipher/rijndael-ssse3-amd64.c (_gcry_aes_ssse3_ctr_enc): Change
-'ctrlow' operand from read-only to read-write.
---
-
-With read-only operand, compiler is allowed to pass temporary
-register to assembly block and throw away any calculation that
-have been done on that register. On the other hand, compiler is
-also allowed to keep operand value permanently in one register
-as value is treated as read-only, and effectly operates as
-expected. Selection between these two depends on compiler
-version and used flags.
-
-Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
----
- cipher/rijndael-ssse3-amd64.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/cipher/rijndael-ssse3-amd64.c b/cipher/rijndael-ssse3-amd64.c
-index a8e89d4..2adb73f 100644
---- a/cipher/rijndael-ssse3-amd64.c
-+++ b/cipher/rijndael-ssse3-amd64.c
-@@ -387,8 +387,8 @@ _gcry_aes_ssse3_ctr_enc (RIJNDAEL_context *ctx, unsigned char *outbuf,
-                     ".Lno_carry%=:\n\t"
- 
-                     "pshufb %%xmm6, %%xmm7\n\t"
--                    :
--                    : [ctr] "r" (ctr), [ctrlow] "r" (ctrlow)
-+                    : [ctrlow] "+r" (ctrlow)
-+                    : [ctr] "r" (ctr)
-                     : "cc", "memory");
- 
-       do_vpaes_ssse3_enc (ctx, nrounds, aes_const_ptr);
--- 
-2.8.0.rc3
-

diff --git a/dev-libs/libgcrypt/libgcrypt-1.7.3.ebuild b/dev-libs/libgcrypt/libgcrypt-1.7.3.ebuild
deleted file mode 100644
index 7ad973e8e8f..00000000000
--- a/dev-libs/libgcrypt/libgcrypt-1.7.3.ebuild
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-AUTOTOOLS_AUTORECONF=1
-WANT_AUTOMAKE=1.14
-
-inherit autotools-multilib flag-o-matic
-
-DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
-HOMEPAGE="http://www.gnupg.org/"
-SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
-
-LICENSE="LGPL-2.1 MIT"
-SLOT="0/20" # subslot = soname major version
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="doc static-libs"
-
-RDEPEND=">=dev-libs/libgpg-error-1.12[${MULTILIB_USEDEP}]
-	abi_x86_32? (
-		!<=app-emulation/emul-linux-x86-baselibs-20131008-r19
-		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32]
-	)"
-DEPEND="${RDEPEND}
-	doc? ( virtual/texi2dvi )"
-
-DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-1.6.1-uscore.patch
-	"${FILESDIR}"/${PN}-multilib-syspath.patch
-)
-
-MULTILIB_CHOST_TOOLS=(
-	/usr/bin/libgcrypt-config
-)
-
-multilib_src_configure() {
-	if [[ ${CHOST} == *86*-solaris* ]] ; then
-		# ASM code uses GNU ELF syntax, divide in particular, we need to
-		# allow this via ASFLAGS, since we don't have a flag-o-matic
-		# function for that, we'll have to abuse cflags for this
-		append-cflags -Wa,--divide
-	fi
-	local myeconfargs=(
-		--disable-dependency-tracking
-		--enable-noexecstack
-		--disable-O-flag-munging
-		$(use_enable static-libs static)
-
-		# disabled due to various applications requiring privileges
-		# after libgcrypt drops them (bug #468616)
-		--without-capabilities
-
-		# http://trac.videolan.org/vlc/ticket/620
-		# causes bus-errors on sparc64-solaris
-		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
-		$([[ ${CHOST} == sparcv9-*-solaris* ]] && echo "--disable-asm")
-	)
-	autotools-utils_src_configure
-}
-
-multilib_src_compile() {
-	emake
-	multilib_is_native_abi && use doc && VARTEXFONTS="${T}/fonts" emake -C doc gcrypt.pdf
-}
-
-multilib_src_install() {
-	emake DESTDIR="${D}" install
-	multilib_is_native_abi && use doc && dodoc doc/gcrypt.pdf
-}

diff --git a/dev-libs/libgcrypt/libgcrypt-1.7.5-r2.ebuild b/dev-libs/libgcrypt/libgcrypt-1.7.5-r2.ebuild
deleted file mode 100644
index eac98eb478b..00000000000
--- a/dev-libs/libgcrypt/libgcrypt-1.7.5-r2.ebuild
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit autotools flag-o-matic multilib-minimal
-
-DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
-HOMEPAGE="http://www.gnupg.org/"
-SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
-
-LICENSE="LGPL-2.1 MIT"
-SLOT="0/20" # subslot = soname major version
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="doc static-libs"
-
-RDEPEND=">=dev-libs/libgpg-error-1.12[${MULTILIB_USEDEP}]
-	abi_x86_32? (
-		!<=app-emulation/emul-linux-x86-baselibs-20131008-r19
-		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32]
-	)"
-DEPEND="${RDEPEND}
-	doc? ( virtual/texi2dvi )"
-
-DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-1.6.1-uscore.patch
-	"${FILESDIR}"/${PN}-multilib-syspath.patch
-	"${FILESDIR}"/${P}-fix-nehalem.patch
-)
-
-MULTILIB_CHOST_TOOLS=(
-	/usr/bin/libgcrypt-config
-)
-
-src_prepare() {
-	default
-	eautoreconf
-}
-
-multilib_src_configure() {
-	if [[ ${CHOST} == *86*-solaris* ]] ; then
-		# ASM code uses GNU ELF syntax, divide in particular, we need to
-		# allow this via ASFLAGS, since we don't have a flag-o-matic
-		# function for that, we'll have to abuse cflags for this
-		append-cflags -Wa,--divide
-	fi
-	local myeconfargs=(
-		--disable-dependency-tracking
-		--enable-noexecstack
-		--disable-O-flag-munging
-		$(use_enable static-libs static)
-
-		# disabled due to various applications requiring privileges
-		# after libgcrypt drops them (bug #468616)
-		--without-capabilities
-
-		# http://trac.videolan.org/vlc/ticket/620
-		# causes bus-errors on sparc64-solaris
-		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
-		$([[ ${CHOST} == sparcv9-*-solaris* ]] && echo "--disable-asm")
-	)
-	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
-}
-
-multilib_src_compile() {
-	default
-	multilib_is_native_abi && use doc && VARTEXFONTS="${T}/fonts" emake -C doc gcrypt.pdf
-}
-
-multilib_src_install() {
-	emake DESTDIR="${D}" install
-	multilib_is_native_abi && use doc && dodoc doc/gcrypt.pdf
-}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/, dev-libs/libgcrypt/files/
@ 2021-09-18 17:39 David Seifert
  0 siblings, 0 replies; 10+ messages in thread
From: David Seifert @ 2021-09-18 17:39 UTC (permalink / raw
  To: gentoo-commits

commit:     5ea4b6b615f78ace81eba3a21e3d2bfb624e3d97
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 18 17:39:37 2021 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sat Sep 18 17:39:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ea4b6b6

dev-libs/libgcrypt: drop 1.8.6, 1.9.1-r1, 1.9.2, 1.9.3

Signed-off-by: David Seifert <soap <AT> gentoo.org>

 dev-libs/libgcrypt/Manifest                        |   4 -
 .../libgcrypt-1.9.1-fix-no-asm-on-amd64-x86.patch  | 141 ---------------------
 dev-libs/libgcrypt/libgcrypt-1.8.6.ebuild          |  77 -----------
 dev-libs/libgcrypt/libgcrypt-1.9.1-r1.ebuild       |  88 -------------
 dev-libs/libgcrypt/libgcrypt-1.9.2.ebuild          |  86 -------------
 dev-libs/libgcrypt/libgcrypt-1.9.3.ebuild          |  86 -------------
 6 files changed, 482 deletions(-)

diff --git a/dev-libs/libgcrypt/Manifest b/dev-libs/libgcrypt/Manifest
index 1d1e4d9d62a..5a23e33ec52 100644
--- a/dev-libs/libgcrypt/Manifest
+++ b/dev-libs/libgcrypt/Manifest
@@ -1,7 +1,3 @@
-DIST libgcrypt-1.8.6.tar.bz2 2997781 BLAKE2B 90ecacae75633dfff248b9c07a72126aaa4a5c285141f89c42237326ae3bfb99c937eef05d87b466c3d8f5cf022725ccee5c0dbc74d4eb57523a8a2892864b65 SHA512 28a26f665b7e327b79815849ee6e84ab384ee9105d81d4d06e4feeea07d986f940cbbb9faaae8712068cace45b4110a62965a93201da0e1ad008b65808b2b29b
 DIST libgcrypt-1.8.7.tar.bz2 2985660 BLAKE2B cb2132b826f3f3af240e6c9ac5fd992808aa17ce64144d17452591a5b1e402564af82c021b58f5fd620ebeb5894ac9654835f6d8376ec05ee41fc02189dd6825 SHA512 6309d17624d8029848990d225d5924886c951cef691266c8e010fbbb7f678972cee70cbb91d370ad0bcdc8c8761402a090c2c853c9427ec79293624a59da5060
 DIST libgcrypt-1.8.8.tar.bz2 2987685 BLAKE2B 7b590c06d91403f1bbfa108379b3747271e9c83acc5547a4d43ef9ada9b0b7c78654cdc24f6cd0db012d50628ae4ec9320dcb63a901ec2dadde6a7ed56dbed7e SHA512 9861f3b5da3cb013eb79efbf2859864f8c2c11b41484b051c981c45cc0bf1569202838226da10ebddeb7a7b7f39ebd3a95f107b9bf6f908074ccc9a51ea94db8
-DIST libgcrypt-1.9.1.tar.bz2 3202683 BLAKE2B 102a61c855fb4a9e5c9433f52988ea87db7672de6586ed47f888526369d0ef8ad640752ca1ef144c2db73ce90464d6624cc3b12dbdeaf568d706222af3955672 SHA512 e8a028724cf5476fff0ca82c5c279a64b3bc5d1fd1472b784df4084b185266825baffc49e27b90db7453c8faef68cd0b8264f379abacee629bbdf6b11f2a28d6
-DIST libgcrypt-1.9.2.tar.bz2 3206187 BLAKE2B e0ceb02b0c26a7246c4146640a9dcea01429a365bd484532b9d85fdb0c8f4ac1308862e70899a1593f4665e4b2d16ceaa10029702f67720897975258a25d8ab0 SHA512 d2e3dc89788763229f554382b3cf0c3a2680f774258abc4c1fd9ef1ad44920d57d14422af9b6b405e42742e691d19ab2ee458fddf057e778964519eee090f016
-DIST libgcrypt-1.9.3.tar.bz2 3219061 BLAKE2B 51a6273ba28829c016d9a93fffa181aec24170d0e4d3a363c788f336219e1531274344adeea289f3cc09161fdb2e56846551367a8ac880b14e03a52ab0dd551a SHA512 977e766887c14f19aa1b9fcc0214303036a649e41cd4278de76da7d734cf36888e2e1b6275590dac523dcb4ba8ab07993e6ee8209fd5f1a3383d738b09a060d6
 DIST libgcrypt-1.9.4.tar.bz2 3239704 BLAKE2B b8244bc12a68955797b0c2b474ac5c95df1014231f7180a2ffa113e3aacedc98eed60ee1e4b30b032a5fcd6a04855ae07142c223906d5db9c28328a71e014f33 SHA512 d0e117ac73c94d70e9521ee1e6328691498cc8328f8c4e21338096908f5c04c7b838966eb63d59494565f4e19f506c07dab4f4d922150d75610d9f7b57abbf60

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.9.1-fix-no-asm-on-amd64-x86.patch b/dev-libs/libgcrypt/files/libgcrypt-1.9.1-fix-no-asm-on-amd64-x86.patch
deleted file mode 100644
index 875c2237008..00000000000
--- a/dev-libs/libgcrypt/files/libgcrypt-1.9.1-fix-no-asm-on-amd64-x86.patch
+++ /dev/null
@@ -1,141 +0,0 @@
-Broken in https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff;h=8d404a629167d67ed56e45de3e65d1e0b7cdeb24;hp=3b34bd6e178614d6021ee7d1140646f7c8ed7519
-https://dev.gnupg.org/T5277
-https://bugs.gentoo.org/767859
-
-This is a revert of that commit, as suggested by upstream in the linked bug.
-diff --git a/random/rand-internal.h b/random/rand-internal.h
-index 34221569..d99c6671 100644
---- a/random/rand-internal.h
-+++ b/random/rand-internal.h
-@@ -141,7 +141,7 @@ void _gcry_rndhw_poll_fast (void (*add)(const void*, size_t,
-                             enum random_origins origin);
- size_t _gcry_rndhw_poll_slow (void (*add)(const void*, size_t,
-                                           enum random_origins),
--                              enum random_origins origin, size_t req_length);
-+                              enum random_origins origin);
- 
- 
- 
-diff --git a/random/rndhw.c b/random/rndhw.c
-index 3cf9acc3..2829382c 100644
---- a/random/rndhw.c
-+++ b/random/rndhw.c
-@@ -198,33 +198,24 @@ _gcry_rndhw_poll_fast (void (*add)(const void*, size_t, enum random_origins),
- 
- 
- /* Read 64 bytes from a hardware RNG and return the number of bytes
--   actually read.  However hardware source is let account only
--   for up to 50% (or 25% for RDRAND) of the requested bytes.  */
-+   actually read.  */
- size_t
- _gcry_rndhw_poll_slow (void (*add)(const void*, size_t, enum random_origins),
--                       enum random_origins origin, size_t req_length)
-+                       enum random_origins origin)
- {
-   size_t nbytes = 0;
- 
-   (void)add;
-   (void)origin;
- 
--  req_length /= 2; /* Up to 50%. */
--
- #ifdef USE_DRNG
-   if ((_gcry_get_hw_features () & HWF_INTEL_RDRAND))
--    {
--      req_length /= 2; /* Up to 25%. */
--      nbytes += poll_drng (add, origin, 0);
--    }
-+    nbytes += poll_drng (add, origin, 0);
- #endif
- #ifdef USE_PADLOCK
-   if ((_gcry_get_hw_features () & HWF_PADLOCK_RNG))
-     nbytes += poll_padlock (add, origin, 0);
- #endif
- 
--  if (nbytes > req_length)
--    nbytes = req_length;
--
-   return nbytes;
- }
-diff --git a/random/rndlinux.c b/random/rndlinux.c
-index a22db177..f378a549 100644
---- a/random/rndlinux.c
-+++ b/random/rndlinux.c
-@@ -190,10 +190,19 @@ _gcry_rndlinux_gather_random (void (*add)(const void*, size_t,
-     }
- 
- 
--  /* First read from a hardware source.  Note that _gcry_rndhw_poll_slow lets
--     it account only for up to 50% (or 25% for RDRAND) of the requested
--     bytes.  */
--  n_hw = _gcry_rndhw_poll_slow (add, origin, length);
-+  /* First read from a hardware source.  However let it account only
-+     for up to 50% (or 25% for RDRAND) of the requested bytes.  */
-+  n_hw = _gcry_rndhw_poll_slow (add, origin);
-+  if ((_gcry_get_hw_features () & HWF_INTEL_RDRAND))
-+    {
-+      if (n_hw > length/4)
-+        n_hw = length/4;
-+    }
-+  else
-+    {
-+      if (n_hw > length/2)
-+        n_hw = length/2;
-+    }
-   if (length > 1)
-     length -= n_hw;
- 
-diff --git a/src/g10lib.h b/src/g10lib.h
-index 243997eb..cba2e237 100644
---- a/src/g10lib.h
-+++ b/src/g10lib.h
-@@ -217,8 +217,6 @@ char **_gcry_strtokenize (const char *string, const char *delim);
- 
- 
- /*-- src/hwfeatures.c --*/
--#if defined(HAVE_CPU_ARCH_X86)
--
- #define HWF_PADLOCK_RNG         (1 << 0)
- #define HWF_PADLOCK_AES         (1 << 1)
- #define HWF_PADLOCK_SHA         (1 << 2)
-@@ -238,28 +236,20 @@ char **_gcry_strtokenize (const char *string, const char *delim);
- #define HWF_INTEL_RDTSC         (1 << 15)
- #define HWF_INTEL_SHAEXT        (1 << 16)
- 
--#elif defined(HAVE_CPU_ARCH_ARM)
--
--#define HWF_ARM_NEON            (1 << 0)
--#define HWF_ARM_AES             (1 << 1)
--#define HWF_ARM_SHA1            (1 << 2)
--#define HWF_ARM_SHA2            (1 << 3)
--#define HWF_ARM_PMULL           (1 << 4)
--
--#elif defined(HAVE_CPU_ARCH_PPC)
-+#define HWF_ARM_NEON            (1 << 17)
-+#define HWF_ARM_AES             (1 << 18)
-+#define HWF_ARM_SHA1            (1 << 19)
-+#define HWF_ARM_SHA2            (1 << 20)
-+#define HWF_ARM_PMULL           (1 << 21)
- 
--#define HWF_PPC_VCRYPTO         (1 << 0)
--#define HWF_PPC_ARCH_3_00       (1 << 1)
--#define HWF_PPC_ARCH_2_07       (1 << 2)
-+#define HWF_PPC_VCRYPTO         (1 << 22)
-+#define HWF_PPC_ARCH_3_00       (1 << 23)
-+#define HWF_PPC_ARCH_2_07       (1 << 24)
- 
--#elif defined(HAVE_CPU_ARCH_S390X)
--
--#define HWF_S390X_MSA           (1 << 0)
--#define HWF_S390X_MSA_4         (1 << 1)
--#define HWF_S390X_MSA_8         (1 << 2)
--#define HWF_S390X_VX            (1 << 3)
--
--#endif
-+#define HWF_S390X_MSA           (1 << 25)
-+#define HWF_S390X_MSA_4         (1 << 26)
-+#define HWF_S390X_MSA_8         (1 << 27)
-+#define HWF_S390X_VX            (1 << 28)
- 
- gpg_err_code_t _gcry_disable_hw_feature (const char *name);
- void _gcry_detect_hw_features (void);

diff --git a/dev-libs/libgcrypt/libgcrypt-1.8.6.ebuild b/dev-libs/libgcrypt/libgcrypt-1.8.6.ebuild
deleted file mode 100644
index 104cd442afc..00000000000
--- a/dev-libs/libgcrypt/libgcrypt-1.8.6.ebuild
+++ /dev/null
@@ -1,77 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit autotools flag-o-matic multilib-minimal toolchain-funcs
-
-DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
-HOMEPAGE="https://www.gnupg.org/"
-SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
-
-LICENSE="LGPL-2.1 MIT"
-SLOT="0/20" # subslot = soname major version
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="doc o-flag-munging static-libs"
-
-RDEPEND=">=dev-libs/libgpg-error-1.25[${MULTILIB_USEDEP}]"
-DEPEND="${RDEPEND}"
-BDEPEND="doc? ( virtual/texi2dvi )"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-1.6.1-uscore.patch
-	"${FILESDIR}"/${PN}-multilib-syspath.patch
-)
-
-MULTILIB_CHOST_TOOLS=(
-	/usr/bin/libgcrypt-config
-)
-
-src_prepare() {
-	default
-	eautoreconf
-}
-
-multilib_src_configure() {
-	if [[ ${CHOST} == *86*-solaris* ]] ; then
-		# ASM code uses GNU ELF syntax, divide in particular, we need to
-		# allow this via ASFLAGS, since we don't have a flag-o-matic
-		# function for that, we'll have to abuse cflags for this
-		append-cflags -Wa,--divide
-	fi
-	local myeconfargs=(
-		CC_FOR_BUILD="$(tc-getBUILD_CC)"
-		--enable-noexecstack
-		# required for sys-power/suspend[crypt], bug 751568
-		$(use_enable static-libs static)
-		$(use_enable o-flag-munging O-flag-munging)
-
-		# disabled due to various applications requiring privileges
-		# after libgcrypt drops them (bug #468616)
-		--without-capabilities
-
-		# http://trac.videolan.org/vlc/ticket/620
-		# causes bus-errors on sparc64-solaris
-		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
-		$([[ ${CHOST} == sparcv9-*-solaris* ]] && echo "--disable-asm")
-
-		GPG_ERROR_CONFIG="${EROOT}/usr/bin/${CHOST}-gpg-error-config"
-	)
-	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" \
-		$("${S}/configure" --help | grep -o -- '--without-.*-prefix')
-}
-
-multilib_src_compile() {
-	default
-	multilib_is_native_abi && use doc && VARTEXFONTS="${T}/fonts" emake -C doc gcrypt.pdf
-}
-
-multilib_src_install() {
-	emake DESTDIR="${D}" install
-	multilib_is_native_abi && use doc && dodoc doc/gcrypt.pdf
-}
-
-multilib_src_install_all() {
-	default
-	find "${D}" -type f -name '*.la' -delete || die
-}

diff --git a/dev-libs/libgcrypt/libgcrypt-1.9.1-r1.ebuild b/dev-libs/libgcrypt/libgcrypt-1.9.1-r1.ebuild
deleted file mode 100644
index 8ba8d90c7b2..00000000000
--- a/dev-libs/libgcrypt/libgcrypt-1.9.1-r1.ebuild
+++ /dev/null
@@ -1,88 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit autotools flag-o-matic multilib-minimal toolchain-funcs
-
-DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
-HOMEPAGE="https://www.gnupg.org/"
-SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
-
-LICENSE="LGPL-2.1 MIT"
-SLOT="0/20" # subslot = soname major version
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="+asm cpu_flags_arm_neon cpu_flags_x86_aes cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_padlock cpu_flags_x86_sha cpu_flags_x86_sse4_1 doc o-flag-munging static-libs"
-
-RDEPEND=">=dev-libs/libgpg-error-1.25[${MULTILIB_USEDEP}]"
-DEPEND="${RDEPEND}"
-BDEPEND="doc? ( virtual/texi2dvi )"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-1.6.1-uscore.patch
-	"${FILESDIR}"/${PN}-multilib-syspath.patch
-	"${FILESDIR}"/${PN}-1.9.1-fix-no-asm-on-amd64-x86.patch
-)
-
-MULTILIB_CHOST_TOOLS=(
-	/usr/bin/libgcrypt-config
-)
-
-src_prepare() {
-	default
-	eautoreconf
-}
-
-multilib_src_configure() {
-	if [[ ${CHOST} == *86*-solaris* ]] ; then
-		# ASM code uses GNU ELF syntax, divide in particular, we need to
-		# allow this via ASFLAGS, since we don't have a flag-o-matic
-		# function for that, we'll have to abuse cflags for this
-		append-cflags -Wa,--divide
-	fi
-	local myeconfargs=(
-		CC_FOR_BUILD="$(tc-getBUILD_CC)"
-
-		--enable-noexecstack
-		$(use_enable cpu_flags_arm_neon neon-support)
-		$(use_enable cpu_flags_x86_aes aesni-support)
-		$(use_enable cpu_flags_x86_avx avx-support)
-		$(use_enable cpu_flags_x86_avx2 avx2-support)
-		$(use_enable cpu_flags_x86_padlock padlock-support)
-		$(use_enable cpu_flags_x86_sha shaext-support)
-		$(use_enable cpu_flags_x86_sse4_1 sse41-support)
-		# required for sys-power/suspend[crypt], bug 751568
-		$(use_enable static-libs static)
-		$(use_enable o-flag-munging O-flag-munging)
-
-		# disabled due to various applications requiring privileges
-		# after libgcrypt drops them (bug #468616)
-		--without-capabilities
-
-		# http://trac.videolan.org/vlc/ticket/620
-		# causes bus-errors on sparc64-solaris
-		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
-		$([[ ${CHOST} == sparcv9-*-solaris* ]] && echo "--disable-asm")
-
-		$(use asm || echo "--disable-asm")
-
-		GPG_ERROR_CONFIG="${EROOT}/usr/bin/${CHOST}-gpg-error-config"
-	)
-	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" \
-		$("${S}/configure" --help | grep -o -- '--without-.*-prefix')
-}
-
-multilib_src_compile() {
-	default
-	multilib_is_native_abi && use doc && VARTEXFONTS="${T}/fonts" emake -C doc gcrypt.pdf
-}
-
-multilib_src_install() {
-	emake DESTDIR="${D}" install
-	multilib_is_native_abi && use doc && dodoc doc/gcrypt.pdf
-}
-
-multilib_src_install_all() {
-	default
-	find "${ED}" -type f -name '*.la' -delete || die
-}

diff --git a/dev-libs/libgcrypt/libgcrypt-1.9.2.ebuild b/dev-libs/libgcrypt/libgcrypt-1.9.2.ebuild
deleted file mode 100644
index 584154b6ff2..00000000000
--- a/dev-libs/libgcrypt/libgcrypt-1.9.2.ebuild
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit autotools flag-o-matic multilib-minimal toolchain-funcs
-
-DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
-HOMEPAGE="https://www.gnupg.org/"
-SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
-
-LICENSE="LGPL-2.1 MIT"
-SLOT="0/20" # subslot = soname major version
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="+asm cpu_flags_arm_neon cpu_flags_x86_aes cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_padlock cpu_flags_x86_sha cpu_flags_x86_sse4_1 doc o-flag-munging static-libs"
-
-RDEPEND=">=dev-libs/libgpg-error-1.25[${MULTILIB_USEDEP}]"
-DEPEND="${RDEPEND}"
-BDEPEND="doc? ( virtual/texi2dvi )"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-multilib-syspath.patch
-)
-
-MULTILIB_CHOST_TOOLS=(
-	/usr/bin/libgcrypt-config
-)
-
-src_prepare() {
-	default
-	eautoreconf
-}
-
-multilib_src_configure() {
-	if [[ ${CHOST} == *86*-solaris* ]] ; then
-		# ASM code uses GNU ELF syntax, divide in particular, we need to
-		# allow this via ASFLAGS, since we don't have a flag-o-matic
-		# function for that, we'll have to abuse cflags for this
-		append-cflags -Wa,--divide
-	fi
-	local myeconfargs=(
-		CC_FOR_BUILD="$(tc-getBUILD_CC)"
-
-		--enable-noexecstack
-		$(use_enable cpu_flags_arm_neon neon-support)
-		$(use_enable cpu_flags_x86_aes aesni-support)
-		$(use_enable cpu_flags_x86_avx avx-support)
-		$(use_enable cpu_flags_x86_avx2 avx2-support)
-		$(use_enable cpu_flags_x86_padlock padlock-support)
-		$(use_enable cpu_flags_x86_sha shaext-support)
-		$(use_enable cpu_flags_x86_sse4_1 sse41-support)
-		# required for sys-power/suspend[crypt], bug 751568
-		$(use_enable static-libs static)
-		$(use_enable o-flag-munging O-flag-munging)
-
-		# disabled due to various applications requiring privileges
-		# after libgcrypt drops them (bug #468616)
-		--without-capabilities
-
-		# http://trac.videolan.org/vlc/ticket/620
-		# causes bus-errors on sparc64-solaris
-		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
-		$([[ ${CHOST} == sparcv9-*-solaris* ]] && echo "--disable-asm")
-
-		$(use asm || echo "--disable-asm")
-
-		GPG_ERROR_CONFIG="${ESYSROOT}/usr/bin/${CHOST}-gpg-error-config"
-	)
-	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" \
-		$("${S}/configure" --help | grep -o -- '--without-.*-prefix')
-}
-
-multilib_src_compile() {
-	default
-	multilib_is_native_abi && use doc && VARTEXFONTS="${T}/fonts" emake -C doc gcrypt.pdf
-}
-
-multilib_src_install() {
-	emake DESTDIR="${D}" install
-	multilib_is_native_abi && use doc && dodoc doc/gcrypt.pdf
-}
-
-multilib_src_install_all() {
-	default
-	find "${ED}" -type f -name '*.la' -delete || die
-}

diff --git a/dev-libs/libgcrypt/libgcrypt-1.9.3.ebuild b/dev-libs/libgcrypt/libgcrypt-1.9.3.ebuild
deleted file mode 100644
index 584154b6ff2..00000000000
--- a/dev-libs/libgcrypt/libgcrypt-1.9.3.ebuild
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit autotools flag-o-matic multilib-minimal toolchain-funcs
-
-DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
-HOMEPAGE="https://www.gnupg.org/"
-SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
-
-LICENSE="LGPL-2.1 MIT"
-SLOT="0/20" # subslot = soname major version
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="+asm cpu_flags_arm_neon cpu_flags_x86_aes cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_padlock cpu_flags_x86_sha cpu_flags_x86_sse4_1 doc o-flag-munging static-libs"
-
-RDEPEND=">=dev-libs/libgpg-error-1.25[${MULTILIB_USEDEP}]"
-DEPEND="${RDEPEND}"
-BDEPEND="doc? ( virtual/texi2dvi )"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-multilib-syspath.patch
-)
-
-MULTILIB_CHOST_TOOLS=(
-	/usr/bin/libgcrypt-config
-)
-
-src_prepare() {
-	default
-	eautoreconf
-}
-
-multilib_src_configure() {
-	if [[ ${CHOST} == *86*-solaris* ]] ; then
-		# ASM code uses GNU ELF syntax, divide in particular, we need to
-		# allow this via ASFLAGS, since we don't have a flag-o-matic
-		# function for that, we'll have to abuse cflags for this
-		append-cflags -Wa,--divide
-	fi
-	local myeconfargs=(
-		CC_FOR_BUILD="$(tc-getBUILD_CC)"
-
-		--enable-noexecstack
-		$(use_enable cpu_flags_arm_neon neon-support)
-		$(use_enable cpu_flags_x86_aes aesni-support)
-		$(use_enable cpu_flags_x86_avx avx-support)
-		$(use_enable cpu_flags_x86_avx2 avx2-support)
-		$(use_enable cpu_flags_x86_padlock padlock-support)
-		$(use_enable cpu_flags_x86_sha shaext-support)
-		$(use_enable cpu_flags_x86_sse4_1 sse41-support)
-		# required for sys-power/suspend[crypt], bug 751568
-		$(use_enable static-libs static)
-		$(use_enable o-flag-munging O-flag-munging)
-
-		# disabled due to various applications requiring privileges
-		# after libgcrypt drops them (bug #468616)
-		--without-capabilities
-
-		# http://trac.videolan.org/vlc/ticket/620
-		# causes bus-errors on sparc64-solaris
-		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
-		$([[ ${CHOST} == sparcv9-*-solaris* ]] && echo "--disable-asm")
-
-		$(use asm || echo "--disable-asm")
-
-		GPG_ERROR_CONFIG="${ESYSROOT}/usr/bin/${CHOST}-gpg-error-config"
-	)
-	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" \
-		$("${S}/configure" --help | grep -o -- '--without-.*-prefix')
-}
-
-multilib_src_compile() {
-	default
-	multilib_is_native_abi && use doc && VARTEXFONTS="${T}/fonts" emake -C doc gcrypt.pdf
-}
-
-multilib_src_install() {
-	emake DESTDIR="${D}" install
-	multilib_is_native_abi && use doc && dodoc doc/gcrypt.pdf
-}
-
-multilib_src_install_all() {
-	default
-	find "${ED}" -type f -name '*.la' -delete || die
-}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/, dev-libs/libgcrypt/files/
@ 2022-01-18 13:12 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2022-01-18 13:12 UTC (permalink / raw
  To: gentoo-commits

commit:     092edcd917732ae0d21ef78f0484cc73d386225a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 18 13:12:38 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jan 18 13:12:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=092edcd9

dev-libs/libgcrypt: fix build on ARM

Closes: https://bugs.gentoo.org/831397
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../libgcrypt-1.9.4-arm-neon-compile-fix.patch     | 42 ++++++++++++++++++++++
 dev-libs/libgcrypt/libgcrypt-1.9.4.ebuild          |  1 +
 2 files changed, 43 insertions(+)

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.9.4-arm-neon-compile-fix.patch b/dev-libs/libgcrypt/files/libgcrypt-1.9.4-arm-neon-compile-fix.patch
new file mode 100644
index 000000000000..b8126185817b
--- /dev/null
+++ b/dev-libs/libgcrypt/files/libgcrypt-1.9.4-arm-neon-compile-fix.patch
@@ -0,0 +1,42 @@
+From bc0b82ad8201a4d7bffa3cf0f5504b72c1011cb1 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Tue, 18 Jan 2022 12:44:22 +0000
+Subject: [PATCH] cipher/cipher-gcm: fix build failure on ARM NEON
+
+'features' is only defined when relevant CPU features are found, but
+one of the uses below its definition checked for GCM_USE_ARM_NEON which
+wasn't in the guard above it.
+
+i.e. We used to only define 'features' when:
+- GCM_USE_INTEL_PCLMUL
+- GCM_USE_ARM_PMULL
+- GCM_USE_S390X_CRYPTO
+- GCM_USE_PPC_VPMSUM
+- GCM_USE_S390X_CRYPTO
+- GCM_USE_PPC_VPMSUM
+is set.
+
+We were missing GCM_USE_ARM_NEON so when we check for GCM_USE_ARM_NEON
+below, it'd fail as features wasn't defined.
+
+Bug: https://bugs.gentoo.org/831397
+---
+ cipher/cipher-gcm.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/cipher/cipher-gcm.c b/cipher/cipher-gcm.c
+index a039c5e9..22834f35 100644
+--- a/cipher/cipher-gcm.c
++++ b/cipher/cipher-gcm.c
+@@ -583,7 +583,8 @@ static void
+ setupM (gcry_cipher_hd_t c)
+ {
+ #if defined(GCM_USE_INTEL_PCLMUL) || defined(GCM_USE_ARM_PMULL) || \
+-    defined(GCM_USE_S390X_CRYPTO) || defined(GCM_USE_PPC_VPMSUM)
++    defined(GCM_USE_ARM_NEON) || defined(GCM_USE_S390X_CRYPTO) || \
++    defined(GCM_USE_PPC_VPMSUM)
+   unsigned int features = _gcry_get_hw_features ();
+ #endif
+ 
+-- 
+2.34.1

diff --git a/dev-libs/libgcrypt/libgcrypt-1.9.4.ebuild b/dev-libs/libgcrypt/libgcrypt-1.9.4.ebuild
index b60616307fb9..a5b6b9652284 100644
--- a/dev-libs/libgcrypt/libgcrypt-1.9.4.ebuild
+++ b/dev-libs/libgcrypt/libgcrypt-1.9.4.ebuild
@@ -35,6 +35,7 @@ BDEPEND="doc? ( virtual/texi2dvi )"
 PATCHES=(
 	"${FILESDIR}"/${PN}-multilib-syspath.patch
 	"${FILESDIR}"/${PN}-powerpc-darwin.patch
+	"${FILESDIR}"/${PN}-1.9.4-arm-neon-compile-fix.patch
 )
 
 MULTILIB_CHOST_TOOLS=(


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/, dev-libs/libgcrypt/files/
@ 2022-09-11 17:49 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2022-09-11 17:49 UTC (permalink / raw
  To: gentoo-commits

commit:     89403d02a8a9cfdf3ed6356159505774f0b501c2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 11 17:45:13 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep 11 17:45:13 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89403d02

dev-libs/libgcrypt: fix fgrep warnings in libgcrypt-config

Closes: https://bugs.gentoo.org/868384
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../libgcrypt-1.9.4-no-fgrep-libgcrypt-config.patch | 21 +++++++++++++++++++++
 ...-1.10.1-r1.ebuild => libgcrypt-1.10.1-r2.ebuild} |  1 +
 ...pt-1.9.4-r1.ebuild => libgcrypt-1.9.4-r2.ebuild} |  1 +
 3 files changed, 23 insertions(+)

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.9.4-no-fgrep-libgcrypt-config.patch b/dev-libs/libgcrypt/files/libgcrypt-1.9.4-no-fgrep-libgcrypt-config.patch
new file mode 100644
index 000000000000..738eac1631b6
--- /dev/null
+++ b/dev-libs/libgcrypt/files/libgcrypt-1.9.4-no-fgrep-libgcrypt-config.patch
@@ -0,0 +1,21 @@
+https://bugs.gentoo.org/868384
+--- a/src/libgcrypt-config.in
++++ b/src/libgcrypt-config.in
+@@ -154,7 +154,7 @@ if test "$echo_cflags" = "yes"; then
+ 
+     tmp=""
+     for i in $includes $cflags_final; do
+-       if echo "$tmp" | fgrep -v -- "$i" >/dev/null; then
++       if echo "$tmp" | grep -F -v -- "$i" >/dev/null; then
+            tmp="$tmp $i"
+        fi
+     done
+@@ -178,7 +178,7 @@ if test "$echo_libs" = "yes"; then
+ 
+     tmp=""
+     for i in $libdirs $libs_final; do
+-       if echo "$tmp" | fgrep -v -- "$i" >/dev/null; then
++       if echo "$tmp" | grep -F -v -- "$i" >/dev/null; then
+            tmp="$tmp $i"
+        fi
+     done

diff --git a/dev-libs/libgcrypt/libgcrypt-1.10.1-r1.ebuild b/dev-libs/libgcrypt/libgcrypt-1.10.1-r2.ebuild
similarity index 98%
rename from dev-libs/libgcrypt/libgcrypt-1.10.1-r1.ebuild
rename to dev-libs/libgcrypt/libgcrypt-1.10.1-r2.ebuild
index b7a3aa4aaf26..285a83d7d62f 100644
--- a/dev-libs/libgcrypt/libgcrypt-1.10.1-r1.ebuild
+++ b/dev-libs/libgcrypt/libgcrypt-1.10.1-r2.ebuild
@@ -39,6 +39,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-multilib-syspath.patch
 	"${FILESDIR}"/${PN}-powerpc-darwin.patch
 	"${FILESDIR}"/${PN}-1.10.1-fix-no-asm-hppa.patch
+	"${FILESDIR}"/${PN}-1.9.4-no-fgrep-libgcrypt-config.patch
 )
 
 MULTILIB_CHOST_TOOLS=(

diff --git a/dev-libs/libgcrypt/libgcrypt-1.9.4-r1.ebuild b/dev-libs/libgcrypt/libgcrypt-1.9.4-r2.ebuild
similarity index 98%
rename from dev-libs/libgcrypt/libgcrypt-1.9.4-r1.ebuild
rename to dev-libs/libgcrypt/libgcrypt-1.9.4-r2.ebuild
index 713d3c7e3a16..c7a2a6fe71fc 100644
--- a/dev-libs/libgcrypt/libgcrypt-1.9.4-r1.ebuild
+++ b/dev-libs/libgcrypt/libgcrypt-1.9.4-r2.ebuild
@@ -39,6 +39,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-multilib-syspath.patch
 	"${FILESDIR}"/${PN}-powerpc-darwin.patch
 	"${FILESDIR}"/${PN}-1.9.4-arm-neon-compile-fix.patch
+	"${FILESDIR}"/${PN}-1.9.4-no-fgrep-libgcrypt-config.patch
 )
 
 MULTILIB_CHOST_TOOLS=(


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/, dev-libs/libgcrypt/files/
@ 2023-04-03 14:51 Mike Gilbert
  0 siblings, 0 replies; 10+ messages in thread
From: Mike Gilbert @ 2023-04-03 14:51 UTC (permalink / raw
  To: gentoo-commits

commit:     c4d457bd94c24853e0f6fe5ad3551f9407edde79
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  3 14:47:14 2023 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Apr  3 14:47:46 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4d457bd

dev-libs/libgcrypt: enable munging of -Oz

Closes: https://bugs.gentoo.org/902765
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 .../libgcrypt-1.10-build-Allow-build-with-Oz.patch | 50 ++++++++++++++++++++++
 dev-libs/libgcrypt/libgcrypt-1.10.1-r3.ebuild      |  1 +
 2 files changed, 51 insertions(+)

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.10-build-Allow-build-with-Oz.patch b/dev-libs/libgcrypt/files/libgcrypt-1.10-build-Allow-build-with-Oz.patch
new file mode 100644
index 000000000000..c54499e15dba
--- /dev/null
+++ b/dev-libs/libgcrypt/files/libgcrypt-1.10-build-Allow-build-with-Oz.patch
@@ -0,0 +1,50 @@
+https://bugs.gentoo.org/902765
+https://dev.gnupg.org/T6432
+https://dev.gnupg.org/rC7edf1abb9a0d892a80cbf7ab42f64b2720671ee9
+
+From 7edf1abb9a0d892a80cbf7ab42f64b2720671ee9 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Mon, 3 Apr 2023 14:00:15 +0900
+Subject: [PATCH] build: Allow build with -Oz.
+
+* cipher/Makefile.am [ENABLE_O_FLAG_MUNGING]: Support -Oz.
+* random/Makefile.am [ENABLE_O_FLAG_MUNGING]: Support -Oz.
+
+--
+
+GnuPG-bug-id: 6432
+Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
+---
+ cipher/Makefile.am | 2 +-
+ random/Makefile.am | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cipher/Makefile.am b/cipher/Makefile.am
+index cf1fbe85..e67b1ee2 100644
+--- a/cipher/Makefile.am
++++ b/cipher/Makefile.am
+@@ -165,7 +165,7 @@ gost-s-box$(EXEEXT_FOR_BUILD): gost-s-box.c
+ 
+ 
+ if ENABLE_O_FLAG_MUNGING
+-o_flag_munging = sed -e 's/-O\([2-9sg][2-9sg]*\)/-O1/' -e 's/-Ofast/-O1/g'
++o_flag_munging = sed -e 's/-O\([2-9sgz][2-9sgz]*\)/-O1/' -e 's/-Ofast/-O1/g'
+ else
+ o_flag_munging = cat
+ endif
+diff --git a/random/Makefile.am b/random/Makefile.am
+index af978570..0c935a05 100644
+--- a/random/Makefile.am
++++ b/random/Makefile.am
+@@ -56,7 +56,7 @@ jitterentropy-base.c jitterentropy.h jitterentropy-base-user.h
+ 
+ # The rndjent module needs to be compiled without optimization.  */
+ if ENABLE_O_FLAG_MUNGING
+-o_flag_munging = sed -e 's/-O\([1-9sg][1-9sg]*\)/-O0/g' -e 's/-Ofast/-O0/g'
++o_flag_munging = sed -e 's/-O\([1-9sgz][1-9sgz]*\)/-O0/g' -e 's/-Ofast/-O0/g'
+ else
+ o_flag_munging = cat
+ endif
+-- 
+2.40.0
+

diff --git a/dev-libs/libgcrypt/libgcrypt-1.10.1-r3.ebuild b/dev-libs/libgcrypt/libgcrypt-1.10.1-r3.ebuild
index 2d2497903a5b..d21cd0309fdb 100644
--- a/dev-libs/libgcrypt/libgcrypt-1.10.1-r3.ebuild
+++ b/dev-libs/libgcrypt/libgcrypt-1.10.1-r3.ebuild
@@ -47,6 +47,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-1.10.1-fix-no-asm-hppa.patch
 	"${FILESDIR}"/${PN}-1.9.4-no-fgrep-libgcrypt-config.patch
 	"${FILESDIR}"/${PN}-1.10.1-configure-clang16.patch
+	"${FILESDIR}"/libgcrypt-1.10-build-Allow-build-with-Oz.patch
 )
 
 MULTILIB_CHOST_TOOLS=(


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/, dev-libs/libgcrypt/files/
@ 2023-04-25 14:50 Fabian Groffen
  0 siblings, 0 replies; 10+ messages in thread
From: Fabian Groffen @ 2023-04-25 14:50 UTC (permalink / raw
  To: gentoo-commits

commit:     89dc47953394cbd86d303b939a7c77e1905a2af8
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 25 14:49:09 2023 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Apr 25 14:50:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89dc4795

dev-libs/libgcrypt-1.10.2: fix compilation on Darwin, #904083

Add patch as suggested on upstream bug to fix compilation on non-Linux.

Closes: https://bugs.gentoo.org/904083
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 .../libgcrypt/files/libgcrypt-1.10.2-darwin.patch    | 20 ++++++++++++++++++++
 dev-libs/libgcrypt/libgcrypt-1.10.2.ebuild           |  1 +
 2 files changed, 21 insertions(+)

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.10.2-darwin.patch b/dev-libs/libgcrypt/files/libgcrypt-1.10.2-darwin.patch
new file mode 100644
index 000000000000..6153f1840b97
--- /dev/null
+++ b/dev-libs/libgcrypt/files/libgcrypt-1.10.2-darwin.patch
@@ -0,0 +1,20 @@
+https://dev.gnupg.org/T6442
+
+Patch as suggested by Werned in https://dev.gnupg.org/T6442#169396
+
+--- a/random/rndgetentropy.c
++++ b/random/rndgetentropy.c
+@@ -94,8 +94,13 @@
+                * and might not be applicable on other FIPS modules not running
+                * RHEL kernel.
+                */
++#ifdef GRND_RANDOM
+               nbytes = length < 32 ? length : 32;
+               ret = getrandom (buffer, nbytes, GRND_RANDOM);
++#else
++              ret = -1;
++              gpg_err_set_errno (ENOSYS);
++#endif
+             }
+           else
+             {

diff --git a/dev-libs/libgcrypt/libgcrypt-1.10.2.ebuild b/dev-libs/libgcrypt/libgcrypt-1.10.2.ebuild
index 3bc1ef525b06..41cdeeafe307 100644
--- a/dev-libs/libgcrypt/libgcrypt-1.10.2.ebuild
+++ b/dev-libs/libgcrypt/libgcrypt-1.10.2.ebuild
@@ -45,6 +45,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-multilib-syspath.patch
 	"${FILESDIR}"/${PN}-powerpc-darwin.patch
 	"${FILESDIR}"/${PN}-1.9.4-no-fgrep-libgcrypt-config.patch
+	"${FILESDIR}"/${P}-darwin.patch  # upstream T6442
 )
 
 MULTILIB_CHOST_TOOLS=(


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/, dev-libs/libgcrypt/files/
@ 2024-03-04  2:38 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2024-03-04  2:38 UTC (permalink / raw
  To: gentoo-commits

commit:     361b44c3bbbb24c615c26b5ba36cc84a80968f33
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  4 02:37:32 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar  4 02:37:32 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=361b44c3

dev-libs/libgcrypt: backport asm fixes

* Backport fixes for x86 with less/no optimisation
* Backport HPPA asm fix

Closes: https://bugs.gentoo.org/915060
Closes: https://bugs.gentoo.org/925284
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../libgcrypt/files/libgcrypt-1.10.3-hppa.patch    | 110 ++++++
 .../files/libgcrypt-1.10.3-x86-refactor.patch      | 428 +++++++++++++++++++++
 .../libgcrypt/files/libgcrypt-1.10.3-x86.patch     |  94 +++++
 dev-libs/libgcrypt/libgcrypt-1.10.3-r2.ebuild      | 178 +++++++++
 4 files changed, 810 insertions(+)

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.10.3-hppa.patch b/dev-libs/libgcrypt/files/libgcrypt-1.10.3-hppa.patch
new file mode 100644
index 000000000000..daa1bba9f439
--- /dev/null
+++ b/dev-libs/libgcrypt/files/libgcrypt-1.10.3-hppa.patch
@@ -0,0 +1,110 @@
+https://bugs.gentoo.org/925284
+https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commit;h=75e9bcccb69a9dea67d90840bd295bbd1749cea3
+
+From 75e9bcccb69a9dea67d90840bd295bbd1749cea3 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Mon, 4 Mar 2024 09:00:59 +0900
+Subject: [PATCH] mpi: Fix ECC computation on hppa.
+
+* mpi/ec-inline.h [__hppa] (ADD4_LIMB32, SUB4_LIMB32): New.
+* mpi/longlong.h [__hppa] (add_ssaaaa, sub_ddmmss): Add __CLOBBER_CC.
+
+--
+
+Cherry-pick master commit of:
+	b757f4130af987bdfc769b754b6e9e27882c349c
+
+GnuPG-bug-id: 7022
+Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
+---
+ mpi/ec-inline.h | 40 ++++++++++++++++++++++++++++++++++++++++
+ mpi/longlong.h  | 12 ++++++------
+ 2 files changed, 46 insertions(+), 6 deletions(-)
+
+diff --git a/mpi/ec-inline.h b/mpi/ec-inline.h
+index 0ffdf8eb..c24d5352 100644
+--- a/mpi/ec-inline.h
++++ b/mpi/ec-inline.h
+@@ -921,6 +921,46 @@ LIMB64_HILO(mpi_limb_t hi, mpi_limb_t lo)
+ 
+ #endif /* HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS */
+ 
++#if defined (__hppa) && __GNUC__ >= 4
++#define ADD4_LIMB32(A3, A2, A1, A0, B3, B2, B1, B0, C3, C2, C1, C0) \
++  __asm__ ("add %7,%11,%3\n\t" \
++	   "addc %6,%10,%2\n\t" \
++	   "addc %5,%9,%1\n\t" \
++	   "addc %4,%8,%0" \
++	   : "=r" (A3), \
++	     "=&r" (A2), \
++	     "=&r" (A1), \
++	     "=&r" (A0) \
++	   : "rM" ((mpi_limb_t)(B3)), \
++	     "rM" ((mpi_limb_t)(B2)), \
++	     "rM" ((mpi_limb_t)(B1)), \
++	     "rM" ((mpi_limb_t)(B0)), \
++	     "rM" ((mpi_limb_t)(C3)), \
++	     "rM" ((mpi_limb_t)(C2)), \
++	     "rM" ((mpi_limb_t)(C1)), \
++	     "rM" ((mpi_limb_t)(C0)) \
++	   : "cc")
++
++#define SUB4_LIMB32(A3, A2, A1, A0, B3, B2, B1, B0, C3, C2, C1, C0) \
++  __asm__ ("sub %7,%11,%3\n\t" \
++	   "subb %6,%10,%2\n\t" \
++	   "subb %5,%9,%1\n\t" \
++	   "subb %4,%8,%0\n\t" \
++	   : "=r" (A3), \
++	     "=&r" (A2), \
++	     "=&r" (A1), \
++	     "=&r" (A0) \
++	   : "rM" ((mpi_limb_t)(B3)), \
++	     "rM" ((mpi_limb_t)(B2)), \
++	     "rM" ((mpi_limb_t)(B1)), \
++	     "rM" ((mpi_limb_t)(B0)), \
++	     "rM" ((mpi_limb_t)(C3)), \
++	     "rM" ((mpi_limb_t)(C2)), \
++	     "rM" ((mpi_limb_t)(C1)), \
++	     "rM" ((mpi_limb_t)(C0)) \
++	   : "cc")
++
++#endif /* __hppa */
+ 
+ /* Common 32-bit arch addition/subtraction macros.  */
+ 
+diff --git a/mpi/longlong.h b/mpi/longlong.h
+index c299534c..1ab70e7e 100644
+--- a/mpi/longlong.h
++++ b/mpi/longlong.h
+@@ -394,23 +394,23 @@ extern UDItype __udiv_qrnnd ();
+  ***************************************/
+ #if defined (__hppa) && W_TYPE_SIZE == 32
+ # define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+-  __asm__ ("	add %4,%5,%1\n"                                             \
+- 	   "	addc %2,%3,%0"                                              \
++  __asm__ ("add %4,%5,%1\n\t"                                           \
++	   "addc %2,%3,%0"                                              \
+ 	   : "=r" ((USItype)(sh)),                                      \
+ 	     "=&r" ((USItype)(sl))                                      \
+ 	   : "%rM" ((USItype)(ah)),                                     \
+ 	     "rM" ((USItype)(bh)),                                      \
+ 	     "%rM" ((USItype)(al)),                                     \
+-	     "rM" ((USItype)(bl)))
++	     "rM" ((USItype)(bl)) __CLOBBER_CC)
+ # define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+-  __asm__ ("	sub %4,%5,%1\n"                                             \
+-	   "	subb %2,%3,%0"                                              \
++  __asm__ ("sub %4,%5,%1\n\t"                                           \
++	   "subb %2,%3,%0"                                              \
+ 	   : "=r" ((USItype)(sh)),                                      \
+ 	     "=&r" ((USItype)(sl))                                      \
+ 	   : "rM" ((USItype)(ah)),                                      \
+ 	     "rM" ((USItype)(bh)),                                      \
+ 	     "rM" ((USItype)(al)),                                      \
+-	     "rM" ((USItype)(bl)))
++	     "rM" ((USItype)(bl)) __CLOBBER_CC)
+ # if defined (_PA_RISC1_1)
+ #  define umul_ppmm(wh, wl, u, v) \
+   do {									\
+-- 
+2.30.2

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.10.3-x86-refactor.patch b/dev-libs/libgcrypt/files/libgcrypt-1.10.3-x86-refactor.patch
new file mode 100644
index 000000000000..527150671097
--- /dev/null
+++ b/dev-libs/libgcrypt/files/libgcrypt-1.10.3-x86-refactor.patch
@@ -0,0 +1,428 @@
+https://bugs.gentoo.org/915060
+https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commit;h=07f0563d325c6589ca1560525d3b22291feec227
+
+From 07f0563d325c6589ca1560525d3b22291feec227 Mon Sep 17 00:00:00 2001
+From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
+Date: Tue, 19 Dec 2023 20:23:47 +0200
+Subject: [PATCH] mpi/ec-inline: refactor i386 assembly to reduce register
+ usage
+
+* mpi/ec-inline.h [__i386__] (ADD2_LIMB32_CARRY_OUT)
+(ADD2_LIMB32_CARRY_IN_OUT, ADD2_LIB32_CARRY_IN, SUB2_LIMB32_CARRY_OUT)
+(SUB2_LIMB32_CARRY_IN_OUT, SUB2_LIB32_CARRY_IN, ADD8_LIMB32)
+(ADD10_LIMB32, ADD14_LIMB32, SUB8_LIMB32, SUB10_LIMB32)
+(SUB14_LIMB32): New.
+[__i386__] (ADD4_LIMB32, ADD6_LIMB32, SUB4_LIMB32, SUB6_LIMB32): Rewrite
+to use new *_CARRY_* macros.
+[BYTES_PER_MPI_LIMB == 4] (ADD4_LIMB64): Use ADD8_LIMB32 if available.
+[BYTES_PER_MPI_LIMB == 4] (ADD5_LIMB64): Use ADD10_LIMB32 if available.
+[BYTES_PER_MPI_LIMB == 4] (ADD7_LIMB64): Use ADD14_LIMB32 if available.
+[BYTES_PER_MPI_LIMB == 4] (SUB4_LIMB64): Use SUB8_LIMB32 if available.
+[BYTES_PER_MPI_LIMB == 4] (SUB5_LIMB64): Use SUB10_LIMB32 if available.
+[BYTES_PER_MPI_LIMB == 4] (SUB7_LIMB64): Use SUB14_LIMB32 if available.
+--
+
+Cherry pick of master commit:
+     956f1ed4ec6ead59dc56f574f943f1fe25dac723
+
+This commit reduces number register operands and register pressure
+at i386 assembly used in `ec-nist.c` NIST-P192, P224, P256, and P384.
+Performance stays relatively same, with P192 being ~2% slower
+than before and P384 being ~5% faster.
+
+GnuPG-bug-id: T6892
+Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
+---
+ mpi/ec-inline.h | 327 +++++++++++++++++++++++++++++++++---------------
+ 1 file changed, 229 insertions(+), 98 deletions(-)
+
+diff --git a/mpi/ec-inline.h b/mpi/ec-inline.h
+index a07826e3..0ffdf8eb 100644
+--- a/mpi/ec-inline.h
++++ b/mpi/ec-inline.h
+@@ -641,116 +641,192 @@ LIMB64_HILO(mpi_limb_t hi, mpi_limb_t lo)
+ /* i386 addition/subtraction helpers.  */
+ #if defined (__i386__) && defined(HAVE_CPU_ARCH_X86) && __GNUC__ >= 4
+ 
+-#define ADD4_LIMB32(a3, a2, a1, a0, b3, b2, b1, b0, c3, c2, c1, c0) \
+-  __asm__ ("addl %11, %3\n" \
+-	   "adcl %10, %2\n" \
+-	   "adcl %9, %1\n" \
+-	   "adcl %8, %0\n" \
+-	   : "=r" (a3), \
+-	     "=&r" (a2), \
++#define ADD2_LIMB32_CARRY_OUT(carry, a1, a0, b1, b0, c1, c0) \
++  __asm__ ("addl %7, %2\n" \
++	   "adcl %6, %1\n" \
++	   "sbbl %0, %0\n" \
++	   : "=r" (carry), \
+ 	     "=&r" (a1), \
+ 	     "=&r" (a0) \
+-	   : "0" ((mpi_limb_t)(b3)), \
+-	     "1" ((mpi_limb_t)(b2)), \
+-	     "2" ((mpi_limb_t)(b1)), \
+-	     "3" ((mpi_limb_t)(b0)), \
+-	     "g" ((mpi_limb_t)(c3)), \
+-	     "g" ((mpi_limb_t)(c2)), \
+-	     "g" ((mpi_limb_t)(c1)), \
+-	     "g" ((mpi_limb_t)(c0)) \
++	   : "0" ((mpi_limb_t)(0)), \
++	     "1" ((mpi_limb_t)(b1)), \
++	     "2" ((mpi_limb_t)(b0)), \
++	     "re" ((mpi_limb_t)(c1)), \
++	     "re" ((mpi_limb_t)(c0)) \
+ 	   : "cc")
+ 
++#define ADD2_LIMB32_CARRY_IN_OUT(a1, a0, b1, b0, c1, c0, carry) \
++  __asm__ ("addl $1, %0\n" \
++	   "adcl %7, %2\n" \
++	   "adcl %6, %1\n" \
++	   "sbbl %0, %0\n" \
++	   : "=r" (carry), \
++	     "=&r" (a1), \
++	     "=&r" (a0) \
++	   : "0" ((mpi_limb_t)(carry)), \
++	     "1" ((mpi_limb_t)(b1)), \
++	     "2" ((mpi_limb_t)(b0)), \
++	     "re" ((mpi_limb_t)(c1)), \
++	     "re" ((mpi_limb_t)(c0)) \
++	   : "cc")
++
++#define ADD2_LIMB32_CARRY_IN(a1, a0, b1, b0, c1, c0, carry) \
++    __asm__ ("addl $1, %2\n" \
++	     "adcl %7, %1\n" \
++	     "adcl %6, %0\n" \
++	     : "=r" (a1), \
++	       "=&r" (a0), \
++	       "=&g" (carry) \
++	     : "0" ((mpi_limb_t)(b1)), \
++	       "1" ((mpi_limb_t)(b0)), \
++	       "2" ((mpi_limb_t)(carry)), \
++	       "re" ((mpi_limb_t)(c1)), \
++	       "re" ((mpi_limb_t)(c0)) \
++	   : "cc")
++
++#define ADD4_LIMB32(a3, a2, a1, a0, b3, b2, b1, b0, c3, c2, c1, c0) do { \
++    mpi_limb_t __carry4_32; \
++    ADD2_LIMB32_CARRY_OUT(__carry4_32, a1, a0, b1, b0, c1, c0); \
++    ADD2_LIMB32_CARRY_IN(a3, a2, b3, b2, c3, c2, __carry4_32); \
++  } while (0)
++
+ #define ADD6_LIMB32(a5, a4, a3, a2, a1, a0, b5, b4, b3, b2, b1, b0, \
+ 		    c5, c4, c3, c2, c1, c0) do { \
+     mpi_limb_t __carry6_32; \
+-    __asm__ ("addl %10, %3\n" \
+-	     "adcl %9, %2\n" \
+-	     "adcl %8, %1\n" \
+-	     "sbbl %0, %0\n" \
+-	     : "=r" (__carry6_32), \
+-	       "=&r" (a2), \
+-	       "=&r" (a1), \
+-	       "=&r" (a0) \
+-	     : "0" ((mpi_limb_t)(0)), \
+-	       "1" ((mpi_limb_t)(b2)), \
+-	       "2" ((mpi_limb_t)(b1)), \
+-	       "3" ((mpi_limb_t)(b0)), \
+-	       "g" ((mpi_limb_t)(c2)), \
+-	       "g" ((mpi_limb_t)(c1)), \
+-	       "g" ((mpi_limb_t)(c0)) \
+-	     : "cc"); \
+-    __asm__ ("addl $1, %3\n" \
+-	     "adcl %10, %2\n" \
+-	     "adcl %9, %1\n" \
+-	     "adcl %8, %0\n" \
+-	     : "=r" (a5), \
+-	       "=&r" (a4), \
+-	       "=&r" (a3), \
+-	       "=&r" (__carry6_32) \
+-	     : "0" ((mpi_limb_t)(b5)), \
+-	       "1" ((mpi_limb_t)(b4)), \
+-	       "2" ((mpi_limb_t)(b3)), \
+-	       "3" ((mpi_limb_t)(__carry6_32)), \
+-	       "g" ((mpi_limb_t)(c5)), \
+-	       "g" ((mpi_limb_t)(c4)), \
+-	       "g" ((mpi_limb_t)(c3)) \
+-	   : "cc"); \
++    ADD2_LIMB32_CARRY_OUT(__carry6_32, a1, a0, b1, b0, c1, c0); \
++    ADD2_LIMB32_CARRY_IN_OUT(a3, a2, b3, b2, c3, c2, __carry6_32); \
++    ADD2_LIMB32_CARRY_IN(a5, a4, b5, b4, c5, c4, __carry6_32); \
++  } while (0)
++
++#define ADD8_LIMB32(a7, a6, a5, a4, a3, a2, a1, a0, \
++		    b7, b6, b5, b4, b3, b2, b1, b0, \
++		    c7, c6, c5, c4, c3, c2, c1, c0) do { \
++    mpi_limb_t __carry8_32; \
++    ADD2_LIMB32_CARRY_OUT(__carry8_32, a1, a0, b1, b0, c1, c0); \
++    ADD2_LIMB32_CARRY_IN_OUT(a3, a2, b3, b2, c3, c2, __carry8_32); \
++    ADD2_LIMB32_CARRY_IN_OUT(a5, a4, b5, b4, c5, c4, __carry8_32); \
++    ADD2_LIMB32_CARRY_IN(a7, a6, b7, b6, c7, c6, __carry8_32); \
+   } while (0)
+ 
+-#define SUB4_LIMB32(a3, a2, a1, a0, b3, b2, b1, b0, c3, c2, c1, c0) \
+-  __asm__ ("subl %11, %3\n" \
+-	   "sbbl %10, %2\n" \
+-	   "sbbl %9, %1\n" \
+-	   "sbbl %8, %0\n" \
+-	   : "=r" (a3), \
+-	     "=&r" (a2), \
++#define ADD10_LIMB32(a9, a8, a7, a6, a5, a4, a3, a2, a1, a0, \
++		     b9, b8, b7, b6, b5, b4, b3, b2, b1, b0, \
++		     c9, c8, c7, c6, c5, c4, c3, c2, c1, c0) do { \
++    mpi_limb_t __carry10_32; \
++    ADD2_LIMB32_CARRY_OUT(__carry10_32, a1, a0, b1, b0, c1, c0); \
++    ADD2_LIMB32_CARRY_IN_OUT(a3, a2, b3, b2, c3, c2, __carry10_32); \
++    ADD2_LIMB32_CARRY_IN_OUT(a5, a4, b5, b4, c5, c4, __carry10_32); \
++    ADD2_LIMB32_CARRY_IN_OUT(a7, a6, b7, b6, c7, c6, __carry10_32); \
++    ADD2_LIMB32_CARRY_IN(a9, a8, b9, b8, c9, c8, __carry10_32); \
++  } while (0)
++
++#define ADD14_LIMB32(a13, a12, a11, a10, a9, a8, a7, \
++		     a6, a5, a4, a3, a2, a1, a0, \
++		     b13, b12, b11, b10, b9, b8, b7, \
++		     b6, b5, b4, b3, b2, b1, b0, \
++		     c13, c12, c11, c10, c9, c8, c7, \
++		     c6, c5, c4, c3, c2, c1, c0) do { \
++    mpi_limb_t __carry14_32; \
++    ADD2_LIMB32_CARRY_OUT(__carry14_32, a1, a0, b1, b0, c1, c0); \
++    ADD2_LIMB32_CARRY_IN_OUT(a3, a2, b3, b2, c3, c2, __carry14_32); \
++    ADD2_LIMB32_CARRY_IN_OUT(a5, a4, b5, b4, c5, c4, __carry14_32); \
++    ADD2_LIMB32_CARRY_IN_OUT(a7, a6, b7, b6, c7, c6, __carry14_32); \
++    ADD2_LIMB32_CARRY_IN_OUT(a9, a8, b9, b8, c9, c8, __carry14_32); \
++    ADD2_LIMB32_CARRY_IN_OUT(a11, a10, b11, b10, c11, c10, __carry14_32); \
++    ADD2_LIMB32_CARRY_IN(a13, a12, b13, b12, c13, c12, __carry14_32); \
++  } while (0)
++
++#define SUB2_LIMB32_CARRY_OUT(carry, a1, a0, b1, b0, c1, c0) \
++  __asm__ ("subl %7, %2\n" \
++	   "sbbl %6, %1\n" \
++	   "sbbl %0, %0\n" \
++	   : "=r" (carry), \
+ 	     "=&r" (a1), \
+ 	     "=&r" (a0) \
+-	   : "0" ((mpi_limb_t)(b3)), \
+-	     "1" ((mpi_limb_t)(b2)), \
+-	     "2" ((mpi_limb_t)(b1)), \
+-	     "3" ((mpi_limb_t)(b0)), \
+-	     "g" ((mpi_limb_t)(c3)), \
+-	     "g" ((mpi_limb_t)(c2)), \
+-	     "g" ((mpi_limb_t)(c1)), \
+-	     "g" ((mpi_limb_t)(c0)) \
++	   : "0" ((mpi_limb_t)(0)), \
++	     "1" ((mpi_limb_t)(b1)), \
++	     "2" ((mpi_limb_t)(b0)), \
++	     "re" ((mpi_limb_t)(c1)), \
++	     "re" ((mpi_limb_t)(c0)) \
++	   : "cc")
++
++#define SUB2_LIMB32_CARRY_IN_OUT(a1, a0, b1, b0, c1, c0, carry) \
++  __asm__ ("addl $1, %0\n" \
++	   "sbbl %7, %2\n" \
++	   "sbbl %6, %1\n" \
++	   "sbbl %0, %0\n" \
++	   : "=r" (carry), \
++	     "=&r" (a1), \
++	     "=&r" (a0) \
++	   : "0" ((mpi_limb_t)(carry)), \
++	     "1" ((mpi_limb_t)(b1)), \
++	     "2" ((mpi_limb_t)(b0)), \
++	     "re" ((mpi_limb_t)(c1)), \
++	     "re" ((mpi_limb_t)(c0)) \
++	   : "cc")
++
++#define SUB2_LIMB32_CARRY_IN(a1, a0, b1, b0, c1, c0, carry) \
++    __asm__ ("addl $1, %2\n" \
++	     "sbbl %7, %1\n" \
++	     "sbbl %6, %0\n" \
++	     : "=r" (a1), \
++	       "=&r" (a0), \
++	       "=&g" (carry) \
++	     : "0" ((mpi_limb_t)(b1)), \
++	       "1" ((mpi_limb_t)(b0)), \
++	       "2" ((mpi_limb_t)(carry)), \
++	       "re" ((mpi_limb_t)(c1)), \
++	       "re" ((mpi_limb_t)(c0)) \
+ 	   : "cc")
+ 
++#define SUB4_LIMB32(a3, a2, a1, a0, b3, b2, b1, b0, c3, c2, c1, c0) do { \
++    mpi_limb_t __carry4_32; \
++    SUB2_LIMB32_CARRY_OUT(__carry4_32, a1, a0, b1, b0, c1, c0); \
++    SUB2_LIMB32_CARRY_IN(a3, a2, b3, b2, c3, c2, __carry4_32); \
++  } while (0)
++
+ #define SUB6_LIMB32(a5, a4, a3, a2, a1, a0, b5, b4, b3, b2, b1, b0, \
+ 		    c5, c4, c3, c2, c1, c0) do { \
+-    mpi_limb_t __borrow6_32; \
+-    __asm__ ("subl %10, %3\n" \
+-	     "sbbl %9, %2\n" \
+-	     "sbbl %8, %1\n" \
+-	     "sbbl %0, %0\n" \
+-	     : "=r" (__borrow6_32), \
+-	       "=&r" (a2), \
+-	       "=&r" (a1), \
+-	       "=&r" (a0) \
+-	     : "0" ((mpi_limb_t)(0)), \
+-	       "1" ((mpi_limb_t)(b2)), \
+-	       "2" ((mpi_limb_t)(b1)), \
+-	       "3" ((mpi_limb_t)(b0)), \
+-	       "g" ((mpi_limb_t)(c2)), \
+-	       "g" ((mpi_limb_t)(c1)), \
+-	       "g" ((mpi_limb_t)(c0)) \
+-	     : "cc"); \
+-    __asm__ ("addl $1, %3\n" \
+-	     "sbbl %10, %2\n" \
+-	     "sbbl %9, %1\n" \
+-	     "sbbl %8, %0\n" \
+-	     : "=r" (a5), \
+-	       "=&r" (a4), \
+-	       "=&r" (a3), \
+-	       "=&r" (__borrow6_32) \
+-	     : "0" ((mpi_limb_t)(b5)), \
+-	       "1" ((mpi_limb_t)(b4)), \
+-	       "2" ((mpi_limb_t)(b3)), \
+-	       "3" ((mpi_limb_t)(__borrow6_32)), \
+-	       "g" ((mpi_limb_t)(c5)), \
+-	       "g" ((mpi_limb_t)(c4)), \
+-	       "g" ((mpi_limb_t)(c3)) \
+-	   : "cc"); \
++    mpi_limb_t __carry6_32; \
++    SUB2_LIMB32_CARRY_OUT(__carry6_32, a1, a0, b1, b0, c1, c0); \
++    SUB2_LIMB32_CARRY_IN_OUT(a3, a2, b3, b2, c3, c2, __carry6_32); \
++    SUB2_LIMB32_CARRY_IN(a5, a4, b5, b4, c5, c4, __carry6_32); \
++  } while (0)
++
++#define SUB8_LIMB32(a7, a6, a5, a4, a3, a2, a1, a0, \
++		    b7, b6, b5, b4, b3, b2, b1, b0, \
++		    c7, c6, c5, c4, c3, c2, c1, c0) do { \
++    mpi_limb_t __carry8_32; \
++    SUB2_LIMB32_CARRY_OUT(__carry8_32, a1, a0, b1, b0, c1, c0); \
++    SUB2_LIMB32_CARRY_IN_OUT(a3, a2, b3, b2, c3, c2, __carry8_32); \
++    SUB2_LIMB32_CARRY_IN_OUT(a5, a4, b5, b4, c5, c4, __carry8_32); \
++    SUB2_LIMB32_CARRY_IN(a7, a6, b7, b6, c7, c6, __carry8_32); \
++  } while (0)
++
++#define SUB10_LIMB32(a9, a8, a7, a6, a5, a4, a3, a2, a1, a0, \
++		     b9, b8, b7, b6, b5, b4, b3, b2, b1, b0, \
++		     c9, c8, c7, c6, c5, c4, c3, c2, c1, c0) do { \
++    mpi_limb_t __carry10_32; \
++    SUB2_LIMB32_CARRY_OUT(__carry10_32, a1, a0, b1, b0, c1, c0); \
++    SUB2_LIMB32_CARRY_IN_OUT(a3, a2, b3, b2, c3, c2, __carry10_32); \
++    SUB2_LIMB32_CARRY_IN_OUT(a5, a4, b5, b4, c5, c4, __carry10_32); \
++    SUB2_LIMB32_CARRY_IN_OUT(a7, a6, b7, b6, c7, c6, __carry10_32); \
++    SUB2_LIMB32_CARRY_IN(a9, a8, b9, b8, c9, c8, __carry10_32); \
++  } while (0)
++
++#define SUB14_LIMB32(a13, a12, a11, a10, a9, a8, a7, \
++		     a6, a5, a4, a3, a2, a1, a0, \
++		     b13, b12, b11, b10, b9, b8, b7, \
++		     b6, b5, b4, b3, b2, b1, b0, \
++		     c13, c12, c11, c10, c9, c8, c7, \
++		     c6, c5, c4, c3, c2, c1, c0) do { \
++    mpi_limb_t __carry14_32; \
++    SUB2_LIMB32_CARRY_OUT(__carry14_32, a1, a0, b1, b0, c1, c0); \
++    SUB2_LIMB32_CARRY_IN_OUT(a3, a2, b3, b2, c3, c2, __carry14_32); \
++    SUB2_LIMB32_CARRY_IN_OUT(a5, a4, b5, b4, c5, c4, __carry14_32); \
++    SUB2_LIMB32_CARRY_IN_OUT(a7, a6, b7, b6, c7, c6, __carry14_32); \
++    SUB2_LIMB32_CARRY_IN_OUT(a9, a8, b9, b8, c9, c8, __carry14_32); \
++    SUB2_LIMB32_CARRY_IN_OUT(a11, a10, b11, b10, c11, c10, __carry14_32); \
++    SUB2_LIMB32_CARRY_IN(a13, a12, b13, b12, c13, c12, __carry14_32); \
+   } while (0)
+ 
+ #endif /* __i386__ */
+@@ -820,7 +896,6 @@ LIMB64_HILO(mpi_limb_t hi, mpi_limb_t lo)
+ 	     "Ir" ((mpi_limb_t)(C0)) \
+ 	   : "cc")
+ 
+-
+ #define SUB6_LIMB32(A5, A4, A3, A2, A1, A0, B5, B4, B3, B2, B1, B0, \
+ 		    C5, C4, C3, C2, C1, C0) do { \
+     mpi_limb_t __borrow6_32; \
+@@ -875,7 +950,13 @@ LIMB64_HILO(mpi_limb_t hi, mpi_limb_t lo)
+ 		    C2.hi, C2.lo, C1.hi, C1.lo, C0.hi, C0.lo)
+ #endif
+ 
+-#if defined(ADD6_LIMB32)
++#if defined(ADD8_LIMB32)
++/* A[0..3] = B[0..3] + C[0..3] */
++#define ADD4_LIMB64(A3, A2, A1, A0, B3, B2, B1, B0, C3, C2, C1, C0) \
++    ADD8_LIMB32(A3.hi, A3.lo, A2.hi, A2.lo, A1.hi, A1.lo, A0.hi, A0.lo, \
++		B3.hi, B3.lo, B2.hi, B2.lo, B1.hi, B1.lo, B0.hi, B0.lo, \
++		C3.hi, C3.lo, C2.hi, C2.lo, C1.hi, C1.lo, C0.hi, C0.lo)
++#elif defined(ADD6_LIMB32)
+ /* A[0..3] = B[0..3] + C[0..3] */
+ #define ADD4_LIMB64(A3, A2, A1, A0, B3, B2, B1, B0, C3, C2, C1, C0) do { \
+     mpi_limb_t __carry4; \
+@@ -888,6 +969,28 @@ LIMB64_HILO(mpi_limb_t hi, mpi_limb_t lo)
+   } while (0)
+ #endif
+ 
++#if defined(ADD10_LIMB32)
++/* A[0..4] = B[0..4] + C[0..4] */
++#define ADD5_LIMB64(A4, A3, A2, A1, A0, B4, B3, B2, B1, B0, \
++		    C4, C3, C2, C1, C0) \
++    ADD10_LIMB32(A4.hi, A4.lo, A3.hi, A3.lo, A2.hi, A2.lo, A1.hi, A1.lo, \
++		 A0.hi, A0.lo, B4.hi, B4.lo, B3.hi, B3.lo, B2.hi, B2.lo, \
++		 B1.hi, B1.lo, B0.hi, B0.lo, C4.hi, C4.lo, C3.hi, C3.lo, \
++		 C2.hi, C2.lo, C1.hi, C1.lo, C0.hi, C0.lo)
++#endif
++
++#if defined(ADD14_LIMB32)
++/* A[0..6] = B[0..6] + C[0..6] */
++#define ADD7_LIMB64(A6, A5, A4, A3, A2, A1, A0, B6, B5, B4, B3, B2, B1, B0, \
++		    C6, C5, C4, C3, C2, C1, C0) \
++    ADD14_LIMB32(A6.hi, A6.lo, A5.hi, A5.lo, A4.hi, A4.lo, A3.hi, A3.lo, \
++		 A2.hi, A2.lo, A1.hi, A1.lo, A0.hi, A0.lo, B6.hi, B6.lo, \
++		 B5.hi, B5.lo, B4.hi, B4.lo, B3.hi, B3.lo, B2.hi, B2.lo, \
++		 B1.hi, B1.lo, B0.hi, B0.lo, C6.hi, C6.lo, C5.hi, C5.lo, \
++		 C4.hi, C4.lo, C3.hi, C3.lo, C2.hi, C2.lo, C1.hi, C1.lo, \
++		 C0.hi, C0.lo)
++#endif
++
+ #if defined(SUB4_LIMB32)
+ /* A[0..1] = B[0..1] - C[0..1] */
+ #define SUB2_LIMB64(A1, A0, B1, B0, C1, C0) \
+@@ -914,7 +1017,13 @@ LIMB64_HILO(mpi_limb_t hi, mpi_limb_t lo)
+ 		    C2.hi, C2.lo, C1.hi, C1.lo, C0.hi, C0.lo)
+ #endif
+ 
+-#if defined(SUB6_LIMB32)
++#if defined(SUB8_LIMB32)
++/* A[0..3] = B[0..3] - C[0..3] */
++#define SUB4_LIMB64(A3, A2, A1, A0, B3, B2, B1, B0, C3, C2, C1, C0) \
++    SUB8_LIMB32(A3.hi, A3.lo, A2.hi, A2.lo, A1.hi, A1.lo, A0.hi, A0.lo, \
++		B3.hi, B3.lo, B2.hi, B2.lo, B1.hi, B1.lo, B0.hi, B0.lo, \
++		C3.hi, C3.lo, C2.hi, C2.lo, C1.hi, C1.lo, C0.hi, C0.lo)
++#elif defined(SUB6_LIMB32)
+ /* A[0..3] = B[0..3] - C[0..3] */
+ #define SUB4_LIMB64(A3, A2, A1, A0, B3, B2, B1, B0, C3, C2, C1, C0) do { \
+     mpi_limb_t __borrow4; \
+@@ -927,6 +1036,28 @@ LIMB64_HILO(mpi_limb_t hi, mpi_limb_t lo)
+   } while (0)
+ #endif
+ 
++#if defined(SUB10_LIMB32)
++/* A[0..4] = B[0..4] - C[0..4] */
++#define SUB5_LIMB64(A4, A3, A2, A1, A0, B4, B3, B2, B1, B0, \
++		    C4, C3, C2, C1, C0) \
++    SUB10_LIMB32(A4.hi, A4.lo, A3.hi, A3.lo, A2.hi, A2.lo, A1.hi, A1.lo, \
++		 A0.hi, A0.lo, B4.hi, B4.lo, B3.hi, B3.lo, B2.hi, B2.lo, \
++		 B1.hi, B1.lo, B0.hi, B0.lo, C4.hi, C4.lo, C3.hi, C3.lo, \
++		 C2.hi, C2.lo, C1.hi, C1.lo, C0.hi, C0.lo)
++#endif
++
++#if defined(SUB14_LIMB32)
++/* A[0..6] = B[0..6] - C[0..6] */
++#define SUB7_LIMB64(A6, A5, A4, A3, A2, A1, A0, B6, B5, B4, B3, B2, B1, B0, \
++		    C6, C5, C4, C3, C2, C1, C0) \
++    SUB14_LIMB32(A6.hi, A6.lo, A5.hi, A5.lo, A4.hi, A4.lo, A3.hi, A3.lo, \
++		 A2.hi, A2.lo, A1.hi, A1.lo, A0.hi, A0.lo, B6.hi, B6.lo, \
++		 B5.hi, B5.lo, B4.hi, B4.lo, B3.hi, B3.lo, B2.hi, B2.lo, \
++		 B1.hi, B1.lo, B0.hi, B0.lo, C6.hi, C6.lo, C5.hi, C5.lo, \
++		 C4.hi, C4.lo, C3.hi, C3.lo, C2.hi, C2.lo, C1.hi, C1.lo, \
++		 C0.hi, C0.lo)
++#endif
++
+ #endif /* BYTES_PER_MPI_LIMB == 4 */
+ 
+ 
+-- 
+2.30.2

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.10.3-x86.patch b/dev-libs/libgcrypt/files/libgcrypt-1.10.3-x86.patch
new file mode 100644
index 000000000000..51ea0047c4e4
--- /dev/null
+++ b/dev-libs/libgcrypt/files/libgcrypt-1.10.3-x86.patch
@@ -0,0 +1,94 @@
+https://bugs.gentoo.org/915060
+https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commit;h=08b88b4012f7837736b8d29a3689ce3fff2a10c8
+
+From 08b88b4012f7837736b8d29a3689ce3fff2a10c8 Mon Sep 17 00:00:00 2001
+From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
+Date: Sat, 16 Dec 2023 19:50:23 +0200
+Subject: [PATCH] mpi/ec-nist: fix for -Og build failure on i386
+
+* mpi/ec-nist.c (_gcry_mpi_ec_nist256_mod)
+(_gcry_mpi_ec_nist384_mod): Load p_mult constant with carry offset
+to stack.
+--
+
+Cherry pick master commit of:
+     90097bd2f41c217dc5c666570e5680f432cf92d3
+
+Patch fixes compilation error on i386 with -Og optimization level.
+
+In file included from ../../mpi/ec-nist.c:34:
+../../mpi/ec-nist.c: In function '_gcry_mpi_ec_nist256_mod':
+../../mpi/ec-inline.h:701:3: error: 'asm' operand has impossible constraints
+  701 |   __asm__ ("subl %11, %3\n" \
+      |   ^~~~~~~
+../../mpi/ec-inline.h:894:9: note: in expansion of macro 'SUB4_LIMB32'
+  894 |         SUB4_LIMB32(A1.hi, A1.lo, A0.hi, A0.lo, \
+      |         ^~~~~~~~~~~
+../../mpi/ec-inline.h:1009:5: note: in expansion of macro 'SUB2_LIMB64'
+ 1009 |     SUB2_LIMB64(A4, A3, B4, B3, C4, C3); \
+      |     ^~~~~~~~~~~
+../../mpi/ec-nist.c:474:3: note: in expansion of macro 'SUB5_LIMB64'
+  474 |   SUB5_LIMB64 (s[4], s[3], s[2], s[1], s[0],
+      |   ^~~~~~~~~~~
+
+Appears that in problematic function, too many registers end up being
+allocated for addressing and there is not enough register left for
+asm input/output (4 registers needed for this block). Problem can be
+workaround by reducing needed addressing registers by pushing
+`p_mult[carry + ...]` values to stack.  On other compiler flag levels
+and architectures, compiler should be able to optimize away this
+extra copying and have not effect on performance.
+
+GnuPG-bug-id: T6892
+Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
+---
+ mpi/ec-nist.c | 23 ++++++++++++++++-------
+ 1 file changed, 16 insertions(+), 7 deletions(-)
+
+diff --git a/mpi/ec-nist.c b/mpi/ec-nist.c
+index f792405c..559d02d9 100644
+--- a/mpi/ec-nist.c
++++ b/mpi/ec-nist.c
+@@ -471,11 +471,15 @@ _gcry_mpi_ec_nist256_mod (gcry_mpi_t w, mpi_ec_t ctx)
+ 
+   carry = LO32_LIMB64(s[4]);
+ 
++  /* Load values to stack to ease register pressure on i386. */
++  e[0] = p_mult[carry + 4][0];
++  e[1] = p_mult[carry + 4][1];
++  e[2] = p_mult[carry + 4][2];
++  e[3] = p_mult[carry + 4][3];
++  e[4] = p_mult[carry + 4][4];
+   SUB5_LIMB64 (s[4], s[3], s[2], s[1], s[0],
+ 	       s[4], s[3], s[2], s[1], s[0],
+-	       p_mult[carry + 4][4], p_mult[carry + 4][3],
+-	       p_mult[carry + 4][2], p_mult[carry + 4][1],
+-	       p_mult[carry + 4][0]);
++	       e[4], e[3], e[2], e[1], e[0]);
+ 
+   /* Add 1*P */
+   ADD5_LIMB64 (d[4], d[3], d[2], d[1], d[0],
+@@ -749,12 +753,17 @@ _gcry_mpi_ec_nist384_mod (gcry_mpi_t w, mpi_ec_t ctx)
+ 
+   carry = LO32_LIMB64(s[6]);
+ 
++  /* Load values to stack to ease register pressure on i386. */
++  x[0] = p_mult[carry + 3][0];
++  x[1] = p_mult[carry + 3][1];
++  x[2] = p_mult[carry + 3][2];
++  x[3] = p_mult[carry + 3][3];
++  x[4] = p_mult[carry + 3][4];
++  x[5] = p_mult[carry + 3][5];
++  x[6] = p_mult[carry + 3][6];
+   SUB7_LIMB64 (s[6], s[5], s[4], s[3], s[2], s[1], s[0],
+ 	       s[6], s[5], s[4], s[3], s[2], s[1], s[0],
+-	       p_mult[carry + 3][6], p_mult[carry + 3][5],
+-	       p_mult[carry + 3][4], p_mult[carry + 3][3],
+-	       p_mult[carry + 3][2], p_mult[carry + 3][1],
+-	       p_mult[carry + 3][0]);
++	       x[6], x[5], x[4], x[3], x[2], x[1], x[0]);
+ 
+   ADD7_LIMB64 (d[6], d[5], d[4], d[3], d[2], d[1], d[0],
+ 	       s[6], s[5], s[4], s[3], s[2], s[1], s[0],
+-- 
+2.30.2

diff --git a/dev-libs/libgcrypt/libgcrypt-1.10.3-r2.ebuild b/dev-libs/libgcrypt/libgcrypt-1.10.3-r2.ebuild
new file mode 100644
index 000000000000..bbb0d0fd009b
--- /dev/null
+++ b/dev-libs/libgcrypt/libgcrypt-1.10.3-r2.ebuild
@@ -0,0 +1,178 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/gnupg.asc
+inherit autotools flag-o-matic linux-info multilib-minimal toolchain-funcs verify-sig
+
+DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
+HOMEPAGE="https://www.gnupg.org/"
+SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
+SRC_URI+=" verify-sig? ( mirror://gnupg/${PN}/${P}.tar.bz2.sig )"
+
+LICENSE="LGPL-2.1+ GPL-2+ MIT"
+SLOT="0/20" # subslot = soname major version
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE="+asm cpu_flags_arm_neon cpu_flags_arm_aes cpu_flags_arm_sha1 cpu_flags_arm_sha2 cpu_flags_ppc_altivec cpu_flags_ppc_vsx2 cpu_flags_ppc_vsx3 cpu_flags_x86_aes cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_padlock cpu_flags_x86_sha cpu_flags_x86_sse4_1 doc +getentropy static-libs"
+
+# Build system only has --disable-arm-crypto-support right now
+# If changing this, update src_configure logic too.
+# ARM CPUs seem to, right now, support all-or-nothing for crypto extensions,
+# but this looks like it might change in future. This is just a safety check
+# in case people somehow do have a CPU which only supports some. They must
+# for now disable them all if that's the case.
+REQUIRED_USE="
+	cpu_flags_arm_aes? ( cpu_flags_arm_sha1 cpu_flags_arm_sha2 )
+	cpu_flags_arm_sha1? ( cpu_flags_arm_aes cpu_flags_arm_sha2 )
+	cpu_flags_arm_sha2? ( cpu_flags_arm_aes cpu_flags_arm_sha1 )
+	cpu_flags_ppc_vsx3? ( cpu_flags_ppc_altivec cpu_flags_ppc_vsx2 )
+	cpu_flags_ppc_vsx2? ( cpu_flags_ppc_altivec )
+"
+
+RDEPEND="
+	>=dev-libs/libgpg-error-1.25[${MULTILIB_USEDEP}]
+	getentropy? (
+		kernel_linux? (
+			elibc_glibc? ( >=sys-libs/glibc-2.25 )
+			elibc_musl? ( >=sys-libs/musl-1.1.20 )
+		)
+	)
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	doc? ( virtual/texi2dvi )
+	verify-sig? ( sec-keys/openpgp-keys-gnupg )
+"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-multilib-syspath.patch
+	"${FILESDIR}"/${PN}-powerpc-darwin.patch
+	"${FILESDIR}"/${PN}-1.9.4-no-fgrep-libgcrypt-config.patch
+	"${FILESDIR}"/${PN}-1.10.3-x86.patch
+	"${FILESDIR}"/${PN}-1.10.3-x86-refactor.patch
+	"${FILESDIR}"/${PN}-1.10.3-hppa.patch
+)
+
+MULTILIB_CHOST_TOOLS=(
+	/usr/bin/libgcrypt-config
+)
+
+pkg_pretend() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+	if use kernel_linux && use getentropy; then
+		unset KV_FULL
+		get_running_version
+		if [[ -n ${KV_FULL} ]] && kernel_is -lt 3 17; then
+			eerror "The getentropy function requires the getrandom syscall."
+			eerror "This was introduced in Linux 3.17."
+			eerror "Your system is currently running Linux ${KV_FULL}."
+			eerror "Disable the 'getentropy' USE flag or upgrade your kernel."
+			die "Kernel is too old for getentropy"
+		fi
+	fi
+}
+
+pkg_setup() {
+	:
+}
+
+src_prepare() {
+	default
+	eautoreconf
+}
+
+multilib_src_configure() {
+	if [[ ${CHOST} == *86*-solaris* ]] ; then
+		# ASM code uses GNU ELF syntax, divide in particular, we need to
+		# allow this via ASFLAGS, since we don't have a flag-o-matic
+		# function for that, we'll have to abuse cflags for this
+		append-cflags -Wa,--divide
+	fi
+
+	if [[ ${CHOST} == powerpc* ]] ; then
+		# ./configure does a lot of automagic, prevent that
+		# generic ppc32+ppc64 altivec
+		use cpu_flags_ppc_altivec || local -x gcry_cv_cc_ppc_altivec=no
+		use cpu_flags_ppc_altivec || local -x gcry_cv_cc_ppc_altivec_cflags=no
+		# power8 vector extension, aka arch 2.07 ISA, also checked below via ppc-crypto-support
+		use cpu_flags_ppc_vsx2 || local -x gcry_cv_gcc_inline_asm_ppc_altivec=no
+		# power9 vector extension, aka arch 3.00 ISA
+		use cpu_flags_ppc_vsx3 || local -x gcry_cv_gcc_inline_asm_ppc_arch_3_00=no
+	fi
+
+	# Workaround for GCC < 11.3 bug
+	# https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff;h=0b399721ce9709ae25f9d2050360c5ab2115ae29
+	# https://dev.gnupg.org/T5581
+	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102124
+	if use arm64 && tc-is-gcc && (($(gcc-major-version) == 11)) &&
+		(($(gcc-minor-version) <= 2)) && (($(gcc-micro-version) == 0)) ; then
+		append-flags -fno-tree-loop-vectorize
+	fi
+
+	append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
+
+	local myeconfargs=(
+		CC_FOR_BUILD="$(tc-getBUILD_CC)"
+
+		--enable-noexecstack
+		$(use_enable cpu_flags_arm_neon neon-support)
+		# See REQUIRED_USE comment above
+		$(use_enable cpu_flags_arm_aes arm-crypto-support)
+		$(use_enable cpu_flags_ppc_vsx2 ppc-crypto-support)
+		$(use_enable cpu_flags_x86_aes aesni-support)
+		$(use_enable cpu_flags_x86_avx avx-support)
+		$(use_enable cpu_flags_x86_avx2 avx2-support)
+		$(use_enable cpu_flags_x86_padlock padlock-support)
+		$(use_enable cpu_flags_x86_sha shaext-support)
+		$(use_enable cpu_flags_x86_sse4_1 sse41-support)
+		# required for sys-power/suspend[crypt], bug 751568
+		$(use_enable static-libs static)
+
+		# disabled due to various applications requiring privileges
+		# after libgcrypt drops them (bug #468616)
+		--without-capabilities
+
+		# http://trac.videolan.org/vlc/ticket/620
+		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
+
+		$(use asm || echo "--disable-asm")
+
+		GPG_ERROR_CONFIG="${ESYSROOT}/usr/bin/${CHOST}-gpg-error-config"
+	)
+
+	if use kernel_linux; then
+		# --enable-random=getentropy requires getentropy/getrandom.
+		# --enable-random=linux enables legacy code that tries getrandom
+		# and falls back to reading /dev/random.
+		myeconfargs+=( --enable-random=$(usex getentropy getentropy linux) )
+	fi
+
+	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" \
+		$("${S}/configure" --help | grep -o -- '--without-.*-prefix')
+}
+
+multilib_src_compile() {
+	default
+	multilib_is_native_abi && use doc && VARTEXFONTS="${T}/fonts" emake -C doc gcrypt.pdf
+}
+
+multilib_src_test() {
+	# t-secmem and t-sexp need mlock which requires extra privileges; nspawn
+	# at least disallows that by default.
+	local -x GCRYPT_IN_ASAN_TEST=1
+
+	default
+}
+
+multilib_src_install() {
+	emake DESTDIR="${D}" install
+	multilib_is_native_abi && use doc && dodoc doc/gcrypt.pdf
+}
+
+multilib_src_install_all() {
+	default
+	find "${ED}" -type f -name '*.la' -delete || die
+}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/, dev-libs/libgcrypt/files/
@ 2024-06-23  1:49 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2024-06-23  1:49 UTC (permalink / raw
  To: gentoo-commits

commit:     c3d48d64103057105a8dde2d0e1617cd98c9480c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 23 01:39:47 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun 23 01:49:04 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3d48d64

dev-libs/libgcrypt: add 1.11.0

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/libgcrypt/Manifest                        |   2 +
 .../libgcrypt/files/libgcrypt-1.11.0-s390x.patch   |  59 +++++++
 dev-libs/libgcrypt/libgcrypt-1.11.0.ebuild         | 180 +++++++++++++++++++++
 3 files changed, 241 insertions(+)

diff --git a/dev-libs/libgcrypt/Manifest b/dev-libs/libgcrypt/Manifest
index 2bbd8c896934..8f6a1788ff24 100644
--- a/dev-libs/libgcrypt/Manifest
+++ b/dev-libs/libgcrypt/Manifest
@@ -2,3 +2,5 @@ DIST libgcrypt-1.10.2.tar.bz2 3795164 BLAKE2B c86b29648664aae3fb694b20ad258828d2
 DIST libgcrypt-1.10.2.tar.bz2.sig 119 BLAKE2B 3753134a1ed1fd2bfd2c64f175c3745db02791359646b3f0229c80ce4ccedbb147ee889a6b8c4fe4bf7e9067d804ee18a8411cd347026cd1656ad1d4d5686bec SHA512 9350444a0bcfa49217815a831f2286ccea470311673257bd809eb5dedbe97d2a5543b0bc7fb752312df69adeb7ac5f064e433f2545a8bf3e494027986cd8020c
 DIST libgcrypt-1.10.3.tar.bz2 3783827 BLAKE2B 1a228e02820e886016eb55dee75936c4422a15fb4f95a2f9bcd1e4faac4015d4321c7c8d23f164eb08ece5d62935ab3b3d3104eabfdd22db997ab3e5689dfa6f SHA512 8a8d4c61a6622d8481ceb9edc88ec43f58da32e316f79f8d4775325a48f8936aaa9eb355923b39e2c267b784e9c390600daeb62e0c94f00e30bbadb0d8c0865d
 DIST libgcrypt-1.10.3.tar.bz2.sig 238 BLAKE2B 216baebca91b2e940f60d70a4260b6b6b8221ef88cfb42b020bc7b3743a465ef2cf105316648ed1e689cbbf7d79da421aa9f08b5af21c5b862734cf01f377214 SHA512 73795781a458c334ec6daade1b86ae8b788dd5da0b7198b46b8e54a103c5ec4c65a5dd7e6a9d173d136889f24e7f5721992f59117334f39bd1c8a94e3b55a048
+DIST libgcrypt-1.11.0.tar.bz2 4180345 BLAKE2B fe3f42480c0b9a0c50c24f4c54197404b4e1056d8baa9c0c07c671c9c05b90777580b4cbcde931b50ecb4dd93f5ddad89cea99aa36a35f86f796a003e3816f7d SHA512 8e093e69e3c45d30838625ca008e995556f0d5b272de1c003d44ef94633bcc0d0ef5d95e8725eb531bfafb4490ac273488633e0c801200d4666194f86c3e270e
+DIST libgcrypt-1.11.0.tar.bz2.sig 119 BLAKE2B e64d59dae5556e2826f6d297988a3300c36d05aeecfe19544c5092b5f7b777b9b3f37c5ddcfcba5a916ae237cf981efdd9e3bdec482f7c36b12ac5c70f9d4c52 SHA512 8c5ceb50d70ccdedcc1ff4b31a65a07198567b85f582e3e67699cc3e5d012bebf7b1d4903652d11905a9cd845976ad7d3642474804777d0bdc46c6847d92fe38

diff --git a/dev-libs/libgcrypt/files/libgcrypt-1.11.0-s390x.patch b/dev-libs/libgcrypt/files/libgcrypt-1.11.0-s390x.patch
new file mode 100644
index 000000000000..6d306423df51
--- /dev/null
+++ b/dev-libs/libgcrypt/files/libgcrypt-1.11.0-s390x.patch
@@ -0,0 +1,59 @@
+https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commit;h=2486d9b5ae015c1786cb84466a751da4bc0d7122
+
+From 2486d9b5ae015c1786cb84466a751da4bc0d7122 Mon Sep 17 00:00:00 2001
+From: Jussi Kivilinna <jussi.kivilinna@iki.fi>
+Date: Thu, 20 Jun 2024 20:10:09 +0300
+Subject: [PATCH] Disable SHA3 s390x acceleration for CSHAKE
+
+* cipher/keccak.c (keccak_final_s390x): Add assert check for
+expected SHAKE suffix.
+(_gcry_cshake_customize, cshake_hash_buffers): Disable s390x
+acceleration when selecting CSHAKE suffix.
+--
+
+Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
+--- a/cipher/keccak.c
++++ b/cipher/keccak.c
+@@ -745,6 +745,8 @@ keccak_final_s390x (void *context)
+     }
+   else
+     {
++      gcry_assert(ctx->suffix == SHAKE_DELIMITED_SUFFIX);
++
+       klmd_shake_execute (ctx->kimd_func, &ctx->state, NULL, 0, ctx->buf,
+ 			  ctx->count);
+       ctx->count = 0;
+@@ -1497,9 +1499,14 @@ _gcry_cshake_customize (void *context, struct gcry_cshake_customization *p)
+     /* No customization */
+     return 0;
+ 
++  ctx->suffix = CSHAKE_DELIMITED_SUFFIX;
++#ifdef USE_S390X_CRYPTO
++  /* CSHAKE suffix is not supported by s390x/kimd. */
++  ctx->kimd_func = 0;
++#endif
++
+   len_written = cshake_input_n (ctx, p->n, p->n_len);
+   cshake_input_s (ctx, p->s, p->s_len, len_written);
+-  ctx->suffix = CSHAKE_DELIMITED_SUFFIX;
+   return 0;
+ }
+ 
+@@ -1536,9 +1543,14 @@ cshake_hash_buffers (const gcry_md_spec_t *spec, void *outbuf, size_t nbytes,
+           size_t s_len = iov[1].len;
+           size_t len;
+ 
++          ctx.suffix = CSHAKE_DELIMITED_SUFFIX;
++#ifdef USE_S390X_CRYPTO
++          /* CSHAKE suffix is not supported by s390x/kimd. */
++          ctx.kimd_func = 0;
++#endif
++
+           len = cshake_input_n (&ctx, n, n_len);
+           cshake_input_s (&ctx, s, s_len, len);
+-          ctx.suffix = CSHAKE_DELIMITED_SUFFIX;
+         }
+       iovcnt -= 2;
+       iov += 2;
+-- 
+2.30.2

diff --git a/dev-libs/libgcrypt/libgcrypt-1.11.0.ebuild b/dev-libs/libgcrypt/libgcrypt-1.11.0.ebuild
new file mode 100644
index 000000000000..10b42d5ca451
--- /dev/null
+++ b/dev-libs/libgcrypt/libgcrypt-1.11.0.ebuild
@@ -0,0 +1,180 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/gnupg.asc
+inherit autotools flag-o-matic linux-info multilib-minimal toolchain-funcs verify-sig
+
+DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
+HOMEPAGE="https://www.gnupg.org/"
+SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
+SRC_URI+=" verify-sig? ( mirror://gnupg/${PN}/${P}.tar.bz2.sig )"
+
+LICENSE="LGPL-2.1+ GPL-2+ MIT"
+SLOT="0/20" # subslot = soname major version
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE="+asm doc +getentropy static-libs"
+IUSE+=" cpu_flags_arm_neon cpu_flags_arm_aes cpu_flags_arm_sha1 cpu_flags_arm_sha2 cpu_flags_arm_sve"
+IUSE+=" cpu_flags_ppc_altivec cpu_flags_ppc_vsx2 cpu_flags_ppc_vsx3"
+IUSE+=" cpu_flags_x86_aes cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_avx512f cpu_flags_x86_padlock cpu_flags_x86_sha cpu_flags_x86_sse4_1"
+
+# Build system only has --disable-arm-crypto-support right now
+# If changing this, update src_configure logic too.
+# ARM CPUs seem to, right now, support all-or-nothing for crypto extensions,
+# but this looks like it might change in future. This is just a safety check
+# in case people somehow do have a CPU which only supports some. They must
+# for now disable them all if that's the case.
+REQUIRED_USE="
+	cpu_flags_arm_aes? ( cpu_flags_arm_sha1 cpu_flags_arm_sha2 )
+	cpu_flags_arm_sha1? ( cpu_flags_arm_aes cpu_flags_arm_sha2 )
+	cpu_flags_arm_sha2? ( cpu_flags_arm_aes cpu_flags_arm_sha1 )
+	cpu_flags_ppc_vsx3? ( cpu_flags_ppc_altivec cpu_flags_ppc_vsx2 )
+	cpu_flags_ppc_vsx2? ( cpu_flags_ppc_altivec )
+"
+
+RDEPEND="
+	>=dev-libs/libgpg-error-1.49[${MULTILIB_USEDEP}]
+	getentropy? (
+		kernel_linux? (
+			elibc_glibc? ( >=sys-libs/glibc-2.25 )
+			elibc_musl? ( >=sys-libs/musl-1.1.20 )
+		)
+	)
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	doc? ( virtual/texi2dvi )
+	verify-sig? ( sec-keys/openpgp-keys-gnupg )
+"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-multilib-syspath.patch
+	"${FILESDIR}"/${PN}-powerpc-darwin.patch
+	"${FILESDIR}"/${P}-s390x.patch
+)
+
+MULTILIB_CHOST_TOOLS=(
+	/usr/bin/libgcrypt-config
+)
+
+pkg_pretend() {
+	if [[ ${MERGE_TYPE} == buildonly ]]; then
+		return
+	fi
+	if use kernel_linux && use getentropy; then
+		unset KV_FULL
+		get_running_version
+		if [[ -n ${KV_FULL} ]] && kernel_is -lt 3 17; then
+			eerror "The getentropy function requires the getrandom syscall."
+			eerror "This was introduced in Linux 3.17."
+			eerror "Your system is currently running Linux ${KV_FULL}."
+			eerror "Disable the 'getentropy' USE flag or upgrade your kernel."
+			die "Kernel is too old for getentropy"
+		fi
+	fi
+}
+
+pkg_setup() {
+	:
+}
+
+src_prepare() {
+	default
+	eautoreconf
+}
+
+multilib_src_configure() {
+	if [[ ${CHOST} == *86*-solaris* ]] ; then
+		# ASM code uses GNU ELF syntax, divide in particular, we need to
+		# allow this via ASFLAGS, since we don't have a flag-o-matic
+		# function for that, we'll have to abuse cflags for this
+		append-cflags -Wa,--divide
+	fi
+
+	if [[ ${CHOST} == powerpc* ]] ; then
+		# ./configure does a lot of automagic, prevent that
+		# generic ppc32+ppc64 altivec
+		use cpu_flags_ppc_altivec || local -x gcry_cv_cc_ppc_altivec=no
+		use cpu_flags_ppc_altivec || local -x gcry_cv_cc_ppc_altivec_cflags=no
+		# power8 vector extension, aka arch 2.07 ISA, also checked below via ppc-crypto-support
+		use cpu_flags_ppc_vsx2 || local -x gcry_cv_gcc_inline_asm_ppc_altivec=no
+		# power9 vector extension, aka arch 3.00 ISA
+		use cpu_flags_ppc_vsx3 || local -x gcry_cv_gcc_inline_asm_ppc_arch_3_00=no
+	fi
+
+	# Workaround for GCC < 11.3 bug
+	# https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff;h=0b399721ce9709ae25f9d2050360c5ab2115ae29
+	# https://dev.gnupg.org/T5581
+	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102124
+	if use arm64 && tc-is-gcc && (($(gcc-major-version) == 11)) &&
+		(($(gcc-minor-version) <= 2)) && (($(gcc-micro-version) == 0)) ; then
+		append-flags -fno-tree-loop-vectorize
+	fi
+
+	append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
+
+	local myeconfargs=(
+		CC_FOR_BUILD="$(tc-getBUILD_CC)"
+
+		--enable-noexecstack
+		$(use_enable cpu_flags_arm_neon neon-support)
+		# See REQUIRED_USE comment above
+		$(use_enable cpu_flags_arm_aes arm-crypto-support)
+		$(use_enable cpu_flags_arm_sve sve-support)
+		$(use_enable cpu_flags_ppc_vsx2 ppc-crypto-support)
+		$(use_enable cpu_flags_x86_aes aesni-support)
+		$(use_enable cpu_flags_x86_avx avx-support)
+		$(use_enable cpu_flags_x86_avx2 avx2-support)
+		$(use_enable cpu_flags_x86_avx512f avx512-support)
+		$(use_enable cpu_flags_x86_padlock padlock-support)
+		$(use_enable cpu_flags_x86_sha shaext-support)
+		$(use_enable cpu_flags_x86_sse4_1 sse41-support)
+		# required for sys-power/suspend[crypt], bug 751568
+		$(use_enable static-libs static)
+
+		# disabled due to various applications requiring privileges
+		# after libgcrypt drops them (bug #468616)
+		--without-capabilities
+
+		# http://trac.videolan.org/vlc/ticket/620
+		$([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
+
+		$(use asm || echo "--disable-asm")
+
+		GPG_ERROR_CONFIG="${ESYSROOT}/usr/bin/${CHOST}-gpg-error-config"
+	)
+
+	if use kernel_linux; then
+		# --enable-random=getentropy requires getentropy/getrandom.
+		# --enable-random=linux enables legacy code that tries getrandom
+		# and falls back to reading /dev/random.
+		myeconfargs+=( --enable-random=$(usex getentropy getentropy linux) )
+	fi
+
+	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" \
+		$("${S}/configure" --help | grep -o -- '--without-.*-prefix')
+}
+
+multilib_src_compile() {
+	default
+	multilib_is_native_abi && use doc && VARTEXFONTS="${T}/fonts" emake -C doc gcrypt.pdf
+}
+
+multilib_src_test() {
+	# t-secmem and t-sexp need mlock which requires extra privileges; nspawn
+	# at least disallows that by default.
+	local -x GCRYPT_IN_ASAN_TEST=1
+
+	default
+}
+
+multilib_src_install() {
+	emake DESTDIR="${D}" install
+	multilib_is_native_abi && use doc && dodoc doc/gcrypt.pdf
+}
+
+multilib_src_install_all() {
+	default
+	find "${ED}" -type f -name '*.la' -delete || die
+}


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-06-23  1:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-01  6:48 [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/, dev-libs/libgcrypt/files/ Alon Bar-Lev
  -- strict thread matches above, loose matches on Subject: below --
2016-02-10 22:57 Kristian Fiskerstrand
2017-04-11  6:52 Alon Bar-Lev
2021-09-18 17:39 David Seifert
2022-01-18 13:12 Sam James
2022-09-11 17:49 Sam James
2023-04-03 14:51 Mike Gilbert
2023-04-25 14:50 Fabian Groffen
2024-03-04  2:38 Sam James
2024-06-23  1:49 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox