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 <t...@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(...) /*_*/
+ #endif
+ 
+-#define GET_LOCAL_POINTER(reg, label) \
+-      adr reg, label;
++#ifdef __APPLE__
++#define GET_DATA_POINTER(reg, name) \
++      adrp    reg, name@GOTPAGE ; \
++      add     reg, reg, name@GOTPAGEOFF ;
++#else
++#define GET_DATA_POINTER(reg, name) \
++      adrp    reg, :got:name ; \
++      ldr     reg, [reg, #:got_lo12:name] ;
++#endif
+ 
+ #ifdef HAVE_GCC_ASM_CFI_DIRECTIVES
+ /* CFI directives to emit DWARF stack unwinding information. */
Index: patches/patch-cipher_camellia-aarch64_S
===================================================================
RCS file: 
/cvs/ports/security/libgcrypt/patches/patch-cipher_camellia-aarch64_S,v
retrieving revision 1.3
diff -u -p -r1.3 patch-cipher_camellia-aarch64_S
--- patches/patch-cipher_camellia-aarch64_S     15 Jan 2023 09:35:41 -0000      
1.3
+++ patches/patch-cipher_camellia-aarch64_S     16 Jan 2023 17:07:40 -0000
@@ -1,6 +1,26 @@
+first 2 hunks, https://marc.info/?l=gcrypt-devel&m=167380913210961
+
 Index: cipher/camellia-aarch64.S
 --- cipher/camellia-aarch64.S.orig
 +++ cipher/camellia-aarch64.S
+@@ -214,7 +214,7 @@ _gcry_camellia_arm_encrypt_block:
+        *      w3: keybitlen
+        */
+ 
+-      GET_LOCAL_POINTER(RTAB1,  _gcry_camellia_arm_tables);
++      GET_DATA_POINTER(RTAB1,  _gcry_camellia_arm_tables);
+       mov RMASK, #(0xff<<4); /* byte mask */
+       add RTAB2, RTAB1, #(1 * 4);
+       add RTAB3, RTAB1, #(2 * 4);
+@@ -274,7 +274,7 @@ _gcry_camellia_arm_decrypt_block:
+        *      w3: keybitlen
+        */
+ 
+-      GET_LOCAL_POINTER(RTAB1,  _gcry_camellia_arm_tables);
++      adr RTAB1,  _gcry_camellia_arm_tables;
+       mov RMASK, #(0xff<<4); /* byte mask */
+       add RTAB2, RTAB1, #(1 * 4);
+       add RTAB3, RTAB1, #(2 * 4);
 @@ -313,6 +313,7 @@ _gcry_camellia_arm_decrypt_block:
  .ltorg
  ELF(.size 
_gcry_camellia_arm_decrypt_block,.-_gcry_camellia_arm_decrypt_block;)
Index: patches/patch-cipher_chacha20-aarch64_S
===================================================================
RCS file: 
/cvs/ports/security/libgcrypt/patches/patch-cipher_chacha20-aarch64_S,v
retrieving revision 1.1
diff -u -p -r1.1 patch-cipher_chacha20-aarch64_S
--- patches/patch-cipher_chacha20-aarch64_S     15 Jan 2023 09:35:41 -0000      
1.1
+++ patches/patch-cipher_chacha20-aarch64_S     16 Jan 2023 17:07:40 -0000
@@ -1,3 +1,5 @@
+GET_LOCAL_POINTER -> GET_DATA_POINTER: 
https://marc.info/?l=gcrypt-devel&m=167380913210961
+
 Index: cipher/chacha20-aarch64.S
 --- cipher/chacha20-aarch64.S.orig
 +++ cipher/chacha20-aarch64.S
@@ -10,12 +12,38 @@ Index: cipher/chacha20-aarch64.S
  
  #include "asm-poly1305-aarch64.h"
  
-@@ -192,6 +192,8 @@ _gcry_chacha20_aarch64_blocks4_data_rot8:
-       .byte 7,4,5,6
+@@ -193,6 +193,8 @@ _gcry_chacha20_aarch64_blocks4_data_rot8:
        .byte 11,8,9,10
        .byte 15,12,13,14
-+
-+.text
  
++.text
++
  .align 3
  .globl _gcry_chacha20_aarch64_blocks4
+ ELF(.type _gcry_chacha20_aarch64_blocks4,%function;)
+@@ -206,10 +208,10 @@ _gcry_chacha20_aarch64_blocks4:
+        */
+       CFI_STARTPROC()
+ 
+-      GET_LOCAL_POINTER(CTR, _gcry_chacha20_aarch64_blocks4_data_rot8);
++      GET_DATA_POINTER(CTR, _gcry_chacha20_aarch64_blocks4_data_rot8);
+       add INPUT_CTR, INPUT, #(12*4);
+       ld1 {ROT8.16b}, [CTR];
+-      GET_LOCAL_POINTER(CTR, _gcry_chacha20_aarch64_blocks4_data_inc_counter);
++      GET_DATA_POINTER(CTR, _gcry_chacha20_aarch64_blocks4_data_inc_counter);
+       mov INPUT_POS, INPUT;
+       ld1 {VCTR.16b}, [CTR];
+ 
+@@ -383,10 +385,10 @@ _gcry_chacha20_poly1305_aarch64_blocks4:
+       mov POLY_RSTATE, x4;
+       mov POLY_RSRC, x5;
+ 
+-      GET_LOCAL_POINTER(CTR, _gcry_chacha20_aarch64_blocks4_data_rot8);
++      GET_DATA_POINTER(CTR, _gcry_chacha20_aarch64_blocks4_data_rot8);
+       add INPUT_CTR, INPUT, #(12*4);
+       ld1 {ROT8.16b}, [CTR];
+-      GET_LOCAL_POINTER(CTR, _gcry_chacha20_aarch64_blocks4_data_inc_counter);
++      GET_DATA_POINTER(CTR, _gcry_chacha20_aarch64_blocks4_data_inc_counter);
+       mov INPUT_POS, INPUT;
+       ld1 {VCTR.16b}, [CTR];
+ 
Index: patches/patch-cipher_cipher-gcm-armv8-aarch64-ce_S
===================================================================
RCS file: 
/cvs/ports/security/libgcrypt/patches/patch-cipher_cipher-gcm-armv8-aarch64-ce_S,v
retrieving revision 1.1
diff -u -p -r1.1 patch-cipher_cipher-gcm-armv8-aarch64-ce_S
--- patches/patch-cipher_cipher-gcm-armv8-aarch64-ce_S  15 Jan 2023 09:35:41 
-0000      1.1
+++ patches/patch-cipher_cipher-gcm-armv8-aarch64-ce_S  16 Jan 2023 17:07:40 
-0000
@@ -1,3 +1,5 @@
+GET_LOCAL_POINTER -> GET_DATA_POINTER: 
https://marc.info/?l=gcrypt-devel&m=167380913210961
+
 Index: cipher/cipher-gcm-armv8-aarch64-ce.S
 --- cipher/cipher-gcm-armv8-aarch64-ce.S.orig
 +++ cipher/cipher-gcm-armv8-aarch64-ce.S
@@ -10,12 +12,39 @@ Index: cipher/cipher-gcm-armv8-aarch64-c
  
  
  /* Constants */
-@@ -170,6 +170,8 @@ gcry_gcm_reduction_constant:
-         CFI_ADJUST_CFA_OFFSET(-16); \
-         ldp d8, d9, [sp], #16; \
-         CFI_ADJUST_CFA_OFFSET(-16);
-+
-+.text
+@@ -149,6 +149,8 @@ gcry_gcm_reduction_constant:
+ #define _(...) __VA_ARGS__
+ #define __ _()
  
++.text
++
  /*
   * unsigned int _gcry_ghash_armv8_ce_pmull (void *gcm_key, byte *result,
+  *                                          const byte *buf, size_t nblocks,
+@@ -169,7 +171,7 @@ _gcry_ghash_armv8_ce_pmull:
+ 
+   cbz x3, .Ldo_nothing;
+ 
+-  GET_LOCAL_POINTER(x5, .Lrconst)
++  GET_DATA_POINTER(x5, .Lrconst)
+ 
+   eor vZZ.16b, vZZ.16b, vZZ.16b
+   ld1 {rhash.16b}, [x1]
+@@ -368,7 +370,7 @@ _gcry_polyval_armv8_ce_pmull:
+ 
+   cbz x3, .Lpolyval_do_nothing;
+ 
+-  GET_LOCAL_POINTER(x5, .Lrconst)
++  GET_DATA_POINTER(x5, .Lrconst)
+ 
+   eor vZZ.16b, vZZ.16b, vZZ.16b
+   ld1 {rhash.16b}, [x1]
+@@ -589,7 +591,7 @@ _gcry_ghash_setup_armv8_ce_pmull:
+    */
+   CFI_STARTPROC()
+ 
+-  GET_LOCAL_POINTER(x2, .Lrconst)
++  GET_DATA_POINTER(x2, .Lrconst)
+ 
+   eor vZZ.16b, vZZ.16b, vZZ.16b
+ 
Index: patches/patch-cipher_crc-armv8-aarch64-ce_S
===================================================================
RCS file: 
/cvs/ports/security/libgcrypt/patches/patch-cipher_crc-armv8-aarch64-ce_S,v
retrieving revision 1.1
diff -u -p -r1.1 patch-cipher_crc-armv8-aarch64-ce_S
--- patches/patch-cipher_crc-armv8-aarch64-ce_S 15 Jan 2023 09:35:41 -0000      
1.1
+++ patches/patch-cipher_crc-armv8-aarch64-ce_S 16 Jan 2023 17:07:40 -0000
@@ -1,3 +1,5 @@
+GET_LOCAL_POINTER -> GET_DATA_POINTER: 
https://marc.info/?l=gcrypt-devel&m=167380913210961
+
 Index: cipher/crc-armv8-aarch64-ce.S
 --- cipher/crc-armv8-aarch64-ce.S.orig
 +++ cipher/crc-armv8-aarch64-ce.S
@@ -18,3 +20,21 @@ Index: cipher/crc-armv8-aarch64-ce.S
  
  /*
   * void _gcry_crc32r_armv8_ce_bulk (u32 *pcrc, const byte *inbuf, size_t 
inlen,
+@@ -71,7 +72,7 @@ _gcry_crc32r_armv8_ce_bulk:
+    */
+   CFI_STARTPROC()
+ 
+-  GET_LOCAL_POINTER(x7, .Lcrc32_constants)
++  GET_DATA_POINTER(x7, .Lcrc32_constants)
+   add x9, x3, #consts_k(5 - 1)
+   cmp x2, #128
+ 
+@@ -280,7 +281,7 @@ _gcry_crc32_armv8_ce_bulk:
+    */
+   CFI_STARTPROC()
+ 
+-  GET_LOCAL_POINTER(x7, .Lcrc32_constants)
++  GET_DATA_POINTER(x7, .Lcrc32_constants)
+   add x4, x7, #.Lcrc32_bswap_shuf - .Lcrc32_constants
+   cmp x2, #128
+   ld1 {v7.16b}, [x4]
Index: patches/patch-cipher_sha1-armv8-aarch64-ce_S
===================================================================
RCS file: 
/cvs/ports/security/libgcrypt/patches/patch-cipher_sha1-armv8-aarch64-ce_S,v
retrieving revision 1.1
diff -u -p -r1.1 patch-cipher_sha1-armv8-aarch64-ce_S
--- patches/patch-cipher_sha1-armv8-aarch64-ce_S        15 Jan 2023 09:35:41 
-0000      1.1
+++ patches/patch-cipher_sha1-armv8-aarch64-ce_S        16 Jan 2023 17:07:40 
-0000
@@ -1,3 +1,5 @@
+GET_LOCAL_POINTER -> GET_DATA_POINTER: 
https://marc.info/?l=gcrypt-devel&m=167380913210961
+
 Index: cipher/sha1-armv8-aarch64-ce.S
 --- cipher/sha1-armv8-aarch64-ce.S.orig
 +++ cipher/sha1-armv8-aarch64-ce.S
@@ -18,3 +20,12 @@ Index: cipher/sha1-armv8-aarch64-ce.S
  
  /*
   * unsigned int
+@@ -109,7 +110,7 @@ _gcry_sha1_transform_armv8_ce:
+ 
+   cbz x2, .Ldo_nothing;
+ 
+-  GET_LOCAL_POINTER(x4, .LK_VEC);
++  GET_DATA_POINTER(x4, .LK_VEC);
+ 
+   ld1 {vH0123.4s}, [x0]     /* load h0,h1,h2,h3 */
+   ld1 {vK1.4s-vK4.4s}, [x4] /* load K1,K2,K3,K4 */
Index: patches/patch-cipher_sha256-armv8-aarch64-ce_S
===================================================================
RCS file: 
/cvs/ports/security/libgcrypt/patches/patch-cipher_sha256-armv8-aarch64-ce_S,v
retrieving revision 1.1
diff -u -p -r1.1 patch-cipher_sha256-armv8-aarch64-ce_S
--- patches/patch-cipher_sha256-armv8-aarch64-ce_S      15 Jan 2023 09:35:41 
-0000      1.1
+++ patches/patch-cipher_sha256-armv8-aarch64-ce_S      16 Jan 2023 17:07:40 
-0000
@@ -1,3 +1,5 @@
+GET_LOCAL_POINTER -> GET_DATA_POINTER: 
https://marc.info/?l=gcrypt-devel&m=167380913210961
+
 Index: cipher/sha256-armv8-aarch64-ce.S
 --- cipher/sha256-armv8-aarch64-ce.S.orig
 +++ cipher/sha256-armv8-aarch64-ce.S
@@ -18,3 +20,12 @@ Index: cipher/sha256-armv8-aarch64-ce.S
  
  /*
   * unsigned int
+@@ -119,7 +120,7 @@ _gcry_sha256_transform_armv8_ce:
+ 
+   cbz x2, .Ldo_nothing;
+ 
+-  GET_LOCAL_POINTER(x3, .LK);
++  GET_DATA_POINTER(x3, .LK);
+   mov x4, x3
+ 
+   ld1 {vH0123.4s-vH4567.4s}, [x0]  /* load state */
Index: patches/patch-cipher_sm3-aarch64_S
===================================================================
RCS file: /cvs/ports/security/libgcrypt/patches/patch-cipher_sm3-aarch64_S,v
retrieving revision 1.1
diff -u -p -r1.1 patch-cipher_sm3-aarch64_S
--- patches/patch-cipher_sm3-aarch64_S  15 Jan 2023 09:35:41 -0000      1.1
+++ patches/patch-cipher_sm3-aarch64_S  16 Jan 2023 17:07:40 -0000
@@ -1,3 +1,5 @@
+GET_LOCAL_POINTER -> GET_DATA_POINTER: 
https://marc.info/?l=gcrypt-devel&m=167380913210961
+
 Index: cipher/sm3-aarch64.S
 --- cipher/sm3-aarch64.S.orig
 +++ cipher/sm3-aarch64.S
@@ -18,3 +20,12 @@ Index: cipher/sm3-aarch64.S
  /*
   * Transform nblks*64 bytes (nblks*16 32-bit words) at DATA.
   *
+@@ -425,7 +426,7 @@ _gcry_sm3_transform_aarch64:
+   CFI_DEF_CFA_REGISTER(RFRAME);
+ 
+   sub addr0, sp, #STACK_SIZE;
+-  GET_LOCAL_POINTER(RKPTR, .LKtable);
++  GET_DATA_POINTER(RKPTR, .LKtable);
+   and sp, addr0, #(~63);
+ 
+   /* Preload first block. */
Index: patches/patch-cipher_sm3-armv8-aarch64-ce_S
===================================================================
RCS file: patches/patch-cipher_sm3-armv8-aarch64-ce_S
diff -N patches/patch-cipher_sm3-armv8-aarch64-ce_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-cipher_sm3-armv8-aarch64-ce_S 16 Jan 2023 17:07:40 -0000
@@ -0,0 +1,14 @@
+https://marc.info/?l=gcrypt-devel&m=167380913210961
+
+Index: cipher/sm3-armv8-aarch64-ce.S
+--- cipher/sm3-armv8-aarch64-ce.S.orig
++++ cipher/sm3-armv8-aarch64-ce.S
+@@ -170,7 +170,7 @@ _gcry_sm3_transform_armv8_ce:
+     ext         CTX2.16b, CTX2.16b, CTX2.16b, #8;
+ 
+ .Lloop:
+-    GET_LOCAL_POINTER(x3, .Lsm3_Ktable);
++    GET_DATA_POINTER(x3, .Lsm3_Ktable);
+     ld1         {v0.16b-v3.16b}, [x1], #64;
+     sub         x2, x2, #1;
+ 
Index: patches/patch-cipher_sm4-aarch64_S
===================================================================
RCS file: patches/patch-cipher_sm4-aarch64_S
diff -N patches/patch-cipher_sm4-aarch64_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-cipher_sm4-aarch64_S  16 Jan 2023 17:15:18 -0000
@@ -0,0 +1,32 @@
+https://marc.info/?l=gcrypt-devel&m=167380913210961
+
+Index: cipher/sm4-aarch64.S
+--- cipher/sm4-aarch64.S.orig
++++ cipher/sm4-aarch64.S
+@@ -30,7 +30,7 @@
+ 
+ /* Constants */
+ 
+-.text
++.rodata
+ .align 4
+ ELF(.type _gcry_sm4_aarch64_consts,@object)
+ _gcry_sm4_aarch64_consts:
+@@ -69,6 +69,8 @@ _gcry_sm4_aarch64_consts:
+   .byte 0x79, 0xee, 0x5f, 0x3e, 0xd7, 0xcb, 0x39, 0x48
+ ELF(.size _gcry_sm4_aarch64_consts,.-_gcry_sm4_aarch64_consts)
+ 
++.text
++
+ /* Register macros */
+ 
+ #define RTMP0   v8
+@@ -84,7 +86,7 @@ ELF(.size _gcry_sm4_aarch64_consts,.-_gcry_sm4_aarch64
+ /* Helper macros. */
+ 
+ #define preload_sbox(ptr)                   \
+-        GET_LOCAL_POINTER(ptr, .Lsm4_sbox);  \
++        GET_DATA_POINTER(ptr, .Lsm4_sbox);  \
+         ld1 {v16.16b-v19.16b}, [ptr], #64;  \
+         ld1 {v20.16b-v23.16b}, [ptr], #64;  \
+         ld1 {v24.16b-v27.16b}, [ptr], #64;  \
Index: patches/patch-cipher_sm4-armv9-aarch64-sve-ce_S
===================================================================
RCS file: patches/patch-cipher_sm4-armv9-aarch64-sve-ce_S
diff -N patches/patch-cipher_sm4-armv9-aarch64-sve-ce_S
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-cipher_sm4-armv9-aarch64-sve-ce_S     16 Jan 2023 17:07:40 
-0000
@@ -0,0 +1,23 @@
+https://marc.info/?l=gcrypt-devel&m=167380913210961
+
+Index: cipher/sm4-armv9-aarch64-sve-ce.S
+--- cipher/sm4-armv9-aarch64-sve-ce.S.orig
++++ cipher/sm4-armv9-aarch64-sve-ce.S
+@@ -167,7 +167,7 @@ ELF(.size _gcry_sm4_armv9_svesm4_consts,.-_gcry_sm4_ar
+ /* Helper macros. */
+ 
+ #define PREPARE()                                   \
+-        GET_LOCAL_POINTER(x7, .Lbswap128_mask);     \
++        GET_DATA_POINTER(x7, .Lbswap128_mask);      \
+         ptrue       p0.b, ALL;                      \
+         rdvl        x5, #1;                         \
+         ld1b        {RSWAP128.b}, p0/z, [x7];       \
+@@ -811,7 +811,7 @@ _gcry_sm4_armv9_sve_ce_ctr_enc:
+     PREPARE();
+ 
+     dup         RZERO.d, #0;
+-    GET_LOCAL_POINTER(x6, .Lle128_inc);
++    GET_DATA_POINTER(x6, .Lle128_inc);
+     ld1b        {RLE128_INC.b}, p0/z, [x6];
+ 
+     ldp         x7, x8, [x3];
Index: patches/patch-mpi_longlong_h
===================================================================
RCS file: /cvs/ports/security/libgcrypt/patches/patch-mpi_longlong_h,v
retrieving revision 1.10
diff -u -p -r1.10 patch-mpi_longlong_h
--- patches/patch-mpi_longlong_h        11 Mar 2022 19:53:30 -0000      1.10
+++ patches/patch-mpi_longlong_h        16 Jan 2023 17:07:40 -0000
@@ -1,8 +1,9 @@
 Fix build on alpha.
 
---- mpi/longlong.h.orig        Wed Jun  8 18:18:15 2016
-+++ mpi/longlong.h     Wed Jun 15 23:15:28 2016
-@@ -174,6 +174,7 @@ MA 02111-1307, USA. */
+Index: mpi/longlong.h
+--- mpi/longlong.h.orig
++++ mpi/longlong.h
+@@ -184,6 +184,7 @@ MA 02111-1307, USA. */
      (pl) = __m0 * __m1;                                               \
    } while (0)
  # define UMUL_TIME 46
@@ -10,7 +11,7 @@ Fix build on alpha.
  # ifndef LONGLONG_STANDALONE
  #  define udiv_qrnnd(q, r, n1, n0, d) \
    do { UDItype __r;                                                   \
-@@ -183,6 +184,7 @@ MA 02111-1307, USA. */
+@@ -193,6 +194,7 @@ MA 02111-1307, USA. */
  extern UDItype __udiv_qrnnd ();
  #  define UDIV_TIME 220
  # endif /* !LONGLONG_STANDALONE */
Index: patches/patch-random_rndgetentropy_c
===================================================================
RCS file: patches/patch-random_rndgetentropy_c
diff -N patches/patch-random_rndgetentropy_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-random_rndgetentropy_c        16 Jan 2023 17:07:40 -0000
@@ -0,0 +1,21 @@
+don't use getrandom()
+
+Index: random/rndgetentropy.c
+--- random/rndgetentropy.c.orig
++++ random/rndgetentropy.c
+@@ -81,6 +81,7 @@ _gcry_rndgetentropy_gather_random (void (*add)(const v
+       do
+         {
+           _gcry_pre_syscall ();
++#if 0
+           if (fips_mode ())
+             {
+               /* DRBG chaining defined in SP 800-90A (rev 1) specify
+@@ -98,6 +99,7 @@ _gcry_rndgetentropy_gather_random (void (*add)(const v
+               ret = getrandom (buffer, nbytes, GRND_RANDOM);
+             }
+           else
++#endif
+             {
+               nbytes = length < sizeof (buffer) ? length : sizeof (buffer);
+               ret = getentropy (buffer, nbytes);
Index: patches/patch-src_hwf-arm_c
===================================================================
RCS file: /cvs/ports/security/libgcrypt/patches/patch-src_hwf-arm_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_hwf-arm_c
--- patches/patch-src_hwf-arm_c 12 Apr 2022 21:04:06 -0000      1.1
+++ patches/patch-src_hwf-arm_c 16 Jan 2023 17:07:40 -0000
@@ -11,9 +11,9 @@ Index: src/hwf-arm.c
 +#include <machine/cpu.h>
 +#include <machine/armreg.h>
  #endif
- 
- #include "g10lib.h"
-@@ -62,7 +67,8 @@ static unsigned long getauxval(unsigned long type)
+ #if defined(__APPLE__) && defined(HAVE_SYS_SYSCTL_H) && \
+     defined(HAVE_SYSCTLBYNAME)
+@@ -66,7 +71,8 @@ static unsigned long getauxval(unsigned long type)
  
  #undef HAS_SYS_AT_HWCAP
  #if defined(__linux__) || \
@@ -23,7 +23,7 @@ Index: src/hwf-arm.c
  #define HAS_SYS_AT_HWCAP 1
  
  struct feature_map_s {
-@@ -196,6 +202,29 @@ get_hwcap(unsigned int *hwcap, unsigned int *hwcap2)
+@@ -243,6 +249,29 @@ get_hwcap(unsigned int *hwcap, unsigned int *hwcap2)
        *hwcap2 = stored_hwcap2;
        return 0;
      }

Reply via email to