summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgkoehler <>2023-02-01 19:02:50 +0000
committergkoehler <>2023-02-01 19:02:50 +0000
commit86f42338b2994b620482c37e3d0d9fc3ba1f523b (patch)
treecbd3002bb98a61c672c0a81d5a700eb0c3031d43
parent673d50eba3176c2ef4c67914008e191ed568f373 (diff)
downloadopenbsd-86f42338b2994b620482c37e3d0d9fc3ba1f523b.tar.gz
openbsd-86f42338b2994b620482c37e3d0d9fc3ba1f523b.tar.bz2
openbsd-86f42338b2994b620482c37e3d0d9fc3ba1f523b.zip
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@
-rwxr-xr-xsrc/lib/libcrypto/sha/asm/sha512-ppc.pl25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/lib/libcrypto/sha/asm/sha512-ppc.pl b/src/lib/libcrypto/sha/asm/sha512-ppc.pl
index 2a7d5a0e8b..b5649299dc 100755
--- a/src/lib/libcrypto/sha/asm/sha512-ppc.pl
+++ b/src/lib/libcrypto/sha/asm/sha512-ppc.pl
@@ -220,8 +220,11 @@ $func:
220 $LD $G,`6*$SZ`($ctx) 220 $LD $G,`6*$SZ`($ctx)
221 $LD $H,`7*$SZ`($ctx) 221 $LD $H,`7*$SZ`($ctx)
222 222
223 bl LPICmeup 223 bcl 20,31,Lpc
224LPICedup: 224Lpc:
225 mflr $Tbl
226 addis $Tbl,$Tbl,Ltable-Lpc\@ha
227 addi $Tbl,$Tbl,Ltable-Lpc\@l
225 andi. r0,$inp,3 228 andi. r0,$inp,3
226 bne Lunaligned 229 bne Lunaligned
227Laligned: 230Laligned:
@@ -377,22 +380,8 @@ $code.=<<___;
377 blr 380 blr
378 .long 0 381 .long 0
379 .byte 0,12,0x14,0,0,0,0,0 382 .byte 0,12,0x14,0,0,0,0,0
380___ 383 .rodata
381 384Ltable:
382# Ugly hack here, because PPC assembler syntax seem to vary too
383# much from platforms to platform...
384$code.=<<___;
385.align 6
386LPICmeup:
387 mflr r0
388 bcl 20,31,\$+4
389 mflr $Tbl ; vvvvvv "distance" between . and 1st data entry
390 addi $Tbl,$Tbl,`64-8`
391 mtlr r0
392 blr
393 .long 0
394 .byte 0,12,0x14,0,0,0,0,0
395 .space `64-9*4`
396___ 385___
397$code.=<<___ if ($SZ==8); 386$code.=<<___ if ($SZ==8);
398 .long 0x428a2f98,0xd728ae22,0x71374491,0x23ef65cd 387 .long 0x428a2f98,0xd728ae22,0x71374491,0x23ef65cd