Monday, January 16, 2023

Re: libgcrypt: arm64 assembly fixes

On Mon, Jan 16, 2023 at 02:25:36PM +0000, Stuart Henderson wrote:
> On 2023/01/15 10:19, Stuart Henderson wrote:
> > On 2023/01/14 22:04, Mark Kettenis wrote:
> > > > Date: Sat, 14 Jan 2023 21:08:38 +0100
> > > > From: Theo Buehler <tb@theobuehler.org>
> > > >
> > > > This moves constants from .text into .rodata.
> > > >
> > > > All tests pass, gnupg tests work, gpgme and gcr build.
> > >
> > > Right, and then the idiots did this:
> > >
> > > https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commit;h=fd02e8e78470deb661269c429f3348f811c054c6
> > >
> > > so future versions will need furher patching. At least they used a
> > > macro, so it is relatively easy to revert.
> >
> > I tried the newer branch before --no-execute-only went in, it doesn't
> > build as-is so needs further patching anyway.
> >
>
> Since I still had my WIP of libgcrypt head lying around from when
> I tried that to see if it would help, I've updated it with the diff
> from https://marc.info/?l=gcrypt-devel&m=167380913210961 added.
> It's not important for ports yet (though presumably will be later)
> and I won't look at this more now, but I've included the diff below
> (I sighed at the getrandom call that I #ifdef'd out) and FWIW
> this is how build now fails on aarch64:
>
> (On amd64 it builds; most tests pass but "basic" / "basic-disable-all-hwf"
> fail with SIGFPE.)

Here's a diff that passes regress on arm64. I haven't looked at other
architectures.

I changed the definition of GET_DATA_POINTER() to what it was before the
commit that was "reverted" by the diff in the mail went in. A couple
more constants needed to move to .rodata.

The build runs fig2dev. So I added a BDEP on print/transfig. Since we
don't package the result, it should probably be neutered.

Index: Makefile
===================================================================
RCS file: /cvs/ports/security/libgcrypt/Makefile,v
retrieving revision 1.82
diff -u -p -r1.82 Makefile
--- Makefile 15 Jan 2023 09:35:41 -0000 1.82
+++ Makefile 16 Jan 2023 17:32:05 -0000
@@ -1,9 +1,13 @@
COMMENT= crypto library based on code used in GnuPG

-DISTNAME= libgcrypt-1.10.1
-REVISION= 2
+DISTNAME= libgcrypt-20230106
CATEGORIES= security

+C= 5e1a04f77933a8295df69d818e9effc076dc68cd
+CS= ${C:C/^(.......)(.*)/\1/}
+DISTFILES= libgcrypt-HEAD-5e1a04f.tar.gz{gitweb.cgi?p=libgcrypt.git\;a=snapshot\;h=$C\;sf=tgz}
+WRKDIST= ${WRKDIR}/libgcrypt-${CS}
+
SHARED_LIBS += gcrypt 21.0 # 24.1

HOMEPAGE= https://www.gnupg.org/software/libgcrypt/index.html
@@ -15,18 +19,28 @@ PERMIT_PACKAGE= Yes

WANTLIB += c gpg-error iconv intl

-MASTER_SITES= ${MASTER_SITE_GNUPG:=libgcrypt/}
+#MASTER_SITES= ${MASTER_SITE_GNUPG:=libgcrypt/}
+MASTER_SITES= https://git.gnupg.org/cgi-bin/

LIB_DEPENDS= security/libgpg-error

-CONFIGURE_STYLE= gnu
+BUILD_DEPENDS= print/transfig
+
+CONFIGURE_STYLE= autoreconf
+AUTORECONF= ./autogen.sh
+AUTOCONF_VERSION= 2.71
+AUTOMAKE_VERSION= 1.16
+
CONFIGURE_ARGS= --enable-static \
--disable-drng-support

-.if ${MACHINE_ARCH} != aarch64
-USE_NOEXECONLY= Yes
-.endif
+#.if ${MACHINE_ARCH} != aarch64
+#USE_NOEXECONLY= Yes
+#.endif

DEBUG_PACKAGES= ${BUILD_PACKAGES}
+
+post-extract:
+ printf '@set UPDATED 28 March 2022\n@set UPDATED-MONTH March 2022\n@set EDITION 1.10.1\n@set VERSION 1.10.1\n' > ${WRKSRC}/doc/version.texi

.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/security/libgcrypt/distinfo,v
retrieving revision 1.43
diff -u -p -r1.43 distinfo
--- distinfo 29 Mar 2022 07:15:13 -0000 1.43
+++ distinfo 16 Jan 2023 17:07:40 -0000
@@ -1,2 +1,2 @@
-SHA256 (libgcrypt-1.10.1.tar.gz) = wDFZxmERfoD/2XoT0Uxe6ItImfi1eQFpPAmdKwQtwSQ=
-SIZE (libgcrypt-1.10.1.tar.gz) = 4484715
+SHA256 (libgcrypt-HEAD-5e1a04f.tar.gz) = YkrchpoNEtOSmYj5jyoQK+6ERN0XoldwAiE3AzNmHeE=
+SIZE (libgcrypt-HEAD-5e1a04f.tar.gz) = 4012633
Index: patches/patch-cipher_asm-common-aarch64_h
===================================================================
RCS file: patches/patch-cipher_asm-common-aarch64_h
diff -N patches/patch-cipher_asm-common-aarch64_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-cipher_asm-common-aarch64_h 16 Jan 2023 17:29:24 -0000
@@ -0,0 +1,23 @@
+https://marc.info/?l=gcrypt-devel&m=167380913210961
+
+Index: cipher/asm-common-aarch64.h
+--- cipher/asm-common-aarch64.h.orig
++++ cipher/asm-common-aarch64.h
+@@ -29,8 +29,15 @@
+ # define ELF(...) /*_*/
+

No comments:

Post a Comment