summaryrefslogtreecommitdiff
path: root/lib/libcrypto/modes/asm
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2023-01-13 17:27:27 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2023-01-13 17:27:27 +0000
commitee59dcc69c40122f097e3f31aebe99f8db99a40d (patch)
tree16bb6ac4ac9efd790176f2af3fd7a3a28e73204a /lib/libcrypto/modes/asm
parent09cf694aba492b1319fabd262911650a4cd42c1b (diff)
Move all data tables from .text section to .rodata, and update the code to
fetch them correctly when building PIC. Also drop unused data, and remove --no-execute-only from linker flags. ok kettenis@
Diffstat (limited to 'lib/libcrypto/modes/asm')
-rw-r--r--lib/libcrypto/modes/asm/ghash-sparcv9.pl35
1 files changed, 28 insertions, 7 deletions
diff --git a/lib/libcrypto/modes/asm/ghash-sparcv9.pl b/lib/libcrypto/modes/asm/ghash-sparcv9.pl
index 70e7b044a3e..ce75045f096 100644
--- a/lib/libcrypto/modes/asm/ghash-sparcv9.pl
+++ b/lib/libcrypto/modes/asm/ghash-sparcv9.pl
@@ -67,7 +67,7 @@ $inp="%i2";
$len="%i3";
$code.=<<___;
-.section ".text",#alloc,#execinstr
+.section ".rodata",#alloc
.align 64
rem_4bit:
@@ -78,18 +78,30 @@ rem_4bit:
.type rem_4bit,#object
.size rem_4bit,(.-rem_4bit)
+.section ".text",#alloc,#execinstr
.globl gcm_ghash_4bit
.align 32
gcm_ghash_4bit:
save %sp,-$frame,%sp
+#ifdef __PIC__
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), $tmp
+ rd %pc, $rem
+ or $tmp, %lo(_GLOBAL_OFFSET_TABLE_+4), $tmp
+ add $tmp, $rem, $tmp
+#endif
+
ldub [$inp+15],$nlo
ldub [$Xi+15],$xi0
ldub [$Xi+14],$xi1
add $len,$inp,$len
add $Htbl,8,$Htblo
-1: call .+8
- add %o7,rem_4bit-1b,$rem_4bit
+#ifdef __PIC__
+ set rem_4bit, $rem_4bit
+ ldx [$rem_4bit+$tmp], $rem_4bit
+#else
+ set rem_4bit, $rem_4bit
+#endif
.Louter:
xor $xi0,$nlo,$nlo
@@ -223,11 +235,22 @@ $code.=<<___;
.align 32
gcm_gmult_4bit:
save %sp,-$frame,%sp
+#ifdef __PIC__
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), $tmp
+ rd %pc, $rem
+ or $tmp, %lo(_GLOBAL_OFFSET_TABLE_+4), $tmp
+ add $tmp, $rem, $tmp
+#endif
+
ldub [$Xi+15],$nlo
add $Htbl,8,$Htblo
-1: call .+8
- add %o7,rem_4bit-1b,$rem_4bit
+#ifdef __PIC__
+ set rem_4bit, $rem_4bit
+ ldx [$rem_4bit+$tmp], $rem_4bit
+#else
+ set rem_4bit, $rem_4bit
+#endif
and $nlo,0xf0,$nhi
and $nlo,0x0f,$nlo
@@ -321,8 +344,6 @@ gcm_gmult_4bit:
restore
.type gcm_gmult_4bit,#function
.size gcm_gmult_4bit,(.-gcm_gmult_4bit)
-.asciz "GHASH for SPARCv9, CRYPTOGAMS by <appro\@openssl.org>"
-.align 4
___
$code =~ s/\`([^\`]*)\`/eval $1/gem;