Revision: 25492
          http://sourceforge.net/p/gar/code/25492
Author:   janholzh
Date:     2015-12-22 11:33:41 +0000 (Tue, 22 Dec 2015)
Log Message:
-----------
openssl1/trunk: add openssl 1.0.2

Modified Paths:
--------------
    csw/mgar/pkg/openssl1/trunk/Makefile
    csw/mgar/pkg/openssl1/trunk/checksums
    csw/mgar/pkg/openssl1/trunk/files/c_rehash-compat.patch
    csw/mgar/pkg/openssl1/trunk/files/map.openssl.libcrypto
    csw/mgar/pkg/openssl1/trunk/files/map.openssl.libssl
    csw/mgar/pkg/openssl1/trunk/files/optimized_configure_targets.patch
    csw/mgar/pkg/openssl1/trunk/files/update-pkcs11-patch.sh

Added Paths:
-----------
    
csw/mgar/pkg/openssl1/trunk/files/0016-Make-engines-dir-soname-dependant.patch
    csw/mgar/pkg/openssl1/trunk/files/029-fork_safe.patch
    csw/mgar/pkg/openssl1/trunk/files/032-aes_cbc_len_check.patch
    csw/mgar/pkg/openssl1/trunk/files/036-evp_leak.patch
    csw/mgar/pkg/openssl1/trunk/files/039-internal_tests.patch
    csw/mgar/pkg/openssl1/trunk/files/040-uninitialized_ctx.patch
    csw/mgar/pkg/openssl1/trunk/files/043-x86_wrong_platform.patch
    csw/mgar/pkg/openssl1/trunk/files/044-suppress_v8plus_abi_warnings.patch
    csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.2e-pkcs11-engine.patch

Removed Paths:
-------------
    
csw/mgar/pkg/openssl1/trunk/files/0003-make-engines-directory-soname-dependant.patch
    csw/mgar/pkg/openssl1/trunk/files/0004-remove-obsolete-mv8.patch
    csw/mgar/pkg/openssl1/trunk/files/fix-test-failure.patch
    csw/mgar/pkg/openssl1/trunk/files/more_configure_targets.patch
    csw/mgar/pkg/openssl1/trunk/files/more_configure_targets.patch.SunOS5.9
    
csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1e-t4-engine-sparcv9+vis.sparc.5.11.patch
    csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1f-t4-engine.sparc.5.11.patch
    csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1m-fork_safe.patch
    csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1m-pkcs11-engine.patch
    csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1m-t4-engine.sparc.5.11.patch
    csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1m-wanboot.patch
    csw/mgar/pkg/openssl1/trunk/files/optimized_configure_targets.patch.SunOS5.9
    csw/mgar/pkg/openssl1/trunk/files/update-t4-patch.sh
    csw/mgar/pkg/openssl1/trunk/files/update-wanboot-patch.sh

Modified: csw/mgar/pkg/openssl1/trunk/Makefile
===================================================================
--- csw/mgar/pkg/openssl1/trunk/Makefile        2015-12-21 22:56:07 UTC (rev 
25491)
+++ csw/mgar/pkg/openssl1/trunk/Makefile        2015-12-22 11:33:41 UTC (rev 
25492)
@@ -13,7 +13,7 @@
 ###### Package information #######
 
 NAME = openssl
-VERSION = 1.0.1q
+VERSION = 1.0.2e
 GARTYPE = v2
 # Since version 1.0.0, soname is fixed and does not follow the minor releases
 SONAME=1.0.0
@@ -28,12 +28,12 @@
 
 # This recipe can be used to compile openssl with Sun Studio or GCC
 # Just define the GARCOMPILER to the GNU or SUN
-GARCOMPILER = GNU
+GARCOMPILER = SOS12U4
 GARCOMPILER_TYPE = $(if $(findstring GCC,$(GARCOMPILER)),GNU,SUN)
 
 PACKAGES = CSWlibssl1-0-0 CSWlibssl-dev CSWopenssl-utils
 
-PACKAGING_PLATFORMS = solaris9-sparc solaris9-i386 solaris10-sparc 
solaris10-i386 solaris11-sparc solaris11-i386
+PACKAGING_PLATFORMS = solaris10-sparc solaris10-i386 solaris11-sparc 
solaris11-i386
 
 RUNTIME_DEP_PKGS_CSWlibssl1-0-0 = 
$(RUNTIME_DEP_PKGS_CSWlibssl1-0-0_$(GARCOMPILER_TYPE))
 RUNTIME_DEP_PKGS_CSWlibssl1-0-0_GNU = CSWlibgcc-s1
@@ -77,7 +77,7 @@
 MASTER_SITES = http://www.openssl.org/source/
 
 DISTFILES  = $(NAME)-$(VERSION).tar.gz
-DISTFILES += changelog.CSW README.CSW
+DISTFILES += README.CSW
 DISTFILES += map.openssl.libcrypto map.openssl.libssl map.openssl.engines
 
 DOCFILES = CHANGES CHANGES.SSLeay PROBLEMS README FAQ README.ASN1 INSTALL NEWS 
README.ENGINE
@@ -85,33 +85,19 @@
 # List of engines that will be shipped in the packages
 ENGINES = 4758cca aep atalla cswift gmp chil nuron sureware ubsec padlock capi
 
-# configure targets patchs needs to be different for Solaris 9 as some map 
files
-# are not available
-ifeq ($(shell /usr/bin/uname -r),5.9)
-       PATCH_SUFFIX = .SunOS5.9
-endif
-
 # This patch is taken from 
https://hg.openindiana.org/upstream/oracle/userland-gate/
 # original file: 
components/openssl/openssl-1.0.1/patches/18-compiler_opts.patch
 # I think they are smarter than me to figure what are the best compiler options
-PATCHFILES += optimized_configure_targets.patch$(PATCH_SUFFIX)
+PATCHFILES += optimized_configure_targets.patch
 
-# This patch add optimised build targets for some solaris isa, ie:
-# solaris-sparcv8-cc-sunw, solaris-pentium_pro-cc-sunw and 
solaris-sparcv9+vis-cc-sunw
-# (wonder if they are really worth it)
-PATCHFILES += more_configure_targets.patch$(PATCH_SUFFIX)
 
-
-#PATCHFILES += fix-test-failure.patch
-
 # We install engines libraries in /opt/csw/lib/engines/1.0.0/
 # instead of /opt/csw/lib/engines to avoid clashes with 0.9.8
 # and futur new release of ssl libraries
-PATCHFILES += 0003-make-engines-directory-soname-dependant.patch
+PATCHFILES += 0016-Make-engines-dir-soname-dependant.patch
 
 # Upstream uses an obsolete GCC flag
 # not the case anymore
-#PATCHFILES += 0004-remove-obsolete-mv8.patch
 
 # Update openssl.cnf path in man page to follow opencsw standard
 PATCHFILES += opencsw_paths.patch
@@ -140,43 +126,18 @@
 # Bug opened upstream: http://rt.openssl.org/Ticket/Display.html?id=3153
 PATCHFILES += make_issetugid_support_configurable.patch
 
-# Patch taken from Oracle upstream (PSARC/2014/077 OpenSSL Thread and Fork 
Safety 17822462) 
-# from https://hg.openindiana.org/upstream/oracle/userland-gate/
-# This patch solves a bug with thread and fork safety and is also needed so 
that
-# upstream wanboot patch can be applied out of the box
-ifneq ($(shell /usr/bin/uname -r),5.9)
-PATCHFILES += openssl-1.0.1m-fork_safe.patch
-endif
+PATCHFILES += openssl-1.0.2e-pkcs11-engine.patch
+ENGINES += pk11
 
-# support for pkcs11 engine 
http://blogs.sun.com/chichang1/entry/how_to_integrate_pkcs11_engine
-ifneq ($(shell /usr/bin/uname -r),5.9)
-       PATCHFILES += openssl-1.0.1m-pkcs11-engine.patch
-       ENGINES += pk11
-endif
+# Patches taken form oracle
+PATCHFILES += 029-fork_safe.patch
+PATCHFILES += 032-aes_cbc_len_check.patch
+PATCHFILES += 036-evp_leak.patch
+PATCHFILES += 039-internal_tests.patch
+PATCHFILES += 040-uninitialized_ctx.patch
+PATCHFILES += 043-x86_wrong_platform.patch
+PATCHFILES += 044-suppress_v8plus_abi_warnings.patch
 
-# support for sparc t4 crypto engine
-# see http://bubbva.blogspot.fr/2011/11/exciting-crypto-advances-with-t4.html
-#     https://blogs.oracle.com/DanX/entry/sparc_t4_openssl_engine
-# patch taken from https://hg.openindiana.org/upstream/oracle/userland-gate/
-# To update the patch, do:
-#   cd files && ./update-t4-patch.sh OPENSSL_VERSION
-
-# The upstream t4 engine patch depends on the wanboot one
-# so we will apply the wanboot patch even if we will not enable wanboot
-PATCHFILES.sparc.5.11 += openssl-1.0.1m-wanboot.patch
-PATCHFILES.sparc.5.11 += openssl-1.0.1m-t4-engine.sparc.5.11.patch
-PATCHFILES.sparc.5.11 += openssl-1.0.1e-t4-engine-sparcv9+vis.sparc.5.11.patch
-PATCHFILES += $(PATCHFILES.$(GARCH).$(GAROSREL))
-
-
-# Building openssl with "-j" option doesn't work properly because of 
dependencies
-# in the Makefile.
-# This patch fixes this problem, it's taken from gentoo and adapted so that it 
works
-# with sh shell.
-# (see 
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/openssl/files/)
-# does not apply anymore
-#PATCHFILES += openssl-1.0.1-parallel-build.patch
-
 LICENSE = LICENSE
 
 ##### Build and installation information #####
@@ -199,18 +160,11 @@
 # c_rehash is shell script: no isaexec please
 EXTRA_ISAEXEC_EXCLUDE_FILES = /opt/csw/bin/c_rehash
 
-# We use Studio 12.3 to have the "-Qoption cg" option
-# but this version is not available under Solaris 9
-ifneq ($(shell /usr/bin/uname -r),5.9)
-       ifneq ($(GARCOMPILER),GNU)
-               GARCOMPILER = SOS12U3
-       endif
-endif
 
 # The corresponding os/compiler to pass to the
 # openssl Configure script
 i386_SUN_CONFIGURE_TARGET              = no-sse2 solaris-x86-cc-sunw
-pentium_pro_SUN_CONFIGURE_TARGET       = solaris-x86-pentium_pro-cc-sunw
+pentium_pro_SUN_CONFIGURE_TARGET       = solaris-x86-cc-sunw
 amd64_SUN_CONFIGURE_TARGET             = solaris64-x86_64-cc-sunw
 
 i386_GNU_CONFIGURE_TARGET              = no-sse2 solaris-x86-gcc
@@ -250,12 +204,8 @@
 CONFIGURE_ARGS += $(CONFIGURE_FLAGS)
 CONFIGURE_ARGS += $($(ISA)_$(GARCOMPILER_TYPE)_CONFIGURE_TARGET)
 CONFIGURE_ARGS += shared
+CONFIGURE_ARGS += --pk11-libname=$(abspath /usr/lib/$(MM_LIBDIR)/libpkcs11.so)
 
-# PKCS11 is only for Solaris 10 so we must create solaris 10 specific packages
-ifneq ($(shell /usr/bin/uname -r),5.9)
-       CONFIGURE_ARGS += --pk11-libname=$(abspath 
/usr/lib/$(MM_LIBDIR)/libpkcs11.so)
-endif
-
 # For now we want the sun perl to be used
 EXTRA_CONFIGURE_ENV += PERL="/usr/bin/perl"
 
@@ -279,7 +229,7 @@
 
 # We define a custom test script to be able to disable -j only for test 
execution
 # as it doesn't work currently
-TEST_SCRIPTS = custom
+#TEST_SCRIPTS = custom
 
 include gar/category.mk
 
@@ -315,7 +265,7 @@
 merge-doc:
        for CATALOGNAME in $(foreach PKG, $(PACKAGES), $(call 
catalogname,$(PKG))); do \
                ginstall -d $(PKGROOT)/$(docdir)/$$CATALOGNAME; \
-               (cd $(DOWNLOADDIR)/ && ginstall -m 0644 README.CSW 
changelog.CSW $(PKGROOT)/$(docdir)/$$CATALOGNAME/); \
+               (cd $(DOWNLOADDIR)/ && ginstall -m 0644 README.CSW 
$(PKGROOT)/$(docdir)/$$CATALOGNAME/); \
                (cd $(WORKSRC_FIRSTMOD)/ && ginstall -m 0644 $(DOCFILES) 
$(PKGROOT)/$(docdir)/$$CATALOGNAME/); \
        done
 

Modified: csw/mgar/pkg/openssl1/trunk/checksums
===================================================================
--- csw/mgar/pkg/openssl1/trunk/checksums       2015-12-21 22:56:07 UTC (rev 
25491)
+++ csw/mgar/pkg/openssl1/trunk/checksums       2015-12-22 11:33:41 UTC (rev 
25492)
@@ -1 +1 @@
-54538d0cdcb912f9bc2b36268388205e  openssl-1.0.1q.tar.gz
+5262bfa25b60ed9de9f28d5d52d77fc5  openssl-1.0.2e.tar.gz

Deleted: 
csw/mgar/pkg/openssl1/trunk/files/0003-make-engines-directory-soname-dependant.patch
===================================================================
--- 
csw/mgar/pkg/openssl1/trunk/files/0003-make-engines-directory-soname-dependant.patch
        2015-12-21 22:56:07 UTC (rev 25491)
+++ 
csw/mgar/pkg/openssl1/trunk/files/0003-make-engines-directory-soname-dependant.patch
        2015-12-22 11:33:41 UTC (rev 25492)
@@ -1,102 +0,0 @@
-From 19481ff83894faf3b114dd7c460be7ca2b8dcea2 Mon Sep 17 00:00:00 2001
-From: Yann Rouillard <[email protected]>
-Date: Sun, 24 Jul 2011 02:18:21 +0200
-Subject: [PATCH] Make engines directory soname dependant
-
----
- Configure               |    2 +-
- Makefile.org            |    3 ++-
- engines/Makefile        |   10 +++++-----
- engines/ccgost/Makefile |    8 ++++----
- 4 files changed, 12 insertions(+), 11 deletions(-)
-
-diff --git a/Configure b/Configure
-index 17b3648..f7e2e0e 100755
---- a/Configure
-+++ b/Configure
-@@ -1690,7 +1690,7 @@ while (<IN>)
-               }
-       elsif   (/^#define\s+ENGINESDIR/)
-               {
--              my $foo = "$prefix/$libdir/engines";
-+              my $foo = 
"$prefix/$libdir/openssl-$shlib_version_number/engines";
-               $foo =~ s/\\/\\\\/g;
-               print OUT "#define ENGINESDIR \"$foo\"\n";
-               }
-diff --git a/Makefile.org b/Makefile.org
-index fb0af7e..c9edd8f 100644
---- a/Makefile.org
-+++ b/Makefile.org
-@@ -194,6 +194,7 @@ BUILDENV=  PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' 
\
-               ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'     \
-               EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'       \
-               SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
-+              SHLIB_VERSION_NUMBER='$(SHLIB_VERSION_NUMBER)'  \
-               PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)'     \
-               CPUID_OBJ='$(CPUID_OBJ)'                        \
-               BN_ASM='$(BN_ASM)' DES_ENC='$(DES_ENC)'         \
-@@ -497,7 +498,7 @@ install: all install_docs install_sw
- install_sw:
-       @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
-               $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
--              $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
-+              
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines
 \
-               $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
-               $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
-               $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
-diff --git a/engines/Makefile b/engines/Makefile
-index 2fa9534..16554ea 100644
---- a/engines/Makefile
-+++ b/engines/Makefile
-@@ -107,7 +107,7 @@ install:
-       @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
-       @if [ -n "$(SHARED_LIBS)" ]; then \
-               set -e; \
--              $(PERL) $(TOP)/util/mkdir-p.pl 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines; \
-+              $(PERL) $(TOP)/util/mkdir-p.pl 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines;
 \
-               for l in $(LIBNAMES); do \
-                       ( echo installing $$l; \
-                         pfx=lib; \
-@@ -119,13 +119,13 @@ install:
-                               *DSO_WIN32*)    sfx="eay32.dll"; pfx=;; \
-                               *)              sfx=".bad";;    \
-                               esac; \
--                              cp $$pfx$$l$$sfx 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
-+                              cp $$pfx$$l$$sfx 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$$pfx$$l$$sfx.new;
 \
-                         else \
-                               sfx=".so"; \
--                              cp cyg$$l.dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
-+                              cp cyg$$l.dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$$pfx$$l$$sfx.new;
 \
-                         fi; \
--                        chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
--                        mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx ); \
-+                        chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$$pfx$$l$$sfx.new;
 \
-+                        mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$$pfx$$l$$sfx.new
 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$$pfx$$l$$sfx
 ); \
-               done; \
-       fi
-       @target=install; $(RECURSIVE_MAKE)
-diff --git a/engines/ccgost/Makefile b/engines/ccgost/Makefile
-index dadb523..e71e6f5 100644
---- a/engines/ccgost/Makefile
-+++ b/engines/ccgost/Makefile
-@@ -53,13 +53,13 @@ install:
-                       *DSO_WIN32*) sfx="eay32.dll"; pfx=;; \
-                       *) sfx=".bad";; \
-                       esac; \
--                      cp $${pfx}$(LIBNAME)$$sfx 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
-+                      cp $${pfx}$(LIBNAME)$$sfx 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$${pfx}$(LIBNAME)$$sfx.new;
 \
-               else \
-                       sfx=".so"; \
--                      cp cyg$(LIBNAME).dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
-+                      cp cyg$(LIBNAME).dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$${pfx}$(LIBNAME)$$sfx.new;
 \
-               fi; \
--              chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
--              mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx; \
-+              chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$${pfx}$(LIBNAME)$$sfx.new;
 \
-+              mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$${pfx}$(LIBNAME)$$sfx.new
 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$${pfx}$(LIBNAME)$$sfx;
 \
-       fi
- 
- links:
--- 
-1.7.6
-

Deleted: csw/mgar/pkg/openssl1/trunk/files/0004-remove-obsolete-mv8.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/0004-remove-obsolete-mv8.patch    
2015-12-21 22:56:07 UTC (rev 25491)
+++ csw/mgar/pkg/openssl1/trunk/files/0004-remove-obsolete-mv8.patch    
2015-12-22 11:33:41 UTC (rev 25492)
@@ -1,12 +0,0 @@
-index 9520bf9..416f210 100755
---- a/Configure
-+++ b/Configure
-@@ -230,7 +230,7 @@ my %table=(
- 
- #### SPARC Solaris with GNU C setups
- "solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN 
-DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK 
DES_UNROLL 
BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
--"solaris-sparcv8-gcc","gcc:-mv8 -O3 -fomit-frame-pointer -Wall -DB_ENDIAN 
-DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK 
DES_UNROLL 
BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-+"solaris-sparcv8-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN 
-DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK 
DES_UNROLL 
BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
- # -m32 should be safe to add as long as driver recognizes -mcpu=ultrasparc
- "solaris-sparcv9-gcc","gcc:-m32 -mcpu=ultrasparc -O3 -fomit-frame-pointer 
-Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl 
-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL 
BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
- "solaris64-sparcv9-gcc","gcc:-m64 -mcpu=ultrasparc -O3 -Wall 
-DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR 
RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL 
BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-fPIC:-m64 
-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::/64",

Added: 
csw/mgar/pkg/openssl1/trunk/files/0016-Make-engines-dir-soname-dependant.patch
===================================================================
--- 
csw/mgar/pkg/openssl1/trunk/files/0016-Make-engines-dir-soname-dependant.patch  
                            (rev 0)
+++ 
csw/mgar/pkg/openssl1/trunk/files/0016-Make-engines-dir-soname-dependant.patch  
    2015-12-22 11:33:41 UTC (rev 25492)
@@ -0,0 +1,110 @@
+From fcd631f0c90301312196c50986751d170fca257c Mon Sep 17 00:00:00 2001
+From: Jan Holzhueter <[email protected]>
+Date: Tue, 22 Dec 2015 10:21:51 +0100
+Subject: [PATCH] Make engines dir soname dependant
+
+---
+ Configure               |  2 +-
+ Makefile.org            |  3 ++-
+ engines/Makefile        | 10 +++++-----
+ engines/ccgost/Makefile |  8 ++++----
+ 4 files changed, 12 insertions(+), 11 deletions(-)
+
+diff --git a/Configure b/Configure
+index 296c31b..bf9b757 100755
+--- a/Configure
++++ b/Configure
+@@ -1937,7 +1937,7 @@ while (<IN>)
+               }
+       elsif   (/^#define\s+ENGINESDIR/)
+               {
+-              my $foo = "$prefix/$libdir/engines";
++              my $foo = 
"$prefix/$libdir/openssl-$shlib_version_number/engines";
+               $foo =~ s/\\/\\\\/g;
+               print OUT "#define ENGINESDIR \"$foo\"\n";
+               }
+diff --git a/Makefile.org b/Makefile.org
+index e2bbb47..7b3ce9f 100644
+--- a/Makefile.org
++++ b/Makefile.org
+@@ -225,6 +225,7 @@ BUILDENV=  LC_ALL=C PLATFORM='$(PLATFORM)' 
PROCESSOR='$(PROCESSOR)'\
+               ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'     \
+               EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'       \
+               SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
++              SHLIB_VERSION_NUMBER='$(SHLIB_VERSION_NUMBER)'  \
+               PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)'     \
+               CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)'     \
+               EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)'         \
+@@ -539,7 +540,7 @@ install: all install_docs install_sw
+ install_sw:
+       @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
+               $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
+-              $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
++              
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines
 \
+               $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
+               $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
+               $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
+diff --git a/engines/Makefile b/engines/Makefile
+index 77521b1..7b0fde0 100644
+--- a/engines/Makefile
++++ b/engines/Makefile
+@@ -111,13 +111,13 @@ install:
+       @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+       @if [ -n "$(SHARED_LIBS)" ]; then \
+               set -e; \
+-              $(PERL) $(TOP)/util/mkdir-p.pl 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines; \
++              $(PERL) $(TOP)/util/mkdir-p.pl 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines;
 \
+               for l in $(LIBNAMES); do \
+                       ( echo installing $$l; \
+                         pfx=lib; \
+                         if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
+                               sfx=".so"; \
+-                              cp cyg$$l.dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
++                              cp cyg$$l.dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$$pfx$$l$$sfx.new;
 \
+                         else \
+                               case "$(CFLAGS)" in \
+                               *DSO_BEOS*)     sfx=".so";;     \
+@@ -126,10 +126,10 @@ install:
+                               *DSO_WIN32*)    sfx="eay32.dll"; pfx=;; \
+                               *)              sfx=".bad";;    \
+                               esac; \
+-                              cp $$pfx$$l$$sfx 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
++                              cp $$pfx$$l$$sfx 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$$pfx$$l$$sfx.new;
 \
+                         fi; \
+-                        chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
+-                        mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx ); \
++                        chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$$pfx$$l$$sfx.new;
 \
++                        mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$$pfx$$l$$sfx.new
 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$$pfx$$l$$sfx
 ); \
+               done; \
+       fi
+       @target=install; $(RECURSIVE_MAKE)
+diff --git a/engines/ccgost/Makefile b/engines/ccgost/Makefile
+index 17e1efb..f605112 100644
+--- a/engines/ccgost/Makefile
++++ b/engines/ccgost/Makefile
+@@ -47,7 +47,7 @@ install:
+               pfx=lib; \
+               if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
+                       sfx=".so"; \
+-                      cp cyg$(LIBNAME).dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
++                      cp cyg$(LIBNAME).dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$${pfx}$(LIBNAME)$$sfx.new;
 \
+               else \
+                       case "$(CFLAGS)" in \
+                       *DSO_BEOS*) sfx=".so";; \
+@@ -56,10 +56,10 @@ install:
+                       *DSO_WIN32*) sfx="eay32.dll"; pfx=;; \
+                       *) sfx=".bad";; \
+                       esac; \
+-                      cp $${pfx}$(LIBNAME)$$sfx 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
++                      cp $${pfx}$(LIBNAME)$$sfx 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$${pfx}$(LIBNAME)$$sfx.new;
 \
+               fi; \
+-              chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
+-              mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx; \
++              chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$${pfx}$(LIBNAME)$$sfx.new;
 \
++              mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$${pfx}$(LIBNAME)$$sfx.new
 
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/openssl-$(SHLIB_VERSION_NUMBER)/engines/$${pfx}$(LIBNAME)$$sfx;
 \
+       fi
+ 
+ links:
+-- 
+2.4.0
+

Added: csw/mgar/pkg/openssl1/trunk/files/029-fork_safe.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/029-fork_safe.patch                       
        (rev 0)
+++ csw/mgar/pkg/openssl1/trunk/files/029-fork_safe.patch       2015-12-22 
11:33:41 UTC (rev 25492)
@@ -0,0 +1,277 @@
+#
+# This file adds the code to setup internal mutexes and callback function.
+#      PSARC/2014/077
+#      PSARC/2015/043
+# This change was implemented in-house.  The issue was brought up to
+# the upstream engineers, but there was no commitment.
+#
+--- openssl-1.0.1f/crypto/cryptlib.c.~1~       Fri Feb  7 10:41:36 2014
++++ openssl-1.0.1f/crypto/cryptlib.c   Thu Feb  6 16:03:58 2014
+@@ -116,6 +116,7 @@
+ 
+ #include "cryptlib.h"
+ #include <openssl/safestack.h>
++#include <pthread.h>
+ 
+ #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16)
+ static double SSLeay_MSVC5_hack = 0.0; /* and for VC1.5 */
+@@ -184,6 +185,8 @@
+  */
+ static STACK_OF(CRYPTO_dynlock) *dyn_locks = NULL;
+ 
++static pthread_mutex_t *solaris_openssl_locks;
++
+ static void (MS_FAR *locking_callback) (int mode, int type,
+                                         const char *file, int line) = 0;
+ static int (MS_FAR *add_lock_callback) (int *pointer, int amount,
+@@ -373,7 +376,10 @@
+ void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*func)
+                                          (const char *file, int line))
+ {
+-    dynlock_create_callback = func;
++    /*
++     * we now setup our own dynamic locking callback, and disallow
++     * setting of another locking callback.
++     */
+ }
+
+ void CRYPTO_set_dynlock_lock_callback(void (*func) (int mode,
+@@ -382,7 +388,10 @@
+                                                     const char *file,
+                                                     int line))
+ {
+-    dynlock_lock_callback = func;
++    /*
++     * we now setup our own dynamic locking callback, and disallow
++     * setting of another locking callback.
++     */
+ }
+
+ void CRYPTO_set_dynlock_destroy_callback(void (*func)
+@@ -389,7 +398,10 @@
+                                           (struct CRYPTO_dynlock_value *l,
+                                            const char *file, int line))
+ {
+-    dynlock_destroy_callback = func;
++    /*
++     * we now setup our own dynamic locking callback, and disallow
++     * setting of another locking callback.
++     */
+ }
+
+ void (*CRYPTO_get_locking_callback(void)) (int mode, int type,
+@@ -402,6 +414,128@@
+     return (add_lock_callback);
+ }
+
++/*
++ * This is the locking callback function which all applications will be
++ * using when CRYPTO_lock() is called.
++ */ 
++static void solaris_locking_callback(int mode, int type, const char *file,
++    int line)
++{
++    if (mode & CRYPTO_LOCK) {
++        pthread_mutex_lock(&solaris_openssl_locks[type]);
++    } else {
++        pthread_mutex_unlock(&solaris_openssl_locks[type]);
++    }
++}
++
++/*
++ * Implement Solaris's own dynamic locking routines.
++ */
++static struct CRYPTO_dynlock_value *
++solaris_dynlock_create(const char *file, int line)
++{
++    int                        ret;
++    pthread_mutex_t    *dynlock;
++
++    dynlock = OPENSSL_malloc(sizeof(pthread_mutex_t));
++    if (dynlock == NULL) {
++        return (NULL);
++    }
++
++    ret = pthread_mutex_init(dynlock, NULL);
++    OPENSSL_assert(ret);
++
++    return ((struct CRYPTO_dynlock_value *)dynlock);
++}
++
++static void
++solaris_dynlock_lock(int mode, struct CRYPTO_dynlock_value *dynlock,
++    const char *file, int line)
++{
++    int        ret;
++
++    if (mode & CRYPTO_LOCK) {
++        ret = pthread_mutex_lock((pthread_mutex_t *)dynlock);
++    } else {
++        ret = pthread_mutex_unlock((pthread_mutex_t *)dynlock);
++    }
++
++    OPENSSL_assert(ret == 0);
++}
++
++static void
++solaris_dynlock_destroy(struct CRYPTO_dynlock_value *dynlock,
++    const char *file, int line)
++{
++    int ret;
++    ret = pthread_mutex_destroy((pthread_mutex_t *)dynlock);
++    OPENSSL_assert(ret);
++}
++
++
++/*
++ * This function is called when a child process is forked to setup its own
++ * global locking callback function ptr and mutexes.
++ */
++static void solaris_fork_child(void)
++{
++    /*
++     * clear locking_callback to indicate that locks should
++     * be reinitialized.
++     */
++    locking_callback = NULL;
++    solaris_locking_setup();
++}
++
++/*
++ * This function allocates and initializes the global mutex array, and
++ * sets the locking callback.
++ */
++void solaris_locking_setup()
++{
++    int i;
++    int num_locks;
++
++    /* setup the dynlock callback if not already */
++    if (dynlock_create_callback == NULL) {
++        dynlock_create_callback = solaris_dynlock_create;
++    }
++    if (dynlock_lock_callback == NULL) {
++        dynlock_lock_callback = solaris_dynlock_lock;
++    }
++    if (dynlock_destroy_callback == NULL) {
++        dynlock_destroy_callback = solaris_dynlock_destroy;
++    }
++
++    /* locking callback is already setup. Nothing to do */
++    if (locking_callback != NULL) {
++        return;
++    }
++
++    /*
++     * Set atfork handler so that child can setup its own mutexes and
++     * locking callbacks when it is forked
++     */
++    (void) pthread_atfork(NULL, NULL, solaris_fork_child);
++
++    /* allocate locks needed by OpenSSL  */
++    num_locks = CRYPTO_num_locks();
++    solaris_openssl_locks =
++        OPENSSL_malloc(sizeof (pthread_mutex_t) * num_locks);
++    if (solaris_openssl_locks == NULL) {
++        fprintf(stderr,
++            "solaris_locking_setup: memory allocation failure.\n");
++        abort();
++    }
++
++    /* initialize openssl mutexes */
++    for (i = 0; i < num_locks; i++) {
++        pthread_mutex_init(&solaris_openssl_locks[i], NULL);
++    }
++    locking_callback = solaris_locking_callback;
++
++}
++
+ void CRYPTO_set_locking_callback(void (*func) (int mode, int type,
+                                                const char *file, int line))
+ {
+@@ -410,7 +486,11 @@
+      * started.
+      */
+     OPENSSL_init();
+-    locking_callback = func;
++
++    /*
++     * we now setup our own locking callback and mutexes, and disallow
++     * setting of another locking callback.
++     */
+ }
+ 
+ void CRYPTO_set_add_lock_callback(int (*func) (int *num, int mount, int type,
+@@ -471,9 +551,10 @@
+ 
+ int CRYPTO_THREADID_set_callback(void (*func) (CRYPTO_THREADID *))
+ {
+-    if (threadid_callback)
+-        return 0;
+-    threadid_callback = func;
++    /*
++     * Use the backup method (the address of 'errno') to identify the
++     * thread and disallow setting the threadid callback.
++     */
+     return 1;
+ }
+ 
+@@ -529,7 +669,10 @@
+ 
+ void CRYPTO_set_id_callback(unsigned long (*func) (void))
+ {
+-    id_callback = func;
++    /*
++     * Use the backup method to identify the thread/process.
++     * Setting the id callback is disallowed.
++     */
+ }
+ 
+ unsigned long CRYPTO_thread_id(void)
+--- openssl-1.0.1f/crypto/cryptlib.h.~1~       Fri Feb  7 10:41:42 2014
++++ openssl-1.0.1f/crypto/cryptlib.h   Thu Feb  6 16:04:16 2014
+@@ -104,6 +104,8 @@
+ void *OPENSSL_stderr(void);
+ extern int OPENSSL_NONPIC_relocated;
+ 
++void solaris_locking_setup();
++
+ #ifdef  __cplusplus
+ }
+ #endif
+--- openssl-1.0.1f/crypto/sparccpuid.S.~1~     Fri Feb  7 10:41:37 2014
++++ openssl-1.0.1f/crypto/sparccpuid.S Thu Feb  6 16:04:14 2014
+@@ -525,5 +525,7 @@
+ .size _sparcv9_vis1_instrument_bus2,.-_sparcv9_vis1_instrument_bus2
+
+ .section      ".init",#alloc,#execinstr
++      call    solaris_locking_setup
++      nop
+       call    OPENSSL_cpuid_setup
+       nop
+--- openssl-1.0.1f/crypto/x86_64cpuid.pl.~1~   Wed Feb 12 13:20:09 2014
++++ openssl-1.0.1f/crypto/x86_64cpuid.pl       Wed Feb 12 13:21:20 2014
+@@ -20,7 +20,10 @@
+ print<<___;
+ .extern               OPENSSL_cpuid_setup
+ .hidden               OPENSSL_cpuid_setup
++.extern               solaris_locking_setup
++.hidden               solaris_locking_setup
+ .section      .init
++      call    solaris_locking_setup
+       call    OPENSSL_cpuid_setup
+ 
+ .hidden       OPENSSL_ia32cap_P
+--- openssl-1.0.1f/crypto/x86cpuid.pl.~1~      Wed Feb 12 13:38:03 2014
++++ openssl-1.0.1f/crypto/x86cpuid.pl  Wed Feb 12 13:38:31 2014
+@@ -379,8 +379,10 @@
+       &ret    ();
+ &function_end_B("OPENSSL_ia32_rdseed");
+ 
++&initseg("solaris_locking_setup");
+ &initseg("OPENSSL_cpuid_setup");
+ 
++&hidden("solaris_locking_setup");
+ &hidden("OPENSSL_cpuid_setup");
+ &hidden("OPENSSL_ia32cap_P");
+ 

Added: csw/mgar/pkg/openssl1/trunk/files/032-aes_cbc_len_check.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/032-aes_cbc_len_check.patch               
                (rev 0)
+++ csw/mgar/pkg/openssl1/trunk/files/032-aes_cbc_len_check.patch       
2015-12-22 11:33:41 UTC (rev 25492)
@@ -0,0 +1,18 @@
+#
+# This was developed in house and reported to the upstream.
+#
+--- openssl-1.0.1e/crypto/evp/e_aes.c        Tue Jul  2 11:03:12 2013
++++ openssl-1.0.1e/crypto/evp/e_aes.c.new    Tue Jul  2 11:04:56 2013
+@@ -1016,8 +1016,12 @@
+ static int aes_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
+                           const unsigned char *in, size_t len)
+ {
++    size_t    bl = ctx->cipher->block_size;
+     EVP_AES_KEY *dat = (EVP_AES_KEY *) ctx->cipher_data;
+ 
++    if (len < bl)
++        return 1;
++
+     if (dat->stream.cbc)
+         (*dat->stream.cbc) (in, out, len, &dat->ks, ctx->iv, ctx->encrypt);
+     else if (ctx->encrypt)

Added: csw/mgar/pkg/openssl1/trunk/files/036-evp_leak.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/036-evp_leak.patch                        
        (rev 0)
+++ csw/mgar/pkg/openssl1/trunk/files/036-evp_leak.patch        2015-12-22 
11:33:41 UTC (rev 25492)
@@ -0,0 +1,144 @@
+Patch developed in-house.  Solaris-specific; not suitable for upstream.
+
+--- openssl-1.0.1f/crypto/evp/evp_enc.c.orig    Mon Feb 11 07:26:04 2013
++++ openssl-1.0.1f/crypto/evp/evp_enc.c    Mon Feb  3 16:40:48 2014
+@@ -392,11 +392,13 @@
+
+     if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
+         ret = M_do_cipher(ctx, out, NULL, 0);
+-        if (ret < 0)
+-            return 0;
+-        else
++        if (ret < 0) {
++            ret = 0;
++            goto cleanup;
++        } else
+             *outl = ret;
+-        return 1;
++        ret = 1;
++        goto cleanup;
+     }
+
+     b = ctx->cipher->block_size;
+@@ -403,7 +405,8 @@
+     OPENSSL_assert(b <= sizeof ctx->buf);
+     if (b == 1) {
+         *outl = 0;
+-        return 1;
++        ret = 1;
++        goto cleanup;
+     }
+     bl = ctx->buf_len;
+     if (ctx->flags & EVP_CIPH_NO_PADDING) {
+@@ -410,10 +413,12 @@
+         if (bl) {
+             EVPerr(EVP_F_EVP_ENCRYPTFINAL_EX,
+                    EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH);
+-            return 0;
++            ret = 0;
++            goto cleanup;
+         }
+         *outl = 0;
+-        return 1;
++        ret = 1;
++        goto cleanup;
+     }
+ 
+     n = b - bl;
+@@ -424,6 +429,11 @@
+     if (ret)
+         *outl = b;
+ 
++cleanup:
++    if (ctx->cipher->cleanup) {
++        ctx->cipher->cleanup(ctx);
++    }
++
+     return ret;
+ }
+ 
+@@ -491,6 +501,7 @@
+ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
+ {
+     int i, n;
++    int err = 1;
+     unsigned int b;
+     *outl = 0;
+ 
+@@ -496,11 +507,13 @@
+
+     if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
+         i = M_do_cipher(ctx, out, NULL, 0);
+-        if (i < 0)
+-            return 0;
+-        else
++        if (i < 0) {
++            err = 0;
++            goto cleanup;
++        } else
+             *outl = i;
+-        return 1;
++        err = 1;
++        goto cleanup;
+     }
+
+     b = ctx->cipher->block_size;
+@@ -508,10 +521,12 @@
+         if (ctx->buf_len) {
+             EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,
+                    EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH);
+-            return 0;
++            err = 0;
++            goto cleanup;
+         }
+         *outl = 0;
+-        return 1;
++        err = 1;
++        goto cleanup;
+     }
+     if (b > 1) {
+         if (ctx->buf_len || !ctx->final_used) {
+@@ -516,7 +531,8 @@
+     if (b > 1) {
+         if (ctx->buf_len || !ctx->final_used) {
+             EVPerr(EVP_F_EVP_DECRYPTFINAL_EX, EVP_R_WRONG_FINAL_BLOCK_LENGTH);
+-            return (0);
++            err = 0;
++            goto cleanup;
+         }
+         OPENSSL_assert(b <= sizeof ctx->final);
+ 
+@@ -527,7 +543,8 @@
+         n = ctx->final[b - 1];
+         if (n == 0 || n > (int)b) {
+             EVPerr(EVP_F_EVP_DECRYPTFINAL_EX, EVP_R_BAD_DECRYPT);
+-            return (0);
++            err = 0;
++            goto cleanup;
+         }
+         for (i = 0; i < n; i++) {
+             if (ctx->final[--b] != n) {
+@@ -532,7 +549,8 @@
+         for (i = 0; i < n; i++) {
+             if (ctx->final[--b] != n) {
+                 EVPerr(EVP_F_EVP_DECRYPTFINAL_EX, EVP_R_BAD_DECRYPT);
+-                return (0);
++                err = 0;
++                goto cleanup;
+             }
+         }
+         n = ctx->cipher->block_size - n;
+@@ -541,7 +559,12 @@
+         *outl = n;
+     } else
+         *outl = 0;
+-    return (1);
++    err = 1;
++cleanup:
++    if (ctx->cipher->cleanup) {
++        ctx->cipher->cleanup(ctx);
++    }
++    return err;
+ }
+ 
+ void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)

Added: csw/mgar/pkg/openssl1/trunk/files/039-internal_tests.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/039-internal_tests.patch                  
        (rev 0)
+++ csw/mgar/pkg/openssl1/trunk/files/039-internal_tests.patch  2015-12-22 
11:33:41 UTC (rev 25492)
@@ -0,0 +1,17 @@
+#
+# Patch developed in-house. Solaris-specific; not suitable for upstream.
+#
+# Remove test 'test_ca' because it depends on directories
+# not present in the build directory. The rest of tests are ok.
+#
+--- a/test/Makefile.orig       Thu Apr  2 12:11:12 2015
++++ b/test/Makefile    Thu Apr  2 12:11:21 2015
+@@ -146,7 +146,7 @@
+       test_rand test_bn test_ec test_ecdsa test_ecdh \
+       test_enc test_x509 test_rsa test_crl test_sid \
+       test_gen test_req test_pkcs7 test_verify test_dh test_dsa \
+-      test_ss test_ca test_engine test_evp test_evp_extra test_ssl test_tsa 
test_ige \
++      test_ss test_engine test_evp test_evp_extra test_ssl test_tsa test_ige \
+       test_jpake test_srp test_cms test_ocsp test_v3name test_heartbeat \
+       test_constant_time test_verify_extra test_clienthello
+ 

Added: csw/mgar/pkg/openssl1/trunk/files/040-uninitialized_ctx.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/040-uninitialized_ctx.patch               
                (rev 0)
+++ csw/mgar/pkg/openssl1/trunk/files/040-uninitialized_ctx.patch       
2015-12-22 11:33:41 UTC (rev 25492)
@@ -0,0 +1,14 @@
+#
+# This was developed in house.  Upstreadm notified (PR#277).
+#
+diff -ru  openssl-1.0.1m/crypto/evp/evp_enc.c 
openssl-1.0.1m/crypto/evp/evp_enc.c.new
+--- openssl-1.0.1m/crypto/evp/evp_enc.c Thu May  7 09:46:32 2015
++++ openssl-1.0.1m/crypto/evp/evp_enc.c.new     Thu May  7 09:46:23 2015
+@@ -185,6 +185,7 @@
+                 EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE);
+                 return 0;
+             }
++            (void) memset(ctx->cipher_data, 0, ctx->cipher->ctx_size);
+         } else {
+             ctx->cipher_data = NULL;
+         }

Added: csw/mgar/pkg/openssl1/trunk/files/043-x86_wrong_platform.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/043-x86_wrong_platform.patch              
                (rev 0)
+++ csw/mgar/pkg/openssl1/trunk/files/043-x86_wrong_platform.patch      
2015-12-22 11:33:41 UTC (rev 25492)
@@ -0,0 +1,15 @@
+#
+# This was developed in house to fix the wrong platform detection for Solaris.
+# Reported to the upstream.
+#
+--- openssl-1.0.2d/crypto/perlasm/x86gas.pl    Thu Jul  9 04:57:15 2015
++++ openssl-1.0.2d/crypto/perlasm/x86gas.pl.new        Thu Jul 30 15:17:14 2015
+@@ -196,8 +196,6 @@
+           &::mov($dst,&::DWP("$indirect-$reflabel",$base));
+           $non_lazy_ptr{"$nmdecor$sym"}=$indirect;
+       }
+-      elsif ($sym eq "OPENSSL_ia32cap_P" && $::elf>0)
+-      {   &::lea($dst,&::DWP("$sym-$reflabel",$base));   }
+       else
+       {   &::lea($dst,&::DWP("_GLOBAL_OFFSET_TABLE_+[.-$reflabel]",
+                           $base));

Added: csw/mgar/pkg/openssl1/trunk/files/044-suppress_v8plus_abi_warnings.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/044-suppress_v8plus_abi_warnings.patch    
                        (rev 0)
+++ csw/mgar/pkg/openssl1/trunk/files/044-suppress_v8plus_abi_warnings.patch    
2015-12-22 11:33:41 UTC (rev 25492)
@@ -0,0 +1,70 @@
+#
+# Patch developed in-house. Solaris-specific; not suitable for upstream.
+#
+# Suppress warnings about sparcv8+ ABI violation
+# when building T4-specific modules as 32-bit:
+#    v8+ ABI violation: illegal use of %i or %l register as rs1 in "brnz,a" 
instruction
+# This has been confirmed as a valid usecase and is thus intentional.
+#
+--- a/crypto/aes/Makefile.orig čt dub 30 03:15:03 2015
++++ b/crypto/aes/Makefile      čt dub 30 03:19:32 2015
+@@ -75,6 +75,9 @@
+ aest4-sparcv9.s: asm/aest4-sparcv9.pl ../perlasm/sparcv9_modes.pl
+       $(PERL) asm/aest4-sparcv9.pl $(CFLAGS) > $@
+ 
++aest4-sparcv9.o: aest4-sparcv9.s
++      $(AS) $(ASFLAGS) -Wa,-n -o $@ $^
++
+ aes-ppc.s:    asm/aes-ppc.pl
+       $(PERL) asm/aes-ppc.pl $(PERLASM_SCHEME) $@
+ vpaes-ppc.s:  asm/vpaes-ppc.pl
+--- a/crypto/sha/Makefile.orig čt dub 30 14:37:32 2015
++++ b/crypto/sha/Makefile      čt dub 30 14:40:49 2015
+@@ -73,6 +73,8 @@
+ sha1-sparcv9.S:       asm/sha1-sparcv9.pl;    $(PERL) asm/sha1-sparcv9.pl $@ 
$(CFLAGS)
+ sha256-sparcv9.S:asm/sha512-sparcv9.pl;       $(PERL) asm/sha512-sparcv9.pl 
$@ $(CFLAGS)
+ sha512-sparcv9.S:asm/sha512-sparcv9.pl;       $(PERL) asm/sha512-sparcv9.pl 
$@ $(CFLAGS)
++sha512-sparcv9.o: sha512-sparcv9.S
++      $(CC) $(CFLAGS) -Wa,-n -c -o $@ $^
+ 
+ sha1-ppc.s:   asm/sha1-ppc.pl;        $(PERL) asm/sha1-ppc.pl 
$(PERLASM_SCHEME) $@
+ sha256-ppc.s: asm/sha512-ppc.pl;      $(PERL) asm/sha512-ppc.pl 
$(PERLASM_SCHEME) $@
+--- a/crypto/bn/Makefile.orig  čt dub 30 14:43:20 2015
++++ b/crypto/bn/Makefile       čt dub 30 14:45:11 2015
+@@ -79,8 +79,12 @@
+       $(PERL) asm/sparcv9-mont.pl $(CFLAGS) > $@
+ vis3-mont.s:          asm/vis3-mont.pl
+       $(PERL) asm/vis3-mont.pl $(CFLAGS) > $@
++vis3-mont.o:  vis3-mont.s
++      $(AS) $(ASFLAGS) -Wa,-n -o $@ $^
+ sparct4-mont.S:       asm/sparct4-mont.pl
+       $(PERL) asm/sparct4-mont.pl $(CFLAGS) > $@
++sparct4-mont.o:       sparct4-mont.S
++      $(CC) $(CFLAGS) -Wa,-n -c -o $@ $^
+ sparcv9-gf2m.S:       asm/sparcv9-gf2m.pl
+       $(PERL) asm/sparcv9-gf2m.pl $(CFLAGS) > $@
+ 
+--- a/crypto/camellia/Makefile.orig        Fri Aug 21 14:51:49 
2015rypto/camellia/Makef
++++ b/crypto/camellia/Makefile     Fri Aug 21 14:53:18 
2015.2d/crypto/camellia/Make
+@@ -51,6 +51,9 @@
+ cmllt4-sparcv9.s: asm/cmllt4-sparcv9.pl ../perlasm/sparcv9_modes.pl
+       $(PERL) asm/cmllt4-sparcv9.pl $(CFLAGS) > $@
+ 
++cmllt4-sparcv9.o: cmllt4-sparcv9.s
++      $(AS) $(ASFLAGS) -Wa,-n -o $@ $^
++
+ files:
+       $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
+ 
+--- a/crypto/modes/Makefile.orig       Fri Aug 21 15:22:37 2015
++++ b/crypto/modes/Makefile    Fri Aug 21 15:26:12 2015
+@@ -54,6 +54,9 @@
+       $(PERL) asm/aesni-gcm-x86_64.pl $(PERLASM_SCHEME) > $@
+ ghash-sparcv9.s:      asm/ghash-sparcv9.pl
+       $(PERL) asm/ghash-sparcv9.pl $@ $(CFLAGS)
++ghash-sparcv9.o:      ghash-sparcv9.s
++      $(AS) $(ASFLAGS) -Wa,-n -o $@ $^
++
+ ghash-alpha.s:        asm/ghash-alpha.pl
+       ([email protected]; trap "rm $$preproc" INT; \
+       $(PERL) asm/ghash-alpha.pl > $$preproc && \

Modified: csw/mgar/pkg/openssl1/trunk/files/c_rehash-compat.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/c_rehash-compat.patch     2015-12-21 
22:56:07 UTC (rev 25491)
+++ csw/mgar/pkg/openssl1/trunk/files/c_rehash-compat.patch     2015-12-22 
11:33:41 UTC (rev 25492)
@@ -7,30 +7,50 @@
  tools/c_rehash.in |    8 +++++++-
  1 files changed, 7 insertions(+), 1 deletions(-)
 
-Index: openssl-1.0.0d/tools/c_rehash.in
+Index: openssl-1.0.2b/tools/c_rehash.in
 ===================================================================
---- openssl-1.0.0d.orig/tools/c_rehash.in      2011-04-13 20:41:28.000000000 
+0000
-+++ openssl-1.0.0d/tools/c_rehash.in   2011-04-13 20:41:28.000000000 +0000
-@@ -86,6 +86,7 @@
-                       }
+--- openssl-1.0.2b.orig/tools/c_rehash.in
++++ openssl-1.0.2b/tools/c_rehash.in
+@@ -8,8 +8,6 @@ my $prefix;
+ 
+ my $openssl = $ENV{OPENSSL} || "openssl";
+ my $pwd;
+-my $x509hash = "-subject_hash";
+-my $crlhash = "-hash";
+ my $verbose = 0;
+ my $symlink_exists=eval {symlink("",""); 1};
+ my $removelinks = 1;
+@@ -18,10 +16,7 @@ my $removelinks = 1;
+ while ( $ARGV[0] =~ /^-/ ) {
+     my $flag = shift @ARGV;
+     last if ( $flag eq '--');
+-    if ( $flag eq '-old') {
+-          $x509hash = "-subject_hash_old";
+-          $crlhash = "-hash_old";
+-    } elsif ( $flag eq '-h') {
++    if ( $flag eq '-h') {
+           help();
+     } elsif ( $flag eq '-n' ) {
+           $removelinks = 0;
+@@ -113,7 +108,9 @@ sub hash_dir {
+                       next;
                }
                link_hash_cert($fname) if($cert);
 +              link_hash_cert_old($fname) if($cert);
                link_hash_crl($fname) if($crl);
++              link_hash_crl_old($fname) if($crl);
        }
  }
-@@ -119,8 +120,9 @@
  
+@@ -146,6 +143,7 @@ sub check_file {
+ 
  sub link_hash_cert {
                my $fname = $_[0];
-+              my $hashopt = $_[1] || '-subject_hash';
++              my $x509hash = $_[1] || '-subject_hash';
                $fname =~ s/'/'\\''/g;
--              my ($hash, $fprint) = `"$openssl" x509 -hash -fingerprint 
-noout -in "$fname"`;
-+              my ($hash, $fprint) = `"$openssl" x509 $hashopt -fingerprint 
-noout -in "$fname"`;
+               my ($hash, $fprint) = `"$openssl" x509 $x509hash -fingerprint 
-noout -in "$fname"`;
                chomp $hash;
-               chomp $fprint;
-               $fprint =~ s/^.*=//;
-@@ -150,6 +152,10 @@
+@@ -177,10 +175,20 @@ sub link_hash_cert {
                $hashlist{$hash} = $fprint;
  }
  
@@ -38,6 +58,16 @@
 +              link_hash_cert($_[0], '-subject_hash_old');
 +}
 +
++sub link_hash_crl_old {
++              link_hash_crl($_[0], '-hash_old');
++}
++
++
  # Same as above except for a CRL. CRL links are of the form <hash>.r<n>
  
  sub link_hash_crl {
+               my $fname = $_[0];
++              my $crlhash = $_[1] || "-hash";
+               $fname =~ s/'/'\\''/g;
+               my ($hash, $fprint) = `"$openssl" crl $crlhash -fingerprint 
-noout -in '$fname'`;
+               chomp $hash;

Deleted: csw/mgar/pkg/openssl1/trunk/files/fix-test-failure.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/fix-test-failure.patch    2015-12-21 
22:56:07 UTC (rev 25491)
+++ csw/mgar/pkg/openssl1/trunk/files/fix-test-failure.patch    2015-12-22 
11:33:41 UTC (rev 25492)
@@ -1,14 +0,0 @@
---- ./ssl/t1_lib.c     2010/11/16 13:26:24     1.64.2.15
-+++ ./ssl/t1_lib.c     2010/11/16 22:41:07     1.64.2.16
-@@ -779,8 +779,8 @@
-                               {
-                               if(s->session->tlsext_ecpointformatlist)
-                                       {
--                                      *al = TLS1_AD_DECODE_ERROR;
--                                      return 0;
-+                                      
OPENSSL_free(s->session->tlsext_ecpointformatlist);
-+                                      s->session->tlsext_ecpointformatlist = 
NULL;
-                                       }
-                               s->session->tlsext_ecpointformatlist_length = 0;
-                               if ((s->session->tlsext_ecpointformatlist = 
OPENSSL_malloc(ecpointformatlist_length)) == NULL)
-

Modified: csw/mgar/pkg/openssl1/trunk/files/map.openssl.libcrypto
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/map.openssl.libcrypto     2015-12-21 
22:56:07 UTC (rev 25491)
+++ csw/mgar/pkg/openssl1/trunk/files/map.openssl.libcrypto     2015-12-22 
11:33:41 UTC (rev 25492)
@@ -3709,7 +3709,6 @@
                CRYPTO_ccm128_aad = DIRECT;
                CRYPTO_gcm128_init = DIRECT;
                CRYPTO_gcm128_decrypt = DIRECT;
-               ENGINE_load_rsax = DIRECT;
                CRYPTO_gcm128_decrypt_ctr32 = DIRECT;
                CRYPTO_gcm128_encrypt_ctr32 = DIRECT;
                CRYPTO_gcm128_finish = DIRECT;
@@ -3739,3 +3738,38 @@
                CRYPTO_memcmp = DIRECT;
 } OPENSSL_1.0.1;               
 
+OPENSSL_1.0.2 {
+       global:
+                X509_chain_up_ref = DIRECT;
+                X509_chain_check_suiteb = DIRECT;
+                X509_get_signature_nid = DIRECT;
+                EVP_aes_256_cbc_hmac_sha256 = DIRECT;
+                EVP_aes_128_cbc_hmac_sha256 = DIRECT;
+                EC_curve_nist2nid  = DIRECT;
+               X509_check_email = DIRECT;
+               EVP_aes_128_wrap = DIRECT;
+               X509_VERIFY_PARAM_set1_ip_asc = DIRECT;
+               X509_check_ip_asc = DIRECT;
+               EVP_des_ede3_wrap = DIRECT;
+               X509_STORE_set_lookup_crls_cb = DIRECT;
+               X509_http_nbio = DIRECT;
+               EC_curve_nid2nist = DIRECT;
+               X509_VERIFY_PARAM_set1_email = DIRECT;
+               X509_CRL_http_nbio = DIRECT;
+               CMS_RecipientInfo_get0_pkey_ctx = DIRECT;
+               CMS_RecipientInfo_kari_get0_ctx = DIRECT;
+               EVP_aes_192_wrap = DIRECT;
+               ASN1_TIME_diff = DIRECT;
+               X509_check_host = DIRECT;
+               EVP_aes_256_wrap = DIRECT;
+               OCSP_REQ_CTX_http = DIRECT;
+               CMS_SignerInfo_get0_pkey_ctx = DIRECT;
+               X509_CRL_diff = DIRECT;
+               OCSP_REQ_CTX_new = DIRECT;
+               X509_VERIFY_PARAM_set1_host = DIRECT;
+               PEM_write_bio_DHxparams = DIRECT;
+               DH_get_1024_160 = DIRECT;
+               DH_get_2048_256 = DIRECT;
+               DH_get_2048_224 = DIRECT;
+} OPENSSL_1.0.1d; 
+

Modified: csw/mgar/pkg/openssl1/trunk/files/map.openssl.libssl
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/map.openssl.libssl        2015-12-21 
22:56:07 UTC (rev 25491)
+++ csw/mgar/pkg/openssl1/trunk/files/map.openssl.libssl        2015-12-22 
11:33:41 UTC (rev 25492)
@@ -292,3 +292,31 @@
 
 } OPENSSL_1.0.0;
 
+OPENSSL_1.0.2 {
+       global:
+               SSL_CONF_CTX_set_ssl_ctx = DIRECT;
+               SSL_CONF_CTX_free = DIRECT;
+               SSL_get_shared_sigalgs  = DIRECT;
+               SSL_check_chain = DIRECT;
+               SSL_CONF_CTX_set_flags = DIRECT;
+               SSL_CTX_set_alpn_protos = DIRECT;
+               SSL_CONF_cmd = DIRECT;
+               SSL_CIPHER_find = DIRECT;
+               SSL_get0_alpn_selected = DIRECT;
+               SSL_certs_clear = DIRECT;
+               SSL_CONF_CTX_new = DIRECT;
+               SSL_get_sigalgs = DIRECT;
+               SSL_CONF_cmd_argv = DIRECT;
+               SSL_CTX_use_serverinfo_file = DIRECT;
+               SSL_is_server = DIRECT;
+               SSL_CTX_add_client_custom_ext = DIRECT;
+               SSL_CTX_set_cert_cb = DIRECT;
+               SSL_CTX_set_alpn_select_cb = DIRECT;
+               SSL_CONF_CTX_finish = DIRECT;
+               DTLSv1_2_client_method = DIRECT;
+               DTLSv1_2_server_method = DIRECT;
+               DTLS_client_method = DIRECT;
+               DTLS_server_method = DIRECT;
+               DTLSv1_2_method = DIRECT;
+               SSL_CTX_add_server_custom_ext = DIRECT;
+} OPENSSL_1.0.1;

Deleted: csw/mgar/pkg/openssl1/trunk/files/more_configure_targets.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/more_configure_targets.patch      
2015-12-21 22:56:07 UTC (rev 25491)
+++ csw/mgar/pkg/openssl1/trunk/files/more_configure_targets.patch      
2015-12-22 11:33:41 UTC (rev 25492)
@@ -1,18 +0,0 @@
-diff --speed-large-files --minimal -Nru ./Configure.old ./Configure
---- ./Configure.old    2015-03-20 22:50:04.861332664 +0100
-+++ ./Configure        2015-03-20 22:50:09.224641344 +0100
-@@ -267,6 +267,14 @@
- # to discard unused sections and files when linking wanboot-openssl.o
- "solaris64-sparcv9-cc-sunw-wanboot","cc:-xtarget=ultra -m64 -Qoption cg 
-xregs=no%appl -xO5 -xstrconst -xdepend -xspace -xF=%all -Xa 
-DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl:BN_LLONG RC4_CHUNK DES_INT 
DES_PTR DES_RISC1 DES_UNROLL 
BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-m64 -G -dy -z text -zdefs 
-Bdirect -zignore 
-M/usr/lib/ld/map.pagealign:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar 
rs::/64",
- 
-+#### More configure targets for Opencsw build
-+"solaris-x86-pentium_pro-cc-sunw","cc:-m32 -xarch=pentium_pro -xO3 -xspace 
-Xa::-D_REENTRANT::-lsocket -lnsl -lc:BN_LLONG RC4_CHUNK DES_PTR DES_UNROLL 
BF_PTR:${x86_elf_asm}:dlfcn:solaris-shared:-KPIC:-m32 -G -dy -z text -zdefs 
-Bdirect -zignore -M/usr/lib/ld/map.pagealign 
-M/usr/lib/ld/map.noexdata:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-+#
-+"solaris-sparcv8-cc-sunw","cc:-xtarget=v8 -m32 -Qoption cg -xregs=no%appl 
-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN 
-DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -lc:BN_LLONG RC4_CHUNK_LL 
DES_PTR DES_RISC1 DES_UNROLL 
BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-m32 -G -dy -z text -zdefs 
-Bdirect -zignore 
-M/usr/lib/ld/map.pagealign:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-+#
-+"solaris-sparcv9+vis-cc-sunw","cc:-xtarget=ultra -m32 -xarch=sparcvis 
-Qoption cg -xregs=no%appl -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN 
-DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -lc:BN_LLONG RC4_CHUNK_LL 
DES_PTR DES_RISC1 DES_UNROLL 
BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-m32 -G -dy -z text -zdefs 
-Bdirect -zignore 
-M/usr/lib/ld/map.pagealign:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-+
-+
- #### IRIX 5.x configs
- # -mips2 flag is added by ./config when appropriate.
- "irix-gcc","gcc:-O3 -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX 
RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR 
BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",

Deleted: csw/mgar/pkg/openssl1/trunk/files/more_configure_targets.patch.SunOS5.9
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/more_configure_targets.patch.SunOS5.9     
2015-12-21 22:56:07 UTC (rev 25491)
+++ csw/mgar/pkg/openssl1/trunk/files/more_configure_targets.patch.SunOS5.9     
2015-12-22 11:33:41 UTC (rev 25492)
@@ -1,18 +0,0 @@
-diff --speed-large-files --minimal -Nru ./Configure.old ./Configure
---- ./Configure.old    2015-03-20 22:50:04.861332664 +0100
-+++ ./Configure        2015-03-20 22:50:09.224641344 +0100
-@@ -267,6 +267,14 @@
- # to discard unused sections and files when linking wanboot-openssl.o
- "solaris64-sparcv9-cc-sunw-wanboot","cc:-xtarget=ultra -m64 -Qoption cg 
-xregs=no%appl -xO5 -xstrconst -xdepend -xspace -xF=%all -Xa 
-DB_ENDIAN::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl:BN_LLONG RC4_CHUNK DES_INT 
DES_PTR DES_RISC1 DES_UNROLL 
BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-m64 -G -dy -z text -zdefs 
-Bdirect -zignore 
-M/usr/lib/ld/map.pagealign:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):/usr/ccs/bin/ar 
rs::/64",
- 
-+#### More configure targets for Opencsw build
-+"solaris-x86-pentium_pro-cc-sunw","cc:-m32 -xarch=pentium_pro -xO3 -xspace 
-Xa::-D_REENTRANT::-lsocket -lnsl -lc:BN_LLONG RC4_CHUNK DES_PTR DES_UNROLL 
BF_PTR:${x86_elf_asm}:dlfcn:solaris-shared:-KPIC:-m32 -G -dy -z text -zdefs 
-Bdirect -zignore:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-+#
-+"solaris-sparcv8-cc-sunw","cc:-xarch=v8 -m32 -xregs=no%appl -xO5 -xstrconst 
-xdepend -Xa -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl 
-lc:BN_LLONG RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL 
BF_PTR:${sparcv8_asm}:dlfcn:solaris-shared:-KPIC:-m32 -G -dy -z text -zdefs 
-Bdirect -zignore:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-+#
-+"solaris-sparcv9+vis-cc-sunw","cc:-xtarget=ultra -m32 -xarch=sparcvis 
-xregs=no%appl -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN 
-DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -lc:BN_LLONG RC4_CHUNK_LL 
DES_PTR DES_RISC1 DES_UNROLL 
BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-m32 -G -dy -z text -zdefs 
-Bdirect -zignore:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-+
-+
- #### IRIX 5.x configs
- # -mips2 flag is added by ./config when appropriate.
- "irix-gcc","gcc:-O3 -DB_ENDIAN::(unknown):::BN_LLONG MD2_CHAR RC4_INDEX 
RC4_CHAR RC4_CHUNK DES_UNROLL DES_RISC2 DES_PTR 
BF_PTR:${mips32_asm}:o32:dlfcn:irix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",

Deleted: 
csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1e-t4-engine-sparcv9+vis.sparc.5.11.patch
===================================================================
--- 
csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1e-t4-engine-sparcv9+vis.sparc.5.11.patch
     2015-12-21 22:56:07 UTC (rev 25491)
+++ 
csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1e-t4-engine-sparcv9+vis.sparc.5.11.patch
     2015-12-22 11:33:41 UTC (rev 25492)
@@ -1,25 +0,0 @@
-From 3b63574c8a3ba589f9a69bece6931a22a73675d2 Mon Sep 17 00:00:00 2001
-From: Yann Rouillard <[email protected]>
-Date: Mon, 11 Mar 2013 23:41:45 +0100
-Subject: [PATCH] t4 engine complement patch for sparcv9+vis target
-
----
- Configure | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Configure b/Configure
-index 3f32e5a..e3bf481 100755
---- a/Configure
-+++ b/Configure
-@@ -278,7 +278,7 @@ my %table=(
- #
- "solaris-sparcv8-cc-sunw","cc:-xtarget=v8 -m32 -Qoption cg -xregs=no%appl 
-xO5 -xstrconst -xdepend -Xa -DB_ENDIAN 
-DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -lc:BN_LLONG RC4_CHUNK_LL 
DES_PTR DES_RISC1 DES_UNROLL 
BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-m32 -G -dy -z text -zdefs 
-Bdirect -zignore 
-M/usr/lib/ld/map.pagealign:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
- #
--"solaris-sparcv9+vis-cc-sunw","cc:-xtarget=ultra -m32 -xarch=sparcvis 
-Qoption cg -xregs=no%appl -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN 
-DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -lc:BN_LLONG RC4_CHUNK_LL 
DES_PTR DES_RISC1 DES_UNROLL 
BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-m32 -G -dy -z text -zdefs 
-Bdirect -zignore 
-M/usr/lib/ld/map.pagealign:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-+"solaris-sparcv9+vis-cc-sunw","cc:-xtarget=ultra -m32 -xarch=sparcvis 
-Qoption cg -xregs=no%appl -xO5 -xstrconst -xdepend -Xa -DB_ENDIAN 
-DBN_DIV2W::-D_REENTRANT:ULTRASPARC:-lsocket -lnsl -lc -lsoftcrypto:BN_LLONG 
RC4_CHUNK_LL DES_PTR DES_RISC1 DES_UNROLL 
BF_PTR:${sparcv9_asm}:dlfcn:solaris-shared:-KPIC:-m32 -G -dy -z text -zdefs 
-Bdirect -zignore 
-M/usr/lib/ld/map.pagealign:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
- 
- 
- #### IRIX 5.x configs
--- 
-1.8.1.4
-

Deleted: 
csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1f-t4-engine.sparc.5.11.patch
===================================================================
--- csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1f-t4-engine.sparc.5.11.patch 
2015-12-21 22:56:07 UTC (rev 25491)
+++ csw/mgar/pkg/openssl1/trunk/files/openssl-1.0.1f-t4-engine.sparc.5.11.patch 
2015-12-22 11:33:41 UTC (rev 25492)
@@ -1,7882 +0,0 @@
-#
-# This file adds inline T4 instruction support to OpenSSL upstream code.
-#
-Index: Configure
-===================================================================
-diff -ru openssl-1.0.1e/Configure openssl-1.0.1e/Configure
---- openssl-1.0.1e/Configure 2011-05-24 17:02:24.000000000 -0700
-+++ openssl-1.0.1e/Configure 2011-07-27 10:48:17.817470000 -0700
-@@ -135,7 +135,7 @@
-
- my $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o x86_64-mont5.o 
x86_64-gf2m.o modexp512-x86_64.o::aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o 
aesni-x86_64.o aesni-sha1-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o 
sha512-x86_64.o::rc4-x86_64.o rc4-md5-x86_64.o:::wp-x86_64.o:cmll-x86_64.o 
cmll_misc.o:ghash-x86_64.o:";
- my $ia64_asm="ia64cpuid.o:bn-ia64.o ia64-mont.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:::::ghash-ia64.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:::::::ghash-sparcv9.o::void";
-+my $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o 
sparcv9a-mont.o vis3-mont.o sparct4-mont.o sparcv9-gf2m.o:des_enc-sparc.o 
fcrypt_b.o dest4-sparcv9.o:aes_core.o aes_cbc.o aes-sparcv9.o 
aest4-sparcv9.o::md5-sparcv9.o:sha1-sparcv9.o sha256-sparcv9.o 
sha512-sparcv9.o:::::::ghash-sparcv9.o::void";
- my $sparcv8_asm=":sparcv8.o:des_enc-sparc.o fcrypt_b.o:::::::::::::void";
- my $alpha_asm="alphacpuid.o:bn_asm.o 
alpha-mont.o:::::sha1-alpha.o:::::::ghash-alpha.o::void";
- my $mips32_asm=":bn-mips.o::aes_cbc.o aes-mips.o:::sha1-mips.o 
sha256-mips.o::::::::";
-Index: crypto/sparccpuid.S
-===================================================================
-diff -ru openssl-1.0.1e/crypto/sparccpuid.S openssl-1.0.1e/crypto/sparccpuid.S
---- openssl-1.0.1e/crypto/sparccpuid.S 2011-05-24 17:02:24.000000000 -0700
-+++ openssl-1.0.1e/crypto/sparccpuid.S 2011-07-27 10:48:17.817470000 -0700
-@@ -1,3 +1,7 @@
-+#ifdef OPENSSL_FIPSCANISTER
-+#include <openssl/fipssyms.h>
-+#endif
-+
- #if defined(__SUNPRO_C) && defined(__sparcv9)
- # define ABI64  /* They've said -xarch=v9 at command line */
- #elif defined(__GNUC__) && defined(__arch64__)
-@@ -123,7 +127,7 @@
-                       fmovs   %f1,%f3
-                       fmovs   %f0,%f2
- 
--      add     %fp,BIAS,%i0    ! return pointer to caller\xB4s top of stack
-+      add     %fp,BIAS,%i0    ! return pointer to caller?s top of stack
- 
-       ret
-       restore
-@@ -235,10 +239,10 @@
- .global       _sparcv9_vis1_probe
- .align        8
- _sparcv9_vis1_probe:
-+      .word   0x81b00d80      !fxor   %f0,%f0,%f0
-       add     %sp,BIAS+2,%o1
--      .word   0xc19a5a40      !ldda   [%o1]ASI_FP16_P,%f0
-       retl
--      .word   0x81b00d80      !fxor   %f0,%f0,%f0
-+      .word   0xc19a5a40      !ldda   [%o1]ASI_FP16_P,%f0
- .type _sparcv9_vis1_probe,#function
- .size _sparcv9_vis1_probe,.-_sparcv9_vis1_probe
- 
-@@ -251,7 +255,12 @@
- !     UltraSPARC IIe          7
- !     UltraSPARC III          7
- !     UltraSPARC T1           24
-+!     SPARC T4                65(*)
- !
-+! (*) result has lesser to do with VIS instruction latencies, rdtick
-+!     appears that slow, but it does the trick in sense that FP and
-+!     VIS code paths are still slower than integer-only ones.
-+!
- ! Numbers for T2 and SPARC64 V-VII are more than welcomed.
- !
- ! It would be possible to detect specifically US-T1 by instrumenting
-@@ -260,6 +269,8 @@
- .global       _sparcv9_vis1_instrument
- .align        8
- _sparcv9_vis1_instrument:
-+      .word   0x81b00d80      !fxor   %f0,%f0,%f0
-+      .word   0x85b08d82      !fxor   %f2,%f2,%f2
-       .word   0x91410000      !rd     %tick,%o0
-       .word   0x81b00d80      !fxor   %f0,%f0,%f0
-       .word   0x85b08d82      !fxor   %f2,%f2,%f2
-@@ -314,6 +325,30 @@
- .type _sparcv9_fmadd_probe,#function
- .size _sparcv9_fmadd_probe,.-_sparcv9_fmadd_probe
- 
-+.global       _sparcv9_rdcfr
-+.align        8
-+_sparcv9_rdcfr:
-+      retl
-+      .word   0x91468000      !rd     %asr26,%o0
-+.type _sparcv9_rdcfr,#function
-+.size _sparcv9_rdcfr,.-_sparcv9_rdcfr
-+
-+.global       _sparcv9_vis3_probe
-+.align        8
-+_sparcv9_vis3_probe:
-+      retl
-+      .word   0x81b022a0      !xmulx  %g0,%g0,%g0
-+.type _sparcv9_vis3_probe,#function
-+.size _sparcv9_vis3_probe,.-_sparcv9_vis3_probe
-+
-+.global       _sparcv9_random
-+.align        8
-+_sparcv9_random:
-+      retl
-+      .word   0x91b002a0      !random %o0
-+.type _sparcv9_random,#function
-+.size _sparcv9_random,.-_sparcv9_vis3_probe
-+
- .global       OPENSSL_cleanse
- .align        32
- OPENSSL_cleanse:
-@@ -398,6 +433,102 @@
- .size OPENSSL_cleanse,.-OPENSSL_cleanse
- 
- #ifndef _BOOT
-+.global       _sparcv9_vis1_instrument_bus
-+.align        8
-+_sparcv9_vis1_instrument_bus:
-+      mov     %o1,%o3                                 ! save cnt
-+      .word   0x99410000      !rd     %tick,%o4       ! tick
-+      mov     %o4,%o5                                 ! lasttick = tick
-+      set     0,%g4                                   ! diff
-+
-+      andn    %o0,63,%g1
-+      .word   0xc1985e00      !ldda   [%g1]0xf0,%f0   ! block load
-+      .word   0x8143e040      !membar #Sync
-+      .word   0xc1b85c00      !stda   %f0,[%g1]0xe0   ! block store and commit
-+      .word   0x8143e040      !membar #Sync
-+      ld      [%o0],%o4
-+      add     %o4,%g4,%g4
-+      .word   0xc9e2100c      !cas    [%o0],%o4,%g4
-+
-+.Loop:        .word   0x99410000      !rd     %tick,%o4
-+      sub     %o4,%o5,%g4                             ! diff=tick-lasttick
-+      mov     %o4,%o5                                 ! lasttick=tick
-+
-+      andn    %o0,63,%g1
-+      .word   0xc1985e00      !ldda   [%g1]0xf0,%f0   ! block load
-+      .word   0x8143e040      !membar #Sync
-+      .word   0xc1b85c00      !stda   %f0,[%g1]0xe0   ! block store and commit
-+      .word   0x8143e040      !membar #Sync
-+      ld      [%o0],%o4
-+      add     %o4,%g4,%g4
-+      .word   0xc9e2100c      !cas    [%o0],%o4,%g4
-+      subcc   %o1,1,%o1                               ! --$cnt
-+      bnz     .Loop
-+      add     %o0,4,%o0                               ! ++$out
-+
-+      retl
-+      mov     %o3,%o0
-+.type _sparcv9_vis1_instrument_bus,#function
-+.size _sparcv9_vis1_instrument_bus,.-_sparcv9_vis1_instrument_bus
-+
-+.global       _sparcv9_vis1_instrument_bus2
-+.align        8
-+_sparcv9_vis1_instrument_bus2:
-+      mov     %o1,%o3                                 ! save cnt
-+      sll     %o1,2,%o1                               ! cnt*=4
-+
-+      .word   0x99410000      !rd     %tick,%o4       ! tick
-+      mov     %o4,%o5                                 ! lasttick = tick
-+      set     0,%g4                                   ! diff
-+
-+      andn    %o0,63,%g1
-+      .word   0xc1985e00      !ldda   [%g1]0xf0,%f0   ! block load
-+      .word   0x8143e040      !membar #Sync
-+      .word   0xc1b85c00      !stda   %f0,[%g1]0xe0   ! block store and commit
-+      .word   0x8143e040      !membar #Sync
-+      ld      [%o0],%o4
-+      add     %o4,%g4,%g4
-+      .word   0xc9e2100c      !cas    [%o0],%o4,%g4
-+
-+      .word   0x99410000      !rd     %tick,%o4       ! tick
-+      sub     %o4,%o5,%g4                             ! diff=tick-lasttick
-+      mov     %o4,%o5                                 ! lasttick=tick
-+      mov     %g4,%g5                                 ! lastdiff=diff
-+.Loop2:
-+      andn    %o0,63,%g1
-+      .word   0xc1985e00      !ldda   [%g1]0xf0,%f0   ! block load
-+      .word   0x8143e040      !membar #Sync
-+      .word   0xc1b85c00      !stda   %f0,[%g1]0xe0   ! block store and commit
-+      .word   0x8143e040      !membar #Sync
-+      ld      [%o0],%o4
-+      add     %o4,%g4,%g4
-+      .word   0xc9e2100c      !cas    [%o0],%o4,%g4
-+
-+      subcc   %o2,1,%o2                               ! --max
-+      bz      .Ldone2
-+      nop
-+
-+      .word   0x99410000      !rd     %tick,%o4       ! tick
-+      sub     %o4,%o5,%g4                             ! diff=tick-lasttick
-+      mov     %o4,%o5                                 ! lasttick=tick
-+      cmp     %g4,%g5
-+      mov     %g4,%g5                                 ! lastdiff=diff
-+
-+      .word   0x83408000      !rd     %ccr,%g1
-+      and     %g1,4,%g1                               ! isolate zero flag
-+      xor     %g1,4,%g1                               ! flip zero flag
-+
-+      subcc   %o1,%g1,%o1                             ! conditional --$cnt
-+      bnz     .Loop2
-+      add     %o0,%g1,%o0                             ! conditional ++$out
-+
-+.Ldone2:
-+      srl     %o1,2,%o1
-+      retl
-+      sub     %o3,%o1,%o0
-+.type _sparcv9_vis1_instrument_bus2,#function
-+.size _sparcv9_vis1_instrument_bus2,.-_sparcv9_vis1_instrument_bus2
-+
- .section      ".init",#alloc,#execinstr
-       call    OPENSSL_cpuid_setup
-       nop
-Index: crypto/sparcv9cap.c
-===================================================================
-diff -ru openssl-1.0.1e/crypto/sparcv9cap.c openssl-1.0.1e/crypto/sparcv9cap.c
---- openssl-1.0.1e/crypto/sparcv9cap.c 2011-05-24 17:02:24.000000000 -0700
-+++ openssl-1.0.1e/crypto/sparcv9cap.c 2011-07-27 10:48:17.817470000 -0700
-@@ -4,31 +4,55 @@
- #include <setjmp.h>
- #include <signal.h>
- #include <sys/time.h>
-+#include <unistd.h>
- #include <openssl/bn.h>
- 
--#define SPARCV9_TICK_PRIVILEGED       (1<<0)
--#define SPARCV9_PREFER_FPU    (1<<1)
--#define SPARCV9_VIS1          (1<<2)
--#define SPARCV9_VIS2          (1<<3)  /* reserved */
--#define SPARCV9_FMADD         (1<<4)  /* reserved for SPARC64 V */
-+#include "sparc_arch.h"
- 
-+#if defined(__GNUC__) && defined(__linux)
-+__attribute__((visibility("hidden")))
-+#endif
- #ifndef       _BOOT
--static int OPENSSL_sparcv9cap_P=SPARCV9_TICK_PRIVILEGED;
-+unsigned int OPENSSL_sparcv9cap_P[2]={SPARCV9_TICK_PRIVILEGED,0};
- #else
--static int OPENSSL_sparcv9cap_P = SPARCV9_VIS1;
-+unsigned int OPENSSL_sparcv9cap_P[2]={SPARCV9_VIS1,0};
- #endif
- 
- int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const 
BN_ULONG *np,const BN_ULONG *n0, int num)
-       {
-+      int bn_mul_mont_vis3(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG 
*bp, const BN_ULONG *np,const BN_ULONG *n0, int num);
-       int bn_mul_mont_fpu(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG 
*bp, const BN_ULONG *np,const BN_ULONG *n0, int num);
-       int bn_mul_mont_int(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG 
*bp, const BN_ULONG *np,const BN_ULONG *n0, int num);
- 
--      if (num>=8 && !(num&1) &&
--          (OPENSSL_sparcv9cap_P&(SPARCV9_PREFER_FPU|SPARCV9_VIS1)) ==
--              (SPARCV9_PREFER_FPU|SPARCV9_VIS1))
--              return bn_mul_mont_fpu(rp,ap,bp,np,n0,num);
--      else
--              return bn_mul_mont_int(rp,ap,bp,np,n0,num);
-+      if (!(num&1) && num>=6)
-+              {
-+              if ((num&15)==0 && num<=64 &&
-+                  (OPENSSL_sparcv9cap_P[1]&(CFR_MONTMUL|CFR_MONTSQR))== 
-+                                           (CFR_MONTMUL|CFR_MONTSQR))
-+                      {
-+                      typedef int (*bn_mul_mont_f)(BN_ULONG *rp, const 
BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0);
-+                      int bn_mul_mont_t4_8(BN_ULONG *rp, const BN_ULONG *ap, 
const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0);
-+                      int bn_mul_mont_t4_16(BN_ULONG *rp, const BN_ULONG *ap, 
const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0);
-+                      int bn_mul_mont_t4_24(BN_ULONG *rp, const BN_ULONG *ap, 
const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0);
-+                      int bn_mul_mont_t4_32(BN_ULONG *rp, const BN_ULONG *ap, 
const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0);
-+                      static const bn_mul_mont_f funcs[4] = {
-+                              bn_mul_mont_t4_8,       bn_mul_mont_t4_16,
-+                              bn_mul_mont_t4_24,      bn_mul_mont_t4_32 };
-+                      bn_mul_mont_f worker = funcs[num/16-1];
-+
-+                      if ((*worker)(rp,ap,bp,np,n0)) return 1;
-+                      /* retry once and fall back */
-+                      if ((*worker)(rp,ap,bp,np,n0)) return 1;
-+                      return bn_mul_mont_vis3(rp,ap,bp,np,n0,num);
-+                      }
-+              if ((OPENSSL_sparcv9cap_P[0]&SPARCV9_VIS3))
-+                      return bn_mul_mont_vis3(rp,ap,bp,np,n0,num);
-+              else if (num>=8 &&
-+                      
(OPENSSL_sparcv9cap_P[0]&(SPARCV9_PREFER_FPU|SPARCV9_VIS1)) ==
-+                      (SPARCV9_PREFER_FPU|SPARCV9_VIS1))
-+                      return bn_mul_mont_fpu(rp,ap,bp,np,n0,num);
-+              }
-+      return bn_mul_mont_int(rp,ap,bp,np,n0,num);
-       }
- 
- unsigned long _sparcv9_rdtick(void);
-@@ -36,11 +60,18 @@
- unsigned long _sparcv9_vis1_instrument(void);
- void          _sparcv9_vis2_probe(void);
- void          _sparcv9_fmadd_probe(void);
-+unsigned long _sparcv9_rdcfr(void);
-+void          _sparcv9_vis3_probe(void);
-+unsigned long _sparcv9_random(void);
-+#ifndef _BOOT
-+size_t        _sparcv9_vis1_instrument_bus(unsigned int *,size_t);
-+size_t                _sparcv9_vis1_instrument_bus2(unsigned int 
*,size_t,size_t);
-+#endif
- 
- #ifndef _BOOT
- unsigned long OPENSSL_rdtsc(void)
-       {
--      if (OPENSSL_sparcv9cap_P&SPARCV9_TICK_PRIVILEGED)
-+      if (OPENSSL_sparcv9cap_P[0]&SPARCV9_TICK_PRIVILEGED)
- #if defined(__sun) && defined(__SVR4)
-               return gethrtime();
- #else
-@@ -49,6 +80,24 @@
-       else
-               return _sparcv9_rdtick();
-       }
-+
-+size_t OPENSSL_instrument_bus(unsigned int *out,size_t cnt)
-+      {
-+      if ((OPENSSL_sparcv9cap_P[0]&(SPARCV9_TICK_PRIVILEGED|SPARCV9_BLK)) ==
-+                      SPARCV9_BLK)
-+              return _sparcv9_vis1_instrument_bus(out,cnt);
-+      else
-+              return 0;
-+      }
-+
-+size_t OPENSSL_instrument_bus2(unsigned int *out,size_t cnt,size_t max)
-+      {
-+      if ((OPENSSL_sparcv9cap_P[0]&(SPARCV9_TICK_PRIVILEGED|SPARCV9_BLK)) ==
-+                      SPARCV9_BLK)
-+              return _sparcv9_vis1_instrument_bus2(out,cnt,max);
-+      else
-+              return 0;
-+      }
- #endif
-
- #if defined(_BOOT)
-@@ -58,7 +107,7 @@
-  */
- void OPENSSL_cpuid_setup(void)
-       {
--      OPENSSL_sparcv9cap_P = SPARCV9_VIS1;
-+      OPENSSL_sparcv9cap_P[0] = SPARCV9_VIS1;
-       }
- 
- #elif 0 && defined(__sun) && defined(__SVR4)
-@@ -85,11 +116,11 @@
-       if (!strcmp (name,"SUNW,UltraSPARC") ||
-           !strncmp(name,"SUNW,UltraSPARC-I",17))  /* covers II,III,IV */
-               {
--              OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU|SPARCV9_VIS1;
-+              OPENSSL_sparcv9cap_P[0] |= SPARCV9_PREFER_FPU|SPARCV9_VIS1;
- 
-               /* %tick is privileged only on UltraSPARC-I/II, but not IIe */
-               if (name[14]!='\0' && name[17]!='\0' && name[18]!='\0')
--                      OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-+                      OPENSSL_sparcv9cap_P[0] &= ~SPARCV9_TICK_PRIVILEGED;
- 
-               return DI_WALK_TERMINATE;
-               }
-@@ -96,7 +127,7 @@
-       /* This is expected to catch remaining UltraSPARCs, such as T1 */
-       else if (!strncmp(name,"SUNW,UltraSPARC",15))
-               {
--              OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-+              OPENSSL_sparcv9cap_P[0] &= ~SPARCV9_TICK_PRIVILEGED;
- 
-               return DI_WALK_TERMINATE;
-               }
-@@ -115,7 +146,7 @@
- 
-       if ((e=getenv("OPENSSL_sparcv9cap")))
-               {
--              OPENSSL_sparcv9cap_P=strtoul(e,NULL,0);
-+              OPENSSL_sparcv9cap_P[0]=strtoul(e,NULL,0);
-               return;
-               }
- 
-@@ -123,17 +154,17 @@
-               {
-               if (strcmp(si,"sun4v"))
-                       /* FPU is preferred for all CPUs, but US-T1/2 */
--                      OPENSSL_sparcv9cap_P |= SPARCV9_PREFER_FPU;
-+                      OPENSSL_sparcv9cap_P[0] |= SPARCV9_PREFER_FPU;
-               }
- 
-       if (sysinfo(SI_ISALIST,si,sizeof(si))>0)
-               {
-               if (strstr(si,"+vis"))
--                      OPENSSL_sparcv9cap_P |= SPARCV9_VIS1;
-+                      OPENSSL_sparcv9cap_P[0] |= SPARCV9_VIS1|SPARCV9_BLK;
-               if (strstr(si,"+vis2"))
-                       {
--                      OPENSSL_sparcv9cap_P |= SPARCV9_VIS2;
--                      OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-+                      OPENSSL_sparcv9cap_P[0] |= SPARCV9_VIS2;
-+                      OPENSSL_sparcv9cap_P[0] &= ~SPARCV9_TICK_PRIVILEGED;
-                       return;
-                       }
-               }
-@@ -193,12 +224,14 @@
-  
-       if ((e=getenv("OPENSSL_sparcv9cap")))
-               {
--              OPENSSL_sparcv9cap_P=strtoul(e,NULL,0);
-+              OPENSSL_sparcv9cap_P[0]=strtoul(e,NULL,0);
-+              if ((e=strchr(e,':')))
-+                      OPENSSL_sparcv9cap_P[1]=strtoul(e+1,NULL,0);
-               return;
-               }
- 
-       /* Initial value, fits UltraSPARC-I&II... */
--      OPENSSL_sparcv9cap_P = SPARCV9_PREFER_FPU|SPARCV9_TICK_PRIVILEGED;
-+      OPENSSL_sparcv9cap_P[0] = SPARCV9_PREFER_FPU|SPARCV9_TICK_PRIVILEGED;
- 
-       sigfillset(&all_masked);
-       sigdelset(&all_masked,SIGILL);
-@@ -221,20 +254,20 @@
-       if (sigsetjmp(common_jmp,1) == 0)
-               {
-               _sparcv9_rdtick();
--              OPENSSL_sparcv9cap_P &= ~SPARCV9_TICK_PRIVILEGED;
-+              OPENSSL_sparcv9cap_P[0] &= ~SPARCV9_TICK_PRIVILEGED;
-               }
- 
-       if (sigsetjmp(common_jmp,1) == 0)
-               {
-               _sparcv9_vis1_probe();
--              OPENSSL_sparcv9cap_P |= SPARCV9_VIS1;
-+              OPENSSL_sparcv9cap_P[0] |= SPARCV9_VIS1|SPARCV9_BLK;
-               /* detect UltraSPARC-Tx, see sparccpud.S for details... */
-               if (_sparcv9_vis1_instrument() >= 12)
--                      OPENSSL_sparcv9cap_P &= 
~(SPARCV9_VIS1|SPARCV9_PREFER_FPU);
-+                      OPENSSL_sparcv9cap_P[0] &= 
~(SPARCV9_VIS1|SPARCV9_PREFER_FPU);
-               else
-                       {
-                       _sparcv9_vis2_probe();
--                      OPENSSL_sparcv9cap_P |= SPARCV9_VIS2;
-+                      OPENSSL_sparcv9cap_P[0] |= SPARCV9_VIS2;
-                       }
-               }
- 
-@@ -241,13 +274,53 @@
-       if (sigsetjmp(common_jmp,1) == 0)
-               {
-               _sparcv9_fmadd_probe();
--              OPENSSL_sparcv9cap_P |= SPARCV9_FMADD;
-+              OPENSSL_sparcv9cap_P[0] |= SPARCV9_FMADD;
-               }
- 
-+      /*
-+       * VIS3 flag is tested independently from VIS1, unlike VIS2 that is,
-+       * because VIS3 defines even integer instructions.
-+       */
-+      if (sigsetjmp(common_jmp,1) == 0)
-+              {
-+              _sparcv9_vis3_probe();
-+              OPENSSL_sparcv9cap_P[0] |= SPARCV9_VIS3;
-+              }
-+
-+      if (sigsetjmp(common_jmp,1) == 0)
-+              {
-+              (void)_sparcv9_random();
-+              OPENSSL_sparcv9cap_P[0] |= SPARCV9_RANDOM;
-+              }
-+
-+      /*
-+       * In wait for better solution _sparcv9_rdcfr is masked by
-+       * VIS3 flag, because it goes to uninterruptable endless
-+       * loop on UltraSPARC II running Solaris. Things might be
-+       * different on Linux...
-+       */
-+      if ((OPENSSL_sparcv9cap_P[0]&SPARCV9_VIS3) &&
-+          sigsetjmp(common_jmp,1) == 0)
-+              {
-+              OPENSSL_sparcv9cap_P[1] = (unsigned int)_sparcv9_rdcfr();
-+              }
-+
-       sigaction(SIGBUS,&bus_oact,NULL);
-       sigaction(SIGILL,&ill_oact,NULL);
- 
-       sigprocmask(SIG_SETMASK,&oset,NULL);
-+
-+      if (sizeof(size_t)==8)
-+              OPENSSL_sparcv9cap_P[0] |= SPARCV9_64BIT_STACK;
-+#ifdef __linux
-+      else
-+              {
-+              int ret = syscall(340);
-+
-+              if (ret>=0 && ret&1)
-+                      OPENSSL_sparcv9cap_P[0] |= SPARCV9_64BIT_STACK;
-+              }
-+#endif
-       }
- 
- #endif
-Index: crypto/md5/Makefile
-===================================================================
-diff -ru openssl-1.0.1e/crypto/md5/Makefile openssl-1.0.1e/crypto/md5/Makefile
---- openssl-1.0.1e/crypto/md5/Makefile    2011-05-24 17:02:24.000000000 -0700
-+++ openssl-1.0.1e/crypto/md5/Makefile    2011-07-27 10:48:17.817470000 -0700
-@@ -52,6 +52,9 @@
-       $(CC) $(CFLAGS) -E asm/md5-ia64.S | \
-       $(PERL) -ne 's/;\s+/;\n/g; print;' > $@
- 
-+md5-sparcv9.S:        asm/md5-sparcv9.pl
-+      $(PERL) asm/md5-sparcv9.pl $@ $(CFLAGS)
-+
- files:
-       $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
- 
-Index: crypto/md5/md5_locl.h
-===================================================================
-diff -ru openssl-1.0.1e/crypto/md5/md5_locl.h 
openssl-1.0.1e/crypto/md5/md5_locl.h
---- openssl-1.0.1e/crypto/md5/md5_locl.h    2011-05-24 17:02:24.000000000 -0700
-+++ openssl-1.0.1e/crypto/md5/md5_locl.h    2011-07-27 10:48:17.817470000 -0700
-@@ -71,6 +71,8 @@
- #  define md5_block_data_order md5_block_asm_data_order
- # elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
- #  define md5_block_data_order md5_block_asm_data_order
-+# elif defined(__sparc) || defined(__sparc__)
-+#  define md5_block_data_order md5_block_asm_data_order
- # endif
- #endif
-
-Index: crypto/sha/Makefile
-===================================================================
-diff -ru openssl-1.0.1e/crypto/sha/Makefile openssl-1.0.1e/crypto/sha/Makefile
---- openssl-1.0.1e/crypto/sha/Makefile    2011-05-24 17:02:24.000000000 -0700
-+++ openssl-1.0.1e/crypto/sha/Makefile    2011-07-27 10:48:17.817470000 -0700
-@@ -68,9 +68,9 @@
- sha1-x86_64.s:        asm/sha1-x86_64.pl;     $(PERL) asm/sha1-x86_64.pl 
$(PERLASM_SCHEME) > $@
- sha256-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl 
$(PERLASM_SCHEME) $@
- sha512-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl 
$(PERLASM_SCHEME) $@
--sha1-sparcv9.s:       asm/sha1-sparcv9.pl;    $(PERL) asm/sha1-sparcv9.pl $@ 
$(CFLAGS)
--sha256-sparcv9.s:asm/sha512-sparcv9.pl;       $(PERL) asm/sha512-sparcv9.pl 
$@ $(CFLAGS)
--sha512-sparcv9.s:asm/sha512-sparcv9.pl;       $(PERL) asm/sha512-sparcv9.pl 
$@ $(CFLAGS)
-+sha1-sparcv9.S:       asm/sha1-sparcv9.pl;    $(PERL) asm/sha1-sparcv9.pl $@ 
$(CFLAGS)
-+sha256-sparcv9.S:asm/sha512-sparcv9.pl;       $(PERL) asm/sha512-sparcv9.pl 
$@ $(CFLAGS)
-+sha512-sparcv9.S:asm/sha512-sparcv9.pl;       $(PERL) asm/sha512-sparcv9.pl 
$@ $(CFLAGS)
- 
- sha1-ppc.s:   asm/sha1-ppc.pl;        $(PERL) asm/sha1-ppc.pl 
$(PERLASM_SCHEME) $@
- sha256-ppc.s: asm/sha512-ppc.pl;      $(PERL) asm/sha512-ppc.pl 
$(PERLASM_SCHEME) $@
-Index: crypto/sha/asm/sha1-sparcv9.pl
-===================================================================
-diff -ru openssl-1.0.1e/crypto/sha/asm/sha1-sparcv9.pl 
openssl-1.0.1e/crypto/sha/asm/sha1-sparcv9.pl
---- openssl-1.0.1e/crypto/sha/asm/sha1-sparcv9.pl 2011-05-24 
17:02:24.000000000 -0700
-+++ openssl-1.0.1e/crypto/sha/asm/sha1-sparcv9.pl 2011-07-27 
10:48:17.817470000 -0700
-@@ -5,6 +5,8 @@
- # project. The module is, however, dual licensed under OpenSSL and
- # CRYPTOGAMS licenses depending on where you obtain it. For further
- # details see http://www.openssl.org/~appro/cryptogams/.
-+#
-+# Hardware SPARC T4 support by David S. Miller <[email protected]>.
- # ====================================================================
- 
- # Performance improvement is not really impressive on pre-T1 CPU: +8%
-@@ -18,6 +20,11 @@
- # ensure scalability on UltraSPARC T1, or rather to avoid decay when
- # amount of active threads exceeds the number of physical cores.
- 
-+# SPARC T4 SHA1 hardware achieves 3.72 cycles per byte, which is 3.1x
-+# faster than software. Multi-process benchmark saturates at 11x
-+# single-process result on 8-core processor, or ~9GBps per 2.85GHz
-+# socket.
-+
- $bits=32;
- for (@ARGV)   { $bits=64 if (/\-m64/ || /\-xarch\=v9/); }
- if ($bits==64)        { $bias=2047; $frame=192; }
-@@ -183,11 +190,93 @@
- .register     %g3,#scratch
- ___
- $code.=<<___;
-+#include "sparc_arch.h"
-+
- .section      ".text",#alloc,#execinstr
- 
-+#ifdef __PIC__
-+SPARC_PIC_THUNK(%g1)
-+#endif
-+
- .align        32
- .globl        sha1_block_data_order
- sha1_block_data_order:
-+      SPARC_LOAD_ADDRESS_LEAF(OPENSSL_sparcv9cap_P,%g1,%g5)
-+      ld      [%g1+4],%g1             ! OPENSSL_sparcv9cap_P[1]
-+
-+      andcc   %g1, CFR_SHA1, %g0
-+      be      .Lsoftware
-+      nop
-+
-+      ld      [%o0 + 0x00], %f0       ! load context
-+      ld      [%o0 + 0x04], %f1
-+      ld      [%o0 + 0x08], %f2
-+      andcc   %o1, 0x7, %g0
-+      ld      [%o0 + 0x0c], %f3
-+      bne,pn  %icc, .Lhwunaligned
-+       ld     [%o0 + 0x10], %f4
-+
-+.Lhw_loop:
-+      ldd     [%o1 + 0x00], %f8
-+      ldd     [%o1 + 0x08], %f10
-+      ldd     [%o1 + 0x10], %f12
-+      ldd     [%o1 + 0x18], %f14
-+      ldd     [%o1 + 0x20], %f16
-+      ldd     [%o1 + 0x28], %f18
-+      ldd     [%o1 + 0x30], %f20
-+      subcc   %o2, 1, %o2             ! done yet? 
-+      ldd     [%o1 + 0x38], %f22
-+      add     %o1, 0x40, %o1
-+
-+      .word   0x81b02820              ! SHA1
-+
-+      bne,pt  `$bits==64?"%xcc":"%icc"`, .Lhw_loop
-+      nop
-+
-+.Lhwfinish:
-+      st      %f0, [%o0 + 0x00]       ! store context
-+      st      %f1, [%o0 + 0x04]
-+      st      %f2, [%o0 + 0x08]
-+      st      %f3, [%o0 + 0x0c]
-+      retl
-+      st      %f4, [%o0 + 0x10]
-+
-+.align        8
-+.Lhwunaligned:
-+      alignaddr %o1, %g0, %o1
-+
-+      ldd     [%o1 + 0x00], %f10
-+.Lhwunaligned_loop:
-+      ldd     [%o1 + 0x08], %f12
-+      ldd     [%o1 + 0x10], %f14
-+      ldd     [%o1 + 0x18], %f16
-+      ldd     [%o1 + 0x20], %f18
-+      ldd     [%o1 + 0x28], %f20
-+      ldd     [%o1 + 0x30], %f22
-+      ldd     [%o1 + 0x38], %f24
-+      subcc   %o2, 1, %o2             ! done yet?
-+      ldd     [%o1 + 0x40], %f26
-+      add     %o1, 0x40, %o1
-+
-+      faligndata %f10, %f12, %f8
-+      faligndata %f12, %f14, %f10
-+      faligndata %f14, %f16, %f12
-+      faligndata %f16, %f18, %f14
-+      faligndata %f18, %f20, %f16
-+      faligndata %f20, %f22, %f18
-+      faligndata %f22, %f24, %f20
-+      faligndata %f24, %f26, %f22
-+
-+      .word   0x81b02820              ! SHA1
-+
-+      bne,pt  `$bits==64?"%xcc":"%icc"`, .Lhwunaligned_loop
-+      for     %f26, %f26, %f10        ! %f10=%f26
-+
-+      ba      .Lhwfinish
-+      nop
-+
-+.align        16
-+.Lsoftware:
-       save    %sp,-$frame,%sp
-       sllx    $len,6,$len
-       add     $inp,$len,$len
-@@ -279,6 +368,62 @@
- .align        4
- ___
- 
--$code =~ s/\`([^\`]*)\`/eval $1/gem;
--print $code;
-+# Purpose of these subroutines is to explicitly encode VIS instructions,
-+# so that one can compile the module without having to specify VIS
-+# extentions on compiler command line, e.g. -xarch=v9 vs. -xarch=v9a.
-+# Idea is to reserve for option to produce "universal" binary and let
-+# programmer detect if current CPU is VIS capable at run-time.
-+sub unvis {
-+my ($mnemonic,$rs1,$rs2,$rd)=@_;
-+my $ref,$opf;
-+my %visopf = (        "faligndata"    => 0x048,
-+              "for"           => 0x07c        );
-+
-+    $ref = "$mnemonic\t$rs1,$rs2,$rd";
-+
-+    if ($opf=$visopf{$mnemonic}) {
-+      foreach ($rs1,$rs2,$rd) {
-+          return $ref if (!/%f([0-9]{1,2})/);
-+          $_=$1;
-+          if ($1>=32) {
-+              return $ref if ($1&1);
-+              # re-encode for upper double register addressing
-+              $_=($1|$1>>5)&31;
-+          }
-+      }
-+
-+      return  sprintf ".word\t0x%08x !%s",
-+                      0x81b00000|$rd<<25|$rs1<<14|$opf<<5|$rs2,
-+                      $ref;
-+    } else {
-+      return $ref;
-+    }
-+}
-+sub unalignaddr {
-+my ($mnemonic,$rs1,$rs2,$rd)=@_;
-+my %bias = ( "g" => 0, "o" => 8, "l" => 16, "i" => 24 );
-+my $ref="$mnemonic\t$rs1,$rs2,$rd";
-+
-+    foreach ($rs1,$rs2,$rd) {
-+      if (/%([goli])([0-7])/) { $_=$bias{$1}+$2; }
-+      else                    { return $ref; }
-+    }
-+    return  sprintf ".word\t0x%08x !%s",
-+                  0x81b00300|$rd<<25|$rs1<<14|$rs2,
-+                  $ref;
-+}
-+
-+foreach (split("\n",$code)) {
-+      s/\`([^\`]*)\`/eval $1/ge;
-+
-+      s/\b(f[^\s]*)\s+(%f[0-9]{1,2}),\s*(%f[0-9]{1,2}),\s*(%f[0-9]{1,2})/
-+              &unvis($1,$2,$3,$4)
-+       /ge;
-+      s/\b(alignaddr)\s+(%[goli][0-7]),\s*(%[goli][0-7]),\s*(%[goli][0-7])/
-+              &unalignaddr($1,$2,$3,$4)
-+       /ge;
-+
-+      print $_,"\n";
-+}
-+
- close STDOUT;
-
-Index: crypto/sha/asm/sha512-sparcv9.pl
-===================================================================
-diff -ru openssl-1.0.1e/crypto/sha/asm/sha512-sparcv9.pl 
openssl-1.0.1e/crypto/sha/asm/sha512-sparcv9.pl
---- openssl-1.0.1e/crypto/sha/asm/sha512-sparcv9.pl 2011-05-24 
17:02:24.000000000 -0700
-+++ openssl-1.0.1e/crypto/sha/asm/sha512-sparcv9.pl 2011-07-27 
10:48:17.817470000 -0700
-@@ -5,6 +5,8 @@
- # project. The module is, however, dual licensed under OpenSSL and
- # CRYPTOGAMS licenses depending on where you obtain it. For further
- # details see http://www.openssl.org/~appro/cryptogams/.
-+#
-+# Hardware SPARC T4 support by David S. Miller <[email protected]>.
- # ====================================================================
- 
- # SHA256 performance improvement over compiler generated code varies
-@@ -41,6 +43,12 @@
- #     loads are always slower than one 64-bit load. Once again this
- #     is unlike pre-T1 UltraSPARC, where, if scheduled appropriately,
- #     2x32-bit loads can be as fast as 1x64-bit ones.
-+#
-+# SPARC T4 SHA256/512 hardware achieves 3.17/2.01 cycles per byte,
-+# which is 9.3x/11.1x faster than software. Multi-process benchmark
-+# saturates at 11.5x single-process result on 8-core processor, or
-+# ~11/16GBps per 2.85GHz socket.
-+
- 
- $bits=32;
- for (@ARGV)   { $bits=64 if (/\-m64/ || /\-xarch\=v9/); }
-@@ -386,6 +394,8 @@
- .register     %g3,#scratch
- ___
- $code.=<<___;
-+#include "sparc_arch.h"
-+
- .section      ".text",#alloc,#execinstr
- 
- .align        64
-@@ -457,8 +467,196 @@
- }
- $code.=<<___;
- .size K${label},.-K${label}
-+
-+#ifdef __PIC__
-+SPARC_PIC_THUNK(%g1)
-+#endif
-+
- .globl        sha${label}_block_data_order
-+.align        32
- sha${label}_block_data_order:
-+      SPARC_LOAD_ADDRESS_LEAF(OPENSSL_sparcv9cap_P,%g1,%g5)
-+      ld      [%g1+4],%g1             ! OPENSSL_sparcv9cap_P[1]
-+
-+      andcc   %g1, CFR_SHA${label}, %g0
-+      be      .Lsoftware
-+      nop
-+___
-+$code.=<<___ if ($SZ==8);             # SHA512
-+      ldd     [%o0 + 0x00], %f0       ! load context
-+      ldd     [%o0 + 0x08], %f2
-+      ldd     [%o0 + 0x10], %f4
-+      ldd     [%o0 + 0x18], %f6
-+      ldd     [%o0 + 0x20], %f8
-+      ldd     [%o0 + 0x28], %f10
-+      andcc   %o1, 0x7, %g0
-+      ldd     [%o0 + 0x30], %f12
-+      bne,pn  %icc, .Lhwunaligned
-+       ldd    [%o0 + 0x38], %f14
-+
-+.Lhwaligned_loop:
-+      ldd     [%o1 + 0x00], %f16
-+      ldd     [%o1 + 0x08], %f18
-+      ldd     [%o1 + 0x10], %f20
-+      ldd     [%o1 + 0x18], %f22
-+      ldd     [%o1 + 0x20], %f24
-+      ldd     [%o1 + 0x28], %f26
-+      ldd     [%o1 + 0x30], %f28
-+      ldd     [%o1 + 0x38], %f30
-+      ldd     [%o1 + 0x40], %f32
-+      ldd     [%o1 + 0x48], %f34
-+      ldd     [%o1 + 0x50], %f36
-+      ldd     [%o1 + 0x58], %f38
-+      ldd     [%o1 + 0x60], %f40
-+      ldd     [%o1 + 0x68], %f42
-+      ldd     [%o1 + 0x70], %f44
-+      subcc   %o2, 1, %o2             ! done yet?
-+      ldd     [%o1 + 0x78], %f46
-+      add     %o1, 0x80, %o1
-+
-+      .word   0x81b02860              ! SHA512
-+
-+      bne,pt  `$bits==64?"%xcc":"%icc"`, .Lhwaligned_loop
-+      nop
-+
-+.Lhwfinish:
-+      std     %f0, [%o0 + 0x00]       ! store context
-+      std     %f2, [%o0 + 0x08]
-+      std     %f4, [%o0 + 0x10]
-+      std     %f6, [%o0 + 0x18]
-+      std     %f8, [%o0 + 0x20]
-+      std     %f10, [%o0 + 0x28]
-+      std     %f12, [%o0 + 0x30]
-+      retl
-+       std    %f14, [%o0 + 0x38]
-+
-+.align        16
-+.Lhwunaligned:
-+      alignaddr %o1, %g0, %o1
-+
-+      ldd     [%o1 + 0x00], %f18
-+.Lhwunaligned_loop:
-+      ldd     [%o1 + 0x08], %f20
-+      ldd     [%o1 + 0x10], %f22
-+      ldd     [%o1 + 0x18], %f24
-+      ldd     [%o1 + 0x20], %f26
-+      ldd     [%o1 + 0x28], %f28
-+      ldd     [%o1 + 0x30], %f30
-+      ldd     [%o1 + 0x38], %f32
-+      ldd     [%o1 + 0x40], %f34
-+      ldd     [%o1 + 0x48], %f36
-+      ldd     [%o1 + 0x50], %f38
-+      ldd     [%o1 + 0x58], %f40
-+      ldd     [%o1 + 0x60], %f42
-+      ldd     [%o1 + 0x68], %f44
-+      ldd     [%o1 + 0x70], %f46
-+      ldd     [%o1 + 0x78], %f48
-+      subcc   %o2, 1, %o2             ! done yet?
-+      ldd     [%o1 + 0x80], %f50
-+      add     %o1, 0x80, %o1
-+
-+      faligndata %f18, %f20, %f16
-+      faligndata %f20, %f22, %f18
-+      faligndata %f22, %f24, %f20
-+      faligndata %f24, %f26, %f22
-+      faligndata %f26, %f28, %f24
-+      faligndata %f28, %f30, %f26
-+      faligndata %f30, %f32, %f28
-+      faligndata %f32, %f34, %f30
-+      faligndata %f34, %f36, %f32
-+      faligndata %f36, %f38, %f34
-+      faligndata %f38, %f40, %f36
-+      faligndata %f40, %f42, %f38
-+      faligndata %f42, %f44, %f40
-+      faligndata %f44, %f46, %f42
-+      faligndata %f46, %f48, %f44
-+      faligndata %f48, %f50, %f46
-+
-+      .word   0x81b02860              ! SHA512
-+
-+      bne,pt  `$bits==64?"%xcc":"%icc"`, .Lhwunaligned_loop
-+      for     %f50, %f50, %f18        ! %f18=%f50
-+
-+      ba      .Lhwfinish
-+      nop
-+___
-+$code.=<<___ if ($SZ==4);             # SHA256
-+      ld      [%o0 + 0x00], %f0
-+      ld      [%o0 + 0x04], %f1
-+      ld      [%o0 + 0x08], %f2
-+      ld      [%o0 + 0x0c], %f3
-+      ld      [%o0 + 0x10], %f4
-+      ld      [%o0 + 0x14], %f5
-+      andcc   %o1, 0x7, %g0
-+      ld      [%o0 + 0x18], %f6
-+      bne,pn  %icc, .Lhwunaligned
-+       ld     [%o0 + 0x1c], %f7
-+
-+.Lhwloop:
-+      ldd     [%o1 + 0x00], %f8
-+      ldd     [%o1 + 0x08], %f10
-+      ldd     [%o1 + 0x10], %f12
-+      ldd     [%o1 + 0x18], %f14
-+      ldd     [%o1 + 0x20], %f16
-+      ldd     [%o1 + 0x28], %f18
-+      ldd     [%o1 + 0x30], %f20
-+      subcc   %o2, 1, %o2             ! done yet?
-+      ldd     [%o1 + 0x38], %f22
-+      add     %o1, 0x40, %o1
-+
-+      .word   0x81b02840              ! SHA256
-+
-+      bne,pt  `$bits==64?"%xcc":"%icc"`, .Lhwloop
-+      nop
-+
-+.Lhwfinish:
-+      st      %f0, [%o0 + 0x00]       ! store context
-+      st      %f1, [%o0 + 0x04]
-+      st      %f2, [%o0 + 0x08]
-+      st      %f3, [%o0 + 0x0c]
-+      st      %f4, [%o0 + 0x10]
-+      st      %f5, [%o0 + 0x14]
-+      st      %f6, [%o0 + 0x18]
-+      retl
-+       st     %f7, [%o0 + 0x1c]
-+
-+.align        8
-+.Lhwunaligned:
-+      alignaddr %o1, %g0, %o1
-+
-+      ldd     [%o1 + 0x00], %f10
-+.Lhwunaligned_loop:
-+      ldd     [%o1 + 0x08], %f12
-+      ldd     [%o1 + 0x10], %f14
-+      ldd     [%o1 + 0x18], %f16
-+      ldd     [%o1 + 0x20], %f18
-+      ldd     [%o1 + 0x28], %f20
-+      ldd     [%o1 + 0x30], %f22
-+      ldd     [%o1 + 0x38], %f24
-+      subcc   %o2, 1, %o2             ! done yet?
-+      ldd     [%o1 + 0x40], %f26
-+      add     %o1, 0x40, %o1
-+
-+      faligndata %f10, %f12, %f8
-+      faligndata %f12, %f14, %f10
-+      faligndata %f14, %f16, %f12
-+      faligndata %f16, %f18, %f14
-+      faligndata %f18, %f20, %f16
-+      faligndata %f20, %f22, %f18
-+      faligndata %f22, %f24, %f20
-+      faligndata %f24, %f26, %f22
-+
-+      .word   0x81b02840              ! SHA256
-+
-+      bne,pt  `$bits==64?"%xcc":"%icc"`, .Lhwunaligned_loop
-+      for     %f26, %f26, %f10        ! %f10=%f26
-+
-+      ba      .Lhwfinish
-+      nop
-+___
-+$code.=<<___;
-+.align        16
-+.Lsoftware:
-       save    %sp,`-$frame-$locals`,%sp
-       and     $inp,`$align-1`,$tmp31
-       sllx    $len,`log(16*$SZ)/log(2)`,$len
-@@ -589,6 +787,62 @@
- .align        4
- ___
- 
--$code =~ s/\`([^\`]*)\`/eval $1/gem;
--print $code;
-+# Purpose of these subroutines is to explicitly encode VIS instructions,
-+# so that one can compile the module without having to specify VIS
-+# extentions on compiler command line, e.g. -xarch=v9 vs. -xarch=v9a.
-+# Idea is to reserve for option to produce "universal" binary and let
-+# programmer detect if current CPU is VIS capable at run-time.
-+sub unvis {
-+my ($mnemonic,$rs1,$rs2,$rd)=@_;
-+my $ref,$opf;
-+my %visopf = (        "faligndata"    => 0x048,
-+              "for"           => 0x07c        );
-+
-+    $ref = "$mnemonic\t$rs1,$rs2,$rd";
-+
-+    if ($opf=$visopf{$mnemonic}) {
-+      foreach ($rs1,$rs2,$rd) {
-+          return $ref if (!/%f([0-9]{1,2})/);
-+          $_=$1;
-+          if ($1>=32) {
-+              return $ref if ($1&1);
-+              # re-encode for upper double register addressing
-+              $_=($1|$1>>5)&31;
-+          }
-+      }
-+
-+      return  sprintf ".word\t0x%08x !%s",
-+                      0x81b00000|$rd<<25|$rs1<<14|$opf<<5|$rs2,
-+                      $ref;
-+    } else {
-+      return $ref;
-+    }
-+}
-+sub unalignaddr {
-+my ($mnemonic,$rs1,$rs2,$rd)=@_;
-+my %bias = ( "g" => 0, "o" => 8, "l" => 16, "i" => 24 );
-+my $ref="$mnemonic\t$rs1,$rs2,$rd";
-+
-+    foreach ($rs1,$rs2,$rd) {
-+      if (/%([goli])([0-7])/) { $_=$bias{$1}+$2; }
-+      else                    { return $ref; }
-+    }
-+    return  sprintf ".word\t0x%08x !%s",
-+                  0x81b00300|$rd<<25|$rs1<<14|$rs2,
-+                  $ref;
-+}
-+
-+foreach (split("\n",$code)) {
-+      s/\`([^\`]*)\`/eval $1/ge;
-+
-+      s/\b(f[^\s]*)\s+(%f[0-9]{1,2}),\s*(%f[0-9]{1,2}),\s*(%f[0-9]{1,2})/
-+              &unvis($1,$2,$3,$4)
-+       /ge;
-+      s/\b(alignaddr)\s+(%[goli][0-7]),\s*(%[goli][0-7]),\s*(%[goli][0-7])/
-+              &unalignaddr($1,$2,$3,$4)
-+       /ge;
-+
-+      print $_,"\n";
-+}
-+
- close STDOUT;
-Index: crypto/des/Makefile
-===================================================================
-diff -ru openssl-1.0.1e/crypto/des/Makefile.orig 
openssl-1.0.1e/crypto/des/Makefile
---- a/crypto/des/Makefile
-+++ b/crypto/des/Makefile
-@@ -61,6 +61,8 @@ des: des.o cbc3_enc.o lib
- 
- des_enc-sparc.S:      asm/des_enc.m4
-       m4 -B 8192 asm/des_enc.m4 > des_enc-sparc.S
-+dest4-sparcv9.s:      asm/dest4-sparcv9.pl
-+      $(PERL) asm/dest4-sparcv9.pl $(CFLAGS) > $@
- 
- des-586.s:    asm/des-586.pl ../perlasm/x86asm.pl ../perlasm/cbc.pl
-       $(PERL) asm/des-586.pl $(PERLASM_SCHEME) $(CFLAGS) > $@
-Index: crypto/evp/e_des.c
-===================================================================
-diff -ru openssl-1.0.1e/crypto/evp/e_des.c.orig 
openssl-1.0.1e/crypto/evp/e_des.c
---- a/crypto/evp/e_des.c
-+++ b/crypto/evp/e_des.c
-@@ -65,6 +65,30 @@
- #include <openssl/des.h>
- #include <openssl/rand.h>
- 
-+typedef struct
-+      {
-+      union { double align; DES_key_schedule ks; } ks;
-+      union {
-+              void (*cbc)(const void *,void *,size_t,const void *,void *);
-+      } stream;
-+      } EVP_DES_KEY;
-+
-+#if defined(AES_ASM) && (defined(__sparc) || defined(__sparc__))
-+/* ---------^^^ this is not a typo, just a way to detect that
-+ * assembler support was in general requested... */
-+#include "sparc_arch.h"
-+
-+extern unsigned int OPENSSL_sparcv9cap_P[];
-+
-+#define SPARC_DES_CAPABLE     (OPENSSL_sparcv9cap_P[1] & CFR_DES)
-+
-+void  des_t4_key_expand(const void *key, DES_key_schedule *ks);
-+void  des_t4_cbc_encrypt(const void *inp,void *out,size_t len,
-+                              DES_key_schedule *ks,unsigned char iv[8]);
-+void  des_t4_cbc_decrypt(const void *inp,void *out,size_t len,
-+                              DES_key_schedule *ks,unsigned char iv[8]);
-+#endif
-+
- static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
-                       const unsigned char *iv, int enc);
- static int des_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr);
-@@ -99,6 +123,13 @@ static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned 
char *out,
- static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
-                         const unsigned char *in, size_t inl)
- {
-+      EVP_DES_KEY *dat = (EVP_DES_KEY *)ctx->cipher_data;
-+
-+      if (dat->stream.cbc)
-+              {
-+              (*dat->stream.cbc)(in,out,inl,&dat->ks.ks,ctx->iv);
-+              return 1;
-+              }
-       while(inl>=EVP_MAXCHUNK)
-               {
-               DES_ncbc_encrypt(in, out, (long)EVP_MAXCHUNK, ctx->cipher_data,
-@@ -176,18 +207,18 @@
-     return 1;
-     }
- 
--BLOCK_CIPHER_defs(des, DES_key_schedule, NID_des, 8, 8, 8, 64,
-+BLOCK_CIPHER_defs(des, EVP_DES_KEY, NID_des, 8, 8, 8, 64,
-                       EVP_CIPH_RAND_KEY, des_init_key, NULL,
-                       EVP_CIPHER_set_asn1_iv,
-                       EVP_CIPHER_get_asn1_iv,
-                       des_ctrl)
- 
--BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,1,
-+BLOCK_CIPHER_def_cfb(des,EVP_DES_KEY,NID_des,8,8,1,
-                    EVP_CIPH_RAND_KEY, des_init_key,NULL,
-                    EVP_CIPHER_set_asn1_iv,
-                    EVP_CIPHER_get_asn1_iv,des_ctrl)
- 
--BLOCK_CIPHER_def_cfb(des,DES_key_schedule,NID_des,8,8,8,
-+BLOCK_CIPHER_def_cfb(des,EVP_DES_KEY,NID_des,8,8,8,
-                    EVP_CIPH_RAND_KEY,des_init_key,NULL,
-                    EVP_CIPHER_set_asn1_iv,
-                    EVP_CIPHER_get_asn1_iv,des_ctrl)
-@@ -196,8 +227,25 @@ static int des_init_key(EVP_CIPHER_CTX *ctx, const 
unsigned char *key,
-                       const unsigned char *iv, int enc)
-       {
-       DES_cblock *deskey = (DES_cblock *)key;
-+      EVP_DES_KEY *dat = (EVP_DES_KEY *)ctx->cipher_data;
-+
-+      dat->stream.cbc = NULL;
-+#if defined(SPARC_DES_CAPABLE)
-+      if (SPARC_DES_CAPABLE)
-+              {
-+              int mode = ctx->cipher->flags & EVP_CIPH_MODE;
-+
-+              if (mode == EVP_CIPH_CBC_MODE)
-+                      {
-+                      des_t4_key_expand(key,&dat->ks.ks);
-+                      dat->stream.cbc = enc ? des_t4_cbc_encrypt :
-+                                              des_t4_cbc_decrypt;
-+                      return 1;
-+                      }
-+              }
-+#endif
- #ifdef EVP_CHECK_DES_KEY
--      if(DES_set_key_checked(deskey,ctx->cipher_data) != 0)
-+      if(DES_set_key_checked(deskey,dat->ks.ks) != 0)
-               return 0;
- #else
-       DES_set_key_unchecked(deskey,ctx->cipher_data);
-Index: crypto/evp/e_des3.c
-===================================================================
-diff -ru openssl-1.0.1e/crypto/evp/e_des3.c.orig 
openssl-1.0.1e/crypto/evp/e_des3.c
---- a/crypto/evp/e_des3.c
-+++ b/crypto/evp/e_des3.c
-@@ -65,6 +65,33 @@
- #include <openssl/des.h>
- #include <openssl/rand.h>
- 
-+typedef struct
-+      {
-+      union { double align; DES_key_schedule ks[3]; } ks;
-+      union {
-+              void (*cbc)(const void *,void *,size_t,const void *,void *);
-+      } stream;
-+      } DES_EDE_KEY;
-+#define ks1 ks.ks[0]
-+#define ks2 ks.ks[1]
-+#define ks3 ks.ks[2]
-+
-+#if defined(AES_ASM) && (defined(__sparc) || defined(__sparc__))
-+/* ---------^^^ this is not a typo, just a way to detect that
-+ * assembler support was in general requested... */
-+#include "sparc_arch.h"
-+
-+extern unsigned int OPENSSL_sparcv9cap_P[];
-+
-+#define SPARC_DES_CAPABLE     (OPENSSL_sparcv9cap_P[1] & CFR_DES)
-+
-+void  des_t4_key_expand(const void *key, DES_key_schedule *ks);
-+void  des_t4_ede3_cbc_encrypt(const void *inp,void *out,size_t len,
-+                              DES_key_schedule *ks,unsigned char iv[8]);
-+void  des_t4_ede3_cbc_decrypt(const void *inp,void *out,size_t len,
-+                              DES_key_schedule *ks,unsigned char iv[8]);
-+#endif
-+
- #ifndef OPENSSL_FIPS
- 
- static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
-@@ -75,13 +100,6 @@ static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const 
unsigned char *key,
- 
- static int des3_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr);
- 
--typedef struct
--    {
--    DES_key_schedule ks1;/* key schedule */
--    DES_key_schedule ks2;/* key schedule (for ede) */
--    DES_key_schedule ks3;/* key schedule (for ede3) */
--    } DES_EDE_KEY;
--
- #define data(ctx) ((DES_EDE_KEY *)(ctx)->cipher_data)
- 
- /* Because of various casts and different args can't use 
IMPLEMENT_BLOCK_CIPHER */
-@@ -121,6 +141,8 @@ static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, 
unsigned char *out,
- static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
-                             const unsigned char *in, size_t inl)
- {
-+      DES_EDE_KEY *dat = data(ctx);
-+
- #ifdef KSSL_DEBUG
-       {
-         int i;
-@@ -132,10 +154,16 @@
-       printf("\n");
-       }
- #endif    /* KSSL_DEBUG */
-+      if (dat->stream.cbc)
-+              {
-+              (*dat->stream.cbc)(in,out,inl,&dat->ks,ctx->iv);
-+              return 1;
-+              }
-+
-       while (inl>=EVP_MAXCHUNK)
-               {
-               DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK,
--                           &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
-+                           &dat->ks1, &dat->ks2, &dat->ks3,
-                            (DES_cblock *)ctx->iv, ctx->encrypt);
-               inl-=EVP_MAXCHUNK;
-               in +=EVP_MAXCHUNK;
-@@ -143,7 +169,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, 
unsigned char *out,
-               }
-       if (inl)
-               DES_ede3_cbc_encrypt(in, out, (long)inl,
--                           &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
-+                           &dat->ks1, &dat->ks2, &dat->ks3,
-                              (DES_cblock *)ctx->iv, ctx->encrypt);
-       return 1;
- }
-@@ -208,9 +234,8 @@ static int des_ede3_cfb8_cipher(EVP_CIPHER_CTX *ctx, 
unsigned char *out,
-     }
- 
- BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64,
--                      EVP_CIPH_RAND_KEY, des_ede_init_key, NULL, 
--                      EVP_CIPHER_set_asn1_iv,
--                      EVP_CIPHER_get_asn1_iv,
-+                      EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_DEFAULT_ASN1,
-+                      des_ede_init_key, NULL, NULL, NULL,
-                       des3_ctrl)
- 
- #define des_ede3_cfb64_cipher des_ede_cfb64_cipher
-@@ -219,37 +246,53 @@
- #define des_ede3_ecb_cipher des_ede_ecb_cipher
- 
- BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64,
--                      EVP_CIPH_RAND_KEY, des_ede3_init_key, NULL, 
--                      EVP_CIPHER_set_asn1_iv,
--                      EVP_CIPHER_get_asn1_iv,
--                      des3_ctrl)
-+              EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1,
-+              des_ede3_init_key, NULL, NULL, NULL,
-+              des3_ctrl)
- 
- BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,1,
--                   EVP_CIPH_RAND_KEY, des_ede3_init_key,NULL,
--                   EVP_CIPHER_set_asn1_iv,
--                   EVP_CIPHER_get_asn1_iv,
--                   des3_ctrl)
-+              EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1,
-+              des_ede3_init_key, NULL, NULL, NULL,
-+              des3_ctrl)
- 
- BLOCK_CIPHER_def_cfb(des_ede3,DES_EDE_KEY,NID_des_ede3,24,8,8,
--                   EVP_CIPH_RAND_KEY, des_ede3_init_key,NULL,
--                   EVP_CIPHER_set_asn1_iv,
--                   EVP_CIPHER_get_asn1_iv,
--                   des3_ctrl)
-+              EVP_CIPH_RAND_KEY|EVP_CIPH_FLAG_FIPS|EVP_CIPH_FLAG_DEFAULT_ASN1,
-+              des_ede3_init_key, NULL, NULL, NULL,
-+              des3_ctrl)
- 
- static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
-                           const unsigned char *iv, int enc)
-       {
-       DES_cblock *deskey = (DES_cblock *)key;
-+      DES_EDE_KEY *dat = data(ctx);
-+
-+      dat->stream.cbc = NULL;
-+#if defined(SPARC_DES_CAPABLE)
-+      if (SPARC_DES_CAPABLE)
-+              {
-+              int mode = ctx->cipher->flags & EVP_CIPH_MODE;
-+
-+              if (mode == EVP_CIPH_CBC_MODE)
-+                      {
-+                      des_t4_key_expand(&deskey[0],&dat->ks1);
-+                      des_t4_key_expand(&deskey[1],&dat->ks2);
-+                      memcpy(&dat->ks3,&dat->ks1,sizeof(dat->ks1));
-+                      dat->stream.cbc = enc ? des_t4_ede3_cbc_encrypt :
-+                                              des_t4_ede3_cbc_decrypt;
-+                      return 1;
-+                      }
-+              }
-+#endif
- #ifdef EVP_CHECK_DES_KEY
--      if (DES_set_key_checked(&deskey[0],&data(ctx)->ks1)
--              !! DES_set_key_checked(&deskey[1],&data(ctx)->ks2))
-+      if (DES_set_key_checked(&deskey[0],&dat->ks1)
-+              !! DES_set_key_checked(&deskey[1],&dat->ks2))
-               return 0;
- #else
--      DES_set_key_unchecked(&deskey[0],&data(ctx)->ks1);
--      DES_set_key_unchecked(&deskey[1],&data(ctx)->ks2);
-+      DES_set_key_unchecked(&deskey[0],&dat->ks1);
-+      DES_set_key_unchecked(&deskey[1],&dat->ks2);
- #endif
--      memcpy(&data(ctx)->ks3,&data(ctx)->ks1,
--             sizeof(data(ctx)->ks1));
-+      memcpy(&dat->ks3,&dat->ks1,
-+              sizeof(dat->ks1));
-       return 1;
-       }
- 
-@@ -257,6 +300,8 @@ static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const 
unsigned char *key,
-                            const unsigned char *iv, int enc)
-       {
-       DES_cblock *deskey = (DES_cblock *)key;
-+      DES_EDE_KEY *dat = data(ctx);
-+
- #ifdef KSSL_DEBUG
-       {
-         int i;
-@@ -268,15 +313,32 @@ static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const 
unsigned char *key,
-       }
- #endif        /* KSSL_DEBUG */
- 
-+      dat->stream.cbc = NULL;
-+#if defined(SPARC_DES_CAPABLE)
-+      if (SPARC_DES_CAPABLE)
-+              {
-+              int mode = ctx->cipher->flags & EVP_CIPH_MODE;
-+
-+              if (mode == EVP_CIPH_CBC_MODE)
-+                      {
-+                      des_t4_key_expand(&deskey[0],&dat->ks1);
-+                      des_t4_key_expand(&deskey[1],&dat->ks2);
-+                      des_t4_key_expand(&deskey[2],&dat->ks3);
-+                      dat->stream.cbc = enc ? des_t4_ede3_cbc_encrypt :
-+                                              des_t4_ede3_cbc_decrypt;
-+                      return 1;
-+                      }
-+              }
-+#endif
- #ifdef EVP_CHECK_DES_KEY
--      if (DES_set_key_checked(&deskey[0],&data(ctx)->ks1)
--              || DES_set_key_checked(&deskey[1],&data(ctx)->ks2)
--              || DES_set_key_checked(&deskey[2],&data(ctx)->ks3))
-+      if (DES_set_key_checked(&deskey[0],&dat->ks1)
-+              || DES_set_key_checked(&deskey[1],&dat->ks2)
-+              || DES_set_key_checked(&deskey[2],&dat->ks3))
-               return 0;
- #else
--      DES_set_key_unchecked(&deskey[0],&data(ctx)->ks1);
--      DES_set_key_unchecked(&deskey[1],&data(ctx)->ks2);
--      DES_set_key_unchecked(&deskey[2],&data(ctx)->ks3);
-+      DES_set_key_unchecked(&deskey[0],&dat->ks1);
-+      DES_set_key_unchecked(&deskey[1],&dat->ks2);
-+      DES_set_key_unchecked(&deskey[2],&dat->ks3);
- #endif
-       return 1;
-       }
-Index: openssl/crypto/bn/Makefile
-===================================================================
-diff -ru openssl-1.0.1e/crypto/bn/Makefile 
openssl-1.0.1e/crypto/bn/Makefile.new
---- openssl-1.0.1e/crypto/bn/Makefile 2011-05-24 17:02:24.000000000 -0700
-+++ openssl-1.0.1e/crypto/bn/Makefile 2011-07-27 10:48:17.817470000 -0700
-@@ -77,6 +77,12 @@
-       $(PERL) asm/sparcv9a-mont.pl $(CFLAGS) > $@
- sparcv9-mont.s:               asm/sparcv9-mont.pl
-       $(PERL) asm/sparcv9-mont.pl $(CFLAGS) > $@
-+vis3-mont.s:          asm/vis3-mont.pl
-+      $(PERL) asm/vis3-mont.pl $(CFLAGS) > $@
-+sparct4-mont.S:       asm/sparct4-mont.pl
-+      $(PERL) asm/sparct4-mont.pl $(CFLAGS) > $@
-+sparcv9-gf2m.S:       asm/sparcv9-gf2m.pl
-+      $(PERL) asm/sparcv9-gf2m.pl $(CFLAGS) > $@
- 
- bn-mips3.o:   asm/mips3.s
-       @if [ "$(CC)" = "gcc" ]; then \
-Index: openssl/crypto/bn/bn_exp.c
-===================================================================
-diff -ru openssl-1.0.1e/crypto/bn/bn_exp.c 
openssl-1.0.1e/crypto/bn/bn_exp.c.new
---- bn_exp.c   2011/10/29 19:25:13     1.38
-+++ bn_exp.c   2012/11/17 10:34:11     1.39
-@@ -123,8 +123,15 @@
- # ifndef alloca
- #  define alloca(s) __builtin_alloca((s))
- # endif
-+#else
-+#include <alloca.h>
- #endif
- 
-+#if defined(OPENSSL_BN_ASM_MONT) && defined(__sparc)
-+# include "sparc_arch.h"
-+extern unsigned int OPENSSL_sparcv9cap_P[];
-+#endif
-+
- /* maximum precomputation table size for *variable* sliding windows */
- #define TABLE_SIZE    32
- 
-@@ -467,7 +467,15 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const 
BIGNUM *p,
-       wstart=bits-1;  /* The top bit of the window */
-       wend=0;         /* The bottom bit of the window */
- 
-+#if 1 /* by Shay Gueron's suggestion */
-+      j = mont->N.top;        /* borrow j */
-+      if (bn_wexpand(r,j) == NULL) goto err;
-+      r->d[0] = (0-m->d[0])&BN_MASK2;         /* 2^(top*BN_BITS2) - m */
-+      for(i=1;i<j;i++) r->d[i] = (~m->d[i])&BN_MASK2;
-+      r->top = j;
-+#else
-       if (!BN_to_montgomery(r,BN_value_one(),mont,ctx)) goto err;
-+#endif
-       for (;;)
-               {
-               if (BN_is_bit_set(p,wstart) == 0)
-@@ -519,6 +527,17 @@ int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const 
BIGNUM *p,
-               start=0;
-               if (wstart < 0) break;
-               }
-+#if defined(OPENSSL_BN_ASM_MONT) && (defined(__sparc__) || defined(__sparc))
-+      if (OPENSSL_sparcv9cap_P[0]&(SPARCV9_VIS3|SPARCV9_PREFER_FPU))
-+      {
-+              j = mont->N.top;        /* borrow j */
-+              val[0]->d[0] = 1;       /* borrow val[0] */
-+              for (i=1;i<j;i++) val[0]->d[i] = 0;
-+              val[0]->top = j;
-+              if (!BN_mod_mul_montgomery(rr,r,val[0],mont,ctx)) goto err;
-+              }
-+      else
-+#endif
-       if (!BN_from_montgomery(rr,r,mont,ctx)) goto err;
-       ret=1;
- err:
-@@ -528,6 +547,28 @@ err:
-       return(ret);
-       }
- 
-+#if defined(OPENSSL_BN_ASM_MONT) && (defined(__sparc__) || defined(__sparc))
-+static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
-+      {
-+      BN_ULONG ret=0;
-+      int wordpos;
-+
-+      wordpos = bitpos/BN_BITS2;
-+      bitpos %= BN_BITS2;
-+      if (wordpos>=0 && wordpos < a->top)
-+              {
-+              ret = a->d[wordpos]&BN_MASK2;
-+              if (bitpos)
-+                      {
-+                      ret >>= bitpos;
-+                      if (++wordpos < a->top)
-+                              ret |= a->d[wordpos]<<(BN_BITS2-bitpos);
-+                      }
-+              }
-+
-+      return ret&BN_MASK2;
-+}
-+#endif
- 
- /* BN_mod_exp_mont_consttime() stores the precomputed powers in a specific 
layout
-  * so that accessing any of these table values shows the same access pattern 
as far
-@@ -587,6 +592,9 @@
-       int powerbufLen = 0;
-       unsigned char *powerbuf=NULL;
-       BIGNUM tmp, am;
-+#if defined(OPENSSL_BN_ASM_MONT) && defined(__sparc)
-+      unsigned int t4=0;
-+#endif
- 
-       bn_check_top(a);
-       bn_check_top(p);
-@@ -621,9 +629,18 @@
- 
-       /* Get the window size to use with size of p. */
-       window = BN_window_bits_for_ctime_exponent_size(bits);
-+#if defined(OPENSSL_BN_ASM_MONT) && defined(__sparc)
-+      if (window>=5 && (top&15)==0 && top<=64 &&
-+          (OPENSSL_sparcv9cap_P[1]&(CFR_MONTMUL|CFR_MONTSQR))==
-+                                   (CFR_MONTMUL|CFR_MONTSQR) &&
-+          (t4=OPENSSL_sparcv9cap_P[0]))
-+              window=5;
-+      else
-+#endif
- #if defined(OPENSSL_BN_ASM_MONT5)
-       if (window==6 && bits<=1024) window=5;  /* ~5% improvement of 2048-bit 
RSA sign */
- #endif
-+      (void)0;
- 
-       /* Allocate a buffer large enough to hold all of the pre-computed
-        * powers of am, am itself and tmp.
-@@ -656,13 +715,13 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM 
*a, const BIGNUM *p,
-       tmp.flags = am.flags = BN_FLG_STATIC_DATA;
- 
-       /* prepare a^0 in Montgomery domain */
--#if 1
--      if (!BN_to_montgomery(&tmp,BN_value_one(),mont,ctx))    goto err;
--#else
-+#if 1 /* by Shay Gueron's suggestion */
-       tmp.d[0] = (0-m->d[0])&BN_MASK2;        /* 2^(top*BN_BITS2) - m */
-       for (i=1;i<top;i++)
-               tmp.d[i] = (~m->d[i])&BN_MASK2;
-       tmp.top = top;
-+#else
-+      if (!BN_to_montgomery(&tmp,BN_value_one(),mont,ctx))    goto err;
- #endif
- 
-       /* prepare a^1 in Montgomery domain */
-@@ -673,6 +690,121 @@
-               }
-       else    if (!BN_to_montgomery(&am,a,mont,ctx))          goto err;
- 
-+#if defined(OPENSSL_BN_ASM_MONT) && defined(__sparc)
-+    if (t4)
-+      {
-+      typedef int (*bn_pwr5_mont_f)(BN_ULONG *tp,const BN_ULONG *np,

@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

Reply via email to