diff options
author | George Koehler <gkoehler@cvs.openbsd.org> | 2023-02-01 19:02:51 +0000 |
---|---|---|
committer | George Koehler <gkoehler@cvs.openbsd.org> | 2023-02-01 19:02:51 +0000 |
commit | 4f946afaecbc214510d5b6317131f537dbb7c073 (patch) | |
tree | 83f0d85eb4c0b40c13fc4262492dcea675e9d5c1 /lib | |
parent | b202b95b85514d00e1b6f25227132a78d0f9da71 (diff) |
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@
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/libcrypto/sha/asm/sha512-ppc.pl | 25 |
1 files changed, 7 insertions, 18 deletions
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 |