From: gkoehler Date: Wed, 1 Feb 2023 19:02:50 +0000 (+0000) Subject: For xonly, move sha512-ppc.pl's table from text to rodata X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7066554af3d4c0fe04a6394c31866a186f356f84;p=openbsd For xonly, move sha512-ppc.pl's table from text to rodata OpenBSD/macppc will enforce xonly on PowerPC G5, then libcrypto's sha256 would crash by SIGSEGV, because it can't read text. Use ELF relocations "@ha" and "@l" to find the table in rodata. This might break the PowerPC asm on a not-ELF platform (like AIX or Mac OS) if someone would try it there. ok kettenis@ deraadt@ --- diff --git a/lib/libcrypto/sha/asm/sha512-ppc.pl b/lib/libcrypto/sha/asm/sha512-ppc.pl index 2a7d5a0e8bc..b5649299dc8 100755 --- a/lib/libcrypto/sha/asm/sha512-ppc.pl +++ b/lib/libcrypto/sha/asm/sha512-ppc.pl @@ -220,8 +220,11 @@ $func: $LD $G,`6*$SZ`($ctx) $LD $H,`7*$SZ`($ctx) - bl LPICmeup -LPICedup: + bcl 20,31,Lpc +Lpc: + mflr $Tbl + addis $Tbl,$Tbl,Ltable-Lpc\@ha + addi $Tbl,$Tbl,Ltable-Lpc\@l andi. r0,$inp,3 bne Lunaligned Laligned: @@ -377,22 +380,8 @@ $code.=<<___; blr .long 0 .byte 0,12,0x14,0,0,0,0,0 -___ - -# Ugly hack here, because PPC assembler syntax seem to vary too -# much from platforms to platform... -$code.=<<___; -.align 6 -LPICmeup: - mflr r0 - bcl 20,31,\$+4 - mflr $Tbl ; vvvvvv "distance" between . and 1st data entry - addi $Tbl,$Tbl,`64-8` - mtlr r0 - blr - .long 0 - .byte 0,12,0x14,0,0,0,0,0 - .space `64-9*4` + .rodata +Ltable: ___ $code.=<<___ if ($SZ==8); .long 0x428a2f98,0xd728ae22,0x71374491,0x23ef65cd