$code=<<___;
.LEVEL $LEVEL
-#if 0
- .SPACE \$TEXT\$
- .SUBSPA \$CODE\$,QUAD=0,ALIGN=8,ACCESS=0x2C,CODE_ONLY
-#else
.text
-#endif
.EXPORT AES_encrypt,ENTRY,ARGW0=GR,ARGW1=GR,ARGW2=GR
.ALIGN 64
$PUSH %r17,`-$FRAME+14*$SIZE_T`(%sp)
$PUSH %r18,`-$FRAME+15*$SIZE_T`(%sp)
- blr %r0,$tbl
ldi 3,$t0
-L\$enc_pic
- andcm $tbl,$t0,$tbl
- ldo L\$AES_Te-L\$enc_pic($tbl),$tbl
+#ifdef __PIC__
+ addil LT'L\$AES_Te, %r19
+ ldw RT'L\$AES_Te(%r1), $tbl
+#else
+ ldil L'L\$AES_Te, %t1
+ ldo R'L\$AES_Te(%t1), $tbl
+#endif
and $inp,$t0,$t0
sub $inp,$t0,$inp
xor $acc15,$s3,$s3
.PROCEND
+ .section .rodata
.ALIGN 64
L\$AES_Te
.WORD 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d
.BYTE 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf
.BYTE 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68
.BYTE 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
+ .previous
___
$code.=<<___;
$PUSH %r17,`-$FRAME+14*$SIZE_T`(%sp)
$PUSH %r18,`-$FRAME+15*$SIZE_T`(%sp)
- blr %r0,$tbl
ldi 3,$t0
-L\$dec_pic
- andcm $tbl,$t0,$tbl
- ldo L\$AES_Td-L\$dec_pic($tbl),$tbl
+#ifdef __PIC__
+ addil LT'L\$AES_Td, %r19
+ ldw RT'L\$AES_Td(%r1), $tbl
+#else
+ ldil L'L\$AES_Td, %t1
+ ldo R'L\$AES_Td(%t1), $tbl
+#endif
and $inp,$t0,$t0
sub $inp,$t0,$inp
xor $acc15,$s3,$s3
.PROCEND
+ .section .rodata
.ALIGN 64
L\$AES_Td
.WORD 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96
.BYTE 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
.BYTE 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26
.BYTE 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
-
- .data
- .STRINGZ "AES for PA-RISC, CRYPTOGAMS by <appro\@openssl.org>"
+ .previous
___
foreach (split("\n",$code)) {
-# $OpenBSD: Makefile.inc,v 1.11 2023/01/11 16:25:13 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.12 2023/01/13 17:11:41 miod Exp $
# hppa-specific libcrypto build rules
-LDADD+= -Wl,--no-execute-only
-
# aes
SRCS+= aes_core.c aes_cbc.c
CFLAGS+= -DAES_ASM
$code=<<___;
.LEVEL $LEVEL
-#if 0
- .SPACE \$TEXT\$
- .SUBSPA \$CODE\$,QUAD=0,ALIGN=8,ACCESS=0x2C,CODE_ONLY
-#else
.text
-#endif
.EXPORT bn_mul_mont,ENTRY,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR
.ALIGN 64
flddx $idx($np),${fni} ; np[2,3]
___
$code.=<<___ if ($BN_SZ==4);
-#ifndef __OpenBSD__
+#ifdef __LP64__
mtctl $hi0,%cr11 ; $hi0 still holds 31
extrd,u,*= $hi0,%sar,1,$hi0 ; executes on PA-RISC 1.0
b L\$parisc11
.EXIT
$POPMB -$FRAME(%sp),%r3
.PROCEND
-
- .data
- .STRINGZ "Montgomery Multiplication for PA-RISC, CRYPTOGAMS by <appro\@openssl.org>"
___
\f
# Explicitly encode PA-RISC 2.0 instructions used in this module, so
$code.=<<___;
.LEVEL $LEVEL
-#if 0
- .SPACE \$TEXT\$
- .SUBSPA \$CODE\$,QUAD=0,ALIGN=8,ACCESS=0x2C,CODE_ONLY
-#else
.text
-#endif
.EXPORT gcm_gmult_4bit,ENTRY,ARGW0=GR,ARGW1=GR
.ALIGN 64
$PUSH %r11,`-$FRAME+8*$SIZE_T`(%sp)
___
$code.=<<___;
- blr %r0,$rem_4bit
- ldi 3,$rem
-L\$pic_gmult
- andcm $rem_4bit,$rem,$rem_4bit
addl $inp,$len,$len
- ldo L\$rem_4bit-L\$pic_gmult($rem_4bit),$rem_4bit
+#ifdef __PIC__
+ addil LT'L\$rem_4bit, %r19
+ ldw RT'L\$rem_4bit(%r1), $rem_4bit
+#else
+ ldil L'L\$rem_4bit, %t1
+ ldo R'L\$rem_4bit(%t1), $rem_4bit
+#endif
ldi 0xf0,$mask0xf0
___
$code.=<<___ if ($SIZE_T==4);
$PUSH %r11,`-$FRAME+8*$SIZE_T`(%sp)
___
$code.=<<___;
- blr %r0,$rem_4bit
- ldi 3,$rem
-L\$pic_ghash
- andcm $rem_4bit,$rem,$rem_4bit
addl $inp,$len,$len
- ldo L\$rem_4bit-L\$pic_ghash($rem_4bit),$rem_4bit
+#ifdef __PIC__
+ addil LT'L\$rem_4bit, %r19
+ ldw RT'L\$rem_4bit(%r1), $rem_4bit
+#else
+ ldil L'L\$rem_4bit, %t1
+ ldo R'L\$rem_4bit(%t1), $rem_4bit
+#endif
ldi 0xf0,$mask0xf0
___
$code.=<<___ if ($SIZE_T==4);
$POPMB -$FRAME(%sp),%r3
.PROCEND
+ .section .rodata
.ALIGN 64
L\$rem_4bit
.WORD `0x0000<<16`,0,`0x1C20<<16`,0,`0x3840<<16`,0,`0x2460<<16`,0
.WORD `0x7080<<16`,0,`0x6CA0<<16`,0,`0x48C0<<16`,0,`0x54E0<<16`,0
.WORD `0xE100<<16`,0,`0xFD20<<16`,0,`0xD940<<16`,0,`0xC560<<16`,0
.WORD `0x9180<<16`,0,`0x8DA0<<16`,0,`0xA9C0<<16`,0,`0xB5E0<<16`,0
+ .previous
- .data
- .STRINGZ "GHASH for PA-RISC, GRYPTOGAMS by <appro\@openssl.org>"
.ALIGN 64
___
$code=<<___;
.LEVEL $LEVEL
-#if 0
- .SPACE \$TEXT\$
- .SUBSPA \$CODE\$,QUAD=0,ALIGN=8,ACCESS=0x2C,CODE_ONLY
-#else
.text
-#endif
.EXPORT RC4,ENTRY,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR
RC4
.PROC
.CALLINFO NO_CALLS
.ENTRY
- blr %r0,%r28
- ldi 3,%r1
-L\$pic
- andcm %r28,%r1,%r28
+#ifdef __PIC__
+ addil LT'L\$opts, %r19
+ ldw RT'L\$opts(%r1), %r28
+#else
+ ldil L'L\$opts, %t1
+ ldo R'L\$opts(%t1), %r28
+#endif
bv (%r2)
.EXIT
- ldo L\$opts-L\$pic(%r28),%r28
+ nop
.PROCEND
- .data
+ .section .rodata
.ALIGN 8
L\$opts
.STRINGZ "rc4(4x,`$SZ==1?"char":"int"`)"
- .STRINGZ "RC4 for PA-RISC, CRYPTOGAMS by <appro\@openssl.org>"
___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
$code =~ s/cmpib,\*/comib,/gm if ($SIZE_T==4);
$code=<<___;
.LEVEL $LEVEL
-#if 0
- .SPACE \$TEXT\$
- .SUBSPA \$CODE\$,QUAD=0,ALIGN=8,ACCESS=0x2C,CODE_ONLY
-#else
.text
-#endif
.EXPORT sha1_block_data_order,ENTRY,ARGW0=GR,ARGW1=GR,ARGW2=GR
sha1_block_data_order
.EXIT
$POPMB -$FRAME(%sp),%r3
.PROCEND
-
- .data
- .STRINGZ "SHA1 block transform for PA-RISC, CRYPTOGAMS by <appro\@openssl.org>"
___
$code =~ s/\`([^\`]*)\`/eval $1/gem;
$code=<<___;
.LEVEL $LEVEL
-#if 0
- .SPACE \$TEXT\$
- .SUBSPA \$CODE\$,QUAD=0,ALIGN=8,ACCESS=0x2C,CODE_ONLY
-#else
.text
-#endif
+ .section .rodata
.ALIGN 64
L\$table
___
.WORD 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
___
$code.=<<___;
+ .previous
.EXPORT $func,ENTRY,ARGW0=GR,ARGW1=GR,ARGW2=GR
.ALIGN 64
$PUSH $inp,`-$FRAME_MARKER-3*$SIZE_T`(%sp)
$PUSH $ctx,`-$FRAME_MARKER-2*$SIZE_T`(%sp)
- blr %r0,$Tbl
- ldi 3,$t1
-L\$pic
- andcm $Tbl,$t1,$Tbl ; wipe privilege level
- ldo L\$table-L\$pic($Tbl),$Tbl
+#ifdef __PIC__
+ addil LT'L\$table, %r19
+ ldw RT'L\$table(%r1), $Tbl
+#else
+ ldil L'L\$table, %t1
+ ldo R'L\$table(%t1), $Tbl
+#endif
___
$code.=<<___ if ($SZ==8 && $SIZE_T==4);
#ifndef __OpenBSD__
.EXIT
$POPMB -$FRAME(%sp),%r3
.PROCEND
-
- .data
- .STRINGZ "SHA`64*$SZ` block transform for PA-RISC, CRYPTOGAMS by <appro\@openssl.org>"
___
# Explicitly encode PA-RISC 2.0 instructions used in this module, so