From 9409225ba0bf899521709e91376dd12fe5c7d4fb Mon Sep 17 00:00:00 2001 From: miod Date: Fri, 2 May 2014 19:59:16 +0000 Subject: [PATCH] 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) --- lib/libcrypto/sha/asm/sha512-parisc.pl | 6 ++++++ lib/libssl/src/crypto/sha/asm/sha512-parisc.pl | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/lib/libcrypto/sha/asm/sha512-parisc.pl b/lib/libcrypto/sha/asm/sha512-parisc.pl index 578e3f4daf2..4af7731661e 100755 --- a/lib/libcrypto/sha/asm/sha512-parisc.pl +++ b/lib/libcrypto/sha/asm/sha512-parisc.pl @@ -268,6 +268,9 @@ L\$pic andcm $Tbl,$t1,$Tbl ; wipe privilege level ldo L\$table-L\$pic($Tbl),$Tbl ___ +$code.=<<___ if ($SZ==8 && $SIZE_T==4); +#ifndef __OpenBSD__ +___ $code.=<<___ if ($SZ==8 && $SIZE_T==4); ldi 31,$t1 mtctl $t1,%cr11 @@ -363,6 +366,9 @@ $code.=<<___; .ALIGN 64 L\$parisc1 ___ +$code.=<<___ if ($SZ==8 && $SIZE_T==4); +#endif +___ @V=( $Ahi, $Alo, $Bhi, $Blo, $Chi, $Clo, $Dhi, $Dlo, $Ehi, $Elo, $Fhi, $Flo, $Ghi, $Glo, $Hhi, $Hlo) = diff --git a/lib/libssl/src/crypto/sha/asm/sha512-parisc.pl b/lib/libssl/src/crypto/sha/asm/sha512-parisc.pl index 578e3f4daf2..4af7731661e 100755 --- a/lib/libssl/src/crypto/sha/asm/sha512-parisc.pl +++ b/lib/libssl/src/crypto/sha/asm/sha512-parisc.pl @@ -268,6 +268,9 @@ L\$pic andcm $Tbl,$t1,$Tbl ; wipe privilege level ldo L\$table-L\$pic($Tbl),$Tbl ___ +$code.=<<___ if ($SZ==8 && $SIZE_T==4); +#ifndef __OpenBSD__ +___ $code.=<<___ if ($SZ==8 && $SIZE_T==4); ldi 31,$t1 mtctl $t1,%cr11 @@ -363,6 +366,9 @@ $code.=<<___; .ALIGN 64 L\$parisc1 ___ +$code.=<<___ if ($SZ==8 && $SIZE_T==4); +#endif +___ @V=( $Ahi, $Alo, $Bhi, $Blo, $Chi, $Clo, $Dhi, $Dlo, $Ehi, $Elo, $Fhi, $Flo, $Ghi, $Glo, $Hhi, $Hlo) = -- 2.20.1