File libopenssl_add_ppc64le.patch of Package libopenssl0_9_8

Subject: libopenssl add ppc64le
From: Michel Normand <normand@linux.vnet.ibm.com>

The ppc64le support need changes to crypto/bn/asm/ppc.pl
to generate the linux_ppc64le.s asm file for ABI V2.
minimalist change but sufficient as build and tests succeeded.

Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
---
 Configure            |    1 +
 config               |    1 +
 crypto/bn/Makefile   |    1 +
 crypto/bn/asm/ppc.pl |    9 +++++++--
 4 files changed, 10 insertions(+), 2 deletions(-)

Index: openssl-0.9.8x/config
===================================================================
--- openssl-0.9.8x.orig/config
+++ openssl-0.9.8x/config
@@ -550,6 +550,7 @@ case "$GUESSOS" in
        # we have the target and force it here
        OUT="linux-ppc64"
 	;;
+  ppc64le-*-linux2) OUT="linux-ppc64le" ;;
   ppc-*-linux2) OUT="linux-ppc" ;;
   ia64-*-linux?) OUT="linux-ia64" ;;
   sparc64-*-linux2)
Index: openssl-0.9.8x/Configure
===================================================================
--- openssl-0.9.8x.orig/Configure
+++ openssl-0.9.8x/Configure
@@ -340,6 +340,7 @@ my %table=(
 ####
 "linux-generic64","gcc:-DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 "linux-ppc64",	"gcc:-m64 -DB_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc64.o::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"linux-ppc64le",	"gcc:-m64 -DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL::linux_ppc64le.o::::::::::dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 "linux-ia64",	"gcc:-DL_ENDIAN -DTERMIO -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 "linux-ia64-ecc","ecc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
 "linux-ia64-icc","icc:-DL_ENDIAN -DTERMIO -O2 -Wall -no_cpprt::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK:${ia64_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
Index: openssl-0.9.8x/crypto/bn/Makefile
===================================================================
--- openssl-0.9.8x.orig/crypto/bn/Makefile
+++ openssl-0.9.8x/crypto/bn/Makefile
@@ -113,6 +113,7 @@ pa-risc2.o: asm/pa-risc2.s
 # ppc - AIX, Linux, MacOS X...
 linux_ppc32.s: asm/ppc.pl;	$(PERL) $< $@
 linux_ppc64.s: asm/ppc.pl;	$(PERL) $< $@
+linux_ppc64le.s: asm/ppc.pl;	$(PERL) $< $@
 aix_ppc32.s: asm/ppc.pl;	$(PERL) asm/ppc.pl $@
 aix_ppc64.s: asm/ppc.pl;	$(PERL) asm/ppc.pl $@
 osx_ppc32.s: asm/ppc.pl;	$(PERL) $< $@
Index: openssl-0.9.8x/crypto/bn/asm/ppc.pl
===================================================================
--- openssl-0.9.8x.orig/crypto/bn/asm/ppc.pl
+++ openssl-0.9.8x/crypto/bn/asm/ppc.pl
@@ -125,7 +125,12 @@ if ($opf =~ /32\.s/) {
 	$INSR=	"insrwi";	# insert right
 	$ROTL=	"rotlwi";	# rotate left by immediate
 	$TR=	"tw";		# conditional trap
-} elsif ($opf =~ /64\.s/) {
+} elsif (($opf =~ /64\.s/) || ($opf =~ /64le\.s/)) {
+	if ($opf =~ /64le\.s/) {
+		$ENDIAN= LE;
+	} else {
+		$ENDIAN= BE;
+	}
 	$BITS=	64;
 	$BNSZ=	$BITS/8;
 	$ISA=	"\"ppc64\"";
@@ -181,7 +186,7 @@ else			{  do_bsd();	}
 sub do_linux {
     $d=&data();
 
-    if ($BITS==64) {
+    if (($BITS==64) && ($ENDIAN eq 'BE')) {
       foreach $t (@items) {
         $d =~ s/\.$t:/\
 \t.section\t".opd","aw"\
openSUSE Build Service is sponsored by