From: deraadt Date: Sat, 14 Jan 2023 16:58:55 +0000 (+0000) Subject: Move constants out of text segment into rodata to prepare for xonly support X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=03a2914f45721b6e08bcb2bc894fac3eeae0335e;p=openbsd Move constants out of text segment into rodata to prepare for xonly support on amd64. no pic handling is neccessary since amd64 has full reach. ok kettenis --- diff --git a/lib/libcrypto/aes/asm/aes-x86_64.pl b/lib/libcrypto/aes/asm/aes-x86_64.pl index 9072f603a94..d9f501b2529 100755 --- a/lib/libcrypto/aes/asm/aes-x86_64.pl +++ b/lib/libcrypto/aes/asm/aes-x86_64.pl @@ -2113,6 +2113,7 @@ ___ } $code.=<<___; +.rodata .align 64 .LAES_Te: ___ @@ -2533,8 +2534,8 @@ ___ $code.=<<___; .long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe .long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0 -.asciz "AES for x86_64, CRYPTOGAMS by " .align 64 +.previous ___ # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, diff --git a/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl b/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl index 880bcc2d58c..4e83b6ba493 100644 --- a/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl +++ b/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl @@ -1075,6 +1075,7 @@ $code.=<<___; ___ } $code.=<<___; +.rodata .align 64 K_XX_XX: .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19 @@ -1082,9 +1083,8 @@ 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 " .align 64 +.previous ___ # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, diff --git a/lib/libcrypto/aes/asm/aesni-x86_64.pl b/lib/libcrypto/aes/asm/aesni-x86_64.pl index a849073728b..1ec76f529ec 100644 --- a/lib/libcrypto/aes/asm/aesni-x86_64.pl +++ b/lib/libcrypto/aes/asm/aesni-x86_64.pl @@ -2720,6 +2720,7 @@ ___ } $code.=<<___; +.rodata .align 64 .Lbswap_mask: .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 @@ -2729,9 +2730,8 @@ $code.=<<___; .long 1,0,0,0 .Lxts_magic: .long 0x87,0,1,0 - -.asciz "AES for Intel AES-NI, CRYPTOGAMS by " .align 64 +.previous ___ # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, diff --git a/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/lib/libcrypto/aes/asm/bsaes-x86_64.pl index 14dc2c02e7e..a40f836010b 100644 --- a/lib/libcrypto/aes/asm/bsaes-x86_64.pl +++ b/lib/libcrypto/aes/asm/bsaes-x86_64.pl @@ -2882,6 +2882,7 @@ $code.=<<___; ___ } $code.=<<___; +.rodata .type _bsaes_const,\@object .align 64 _bsaes_const: @@ -2934,9 +2935,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/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/lib/libcrypto/aes/asm/vpaes-x86_64.pl index bd7f45b8509..63af96c1dd3 100644 --- a/lib/libcrypto/aes/asm/vpaes-x86_64.pl +++ b/lib/libcrypto/aes/asm/vpaes-x86_64.pl @@ -964,6 +964,7 @@ _vpaes_preheat: ## Constants ## ## ## ######################################################## +.rodata .type _vpaes_consts,\@object .align 64 _vpaes_consts: @@ -1060,9 +1061,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/lib/libcrypto/bn/asm/x86_64-gf2m.pl b/lib/libcrypto/bn/asm/x86_64-gf2m.pl index 24dacb1e9c0..6985725b208 100644 --- a/lib/libcrypto/bn/asm/x86_64-gf2m.pl +++ b/lib/libcrypto/bn/asm/x86_64-gf2m.pl @@ -277,7 +277,6 @@ $code.=<<___; ret .Lend_mul_2x2: .size bn_GF2m_mul_2x2,.-bn_GF2m_mul_2x2 -.asciz "GF(2^m) Multiplication for x86_64, CRYPTOGAMS by " .align 16 ___ diff --git a/lib/libcrypto/bn/asm/x86_64-mont.pl b/lib/libcrypto/bn/asm/x86_64-mont.pl index c35493e80ad..cae7309d5ba 100755 --- a/lib/libcrypto/bn/asm/x86_64-mont.pl +++ b/lib/libcrypto/bn/asm/x86_64-mont.pl @@ -1495,10 +1495,6 @@ $code.=<<___; .size bn_sqr4x_mont,.-bn_sqr4x_mont ___ }}} -$code.=<<___; -.asciz "Montgomery Multiplication for x86_64, CRYPTOGAMS by " -.align 16 -___ print $code; close STDOUT; diff --git a/lib/libcrypto/bn/asm/x86_64-mont5.pl b/lib/libcrypto/bn/asm/x86_64-mont5.pl index bb7ad4c4b78..5d30f210ce0 100755 --- a/lib/libcrypto/bn/asm/x86_64-mont5.pl +++ b/lib/libcrypto/bn/asm/x86_64-mont5.pl @@ -1032,11 +1032,12 @@ $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 " +.previous ___ # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, diff --git a/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/lib/libcrypto/camellia/asm/cmll-x86_64.pl index df6bf11a288..90c56d9e500 100644 --- a/lib/libcrypto/camellia/asm/cmll-x86_64.pl +++ b/lib/libcrypto/camellia/asm/cmll-x86_64.pl @@ -599,6 +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.=<<___; +.rodata .align 64 .LCamellia_SIGMA: .long 0x3bcc908b, 0xa09e667f, 0x4caa73b2, 0xb67ae858 @@ -624,6 +625,7 @@ $_ivp="40(%rsp)"; $_rsp="48(%rsp)"; $code.=<<___; +.previous .globl Camellia_cbc_encrypt .type Camellia_cbc_encrypt,\@function,6 .align 16 @@ -857,8 +859,6 @@ Camellia_cbc_encrypt: .Lcbc_abort: ret .size Camellia_cbc_encrypt,.-Camellia_cbc_encrypt - -.asciz "Camellia for x86_64 by " ___ } diff --git a/lib/libcrypto/modes/asm/ghash-x86_64.pl b/lib/libcrypto/modes/asm/ghash-x86_64.pl index 38d779edbcf..3ae8629cbec 100644 --- a/lib/libcrypto/modes/asm/ghash-x86_64.pl +++ b/lib/libcrypto/modes/asm/ghash-x86_64.pl @@ -622,6 +622,7 @@ ___ } $code.=<<___; +.rodata .align 64 .Lbswap_mask: .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 @@ -668,9 +669,8 @@ $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 " .align 64 +.previous ___ # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, diff --git a/lib/libcrypto/rc4/asm/rc4-x86_64.pl b/lib/libcrypto/rc4/asm/rc4-x86_64.pl index 18a967e5465..36cbf79fbe4 100755 --- a/lib/libcrypto/rc4/asm/rc4-x86_64.pl +++ b/lib/libcrypto/rc4/asm/rc4-x86_64.pl @@ -517,13 +517,14 @@ RC4_options: add \$12,%rax .Ldone: ret +.rodata .align 64 .Lopts: .asciz "rc4(8x,int)" .asciz "rc4(8x,char)" .asciz "rc4(16x,int)" -.asciz "RC4 for x86_64, CRYPTOGAMS by " .align 64 +.previous .size RC4_options,.-RC4_options ___ diff --git a/lib/libcrypto/sha/asm/sha1-x86_64.pl b/lib/libcrypto/sha/asm/sha1-x86_64.pl index cc8ef5337de..0abbbab6ba9 100755 --- a/lib/libcrypto/sha/asm/sha1-x86_64.pl +++ b/lib/libcrypto/sha/asm/sha1-x86_64.pl @@ -1071,6 +1071,7 @@ $code.=<<___; ___ } $code.=<<___; +.rodata .align 64 K_XX_XX: .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19 @@ -1078,10 +1079,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 " .align 64 ___ diff --git a/lib/libcrypto/sha/asm/sha512-x86_64.pl b/lib/libcrypto/sha/asm/sha512-x86_64.pl index bc4b2e74872..6698b1d406f 100755 --- a/lib/libcrypto/sha/asm/sha512-x86_64.pl +++ b/lib/libcrypto/sha/asm/sha512-x86_64.pl @@ -269,6 +269,7 @@ ___ if ($SZ==4) { $code.=<<___; +.rodata .align 64 .type $TABLE,\@object $TABLE: @@ -288,9 +289,11 @@ $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: @@ -334,6 +337,7 @@ $TABLE: .quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c .quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a .quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817 +.previous ___ } diff --git a/lib/libcrypto/whrlpool/asm/wp-x86_64.pl b/lib/libcrypto/whrlpool/asm/wp-x86_64.pl index afadd5d2f15..510a74b91ad 100644 --- a/lib/libcrypto/whrlpool/asm/wp-x86_64.pl +++ b/lib/libcrypto/whrlpool/asm/wp-x86_64.pl @@ -204,6 +204,7 @@ $code.=<<___; ret .size $func,.-$func +.rodata .align 64 .type $table,\@object $table: