--- old/exception_lists/check_rtime	Thu Feb 12 16:37:39 2015
+++ new/exception_lists/check_rtime	Thu Feb 12 16:37:39 2015
@@ -20,6 +20,7 @@
 #
 
 #
+# Copyright 2015 Gary Mills
 # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
 #
 
@@ -60,6 +61,10 @@
 SKIP		^usr/platform/.*/libpsvcpolicy\.so\.1
 SKIP		^usr/lib/sysevent/modules/picl_slm.so$
 
+# Files that link with libraries on the build host
+SKIP		^usr/bin/tpmadm$
+SKIP		^usr/lib/security/pkcs11_tpm.so.1$
+
 # Objects that are allowed to have executable data segments
 EXEC_DATA	^MACH(lib)/ld\.so\.1$
 EXEC_DATA	^lib/libc\.so\.1$	# 6524709, 32-bit, needed for x86 only
@@ -214,6 +219,9 @@
 NOSYMSORT	lib/sparcv9/libsun_fc\.so\.1 			# C++
 NOSYMSORT	usr/lib/amd64/libfru\.so\.1			# C++
 
+# Files with assembler aliasing
+NOSYMSORT	lib/libsunw_crypto\.so\.1
+NOSYMSORT	lib/sparcv9/libsunw_crypto\.so\.1
 
 # The libprtdiag_psr.so.1 objects built under usr/src/lib/libprtdiag_psr
 # are a family, all built using the same makefile, targeted at different
--- old/exception_lists/packaging	Thu Feb 12 16:37:39 2015
+++ new/exception_lists/packaging	Thu Feb 12 16:37:39 2015
@@ -23,6 +23,7 @@
 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 # Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
 # Copyright 2012 OmniTI Computer Consulting, Inc.  All rights reserved.
+# Copyright 2015 Gary Mills
 #
 
 #
@@ -995,3 +996,26 @@
 usr/lib/libpcidb.so
 usr/lib/llib-lpcidb
 usr/lib/llib-lpcidb.ln
+
+#
+# Private openssl headers, symlinks, and lint libraries
+#
+usr/include/openssl
+lib/amd64/libcrypto.so	i386
+lib/amd64/libssl.so	i386
+lib/sparcv9/libcrypto.so	sparc
+lib/sparcv9/libssl.so	sparc
+lib/libcrypto.so
+lib/libssl.so
+lib/openssl/engines/libpk11.so
+lib/amd64/llib-lsunw_crypto.ln	i386
+lib/amd64/llib-lsunw_ssl.ln		i386
+lib/openssl/engines/amd64/libpk11.so	i386
+lib/sparcv9/llib-lsunw_crypto.ln	sparc
+lib/sparcv9/llib-lsunw_ssl.ln	sparc
+lib/openssl/engines/sparcv9/libpk11.so	sparc
+lib/llib-lsunw_crypto
+lib/llib-lsunw_crypto.ln
+lib/llib-lsunw_ssl
+lib/llib-lsunw_ssl.ln
+
--- old/usr/src/Targetdirs	Thu Feb 12 16:37:39 2015
+++ new/usr/src/Targetdirs	Thu Feb 12 16:37:39 2015
@@ -25,6 +25,7 @@
 # Copyright 2012 OmniTI Computer Consulting, Inc.  All rights reserved.
 # Copyright (c) 2013 RackTop Systems.
 # Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
+# Copyright 2015 Gary Mills
 #
 
 #
@@ -161,6 +162,8 @@
 	/lib/crypto \
 	/lib/inet \
 	/lib/fm \
+	/lib/openssl \
+	/lib/openssl/engines \
 	/lib/secure \
 	/lib/svc \
 	/lib/svc/bin \
@@ -522,6 +525,7 @@
 	/lib/$(MACH64) \
 	/lib/crypto/$(MACH64) \
 	/lib/fm/$(MACH64) \
+	/lib/openssl/engines/$(MACH64) \
 	/lib/secure/$(MACH64) \
 	/usr/bin/$(MACH64) \
 	/usr/ccs/bin/$(MACH64)  \
@@ -598,6 +602,7 @@
 	/lib/64 \
 	/lib/crypto/64 \
 	/lib/secure/64 \
+	/lib/openssl/engines/64 \
 	/usr/lib/64 \
 	/usr/lib/brand/sn1/64 \
 	/usr/lib/brand/solaris10/64 \
@@ -705,6 +710,7 @@
 $(BUILD64) $(ROOT)/lib/64:=		LINKDEST=$(MACH64)
 $(BUILD64) $(ROOT)/lib/crypto/64:=	LINKDEST=$(MACH64)
 $(BUILD64) $(ROOT)/lib/secure/64:=	LINKDEST=$(MACH64)
+$(BUILD64) $(ROOT)/lib/openssl/engines/64:=	LINKDEST=$(MACH64)
 $(BUILD64) $(ROOT)/usr/lib/64:=		LINKDEST=$(MACH64)
 $(BUILD64) $(ROOT)/usr/lib/elfedit/64:=	LINKDEST=$(MACH64)
 $(BUILD64) $(ROOT)/usr/lib/brand/sn1/64:=	LINKDEST=$(MACH64)
--- old/usr/src/cmd/cmd-crypto/tpmadm/Makefile	Thu Feb 12 16:37:39 2015
+++ new/usr/src/cmd/cmd-crypto/tpmadm/Makefile	Thu Feb 12 16:37:39 2015
@@ -18,6 +18,7 @@
 #
 # CDDL HEADER END
 #
+# Copyright 2015 Gary Mills
 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
@@ -34,9 +35,12 @@
 POFILE = $(PROG)_msg.po
 MSGFILES=$(SRCS:%.c=%.i)
 
+# Use libraries and include files from the build host
+LDLIBS=		-ltspi -luuid -lcrypto
+CPPFLAGS=	$(DTEXTDOM) $(DTS_ERRNO)
 CPPFLAGS += -xCC
+
 LINTFLAGS += -XCC  -L$(ADJUNCT_PROTO)/usr/lib
-LDLIBS += -ltspi -luuid
 
 CLOBBERFILES = C.ln $(POFILE) $(POFILES)
 
--- old/usr/src/lib/Makefile	Thu Feb 12 16:37:39 2015
+++ new/usr/src/lib/Makefile	Thu Feb 12 16:37:39 2015
@@ -24,6 +24,7 @@
 # Copyright (c) 2012 by Delphix. All rights reserved.
 # Copyright (c) 2012, Joyent, Inc. All rights reserved.
 # Copyright (c) 2013 Gary Mills
+# Copyright 2015 Gary Mills
 
 include ../Makefile.master
 
@@ -136,6 +137,7 @@
 	libsendfile	\
 	nametoaddr	\
 	ncad_addr	\
+	openssl		\
 	hbaapi		\
 	smhba		\
 	sun_fc		\
@@ -476,6 +478,7 @@
 	libzfs_jni	\
 	libzoneinfo	\
 	libzonestat	\
+	openssl		\
 	hal		\
 	policykit	\
 	lvm		\
@@ -588,7 +591,7 @@
 libipadm:	libnsl libinetutil libsocket libdlpi libnvpair libdhcpagent \
 		libdladm libsecdb
 libiscsit:	libc libnvpair libstmf libuuid libnsl
-libkmf:		libcryptoutil pkcs11
+libkmf:		libcryptoutil pkcs11 openssl
 libnsl:		libmd5
 libmapid:	libresolv
 librdc:		libsocket libnsl libnsctl libunistat libdscfg
@@ -621,8 +624,9 @@
 libtsnet:	libnsl libtsol libsecdb
 libwrap:	libnsl libsocket
 libwanboot:	libnvpair libresolv libnsl libsocket libdevinfo libinetutil \
-		libdhcputil
+		libdhcputil openssl
 libwanbootutil:	libnsl
+openssl:	libnsl libsocket
 pam_modules:	libproject passwdutil smbsrv
 libscf:		libuutil libmd libgen libsmbios libnsl
 libinetsvc:	libscf
@@ -630,7 +634,7 @@
 libsaveargs:	libdisasm
 ../cmd/sgs/libdl:	../cmd/sgs/libconv
 ../cmd/sgs/libelf:	../cmd/sgs/libconv
-pkcs11:		libcryptoutil
+pkcs11:		libcryptoutil openssl
 print:		libldap5
 udapl/udapl_tavor:	udapl/libdat
 libzfs:		libdevid libgen libnvpair libuutil \
--- old/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com	Thu Feb 12 16:37:40 2015
+++ new/usr/src/lib/pkcs11/pkcs11_tpm/Makefile.com	Thu Feb 12 16:37:40 2015
@@ -18,6 +18,7 @@
 #
 # CDDL HEADER END
 #
+# Copyright 2015 Gary Mills
 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
@@ -73,9 +74,15 @@
 TSSLIB64=-L$(TSPILIBDIR)/$(MACH64)
 TSSINC=-I$(TSPIINCDIR)
 
-LDLIBS += $(TSSLIB) -L$(ADJUNCT_PROTO)/lib -lc -luuid -lmd -ltspi -lcrypto
-CPPFLAGS += -xCC -D_POSIX_PTHREAD_SEMANTICS $(TSSINC)
-CPPFLAGS64 += $(CPPFLAGS)
+# Use libraries and include files from the build host
+LDLIBS=		$(TSSLIB) -L$(ADJUNCT_PROTO)/lib -lc -luuid -lmd -ltspi \
+		-lcrypto
+CPPFLAGS=	$(DTEXTDOM) $(DTS_ERRNO)
+CPPFLAGS +=	-xCC -D_POSIX_PTHREAD_SEMANTICS
+COMPILE.c=	$(CC) $(CFLAGS) $(TSSINC) $(CPPFLAGS) -c
+LINT.c=		$(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS) $(TSSINC) $(CPPFLAGS) \
+		$(ALWAYS_LINT_DEFS)
+
 C99MODE=        $(C99_ENABLE)
 
 CERRWARN +=	-_gcc=-Wno-parentheses
--- /dev/null	Thu Feb 12 16:37:40 2015
+++ new/usr/src/pkg/manifests/system-library-security-openssl-private.mf	Thu Feb 12 16:37:40 2015
@@ -0,0 +1,37 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source.  A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2015 Gary Mills
+#
+
+set name=pkg.fmri \
+    value=pkg:/system/library/security/openssl-private@1.0.1.8,$(PKGVERS_BUILTON)-0.$(PKGVERS_BRANCH)
+set name=pkg.description \
+    value="Private cryptography toolkit implementing SSL v2/v3 and TLS v1 network protocols, derived from openssl 1.0.1h"
+set name=pkg.summary \
+    value="Private cryptography toolkit with SSL v2/v3 and TLS v1"
+set name=info.classification \
+    value=org.opensolaris.category.2008:System/Libraries
+set name=variant.arch value=$(ARCH)
+dir path=lib
+dir path=lib/openssl
+dir path=lib/openssl/engines
+dir path=lib/openssl/engines/$(ARCH64)
+file path=lib/$(ARCH64)/libsunw_crypto.so.1
+file path=lib/$(ARCH64)/libsunw_ssl.so.1
+file path=lib/libsunw_crypto.so.1
+file path=lib/libsunw_ssl.so.1
+file path=lib/openssl/engines/$(ARCH64)/libsunw_pk11.so.1
+file path=lib/openssl/engines/libsunw_pk11.so.1
+license lic_CDDL license=lic_CDDL
+license usr/src/lib/openssl/LICENSE license=usr/src/lib/openssl/LICENSE
+link path=lib/openssl/engines/64 target=$(ARCH64)
