Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..991e407
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,142 @@
+#
+#    Copyright (c) 2010-2012 Nest, Inc.
+#    All rights reserved.
+#
+#    This document is the property of Nest. It is considered
+#    confidential and proprietary information.
+#
+#    This document may not be reproduced or transmitted in any form,
+#    in whole or in part, without the express written permission of
+#    Nest.
+#
+#    Description:
+#      This file is the makefile for the Open Secure Socket Layer
+#      (SSL) library.
+#
+
+.NOTPARALLEL:
+
+
+include pre.mak
+
+PackageName		:= openssl
+
+PackageExtension	:= tar.gz
+PackageSeparator	:= -
+
+PackagePatchArgs	:= -p1
+
+PackageArchive		:= $(PackageName)$(PackageSeparator)$(PackageVersion).$(PackageExtension)
+PackageSourceDir	:= $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageBuildMakefile	= $(call GenerateBuildPaths,Makefile)
+
+CleanPaths		+= $(PackageLicenseFile)
+
+LinuxDir		:= sw/tps/linux
+LinuxIncDir		:= $(call GenerateResultPaths,$(LinuxDir),include)
+
+ZlibDir			:= sw/tps/zlib
+ZlibIncDir      	:= $(call GenerateResultPaths,$(ZlibDir),usr/include)
+ZlibLibDir      	:= $(call GenerateResultPaths,$(ZlibDir),usr/lib)
+
+OpenSSLPackageOptions	+= experimental-jpake $(call ToolGenerateDefineArgument,OPENSSL_EXPERIMENTAL_JPAKE)
+
+OpenSSLTargets	      = all
+OpenSSLInstallTargets = install
+
+# If the feature BUILD_FEATURE_OPENSSL_FORCE32_LONG is set, we're forcing OpenSSL to use a 32bit long
+# We typically set this when building the simulator because our PASE code expects BN_BYTES == 4
+# We force 32bit by setting the TargetConfig to gcc
+# Couple unfortunate side effects:
+# 1) Assembly is not supported
+# 2) This TargetConfig forces us to build as a static library (OpenSSL limitation)
+# 3) We have to turn off compression.  Zlib causes problems for other packages like curl 
+#    whose configure script can't seem to realize that it needs to bring in zlib as well
+#    (might be a pkgconfig issue with openssl?)
+# 4) We have to compile with -fPIC since other dylibs (curl) link openssl
+ifeq ($(BUILD_FEATURE_OPENSSL_FORCE32_LONG),1)
+OpenSSLPackageOptions += no-asm no-zlib
+OpenSSLCCFlags        = -fPIC
+OpenSSLTargetConfig   = gcc
+else
+OpenSSLPackageOptions += shared zlib
+endif
+
+SOURCEDIRS                      = $(PackageSourceDir)
+$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(PackageSourceDir)/LICENSE: $(BuildDirectory)/source
+
+$(PackageLicenseFile): $(PackageSourceDir)/LICENSE
+	$(copy-result)
+
+# Extract the source from the archive and apply patches, if any.
+
+$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
+	$(expand-and-patch-package)
+
+# Prepare the sources.
+
+$(BuildDirectory)/source: | $(PackageSourceDir)
+	$(Verbose)touch $@
+
+# Patch the sources, if necessary.
+
+$(BuildDirectory)/patch: $(BuildDirectory)/source
+	$(Verbose)touch $@
+
+# Configure the source for building.
+
+$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory)
+	$(Verbose)$(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory)) ; \
+	cd $(BuildDirectory) && \
+	INSTALL="$(INSTALL) $(INSTALLFLAG)" \
+	./Configure \
+	--prefix=/usr \
+	--openssldir=/usr/lib/ssl \
+	$(call ToolGenerateIncludeArgument,$(ZlibIncDir)) \
+	$(call ToolGenerateLibraryPathArgument,$(ZlibLibDir)) \
+	$(OpenSSLPackageOptions) \
+	$(OpenSSLCCFlags) \
+	$(OpenSSLTargetConfig)
+	$(Verbose)touch $@
+
+# Build the source.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/build: $(BuildDirectory)/configure | $(BuildDirectory)
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+	CC="$(CC)" AR="$(AR) $(ARFLAGS)" RANLIB=$(RANLIB) \
+	INSTALL_PREFIX=$(ResultDirectory) \
+	$(OpenSSLTargets)
+	$(Verbose)touch $@
+
+# Stage the build to a temporary installation area.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
+	$(Verbose)unset MAKEFLAGS && \
+	$(MAKE) -C $(BuildDirectory) \
+	CC="$(CC)" AR="$(AR) $(ARFLAGS)" RANLIB=$(RANLIB) \
+	INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+	INSTALL_PREFIX=$(ResultDirectory) \
+	$(OpenSSLInstallTargets)
+	$(Verbose)touch $@
+
+.PHONY: stage
+stage: $(BuildDirectory)/stage
+
+clean:
+	$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+	$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/openssl-1.0.2h.tar.gz b/openssl-1.0.2h.tar.gz
new file mode 100644
index 0000000..7eb74e7
--- /dev/null
+++ b/openssl-1.0.2h.tar.gz
Binary files differ
diff --git a/openssl.patches/openssl-50.description b/openssl.patches/openssl-50.description
new file mode 100644
index 0000000..da8e579
--- /dev/null
+++ b/openssl.patches/openssl-50.description
@@ -0,0 +1,3 @@
+This patch ensures that shared libraries are, at minimum, user writable 
+so that they may be successfully stripped when generating file system 
+and installation images.
diff --git a/openssl.patches/openssl-50.patch b/openssl.patches/openssl-50.patch
new file mode 100644
index 0000000..653d97f
--- /dev/null
+++ b/openssl.patches/openssl-50.patch
@@ -0,0 +1,11 @@
+--- a/Makefile.org	2010-01-27 08:06:36.000000000 -0800
++++ b/Makefile.org	2010-09-03 14:47:59.000000000 -0700
+@@ -527,7 +527,7 @@
+ 			(       echo installing $$i; \
+ 				if [ "$(PLATFORM)" != "Cygwin" ]; then \
+ 					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
+-					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
++					chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
+ 					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
+ 				else \
+ 					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
diff --git a/openssl.patches/openssl-51.description b/openssl.patches/openssl-51.description
new file mode 100644
index 0000000..7988986
--- /dev/null
+++ b/openssl.patches/openssl-51.description
@@ -0,0 +1 @@
+This patch ensures that CHECKED_STACK_OF can successfully work with C++ classes that employs cast operators.
diff --git a/openssl.patches/openssl-51.patch b/openssl.patches/openssl-51.patch
new file mode 100644
index 0000000..a0c4a69
--- /dev/null
+++ b/openssl.patches/openssl-51.patch
@@ -0,0 +1,11 @@
+--- a/crypto/stack/safestack.h	2011-08-17 15:39:52.853888167 -0700
++++ b/crypto/stack/safestack.h	2011-08-17 15:40:20.181928142 -0700
+@@ -68,7 +68,7 @@
+  */
+ 
+ # define CHECKED_STACK_OF(type, p) \
+-    ((_STACK*) (1 ? p : (STACK_OF(type)*)0))
++    ((_STACK*) (1 ? (STACK_OF(type)*)p : (STACK_OF(type)*)0))
+ 
+ # define CHECKED_SK_FREE_FUNC(type, p) \
+     ((void (*)(void *)) ((1 ? p : (void (*)(type *))0)))
diff --git a/openssl.patches/openssl-54.description b/openssl.patches/openssl-54.description
new file mode 100644
index 0000000..964c33a
--- /dev/null
+++ b/openssl.patches/openssl-54.description
@@ -0,0 +1,2 @@
+Fix openssl parallel build problem.  Applying the fix provided here:
+http://rt.openssl.org/Ticket/Display.html?id=3780&user=guest&pass=guest
diff --git a/openssl.patches/openssl-54.patch b/openssl.patches/openssl-54.patch
new file mode 100644
index 0000000..660d504
--- /dev/null
+++ b/openssl.patches/openssl-54.patch
@@ -0,0 +1,15 @@
+diff -Naur a/Makefile.org b/Makefile.org
+--- a/Makefile.org	2015-04-17 16:31:06.448921145 -0700
++++ b/Makefile.org	2015-04-20 13:48:08.654093777 -0700
+@@ -340,7 +340,10 @@
+ 		libs="$$libs -l$$i"; \
+ 	done
+ 
+-build-shared: do_$(SHLIB_TARGET) link-shared
++# The link target in Makefile.shared will create the symlink for us, so no need
++# to call link-shared directly. Doing so will cause races with two processes
++# trying to symlink the lib.
++build-shared: do_$(SHLIB_TARGET)
+ 
+ do_$(SHLIB_TARGET):
+ 	@ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
diff --git a/openssl.url b/openssl.url
new file mode 100644
index 0000000..942af52
--- /dev/null
+++ b/openssl.url
@@ -0,0 +1 @@
+https://www.openssl.org/source/openssl-1.0.2h.tar.gz
diff --git a/openssl.version b/openssl.version
new file mode 100644
index 0000000..d4479af
--- /dev/null
+++ b/openssl.version
@@ -0,0 +1 @@
+1.0.2h