summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authormiod <>2014-05-02 19:59:16 +0000
committermiod <>2014-05-02 19:59:16 +0000
commit9b91067767652b8b5119230a0a75c4b09267511d (patch)
treeb001363f34bc734a46d4080316ad1c0574f515a3 /src/lib
parenta928011ef8b6701a9f677f7a5f330726c9b7cc2f (diff)
downloadopenbsd-9b91067767652b8b5119230a0a75c4b09267511d.tar.gz
openbsd-9b91067767652b8b5119230a0a75c4b09267511d.tar.bz2
openbsd-9b91067767652b8b5119230a0a75c4b09267511d.zip
The assembly sha512 code detects at runtime if it is running on a 64-bit
processor (PA2.0) and, if so, switches to 64-bit code. However, when running under a 32-bit OpenBSD/hppa kernel, there is no guarantee that the upper part of the registers will be preserved accross context switches (or even userland->kernel boundaries), which causes this code to fail. Wrap the generated code within #ifndef __OpenBSD__ in that case, to avoid using the 64-bit code completely. (OpenBSD/hppa64, once stable, will not be affected by this)
Diffstat (limited to 'src/lib')
-rwxr-xr-xsrc/lib/libcrypto/sha/asm/sha512-parisc.pl6
-rwxr-xr-xsrc/lib/libssl/src/crypto/sha/asm/sha512-parisc.pl6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/libcrypto/sha/asm/sha512-parisc.pl b/src/lib/libcrypto/sha/asm/sha512-parisc.pl
index 578e3f4daf..4af7731661 100755
--- a/src/lib/libcrypto/sha/asm/sha512-parisc.pl
+++ b/src/lib/libcrypto/sha/asm/sha512-parisc.pl
@@ -269,6 +269,9 @@ L\$pic
269 ldo L\$table-L\$pic($Tbl),$Tbl 269 ldo L\$table-L\$pic($Tbl),$Tbl
270___ 270___
271$code.=<<___ if ($SZ==8 && $SIZE_T==4); 271$code.=<<___ if ($SZ==8 && $SIZE_T==4);
272#ifndef __OpenBSD__
273___
274$code.=<<___ if ($SZ==8 && $SIZE_T==4);
272 ldi 31,$t1 275 ldi 31,$t1
273 mtctl $t1,%cr11 276 mtctl $t1,%cr11
274 extrd,u,*= $t1,%sar,1,$t1 ; executes on PA-RISC 1.0 277 extrd,u,*= $t1,%sar,1,$t1 ; executes on PA-RISC 1.0
@@ -363,6 +366,9 @@ $code.=<<___;
363 .ALIGN 64 366 .ALIGN 64
364L\$parisc1 367L\$parisc1
365___ 368___
369$code.=<<___ if ($SZ==8 && $SIZE_T==4);
370#endif
371___
366 372
367@V=( $Ahi, $Alo, $Bhi, $Blo, $Chi, $Clo, $Dhi, $Dlo, 373@V=( $Ahi, $Alo, $Bhi, $Blo, $Chi, $Clo, $Dhi, $Dlo,
368 $Ehi, $Elo, $Fhi, $Flo, $Ghi, $Glo, $Hhi, $Hlo) = 374 $Ehi, $Elo, $Fhi, $Flo, $Ghi, $Glo, $Hhi, $Hlo) =
diff --git a/src/lib/libssl/src/crypto/sha/asm/sha512-parisc.pl b/src/lib/libssl/src/crypto/sha/asm/sha512-parisc.pl
index 578e3f4daf..4af7731661 100755
--- a/src/lib/libssl/src/crypto/sha/asm/sha512-parisc.pl
+++ b/src/lib/libssl/src/crypto/sha/asm/sha512-parisc.pl
@@ -269,6 +269,9 @@ L\$pic
269 ldo L\$table-L\$pic($Tbl),$Tbl 269 ldo L\$table-L\$pic($Tbl),$Tbl
270___ 270___
271$code.=<<___ if ($SZ==8 && $SIZE_T==4); 271$code.=<<___ if ($SZ==8 && $SIZE_T==4);
272#ifndef __OpenBSD__
273___
274$code.=<<___ if ($SZ==8 && $SIZE_T==4);
272 ldi 31,$t1 275 ldi 31,$t1
273 mtctl $t1,%cr11 276 mtctl $t1,%cr11
274 extrd,u,*= $t1,%sar,1,$t1 ; executes on PA-RISC 1.0 277 extrd,u,*= $t1,%sar,1,$t1 ; executes on PA-RISC 1.0
@@ -363,6 +366,9 @@ $code.=<<___;
363 .ALIGN 64 366 .ALIGN 64
364L\$parisc1 367L\$parisc1
365___ 368___
369$code.=<<___ if ($SZ==8 && $SIZE_T==4);
370#endif
371___
366 372
367@V=( $Ahi, $Alo, $Bhi, $Blo, $Chi, $Clo, $Dhi, $Dlo, 373@V=( $Ahi, $Alo, $Bhi, $Blo, $Chi, $Clo, $Dhi, $Dlo,
368 $Ehi, $Elo, $Fhi, $Flo, $Ghi, $Glo, $Hhi, $Hlo) = 374 $Ehi, $Elo, $Fhi, $Flo, $Ghi, $Glo, $Hhi, $Hlo) =