.register %g3,#scratch
___
$code.=<<___;
-.section ".text",#alloc,#execinstr
+.section ".rodata",#alloc
.align 256
AES_Te:
.type AES_Te,#object
.size AES_Te,(.-AES_Te)
+.section ".text",#alloc,#execinstr
.align 64
.skip 16
_sparcv9_AES_encrypt:
.align 32
.globl AES_encrypt
AES_encrypt:
- or %o0,%o1,%g1
+ save %sp,-$frame,%sp
+#ifdef __PIC__
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o5
+ rd %pc, %o4
+ or %o5, %lo(_GLOBAL_OFFSET_TABLE_+4), %o5
+ add %o5, %o4, %o5
+#endif
+
+ or %i0,%i1,%g1
andcc %g1,3,%g0
bnz,pn %xcc,.Lunaligned_enc
- save %sp,-$frame,%sp
+ nop
ld [%i0+0],%o0
ld [%i0+4],%o1
ld [%i0+8],%o2
ld [%i0+12],%o3
-1: call .+8
- add %o7,AES_Te-1b,%o4
+#ifdef __PIC__
+ set AES_Te, %o4
+ ldx [%o4+%o5], %o4
+#else
+ set AES_Te, %o4
+#endif
call _sparcv9_AES_encrypt
mov %i2,%o5
or %l7,%l6,%l6
or %l4,%l6,%o3
-1: call .+8
- add %o7,AES_Te-1b,%o4
+#ifdef __PIC__
+ set AES_Te, %o4
+ ldx [%o4+%o5], %o4
+#else
+ set AES_Te, %o4
+#endif
call _sparcv9_AES_encrypt
mov %i2,%o5
___
$code.=<<___;
+.section ".rodata",#alloc
.align 256
AES_Td:
___
.type AES_Td,#object
.size AES_Td,(.-AES_Td)
+.section ".text",#alloc,#execinstr
.align 64
.skip 16
_sparcv9_AES_decrypt:
.align 32
.globl AES_decrypt
AES_decrypt:
- or %o0,%o1,%g1
+ save %sp,-$frame,%sp
+#ifdef __PIC__
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o5
+ rd %pc, %o4
+ or %o5, %lo(_GLOBAL_OFFSET_TABLE_+4), %o5
+ add %o5, %o4, %o5
+#endif
+
+ or %i0,%i1,%g1
andcc %g1,3,%g0
bnz,pn %xcc,.Lunaligned_dec
- save %sp,-$frame,%sp
+ nop
ld [%i0+0],%o0
ld [%i0+4],%o1
ld [%i0+8],%o2
ld [%i0+12],%o3
-1: call .+8
- add %o7,AES_Td-1b,%o4
+#ifdef __PIC__
+ set AES_Td, %o4
+ ldx [%o4+%o5], %o4
+#else
+ set AES_Td, %o4
+#endif
call _sparcv9_AES_decrypt
mov %i2,%o5
or %l7,%l6,%l6
or %l4,%l6,%o3
-1: call .+8
- add %o7,AES_Td-1b,%o4
+#ifdef __PIC__
+ set AES_Td, %o4
+ ldx [%o4+%o5], %o4
+#else
+ set AES_Td, %o4
+#endif
call _sparcv9_AES_decrypt
mov %i2,%o5
-# $OpenBSD: Makefile.inc,v 1.5 2023/01/11 16:36:44 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.6 2023/01/13 17:27:26 miod Exp $
# sparc64-specific libcrypto build rules
-LDADD+= -Wl,--no-execute-only
-
# aes
SRCS+= aes_core.c aes_cbc.c
CFLAGS+= -DAES_ASM
add $tp,8,$tp
.type $fname,#function
.size $fname,(.-$fname)
-.asciz "Montgomery Multipltication for SPARCv9, CRYPTOGAMS by <appro\@openssl.org>"
-.align 32
___
$code =~ s/\`([^\`]*)\`/eval($1)/gem;
print $code;
restore
.type $fname,#function
.size $fname,(.-$fname)
-.asciz "Montgomery Multipltication for UltraSPARC, CRYPTOGAMS by <appro\@openssl.org>"
-.align 32
___
$code =~ s/\`([^\`]*)\`/eval($1)/gem;
$len="%i3";
$code.=<<___;
-.section ".text",#alloc,#execinstr
+.section ".rodata",#alloc
.align 64
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
.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
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;
restore
.type sha1_block_data_order,#function
.size sha1_block_data_order,(.-sha1_block_data_order)
-.asciz "SHA1 block transform for SPARCv9, CRYPTOGAMS by <appro\@openssl.org>"
-.align 4
___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
}
$code.=<<___;
-.section ".text",#alloc,#execinstr
+.section ".rodata",#alloc
.align 64
vis_const:
.type vis_const,#object
.size vis_const,(.-vis_const)
+.section ".text",#alloc,#execinstr
.globl sha1_block_data_order
sha1_block_data_order:
save %sp,-$frame,%sp
add %fp,$bias-256,$base
-1: call .+8
- add %o7,vis_const-1b,$tmp0
+#ifdef __PIC__
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o5
+ rd %pc, %o4
+ or %o5, %lo(_GLOBAL_OFFSET_TABLE_+4), %o5
+ add %o5, %o4, %o5
+ set vis_const, %o4
+ ldx [%o4+%o5], %o4
+#else
+ set vis_const, %o4
+#endif
ldd [$tmp0+0],$VK_00_19
ldd [$tmp0+8],$VK_20_39
restore
.type sha1_block_data_order,#function
.size sha1_block_data_order,(.-sha1_block_data_order)
-.asciz "SHA1 block transform for SPARCv9a, CRYPTOGAMS by <appro\@openssl.org>"
-.align 4
___
# Purpose of these subroutines is to explicitly encode VIS instructions,
.register %g3,#scratch
___
$code.=<<___;
-.section ".text",#alloc,#execinstr
+.section ".rodata",#alloc
.align 64
K${label}:
}
$code.=<<___;
.size K${label},.-K${label}
+
+.section ".text",#alloc,#execinstr
.globl sha${label}_block_data_order
sha${label}_block_data_order:
save %sp,`-$frame-$locals`,%sp
+#ifdef __PIC__
+ sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %o5
+ rd %pc, %o4
+ or %o5, %lo(_GLOBAL_OFFSET_TABLE_+4), %o5
+ add %o5, %o4, %o5
+#endif
and $inp,`$align-1`,$tmp31
sllx $len,`log(16*$SZ)/log(2)`,$len
andn $inp,`$align-1`,$inp
sub $tmp32,$tmp31,$tmp32
___
$code.=<<___;
-.Lpic: call .+8
- add %o7,K${label}-.Lpic,$Ktbl
+#ifdef __PIC__
+ set K${label}, $Ktbl
+ ldx [$Ktbl+%o5], $Ktbl
+#else
+ set K${label}, $Ktbl
+#endif
$LD [$ctx+`0*$SZ`],$A
$LD [$ctx+`1*$SZ`],$B
restore
.type sha${label}_block_data_order,#function
.size sha${label}_block_data_order,(.-sha${label}_block_data_order)
-.asciz "SHA${label} block transform for SPARCv9, CRYPTOGAMS by <appro\@openssl.org>"
-.align 4
___
$code =~ s/\`([^\`]*)\`/eval $1/gem;