portable asm generator patches for portable

This reverses changes from the 3.8.x upstream that are causing issues on
a few different platforms, including macOS x64, Windows, and older
Linux/FreeBSD.
This commit is contained in:
Brent Cook 2023-10-10 08:29:57 -05:00
parent 1fd73818df
commit 98a5122bc6
7 changed files with 1721 additions and 4 deletions

View File

@ -111,7 +111,6 @@ if(HOST_ASM_MACOSX_X86_64)
bn/arch/amd64/word_clz.S bn/arch/amd64/word_clz.S
bn/arch/amd64/bn_arch.c bn/arch/amd64/bn_arch.c
) )
add_definitions(-Dendbr64=)
add_definitions(-DAES_ASM) add_definitions(-DAES_ASM)
add_definitions(-DBSAES_ASM) add_definitions(-DBSAES_ASM)
add_definitions(-DVPAES_ASM) add_definitions(-DVPAES_ASM)
@ -153,6 +152,7 @@ if(HOST_ASM_MASM_X86_64)
whrlpool/wp-masm-x86_64.S whrlpool/wp-masm-x86_64.S
cpuid-masm-x86_64.S cpuid-masm-x86_64.S
) )
add_definitions(-Dendbr64=)
add_definitions(-DAES_ASM) add_definitions(-DAES_ASM)
add_definitions(-DBSAES_ASM) add_definitions(-DBSAES_ASM)
add_definitions(-DVPAES_ASM) add_definitions(-DVPAES_ASM)
@ -193,6 +193,7 @@ if(HOST_ASM_MINGW64_X86_64)
whrlpool/wp-mingw64-x86_64.S whrlpool/wp-mingw64-x86_64.S
cpuid-mingw64-x86_64.S cpuid-mingw64-x86_64.S
) )
add_definitions(-Dendbr64=)
add_definitions(-DAES_ASM) add_definitions(-DAES_ASM)
add_definitions(-DBSAES_ASM) add_definitions(-DBSAES_ASM)
add_definitions(-DVPAES_ASM) add_definitions(-DVPAES_ASM)

View File

@ -34,7 +34,6 @@ ASM_X86_64_MACOSX += bn/arch/amd64/bn_arch.c
EXTRA_DIST += $(ASM_X86_64_MACOSX) EXTRA_DIST += $(ASM_X86_64_MACOSX)
if HOST_ASM_MACOSX_X86_64 if HOST_ASM_MACOSX_X86_64
libcrypto_la_CPPFLAGS += -Dendbr64=
libcrypto_la_CPPFLAGS += -DAES_ASM libcrypto_la_CPPFLAGS += -DAES_ASM
libcrypto_la_CPPFLAGS += -DBSAES_ASM libcrypto_la_CPPFLAGS += -DBSAES_ASM
libcrypto_la_CPPFLAGS += -DVPAES_ASM libcrypto_la_CPPFLAGS += -DVPAES_ASM

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,162 @@
From 8861777e025998cc80bb9e39e88a332e8aec2f26 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Mon, 30 Oct 2023 22:00:12 -0500
Subject: [PATCH 2/4] Revert "Use explicit .text instead of .previous to please
Windows/MinGW on amd64"
This reverts commit e8192f57c4e5910ce7badced4a24c8827810d567.
---
src/lib/libcrypto/aes/asm/aes-x86_64.pl | 2 +-
src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 2 +-
src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 2 +-
src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 2 +-
src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 2 +-
src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 2 +-
src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 2 +-
src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 2 +-
src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 2 +-
src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 4 ++--
10 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
index b7399b552..2986a9fcc 100755
--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
@@ -2535,7 +2535,7 @@ $code.=<<___;
.long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
.long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
.align 64
-.text
+.previous
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
index bafa906a0..8a428c9b1 100644
--- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
@@ -1084,7 +1084,7 @@ K_XX_XX:
.long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79
.long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
.align 64
-.text
+.previous
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
index e662fbc7c..09612b1f8 100644
--- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
@@ -2732,7 +2732,7 @@ $code.=<<___;
.Lxts_magic:
.long 0x87,0,1,0
.align 64
-.text
+.previous
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
index 20e9e1f71..347f4c302 100644
--- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
@@ -2937,7 +2937,7 @@ _bsaes_const:
.quad 0x6363636363636363, 0x6363636363636363
.align 64
.size _bsaes_const,.-_bsaes_const
-.text
+.previous
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
index 3ffb1a303..ad5fa7522 100644
--- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
@@ -1063,7 +1063,7 @@ _vpaes_consts:
.quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C
.align 64
.size _vpaes_consts,.-_vpaes_consts
-.text
+.previous
___
if ($win64) {
diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
index 7b9c6df27..1c8aa255c 100755
--- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
@@ -1037,7 +1037,7 @@ $code.=<<___;
.Linc:
.long 0,0, 1,1
.long 2,2, 2,2
-.text
+.previous
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
index 586e5d6e9..c16725f5c 100644
--- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
@@ -625,7 +625,7 @@ $_ivp="40(%rsp)";
$_rsp="48(%rsp)";
$code.=<<___;
-.text
+.previous
.globl Camellia_cbc_encrypt
.type Camellia_cbc_encrypt,\@function,6
.align 16
diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
index 71d0822ac..bce62947f 100644
--- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
@@ -670,7 +670,7 @@ $code.=<<___;
.value 0xB5E0,0xB422,0xB664,0xB7A6,0xB2E8,0xB32A,0xB16C,0xB0AE
.value 0xBBF0,0xBA32,0xB874,0xB9B6,0xBCF8,0xBD3A,0xBF7C,0xBEBE
.align 64
-.text
+.previous
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
index 43eee73c4..1ec7f609a 100755
--- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
@@ -1079,7 +1079,7 @@ K_XX_XX:
.long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc # K_40_59
.long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79
.long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
-.text
+.previous
___
}}}
$code.=<<___;
diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
index 0517eab66..1a7d9bf2d 100755
--- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
@@ -289,7 +289,7 @@ $TABLE:
.long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
.long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
.long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
-.text
+.previous
___
} else {
$code.=<<___;
@@ -337,7 +337,7 @@ $TABLE:
.quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c
.quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a
.quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817
-.text
+.previous
___
}
--
2.42.0

View File

@ -0,0 +1,203 @@
From 1407448470aff891f9a9eff550ecda06202ffd29 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Mon, 30 Oct 2023 22:00:49 -0500
Subject: [PATCH 3/4] Revert "Use .section .rodata instead of a plain .rodata"
This reverts commit 67afc07de0ed3a0ccc272df42853ba565a8277c6.
---
src/lib/libcrypto/aes/asm/aes-x86_64.pl | 2 +-
src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 2 +-
src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 2 +-
src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 2 +-
src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 2 +-
src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 2 +-
src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 2 +-
src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 2 +-
src/lib/libcrypto/perlasm/x86gas.pl | 2 +-
src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 2 +-
src/lib/libcrypto/sha/asm/sha512-ppc.pl | 2 +-
src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 4 ++--
src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl | 2 +-
13 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
index 2986a9fcc..d9f501b25 100755
--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
@@ -2113,7 +2113,7 @@ ___
}
$code.=<<___;
-.section .rodata
+.rodata
.align 64
.LAES_Te:
___
diff --git a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
index 8a428c9b1..4e83b6ba4 100644
--- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
@@ -1075,7 +1075,7 @@ $code.=<<___;
___
}
$code.=<<___;
-.section .rodata
+.rodata
.align 64
K_XX_XX:
.long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
index 09612b1f8..2ab7106c0 100644
--- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
@@ -2721,7 +2721,7 @@ ___
}
$code.=<<___;
-.section .rodata
+.rodata
.align 64
.Lbswap_mask:
.byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
index 347f4c302..a40f83601 100644
--- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
@@ -2882,7 +2882,7 @@ $code.=<<___;
___
}
$code.=<<___;
-.section .rodata
+.rodata
.type _bsaes_const,\@object
.align 64
_bsaes_const:
diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
index ad5fa7522..63af96c1d 100644
--- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
@@ -964,7 +964,7 @@ _vpaes_preheat:
## Constants ##
## ##
########################################################
-.section .rodata
+.rodata
.type _vpaes_consts,\@object
.align 64
_vpaes_consts:
diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
index 1c8aa255c..5d30f210c 100755
--- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
@@ -1032,7 +1032,7 @@ $code.=<<___;
___
}
$code.=<<___;
-.section .rodata
+.rodata
.align 64
.Linc:
.long 0,0, 1,1
diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
index c16725f5c..90c56d9e5 100644
--- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
@@ -599,7 +599,7 @@ sub S0222 { my $i=shift; $i=@SBOX[$i]; $i=($i<<1|$i>>7)&0xff; $i=$i<<16|$i<<8|$i
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.=<<___;
-.section .rodata
+.rodata
.align 64
.LCamellia_SIGMA:
.long 0x3bcc908b, 0xa09e667f, 0x4caa73b2, 0xb67ae858
diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
index bce62947f..3ae8629cb 100644
--- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
@@ -622,7 +622,7 @@ ___
}
$code.=<<___;
-.section .rodata
+.rodata
.align 64
.Lbswap_mask:
.byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
diff --git a/src/lib/libcrypto/perlasm/x86gas.pl b/src/lib/libcrypto/perlasm/x86gas.pl
index b84e28be9..f28a59054 100644
--- a/src/lib/libcrypto/perlasm/x86gas.pl
+++ b/src/lib/libcrypto/perlasm/x86gas.pl
@@ -307,7 +307,7 @@ sub ::dataseg
{ push(@out,".data\n"); }
sub ::rodataseg
-{ push(@out,".section .rodata\n"); }
+{ push(@out,".rodata\n"); }
sub ::previous
{ push(@out,".previous\n"); }
diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
index 1ec7f609a..0abbbab6b 100755
--- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
@@ -1071,7 +1071,7 @@ $code.=<<___;
___
}
$code.=<<___;
-.section .rodata
+.rodata
.align 64
K_XX_XX:
.long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
diff --git a/src/lib/libcrypto/sha/asm/sha512-ppc.pl b/src/lib/libcrypto/sha/asm/sha512-ppc.pl
index 28bd997cf..1f02cfdd5 100755
--- a/src/lib/libcrypto/sha/asm/sha512-ppc.pl
+++ b/src/lib/libcrypto/sha/asm/sha512-ppc.pl
@@ -375,7 +375,7 @@ $code.=<<___;
$ST $H,`7*$SZ`($ctx)
bne Lsha2_block_private
blr
- .section .rodata
+ .rodata
Ltable:
___
$code.=<<___ if ($SZ==8);
diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
index 1a7d9bf2d..6698b1d40 100755
--- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
@@ -269,7 +269,7 @@ ___
if ($SZ==4) {
$code.=<<___;
-.section .rodata
+.rodata
.align 64
.type $TABLE,\@object
$TABLE:
@@ -293,7 +293,7 @@ $TABLE:
___
} else {
$code.=<<___;
-.section .rodata
+.rodata
.align 64
.type $TABLE,\@object
$TABLE:
diff --git a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
index de5d3acfb..510a74b91 100644
--- a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
+++ b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
@@ -204,7 +204,7 @@ $code.=<<___;
ret
.size $func,.-$func
-.section .rodata
+.rodata
.align 64
.type $table,\@object
$table:
--
2.42.0

View File

@ -0,0 +1,292 @@
From 87b24a6d5a932061cc88b84a856663b328d1c166 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Mon, 30 Oct 2023 22:01:49 -0500
Subject: [PATCH 4/4] Revert "Move constants out of text segment into rodata to
prepare for xonly support"
This reverts commit b5834617204e7520b0209bcff7f1c4a559e05422.
---
src/lib/libcrypto/aes/asm/aes-x86_64.pl | 3 +--
src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 4 ++--
src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 4 ++--
src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 3 +--
src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 3 +--
src/lib/libcrypto/bn/asm/x86_64-mont.pl | 4 ++++
src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 3 +--
src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 4 ++--
src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 4 ++--
src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 3 +--
src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 4 ----
src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl | 1 -
12 files changed, 17 insertions(+), 23 deletions(-)
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
index d9f501b25..9072f603a 100755
--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
@@ -2113,7 +2113,6 @@ ___
}
$code.=<<___;
-.rodata
.align 64
.LAES_Te:
___
@@ -2534,8 +2533,8 @@ ___
$code.=<<___;
.long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
.long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
+.asciz "AES for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
.align 64
-.previous
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
index 4e83b6ba4..880bcc2d5 100644
--- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
@@ -1075,7 +1075,6 @@ $code.=<<___;
___
}
$code.=<<___;
-.rodata
.align 64
K_XX_XX:
.long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
@@ -1083,8 +1082,9 @@ K_XX_XX:
.long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc # K_40_59
.long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79
.long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
+
+.asciz "AESNI-CBC+SHA1 stitch for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
.align 64
-.previous
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
index 2ab7106c0..96978bd35 100644
--- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
@@ -2721,7 +2721,6 @@ ___
}
$code.=<<___;
-.rodata
.align 64
.Lbswap_mask:
.byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
@@ -2731,8 +2730,9 @@ $code.=<<___;
.long 1,0,0,0
.Lxts_magic:
.long 0x87,0,1,0
+
+.asciz "AES for Intel AES-NI, CRYPTOGAMS by <appro\@openssl.org>"
.align 64
-.previous
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
index a40f83601..14dc2c02e 100644
--- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
@@ -2882,7 +2882,6 @@ $code.=<<___;
___
}
$code.=<<___;
-.rodata
.type _bsaes_const,\@object
.align 64
_bsaes_const:
@@ -2935,9 +2934,9 @@ _bsaes_const:
.quad 0x02060a0e03070b0f, 0x0004080c0105090d
.L63:
.quad 0x6363636363636363, 0x6363636363636363
+.asciz "Bit-sliced AES for x86_64/SSSE3, Emilia Käsper, Peter Schwabe, Andy Polyakov"
.align 64
.size _bsaes_const,.-_bsaes_const
-.previous
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
index 63af96c1d..bd7f45b85 100644
--- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
@@ -964,7 +964,6 @@ _vpaes_preheat:
## Constants ##
## ##
########################################################
-.rodata
.type _vpaes_consts,\@object
.align 64
_vpaes_consts:
@@ -1061,9 +1060,9 @@ _vpaes_consts:
.Lk_dsbo: # decryption sbox final output
.quad 0x1387EA537EF94000, 0xC7AA6DB9D4943E2D
.quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C
+.asciz "Vector Permutation AES for x86_64/SSSE3, Mike Hamburg (Stanford University)"
.align 64
.size _vpaes_consts,.-_vpaes_consts
-.previous
___
if ($win64) {
diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont.pl b/src/lib/libcrypto/bn/asm/x86_64-mont.pl
index cae7309d5..c35493e80 100755
--- a/src/lib/libcrypto/bn/asm/x86_64-mont.pl
+++ b/src/lib/libcrypto/bn/asm/x86_64-mont.pl
@@ -1495,6 +1495,10 @@ $code.=<<___;
.size bn_sqr4x_mont,.-bn_sqr4x_mont
___
}}}
+$code.=<<___;
+.asciz "Montgomery Multiplication for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
+.align 16
+___
print $code;
close STDOUT;
diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
index 5d30f210c..bb7ad4c4b 100755
--- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
@@ -1032,12 +1032,11 @@ $code.=<<___;
___
}
$code.=<<___;
-.rodata
.align 64
.Linc:
.long 0,0, 1,1
.long 2,2, 2,2
-.previous
+.asciz "Montgomery Multiplication with scatter/gather for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
index 90c56d9e5..df6bf11a2 100644
--- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
@@ -599,7 +599,6 @@ sub S0222 { my $i=shift; $i=@SBOX[$i]; $i=($i<<1|$i>>7)&0xff; $i=$i<<16|$i<<8|$i
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
@@ -625,7 +624,6 @@ $_ivp="40(%rsp)";
$_rsp="48(%rsp)";
$code.=<<___;
-.previous
.globl Camellia_cbc_encrypt
.type Camellia_cbc_encrypt,\@function,6
.align 16
@@ -859,6 +857,8 @@ Camellia_cbc_encrypt:
.Lcbc_abort:
ret
.size Camellia_cbc_encrypt,.-Camellia_cbc_encrypt
+
+.asciz "Camellia for x86_64 by <appro\@openssl.org>"
___
}
diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
index 3ae8629cb..38d779edb 100644
--- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
@@ -622,7 +622,6 @@ ___
}
$code.=<<___;
-.rodata
.align 64
.Lbswap_mask:
.byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
@@ -669,8 +668,9 @@ $code.=<<___;
.value 0xA7D0,0xA612,0xA454,0xA596,0xA0D8,0xA11A,0xA35C,0xA29E
.value 0xB5E0,0xB422,0xB664,0xB7A6,0xB2E8,0xB32A,0xB16C,0xB0AE
.value 0xBBF0,0xBA32,0xB874,0xB9B6,0xBCF8,0xBD3A,0xBF7C,0xBEBE
+
+.asciz "GHASH for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
.align 64
-.previous
___
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
index 0abbbab6b..cc8ef5337 100755
--- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
@@ -1071,7 +1071,6 @@ $code.=<<___;
___
}
$code.=<<___;
-.rodata
.align 64
K_XX_XX:
.long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
@@ -1079,10 +1078,10 @@ K_XX_XX:
.long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc # K_40_59
.long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79
.long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
-.previous
___
}}}
$code.=<<___;
+.asciz "SHA1 block transform for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
.align 64
___
diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
index 6698b1d40..bc4b2e748 100755
--- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
@@ -269,7 +269,6 @@ ___
if ($SZ==4) {
$code.=<<___;
-.rodata
.align 64
.type $TABLE,\@object
$TABLE:
@@ -289,11 +288,9 @@ $TABLE:
.long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
.long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
.long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
-.previous
___
} else {
$code.=<<___;
-.rodata
.align 64
.type $TABLE,\@object
$TABLE:
@@ -337,7 +334,6 @@ $TABLE:
.quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c
.quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a
.quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817
-.previous
___
}
diff --git a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
index 510a74b91..afadd5d2f 100644
--- a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
+++ b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
@@ -204,7 +204,6 @@ $code.=<<___;
ret
.size $func,.-$func
-.rodata
.align 64
.type $table,\@object
$table:
--
2.42.0

View File

@ -191,12 +191,17 @@ fixup_masm() {
| sed -e 's/|/OR/g' \ | sed -e 's/|/OR/g' \
| sed -e 's/~/NOT/g' \ | sed -e 's/~/NOT/g' \
| sed -e 's/1 << \([0-9]*\)/1 SHL \1/g' \ | sed -e 's/1 << \([0-9]*\)/1 SHL \1/g' \
| sed -e 's/^ALIGN.*//g' \
> $2 > $2
} }
# generate assembly crypto algorithms # generate assembly crypto algorithms
asm_src=$libcrypto_src asm_src=$CWD/asm
rm -fr $asm_src
cp -a $libcrypto_src $asm_src
for i in `ls -1 patches/asm/*.patch | sort -n`; do
patch -d $asm_src -p 4 < $i;
done
gen_asm_stdout() { gen_asm_stdout() {
CC=true perl $asm_src/$2 $1 > crypto/$3.tmp CC=true perl $asm_src/$2 $1 > crypto/$3.tmp
[ $1 = "elf" ] && cat <<-EOF >> crypto/$3.tmp [ $1 = "elf" ] && cat <<-EOF >> crypto/$3.tmp