diff --git a/openssl3/build.sh b/openssl3/build.sh new file mode 100755 index 0000000..4245bcd --- /dev/null +++ b/openssl3/build.sh @@ -0,0 +1,98 @@ +#!/bin/bash +# This is a buildpkg build.sh script +# build.sh helper functions +. ${BUILDPKG_SCRIPTS}/build.sh.functions +# +########################################################### +# Check the following 4 variables before running the script +topdir=openssl +version=3.0.0 +pkgver=1 +source[0]=https://openssl.org/source/$topdir-$version.tar.gz +# If there are no patches, simply comment this +patch[0]=0001-Fix-fallback-for-missing-getaddrinfo.patch +patch[1]=0002-Include-sys-atomic.h-directly-on-Solaris.patch +patch[2]=0003-Provide-socklen_t-on-Solaris-2.6.patch +patch[3]=0004-Fix-build-with-posix95-pthreads.patch +patch[4]=0005-Handle-missing-stdint.h-on-older-Solaris.patch +patch[5]=0006-Handle-missing-strtoumax.patch + +# Source function library +. ${BUILDPKG_SCRIPTS}/buildpkg.functions + +# For cpu settings +. ${BUILDPKG_BASE}/gcc/build.sh.gcc.cpu + +# Global settings +make_check_target="test" +__configure="./Configure" +configure_args=(--prefix=$prefix --openssldir=${prefix}/${_sharedir}/ssl --with-rand-seed=devrandom,egd zlib shared enable-egd) +if [ "$arch" = "sparc" ]; then + configure_args+=(solaris-sparc${gcc_arch}-gcc) +else + configure_args+=(solaris-x86-gcc 386) + configure_args+=(CFLAGS="-march=${gcc_arch}") +fi +configure_args+=(LDFLAGS="-L$prefix/lib -R$prefix/lib -lposix4") +cpus_online=$(psrinfo | nawk '/on-line/ {count++} END { print count }') + +reg prep +prep() +{ + generic_prep +} + +reg build +build() +{ + setdir source + + echo $__configure "${configure_args[@]}" + $__configure "${configure_args[@]}" + + ${__make} -j${cpus_online} depend + ${__make} -j${cpus_online} +} + +reg check +check() +{ + generic_check +} + +reg install +install() +{ + clean stage + setdir source + ${__make} DESTDIR=$stagedir install + # Make .sos writable + chmod 755 ${stagedir}${prefix}/${_libdir}/*.so.* + chmod 755 ${stagedir}${prefix}/${_libdir}/engines-3/*.so + # Nuke static libraries - they just take up space + ${__rm} -f ${stagedir}${prefix}/${_libdir}/*.a + + doc README* CHANGES.md LICENSE.txt NEWS.md + + custom_install=1 + generic_install INSTALL_PREFIX + + # Compatible with previous releases +} + +reg pack +pack() +{ + generic_pack +} + +reg distclean +distclean() +{ + clean distclean +} + +################################################### +# No need to look below here +################################################### +build_sh $* diff --git a/openssl3/meta/ChangeLog b/openssl3/meta/ChangeLog new file mode 100644 index 0000000..ce10f1d --- /dev/null +++ b/openssl3/meta/ChangeLog @@ -0,0 +1,4 @@ +CHANGELOG +--------- +* Sun Nov 14 2021 Tom G. Christensen - 3.0.0-1 +- First release diff --git a/openssl3/meta/depend b/openssl3/meta/depend new file mode 100644 index 0000000..6c273e1 --- /dev/null +++ b/openssl3/meta/depend @@ -0,0 +1,4 @@ +TGCssl3 TGCprngd auto +TGCssl3 TGCossl auto +TGCssl3d openssl auto +TGCssl3u openssl auto diff --git a/openssl3/meta/pkgdef b/openssl3/meta/pkgdef new file mode 100644 index 0000000..fabbf22 --- /dev/null +++ b/openssl3/meta/pkgdef @@ -0,0 +1,57 @@ +[openssl] +pkgname="${pkgprefix}ssl3" +name="openssl - OpenSSL shared libraries" +pkgcat="system" +pkgvendor="https://www.openssl.org" +pkgdesc="Cryptography and SSL/TLS Toolkit" +pkgver="$pkgver" +files(-,root,bin) +$_vdocdir +$_libdir/*.so.* +$_libdir/engines-3 +$_libdir/ossl-modules +$_sharedir/ssl + +[openssl-utils] +pkgname="${pkgprefix}ssl3u" +name="openssl-utils - OpenSSL utilities and manpages" +pkgcat="system" +pkgvendor="https://www.openssl.org" +pkgdesc="Cryptography and SSL/TLS Toolkit" +pkgver="$pkgver" +files(-,root,bin) +$_bindir +$_mandir/man{1,5,7} + +[openssl-devel] +pkgname="${pkgprefix}ssl3d" +name="openssl-devel - Development support for OpenSSL" +pkgcat="system" +pkgvendor="https://www.openssl.org" +pkgdesc="Files needed for developing with OpenSSL" +pkgver="$pkgver" +files(-,root,bin) +$_includedir +$_libdir/*.so +$_libdir/pkgconfig + +[openssl-devel-manpages] +pkgname="${pkgprefix}ssl3m" +name="openssl-devel-manpages - Development documentation for OpenSSL" +pkgcat="system" +pkgvendor="https://www.openssl.org" +pkgdesc="Development manpages for OpenSSL" +pkgver="$pkgver" +files(-,root,bin) +$_mandir/man3 + +[openssl-htmldocs] +pkgname="${pkgprefix}ssl3h" +name="openssl-htmldocs - Documentation in HTML format" +pkgcat="system" +pkgvendor="http://www.openssl.org" +pkgdesc="OpenSSL documentation in HTML format" +pkgver="$pkgver" +files(-,root,bin) +$_sharedir/doc/openssl + diff --git a/openssl3/meta/relnotes b/openssl3/meta/relnotes new file mode 100644 index 0000000..3cf9ffe --- /dev/null +++ b/openssl3/meta/relnotes @@ -0,0 +1,40 @@ +PACKAGE DETAILS +--------------- +Name: %%PKGNAME%% +Version: %%SOURCE_AND_VER%% +Vendor: %%VENDOR%% +Packager: %%PKGEDBY%% + +Source (sha1sum): +%%SOURCE_SHA1SUM%% + +BUILD DETAILS +------------- +Compiler: +%%COMPILER%% + +Environment: +%%ENVIRONMENT%% + +Configure: +%%CONFIGURE%% + +KNOWN DEPENDENCIES +------------------ +%%DEPENDENCIES%% + +ERRORS/MISCELLANEOUS +-------------------- +Note that all manpages has had 'ossl' added to their name. +This means that you might have to specify the whole name +if there's another manpage by the same name. +ie. man x509 vs man x509.1ossl + +The dependency on the previous version of openssl is an artificial one added to +ensure the parallel installable version of that package is used even if other +packages only require the older revision. +It is unfortunately not possible to use the 'I' type in depend(4) to handle +this since those versions are also matched against the compver(4) entries for +the package. +If you have no software installed that require the earlier openssl package you +can safely uninstall it. diff --git a/openssl3/src/0001-Fix-fallback-for-missing-getaddrinfo.patch b/openssl3/src/0001-Fix-fallback-for-missing-getaddrinfo.patch new file mode 100644 index 0000000..04690ef --- /dev/null +++ b/openssl3/src/0001-Fix-fallback-for-missing-getaddrinfo.patch @@ -0,0 +1,26 @@ +From 4b50edca4dfb70ba36ece8dfb457c2c52dd65065 Mon Sep 17 00:00:00 2001 +From: "Tom G. Christensen" +Date: Wed, 27 Oct 2021 20:15:30 +0200 +Subject: [PATCH 1/6] Fix fallback for missing getaddrinfo() + +Allow port 0 which is what the testsuite uses. +--- + crypto/bio/bio_addr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/crypto/bio/bio_addr.c b/crypto/bio/bio_addr.c +index d18c849ade..16a3676492 100644 +--- a/crypto/bio/bio_addr.c ++++ b/crypto/bio/bio_addr.c +@@ -867,7 +867,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type, + } + + if (endp != service && *endp == '\0' +- && portnum > 0 && portnum < 65536) { ++ && portnum >= 0 && portnum < 65536) { + se_fallback.s_port = htons((unsigned short)portnum); + se_fallback.s_proto = proto; + se = &se_fallback; +-- +2.27.0 + diff --git a/openssl3/src/0002-Include-sys-atomic.h-directly-on-Solaris.patch b/openssl3/src/0002-Include-sys-atomic.h-directly-on-Solaris.patch new file mode 100644 index 0000000..35c11cd --- /dev/null +++ b/openssl3/src/0002-Include-sys-atomic.h-directly-on-Solaris.patch @@ -0,0 +1,29 @@ +From 9aa7d4ac148ac0b9aa695936d6f5d01ab198f05c Mon Sep 17 00:00:00 2001 +From: "Tom G. Christensen" +Date: Wed, 27 Oct 2021 20:38:52 +0200 +Subject: [PATCH 2/6] Include directly on Solaris + +Only Solaris 10 has and it is only a wrapper around +. +--- + crypto/threads_pthread.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c +index 9f00d8be5e..2792f82684 100644 +--- a/crypto/threads_pthread.c ++++ b/crypto/threads_pthread.c +@@ -13,8 +13,8 @@ + #include + #include "internal/cryptlib.h" + +-#if defined(__sun) +-# include ++#if defined(__sun) || defined (sun) ++# include + #endif + + #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && !defined(OPENSSL_SYS_WINDOWS) +-- +2.27.0 + diff --git a/openssl3/src/0003-Provide-socklen_t-on-Solaris-2.6.patch b/openssl3/src/0003-Provide-socklen_t-on-Solaris-2.6.patch new file mode 100644 index 0000000..53f7c4c --- /dev/null +++ b/openssl3/src/0003-Provide-socklen_t-on-Solaris-2.6.patch @@ -0,0 +1,27 @@ +From 6266f902d2e12987812060db6fad106e1614dc13 Mon Sep 17 00:00:00 2001 +From: "Tom G. Christensen" +Date: Wed, 27 Oct 2021 20:48:25 +0200 +Subject: [PATCH 3/6] Provide socklen_t on Solaris 2.6 + +--- + crypto/bio/bio_local.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/crypto/bio/bio_local.h b/crypto/bio/bio_local.h +index 749e8f810c..f1c9aa9473 100644 +--- a/crypto/bio/bio_local.h ++++ b/crypto/bio/bio_local.h +@@ -141,6 +141,10 @@ struct bio_st { + typedef unsigned int socklen_t; + # endif + ++# if !defined(socklen_t) && ((defined(sun) || defined(__sun))) ++typedef size_t socklen_t; ++# endif ++ + extern CRYPTO_RWLOCK *bio_lookup_lock; + + int BIO_ADDR_make(BIO_ADDR *ap, const struct sockaddr *sa); +-- +2.27.0 + diff --git a/openssl3/src/0004-Fix-build-with-posix95-pthreads.patch b/openssl3/src/0004-Fix-build-with-posix95-pthreads.patch new file mode 100644 index 0000000..fdebbad --- /dev/null +++ b/openssl3/src/0004-Fix-build-with-posix95-pthreads.patch @@ -0,0 +1,36 @@ +From 6abfca6f0805c0c3e9b6bd0e7298ce01962f08b8 Mon Sep 17 00:00:00 2001 +From: "Tom G. Christensen" +Date: Wed, 27 Oct 2021 20:52:24 +0200 +Subject: [PATCH 4/6] Fix build with posix95 pthreads + +Solaris 2.6 only conforms to POSIX.1c pthreads which has no mutex +attribute support. +--- + crypto/threads_pthread.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c +index 2792f82684..31005ad4c3 100644 +--- a/crypto/threads_pthread.c ++++ b/crypto/threads_pthread.c +@@ -58,10 +58,14 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void) + */ + pthread_mutexattr_init(&attr); + # if !defined (__TANDEM) && !defined (_SPT_MODEL_) +-# if !defined(NDEBUG) && !defined(OPENSSL_NO_MUTEX_ERRORCHECK) +- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); ++# if defined(PTHREAD_MUTEX_NORMAL) ++# if !defined(NDEBUG) && !defined(OPENSSL_NO_MUTEX_ERRORCHECK) ++ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); ++# else ++ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL); ++# endif + # else +- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL); ++ /* Assume POSIX.1c threads with no MUTEX type attribute. */ + # endif + # else + /* The SPT Thread Library does not define MUTEX attributes. */ +-- +2.27.0 + diff --git a/openssl3/src/0005-Handle-missing-stdint.h-on-older-Solaris.patch b/openssl3/src/0005-Handle-missing-stdint.h-on-older-Solaris.patch new file mode 100644 index 0000000..1a7990f --- /dev/null +++ b/openssl3/src/0005-Handle-missing-stdint.h-on-older-Solaris.patch @@ -0,0 +1,29 @@ +From da14a764a1a533bb6043fa9e682256fe6c02772f Mon Sep 17 00:00:00 2001 +From: "Tom G. Christensen" +Date: Wed, 27 Oct 2021 21:33:59 +0200 +Subject: [PATCH 5/6] Handle missing on older Solaris + +Basically we assume that if we are on a Solaris platform with gcc older +than 4.5 then is not available. +If gcc >= 4.5 then either gcc or the platform will provide . +--- + include/openssl/e_os2.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/include/openssl/e_os2.h b/include/openssl/e_os2.h +index 6728909271..a0b68bb376 100644 +--- a/include/openssl/e_os2.h ++++ b/include/openssl/e_os2.h +@@ -235,6 +235,9 @@ typedef UINT64 uint64_t; + # undef OPENSSL_NO_INTTYPES_H + /* Because the specs say that inttypes.h includes stdint.h if present */ + # undef OPENSSL_NO_STDINT_H ++# elif (defined(sun) || defined(__sun)) && (defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))) ++# include ++# undef OPENSSL_NO_INTTYPES_H + # elif defined(_MSC_VER) && _MSC_VER<1600 + /* + * minimally required typdefs for systems not supporting inttypes.h or +-- +2.27.0 + diff --git a/openssl3/src/0006-Handle-missing-strtoumax.patch b/openssl3/src/0006-Handle-missing-strtoumax.patch new file mode 100644 index 0000000..bd25b77 --- /dev/null +++ b/openssl3/src/0006-Handle-missing-strtoumax.patch @@ -0,0 +1,25 @@ +From 749b94c6b91e1abdbd7acb816ac901336c81a911 Mon Sep 17 00:00:00 2001 +From: "Tom G. Christensen" +Date: Thu, 28 Oct 2021 21:33:49 +0200 +Subject: [PATCH 6/6] Handle missing strtoumax + +--- + test/params_conversion_test.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/params_conversion_test.c b/test/params_conversion_test.c +index 9422ef1473..300899f861 100644 +--- a/test/params_conversion_test.c ++++ b/test/params_conversion_test.c +@@ -19,7 +19,7 @@ + # define strcasecmp _stricmp + # endif + +-# ifdef OPENSSL_SYS_VMS ++# if defined(OPENSSL_SYS_VMS) || !defined(strtoumax) + # define strtoumax strtoull + # define strtoimax strtoll + # endif +-- +2.27.0 +