This fixes the perlasm on my x-only amd64 machines to the point that
tests pass (apart form the shlibload test). This is quite a bit more
than what was committed to base libcrypto and it is very possible that I
missed some constants in .text.
So tests and careful sets of eyes would be very welcome.
Index: Makefile
===================================================================
RCS file: /cvs/ports/security/openssl/1.1/Makefile,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile
--- Makefile 14 Jan 2023 17:09:56 -0000 1.47
+++ Makefile 15 Jan 2023 12:20:12 -0000
@@ -3,7 +3,7 @@ PORTROACH= limit:^1\.1\.[0-9][a-z] skipb
V= 1.1.1s
PKGSPEC= openssl->=1.1.0v0,<1.2v0
EPOCH= 0
-REVISION= 2
+REVISION= 3
SHLIBVER= 11.6
SHARED_LIBS= crypto ${SHLIBVER} \
@@ -35,7 +35,7 @@ MAN_PREFIX= @man lib/eopenssl11/man
INSTALL_TARGET+= install_man_docs
.endif
-.if ${MACHINE_ARCH} != aarch64
+.if ${MACHINE_ARCH} != aarch64 && ${MACHINE_ARCH} != amd64
USE_NOEXECONLY= Yes
.endif
Index: patches/patch-crypto_aes_asm_aesni-sha1-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_aes_asm_aesni-sha1-x86_64_pl
diff -N patches/patch-crypto_aes_asm_aesni-sha1-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_aes_asm_aesni-sha1-x86_64_pl 15 Jan 2023 12:20:12
-0000
@@ -0,0 +1,19 @@
+Index: crypto/aes/asm/aesni-sha1-x86_64.pl
+--- crypto/aes/asm/aesni-sha1-x86_64.pl.orig
++++ crypto/aes/asm/aesni-sha1-x86_64.pl
+@@ -1736,6 +1736,7 @@ ___
+ }}}
+ }
+ $code.=<<___;
++.rodata
+ .align 64
+ K_XX_XX:
+ .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
+@@ -1747,6 +1748,7 @@ K_XX_XX:
+
+ .asciz "AESNI-CBC+SHA1 stitch for x86_64, CRYPTOGAMS by
<appro\@openssl.org>"
+ .align 64
++.previous
+ ___
+ if ($shaext) {{{
+
($in0,$out,$len,$key,$ivp,$ctx,$inp)=("%rdi","%rsi","%rdx","%rcx","%r8","%r9","%r10");
Index: patches/patch-crypto_aes_asm_aesni-sha256-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_aes_asm_aesni-sha256-x86_64_pl
diff -N patches/patch-crypto_aes_asm_aesni-sha256-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_aes_asm_aesni-sha256-x86_64_pl 15 Jan 2023 12:20:12
-0000
@@ -0,0 +1,19 @@
+Index: crypto/aes/asm/aesni-sha256-x86_64.pl
+--- crypto/aes/asm/aesni-sha256-x86_64.pl.orig
++++ crypto/aes/asm/aesni-sha256-x86_64.pl
+@@ -166,6 +166,7 @@ $code.=<<___;
+ .cfi_endproc
+ .size $func,.-$func
+
++.rodata
+ .align 64
+ .type $TABLE,\@object
+ $TABLE:
+@@ -208,6 +209,7 @@ $TABLE:
+ .long 0,0,0,0, 0,0,0,0
+ .asciz "AESNI-CBC+SHA256 stitch for x86_64, CRYPTOGAMS by
<appro\@openssl.org>"
+ .align 64
++.previous
+ ___
+
+ ######################################################################
Index: patches/patch-crypto_aes_asm_aesni-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_aes_asm_aesni-x86_64_pl
diff -N patches/patch-crypto_aes_asm_aesni-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_aes_asm_aesni-x86_64_pl 15 Jan 2023 12:20:12
-0000
@@ -0,0 +1,19 @@
+Index: crypto/aes/asm/aesni-x86_64.pl
+--- crypto/aes/asm/aesni-x86_64.pl.orig
++++ crypto/aes/asm/aesni-x86_64.pl
+@@ -4730,6 +4730,7 @@ ___
+ }
+
+ $code.=<<___;
++.rodata
+ .align 64
+ .Lbswap_mask:
+ .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+@@ -4752,6 +4753,7 @@ $code.=<<___;
+
+ .asciz "AES for Intel AES-NI, CRYPTOGAMS by <appro\@openssl.org>"
+ .align 64
++.previous
+ ___
+
+ # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
Index: patches/patch-crypto_aes_asm_vpaes-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_aes_asm_vpaes-x86_64_pl
diff -N patches/patch-crypto_aes_asm_vpaes-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_aes_asm_vpaes-x86_64_pl 15 Jan 2023 12:20:12
-0000
@@ -0,0 +1,19 @@
+Index: crypto/aes/asm/vpaes-x86_64.pl
+--- crypto/aes/asm/vpaes-x86_64.pl.orig
++++ crypto/aes/asm/vpaes-x86_64.pl
+@@ -998,6 +998,7 @@ _vpaes_preheat:
+ ## Constants ##
+ ## ##
+ ########################################################
++.rodata
+ .type _vpaes_consts,\@object
+ .align 64
+ _vpaes_consts:
+@@ -1097,6 +1098,7 @@ _vpaes_consts:
+ .asciz "Vector Permutation AES for x86_64/SSSE3, Mike Hamburg
(Stanford University)"
+ .align 64
+ .size _vpaes_consts,.-_vpaes_consts
++.previous
+ ___
+
+ if ($win64) {
Index: patches/patch-crypto_bn_asm_rsaz-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_bn_asm_rsaz-x86_64_pl
diff -N patches/patch-crypto_bn_asm_rsaz-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_bn_asm_rsaz-x86_64_pl 15 Jan 2023 12:55:08 -0000
@@ -0,0 +1,16 @@
+Index: crypto/bn/asm/rsaz-x86_64.pl
+--- crypto/bn/asm/rsaz-x86_64.pl.orig
++++ crypto/bn/asm/rsaz-x86_64.pl
+@@ -2246,10 +2246,12 @@ $code.=<<___;
+ .cfi_endproc
+ .size rsaz_512_gather4,.-rsaz_512_gather4
+
++.rodata
+ .align 64
+ .Linc:
+ .long 0,0, 1,1
+ .long 2,2, 2,2
++.previous
+ ___
+ }
+
Index: patches/patch-crypto_bn_asm_x86_64-mont5_pl
===================================================================
RCS file: patches/patch-crypto_bn_asm_x86_64-mont5_pl
diff -N patches/patch-crypto_bn_asm_x86_64-mont5_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_bn_asm_x86_64-mont5_pl 15 Jan 2023 12:32:39 -0000
@@ -0,0 +1,17 @@
+Index: crypto/bn/asm/x86_64-mont5.pl
+--- crypto/bn/asm/x86_64-mont5.pl.orig
++++ crypto/bn/asm/x86_64-mont5.pl
+@@ -3575,11 +3575,13 @@ $code.=<<___;
+ ___
+ }
+ $code.=<<___;
++.rodata
+ .align 64
+ .Linc:
+ .long 0,0, 1,1
+ .long 2,2, 2,2
+ .asciz "Montgomery Multiplication with scatter/gather for x86_64,
CRYPTOGAMS by <appro\@openssl.org>"
++.previous
+ ___
+
+ # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
Index: patches/patch-crypto_camellia_asm_cmll-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_camellia_asm_cmll-x86_64_pl
diff -N patches/patch-crypto_camellia_asm_cmll-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_camellia_asm_cmll-x86_64_pl 15 Jan 2023 13:16:15
-0000
@@ -0,0 +1,19 @@
+Index: crypto/camellia/asm/cmll-x86_64.pl
+--- crypto/camellia/asm/cmll-x86_64.pl.orig
++++ crypto/camellia/asm/cmll-x86_64.pl
+@@ -655,6 +655,7 @@ sub S0222 { my $i=shift; $i=@SBOX[$i]; $i=($i<<1|$i>>7
+ sub S3033 { my $i=shift; $i=@SBOX[$i]; $i=($i>>1|$i<<7)&0xff;
$i=$i<<24|$i<<8|$i; sprintf("0x%08x",$i); }
+
+ $code.=<<___;
++.rodata
+ .align 64
+ .LCamellia_SIGMA:
+ .long 0x3bcc908b, 0xa09e667f, 0x4caa73b2, 0xb67ae858
+@@ -680,6 +681,7 @@ $_ivp="40(%rsp)";
+ $_rsp="48(%rsp)";
+
+ $code.=<<___;
++.text
+ .globl Camellia_cbc_encrypt
+ .type Camellia_cbc_encrypt,\@function,6
+ .align 16
Index: patches/patch-crypto_chacha_asm_chacha-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_chacha_asm_chacha-x86_64_pl
diff -N patches/patch-crypto_chacha_asm_chacha-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_chacha_asm_chacha-x86_64_pl 15 Jan 2023 12:25:45
-0000
@@ -0,0 +1,19 @@
+Index: crypto/chacha/asm/chacha-x86_64.pl
+--- crypto/chacha/asm/chacha-x86_64.pl.orig
++++ crypto/chacha/asm/chacha-x86_64.pl
+@@ -100,6 +100,7 @@ $code.=<<___;
+
+ .extern OPENSSL_ia32cap_P
+
++.rodata
+ .align 64
+ .Lzero:
+ .long 0,0,0,0
+@@ -131,6 +132,7 @@ $code.=<<___;
+ .Lsigma:
+ .asciz "expand 32-byte k"
+ .asciz "ChaCha20 for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
++.previous
+ ___
+
+ sub AUTOLOAD() # thunk [simplified] 32-bit style perlasm
Index: patches/patch-crypto_ec_asm_ecp_nistz256-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_ec_asm_ecp_nistz256-x86_64_pl
diff -N patches/patch-crypto_ec_asm_ecp_nistz256-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_ec_asm_ecp_nistz256-x86_64_pl 15 Jan 2023 12:20:12
-0000
@@ -0,0 +1,28 @@
+Index: crypto/ec/asm/ecp_nistz256-x86_64.pl
+--- crypto/ec/asm/ecp_nistz256-x86_64.pl.orig
++++ crypto/ec/asm/ecp_nistz256-x86_64.pl
+@@ -83,6 +83,7 @@ $code.=<<___;
+ .extern OPENSSL_ia32cap_P
+
+ # The polynomial
++.rodata
+ .align 64
+ .Lpoly:
+ .quad 0xffffffffffffffff, 0x00000000ffffffff, 0x0000000000000000,
0xffffffff00000001
+@@ -105,6 +106,7 @@ $code.=<<___;
+ .quad 0xf3b9cac2fc632551, 0xbce6faada7179e84, 0xffffffffffffffff,
0xffffffff00000000
+ .LordK:
+ .quad 0xccd1c8aaee00bc4f
++.previous
+ ___
+
+ {
+@@ -4721,7 +4723,7 @@ close TABLE;
+ die "insane number of elements" if ($#arr != 64*16*37-1);
+
+ print <<___;
+-.text
++.rodata
+ .globl ecp_nistz256_precomputed
+ .type ecp_nistz256_precomputed,\@object
+ .align 4096
Index: patches/patch-crypto_modes_asm_aesni-gcm-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_modes_asm_aesni-gcm-x86_64_pl
diff -N patches/patch-crypto_modes_asm_aesni-gcm-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_modes_asm_aesni-gcm-x86_64_pl 15 Jan 2023 13:01:58
-0000
@@ -0,0 +1,19 @@
+Index: crypto/modes/asm/aesni-gcm-x86_64.pl
+--- crypto/modes/asm/aesni-gcm-x86_64.pl.orig
++++ crypto/modes/asm/aesni-gcm-x86_64.pl
+@@ -941,6 +941,7 @@ $code.=<<___;
+ ___
+
+ $code.=<<___;
++.rodata
+ .align 64
+ .Lbswap_mask:
+ .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+@@ -954,6 +955,7 @@ $code.=<<___;
+ .byte 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .asciz "AES-NI GCM module for x86_64, CRYPTOGAMS by
<appro\@openssl.org>"
+ .align 64
++.previous
+ ___
+ if ($win64) {
+ $rec="%rcx";
Index: patches/patch-crypto_modes_asm_ghash-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_modes_asm_ghash-x86_64_pl
diff -N patches/patch-crypto_modes_asm_ghash-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_modes_asm_ghash-x86_64_pl 15 Jan 2023 12:20:12
-0000
@@ -0,0 +1,19 @@
+Index: crypto/modes/asm/ghash-x86_64.pl
+--- crypto/modes/asm/ghash-x86_64.pl.orig
++++ crypto/modes/asm/ghash-x86_64.pl
+@@ -1601,6 +1601,7 @@ ___
+ }
+
+ $code.=<<___;
++.rodata
+ .align 64
+ .Lbswap_mask:
+ .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+@@ -1654,6 +1655,7 @@ $code.=<<___;
+
+ .asciz "GHASH for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
+ .align 64
++.previous
+ ___
+
+ # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
Index: patches/patch-crypto_poly1305_asm_poly1305-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_poly1305_asm_poly1305-x86_64_pl
diff -N patches/patch-crypto_poly1305_asm_poly1305-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_poly1305_asm_poly1305-x86_64_pl 15 Jan 2023
12:49:10 -0000
@@ -0,0 +1,19 @@
+Index: crypto/poly1305/asm/poly1305-x86_64.pl
+--- crypto/poly1305/asm/poly1305-x86_64.pl.orig
++++ crypto/poly1305/asm/poly1305-x86_64.pl
+@@ -3774,6 +3774,7 @@ poly1305_emit_base2_44:
+ ___
+ } } }
+ $code.=<<___;
++.rodata
+ .align 64
+ .Lconst:
+ .Lmask24:
+@@ -3810,6 +3811,7 @@ ___
+ $code.=<<___;
+ .asciz "Poly1305 for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
+ .align 16
++.previous
+ ___
+
+ { # chacha20-poly1305 helpers
Index: patches/patch-crypto_sha_asm_keccak1600-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_sha_asm_keccak1600-x86_64_pl
diff -N patches/patch-crypto_sha_asm_keccak1600-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_sha_asm_keccak1600-x86_64_pl 15 Jan 2023 12:28:41
-0000
@@ -0,0 +1,11 @@
+Index: crypto/sha/asm/keccak1600-x86_64.pl
+--- crypto/sha/asm/keccak1600-x86_64.pl.orig
++++ crypto/sha/asm/keccak1600-x86_64.pl
+@@ -563,6 +563,7 @@ SHA3_squeeze:
+ ___
+ }
+ $code.=<<___;
++.rodata
+ .align 256
+ .quad 0,0,0,0,0,0,0,0
+ .type iotas,\@object
Index: patches/patch-crypto_sha_asm_sha1-mb-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_sha_asm_sha1-mb-x86_64_pl
diff -N patches/patch-crypto_sha_asm_sha1-mb-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_sha_asm_sha1-mb-x86_64_pl 15 Jan 2023 13:25:44
-0000
@@ -0,0 +1,20 @@
+Index: crypto/sha/asm/sha1-mb-x86_64.pl
+--- crypto/sha/asm/sha1-mb-x86_64.pl.orig
++++ crypto/sha/asm/sha1-mb-x86_64.pl
+@@ -1354,7 +1354,7 @@ $code.=<<___;
+ ___
+ } }}}
+ $code.=<<___;
+-
++.rodata
+ .align 256
+ .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
+ .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
+@@ -1369,6 +1369,7 @@ K_XX_XX:
+ .long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap
+ .byte 0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0
+ .asciz "SHA1 multi-block transform for x86_64, CRYPTOGAMS by
<appro\@openssl.org>"
++.previous
+ ___
+
+ if ($win64) {
Index: patches/patch-crypto_sha_asm_sha1-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_sha_asm_sha1-x86_64_pl
diff -N patches/patch-crypto_sha_asm_sha1-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_sha_asm_sha1-x86_64_pl 15 Jan 2023 12:20:12 -0000
@@ -0,0 +1,19 @@
+Index: crypto/sha/asm/sha1-x86_64.pl
+--- crypto/sha/asm/sha1-x86_64.pl.orig
++++ crypto/sha/asm/sha1-x86_64.pl
+@@ -1830,6 +1830,7 @@ ___
+ }
+ }
+ $code.=<<___;
++.rodata
+ .align 64
+ K_XX_XX:
+ .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
+@@ -1843,6 +1844,7 @@ K_XX_XX:
+ .long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
+ .long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
+ .byte 0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0
++.previous
+ ___
+ }}}
+ $code.=<<___;
Index: patches/patch-crypto_sha_asm_sha512-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_sha_asm_sha512-x86_64_pl
diff -N patches/patch-crypto_sha_asm_sha512-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_sha_asm_sha512-x86_64_pl 15 Jan 2023 12:20:12
-0000
@@ -0,0 +1,31 @@
+Index: crypto/sha/asm/sha512-x86_64.pl
+--- crypto/sha/asm/sha512-x86_64.pl.orig
++++ crypto/sha/asm/sha512-x86_64.pl
+@@ -416,6 +416,7 @@ ___
+
+ if ($SZ==4) {
+ $code.=<<___;
++.rodata
+ .align 64
+ .type $TABLE,\@object
+ $TABLE:
+@@ -459,9 +460,11 @@ $TABLE:
+ .long 0xffffffff,0xffffffff,0x03020100,0x0b0a0908
+ .long 0xffffffff,0xffffffff,0x03020100,0x0b0a0908
+ .asciz "SHA256 block transform for x86_64, CRYPTOGAMS by
<appro\@openssl.org>"
++.previous
+ ___
+ } else {
+ $code.=<<___;
++.rodata
+ .align 64
+ .type $TABLE,\@object
+ $TABLE:
+@@ -549,6 +552,7 @@ $TABLE:
+ .quad 0x0001020304050607,0x08090a0b0c0d0e0f
+ .quad 0x0001020304050607,0x08090a0b0c0d0e0f
+ .asciz "SHA512 block transform for x86_64, CRYPTOGAMS by
<appro\@openssl.org>"
++.previous
+ ___
+ }
+
Index: patches/patch-crypto_whrlpool_asm_wp-x86_64_pl
===================================================================
RCS file: patches/patch-crypto_whrlpool_asm_wp-x86_64_pl
diff -N patches/patch-crypto_whrlpool_asm_wp-x86_64_pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-crypto_whrlpool_asm_wp-x86_64_pl 15 Jan 2023 13:07:40
-0000
@@ -0,0 +1,11 @@
+Index: crypto/whrlpool/asm/wp-x86_64.pl
+--- crypto/whrlpool/asm/wp-x86_64.pl.orig
++++ crypto/whrlpool/asm/wp-x86_64.pl
+@@ -234,6 +234,7 @@ $code.=<<___;
+ .cfi_endproc
+ .size $func,.-$func
+
++.rodata
+ .align 64
+ .type $table,\@object
+ $table: