components/openssl/openssl-1.0.0/patches/openssl-1.0.0d-t4-engine.sparc-patch
author Dan Anderson <dan.anderson@oracle.com>
Mon, 29 Aug 2011 17:51:05 -0700
changeset 498 40d5ca406753
parent 426 8c675b553a27
child 603 1b966e9a6b03
permissions -rw-r--r--
7078325 Problem with /lib/libcrypto.so.1.0.0 in snv_171 and onward on Ultra IIe platforms.

#
# Engine t4 patch openssl-1.0.0d-t4-engine.sparc-patch.
# This engine is SPARC-only.
#
Index: Configure
===================================================================
diff -ru openssl-1.0.0d/Configure openssl-1.0.0d/Configure
--- openssl-1.0.0d/Configure	2011-05-24 17:02:24.000000000 -0700
+++ openssl-1.0.0d/Configure	2011-06-17 16:53:34.203229852 -0700
@@ -134,8 +134,8 @@
 
 my $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o::aes-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o::rc4-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o";
 my $ia64_asm="ia64cpuid.o:bn-ia64.o::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o:::::void";
-my $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o:des_enc-sparc.o fcrypt_b.o:aes_core.o aes_cbc.o aes-sparcv9.o:::sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o:::::::void";
-my $sparcv8_asm=":sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::::void";
+my $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o:des_enc-sparc.o fcrypt_b.o:aes_core.o aes_cbc.o aes-sparcv9.o t4_aes.o::t4_md5.o:sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o t4_sha1.o t4_sha2.o:::::::void";
+my $sparcv8_asm=":sparcv8.o:des_enc-sparc.o fcrypt_b.o:t4_aes.o::t4_md5.o:t4_sha1.o t4_sha2.o:::::::void";
 my $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o::::::::::::void";
 my $mips3_asm=":bn-mips3.o::::::::::::void";
 my $s390x_asm="s390xcap.o s390xcpuid.o:bn-s390x.o s390x-mont.o::aes-s390x.o:::sha1-s390x.o sha256-s390x.o sha512-s390x.o::rc4-s390x.o:::::void";
Index: crypto/aes/Makefile
===================================================================
diff -ru openssl-1.0.0d/crypto/aes/ openssl-1.0.0d/crypto/aes/Makefile
--- openssl-1.0.0d/crypto/aes/Makefile	2011-05-24 17:03:31.000000000 -0700
+++ openssl-1.0.0d/crypto/aes/Makefile	2011-06-30 17:26:34.980110000 -0700
@@ -17,6 +17,10 @@
 ASFLAGS= $(INCLUDES) $(ASFLAG)
 AFLAGS= $(ASFLAGS)
 
+BITS:=	$(shell if grep '^SHARED_LDFLAGS.*=.*-m32' ../../Makefile >/dev/null; \
+		then echo 32; else echo 64; fi)
+ASFLAGSYF= -xregsym=no -K pic -P -xarch=v9v -D_sparcv9 -D_ASM -Dsparc -m$(BITS)
+
 GENERAL=Makefile
 #TEST=aestest.c
 TEST=
@@ -57,6 +61,10 @@
 aes-sparcv9.s: asm/aes-sparcv9.pl
 	$(PERL) asm/aes-sparcv9.pl $(CFLAGS) > $@
 
+t4_aes.o: asm/t4_aes.S
+	as $(ASFLAGSYF) -o $@ asm/t4_aes.S
+	elfedit -e 'cap:hw1 -and -cmp vis vis3' $@
+
 aes-ppc.s:	asm/aes-ppc.pl
 	$(PERL) asm/aes-ppc.pl $(PERLASM_SCHEME) $@
 
Index: crypto/engine/Makefile
===================================================================
diff -ru openssl-1.0.0d/crypto/engine/Makefile openssl-1.0.0d/crypto/engine/Makefile
--- openssl-1.0.0d/crypto/engine/Makefile	2011-05-24 17:04:12.000000000 -0700
+++ openssl-1.0.0d/crypto/engine/Makefile	2011-06-17 16:55:13.074884424 -0700
@@ -22,12 +22,14 @@
 	tb_rsa.c tb_dsa.c tb_ecdsa.c tb_dh.c tb_ecdh.c tb_rand.c tb_store.c \
 	tb_cipher.c tb_digest.c tb_pkmeth.c tb_asnmth.c \
 	eng_openssl.c eng_cnf.c eng_dyn.c eng_cryptodev.c \
+	eng_t4.c eng_t4_digest.c \
 	hw_pk11.c hw_pk11_pub.c hw_pk11_uri.c
 LIBOBJ= eng_err.o eng_lib.o eng_list.o eng_init.o eng_ctrl.o \
 	eng_table.o eng_pkey.o eng_fat.o eng_all.o \
 	tb_rsa.o tb_dsa.o tb_ecdsa.o tb_dh.o tb_ecdh.o tb_rand.o tb_store.o \
 	tb_cipher.o tb_digest.o tb_pkmeth.o tb_asnmth.o \
 	eng_openssl.o eng_cnf.o eng_dyn.o eng_cryptodev.o \
+	eng_t4.o eng_t4_digest.o \
 	hw_pk11.o hw_pk11_pub.o hw_pk11_uri.o
 
 SRC= $(LIBSRC)
Index: crypto/engine/eng_all.c
===================================================================
diff -ru openssl-1.0.0d/crypto/engine/eng_all.c openssl-1.0.0d/crypto/engine/eng_all.c
--- openssl-1.0.0d/crypto/engine/eng_all.c	2011-05-24 17:02:20.000000000 -0700
+++ openssl-1.0.0d/crypto/engine/eng_all.c	2011-06-22 17:34:25.145829355 -0700
@@ -61,6 +61,8 @@
 
 void ENGINE_load_builtin_engines(void)
 	{
+	/* Engines may depend on CPU capabilities */
+	OPENSSL_cpuid_setup();
 #if 0
 	/* There's no longer any need for an "openssl" ENGINE unless, one day,
 	 * it is the *only* way for standard builtin implementations to be be
@@ -71,6 +73,10 @@
 #if !defined(OPENSSL_NO_HW) && (defined(__OpenBSD__) || defined(__FreeBSD__) || defined(HAVE_CRYPTODEV))
 	ENGINE_load_cryptodev();
 #endif
+#if !defined(OPENSSL_NO_HW) && !defined(OPENSSL_NO_HW_T4)
+	ENGINE_load_t4();
+	ENGINE_register_all_complete();
+#endif
 	ENGINE_load_dynamic();
 #ifndef OPENSSL_NO_HW_PKCS11
 	ENGINE_load_pk11();
Index: crypto/engine/engine.h
==================================================================
diff -ru openssl-1.0.0d/crypto/engine/engine.h openssl-1.0.0d/crypto/engine/engine.h
--- openssl-1.0.0d/crypto/engine/engine.h	2011-05-24 17:02:20.000000000 -0700
+++ openssl-1.0.0d/crypto/engine/engine.h	2011-05-24 18:05:29.075766123 -0700
@@ -344,6 +344,7 @@
 #endif
 #endif
 void ENGINE_load_cryptodev(void);
+void ENGINE_load_t4(void);
 void ENGINE_load_pk11(void);
 void ENGINE_load_builtin_engines(void);
 
Index: crypto/md5/Makefile
==================================================================
diff -ru openssl-1.0.0d/crypto/md5/Makefile openssl-1.0.0d/crypto/md5/Makefile
--- openssl-1.0.0d/crypto/md5/Makefile	2011-05-24 17:03:14.000000000 -0700
+++ openssl-1.0.0d/crypto/md5/Makefile	2011-08-27 16:01:49.000000000 -0700
@@ -17,6 +17,10 @@
 ASFLAGS= $(INCLUDES) $(ASFLAG)
 AFLAGS= $(ASFLAGS)
 
+BITS:=	$(shell if grep '^SHARED_LDFLAGS.*=.*-m32' ../../Makefile >/dev/null; \
+		then echo 32; else echo 64; fi)
+ASFLAGSYF= -xregsym=no -K pic -P -xarch=v9v -D_sparcv9 -D_ASM -Dsparc -m$(BITS)
+
 GENERAL=Makefile
 TEST=md5test.c
 APPS=
@@ -52,6 +58,10 @@
 	$(CC) $(CFLAGS) -E asm/md5-ia64.S | \
 	$(PERL) -ne 's/;\s+/;\n/g; print;' > $@
 
+t4_md5.o: asm/t4_md5.S
+	as $(ASFLAGSYF) -o $@ asm/t4_md5.S
+	elfedit -e 'cap:hw1 -and -cmp vis vis3' $@
+
 files:
 	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 
Index: crypto/sha/Makefile
==================================================================
diff -ru openssl-1.0.0d/crypto/sha/Makefile openssl-1.0.0d/crypto/sha/Makefile
--- openssl-1.0.0d/crypto/sha/Makefile	2011-05-24 17:03:18.000000000 -0700
+++ openssl-1.0.0d/crypto/sha/Makefile	2011-08-27 16:01:49.000000000 -0700
@@ -17,6 +17,10 @@
 ASFLAGS= $(INCLUDES) $(ASFLAG)
 AFLAGS= $(ASFLAGS)
 
+BITS:=	$(shell if grep '^SHARED_LDFLAGS.*=.*-m32' ../../Makefile >/dev/null; \
+		then echo 32; else echo 64; fi)
+ASFLAGSYF= -xregsym=no -K pic -P -xarch=v9v -D_sparcv9 -D_ASM -Dsparc -m$(BITS)
+
 GENERAL=Makefile
 TEST=shatest.c sha1test.c sha256t.c sha512t.c
 APPS=
@@ -76,6 +82,14 @@
 sha256-%.s:	asm/sha512-%.pl;	$(PERL) $< $@
 sha512-%.s:	asm/sha512-%.pl;	$(PERL) $< $@
 
+t4_sha1.o: asm/t4_sha1.S
+	as $(ASFLAGSYF) -o $@ asm/t4_sha1.S
+	elfedit -e 'cap:hw1 -and -cmp vis vis3' $@
+
+t4_sha2.o: asm/t4_sha2.S
+	as $(ASFLAGSYF) -o $@ asm/t4_sha2.S
+	elfedit -e 'cap:hw1 -and -cmp vis vis3' $@
+
 files:
 	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 
Index: util/libeay.num
==================================================================
diff -ru openssl-1.0.0d/util/libeay.num openssl-1.0.0d/util/libeay.num
--- openssl-1.0.0d/util/libeay.num	2010-07-25 09:56:06.000000000 -0700
+++ openssl-1.0.0d/util/libeay.num	2011-05-25 11:19:15.585211842 -0700
@@ -4178,6 +4178,7 @@
 UI_method_set_prompt_constructor        4551	EXIST:!VMS:FUNCTION:
 UI_method_set_prompt_constructr         4551	EXIST:VMS:FUNCTION:
 EVP_read_pw_string_min                  4552	EXIST::FUNCTION:
+ENGINE_load_t4                          4553	EXIST::FUNCTION:ENGINE
 CRYPTO_cts128_encrypt                   4553	EXIST::FUNCTION:
 CRYPTO_cts128_decrypt_block             4554	EXIST::FUNCTION:
 CRYPTO_cfb128_1_encrypt                 4555	EXIST::FUNCTION: