APKBUILD 6.65 KB
Newer Older
1
# Maintainer: Timo Teras <timo.teras@iki.fi>
Natanael Copa's avatar
Natanael Copa committed
2
pkgname=openssl
3
pkgver=1.0.2q
4
pkgrel=0
5
pkgdesc="Toolkit for SSL v2/v3 and TLS v1"
6
url="https://openssl.org"
7
depends=
8 9 10
makedepends_build="perl"
makedepends_host="zlib-dev"
makedepends="$makedepends_host $makedepends_build"
11
depends_dev="zlib-dev"
12
arch="all"
13
license="openssl"
14

Natanael Copa's avatar
Natanael Copa committed
15
subpackages="$pkgname-dev $pkgname-doc libcrypto1.0:libcrypto libssl1.0:libssl"
16

17
source="https://www.openssl.org/source/${pkgname}-${pkgver}.tar.gz
18 19 20 21 22 23 24 25
	0001-fix-manpages.patch
	0002-busybox-basename.patch
	0003-use-termios.patch
	0004-fix-default-ca-path-for-apps.patch
	0005-fix-parallel-build.patch
	0006-add-ircv3-tls-3.1-extension-support-to-s_client.patch
	0007-reimplement-c_rehash-in-C.patch
	0008-maintain-abi-compat-with-no-freelist-and-regular-bui.patch
26 27 28 29 30 31
	0009-no-rpath.patch
	0010-ssl-env-zlib.patch
	1001-crypto-hmac-support-EVP_MD_CTX_FLAG_ONESHOT-and-set-.patch
	1002-backport-changes-from-upstream-padlock-module.patch
	1003-engines-e_padlock-implement-sha1-sha224-sha256-accel.patch
	1004-crypto-engine-autoload-padlock-dynamic-engine.patch
32
	"
33

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
# secfixes:
#   1.0.2h-r0:
#     - CVE-2016-2107
#     - CVE-2016-2105
#     - CVE-2016-2106
#     - CVE-2016-2109
#     - CVE-2016-2176
#   1.0.2h-r1:
#     - CVE-2016-2177
#     - CVE-2016-2178
#   1.0.2h-r2:
#     - CVE-2016-2180
#   1.0.2h-r3:
#     - CVE-2016-2179
#     - CVE-2016-2182
#     - CVE-2016-6302
#     - CVE-2016-6303
51 52
#   1.0.2h-r4:
#     - CVE-2016-2181
53 54 55 56
#   1.0.2i-r0:
#     - CVE-2016-2183
#     - CVE-2016-6304
#     - CVE-2016-6306
57 58
#   1.0.2j-r0:
#     - CVE-2016-7052
59 60 61 62
#   1.0.2k-r0:
#     - CVE-2016-7055
#     - CVE-2017-3731
#     - CVE-2017-3732
63 64 65
#   1.0.2m-r0:
#     - CVE-2017-3735
#     - CVE-2017-3736
66 67 68
#   1.0.2n-r0:
#     - CVE-2017-3737
#     - CVE-2017-3738
69 70 71 72
#   1.0.2o-r0:
#     - CVE-2017-3738
#     - CVE-2018-0733
#     - CVE-2018-0739
73 74 75
#   1.0.2o-r1:
#     - CVE-2018-0732
#     - CVE-2018-0737
76 77 78
#   1.0.2q-r0:
#     - CVE-2018-0734
#     - CVE-2018-5407
79

80
_builddir="$srcdir"/$pkgname-$pkgver
81

82
prepare() {
83 84 85 86 87 88 89 90 91
        cd "$_builddir"
        for patch in $source; do
                case $patch in
                *.patch)
                        msg "Applying patch $patch"
                        patch -p1 -i "$srcdir"/$patch || return 1
                        ;;
                esac
        done
92 93 94

	# force generate apps, due to c_rehash patch
	rm -rf "$_builddir"/apps/progs.h
95
}
Natanael Copa's avatar
Natanael Copa committed
96

97
build() {
98
	local _target _optflags
99
	cd "$_builddir"
100 101 102 103 104 105 106 107 108

	# openssl will prepend crosscompile always core CC et al
	CC=${CC#${CROSS_COMPILE}}
	CXX=${CXX#${CROSS_COMPILE}}
	CPP=${CPP#${CROSS_COMPILE}}

	# determine target OS for openssl
	case "$CARCH" in
	x86)    _target="linux-elf" ;;
109
	x86_64) _target="linux-x86_64"; _optflags="enable-ec_nistp_64_gcc_128" ;;
110
	arm*)   _target="linux-armv4" ;;
111
	*)	msg "Unable to determine architecture from (CARCH=$CARCH)" ; return 1 ;;
112 113 114 115 116 117
	esac

	# Configure assumes --options are for it, so can't use
	# gcc's --sysroot fake this by overriding CC
	[ -n "$CBUILDROOT" ] && CC="$CC --sysroot=${CBUILDROOT}"

118
	perl ./Configure $_target --prefix=/usr \
Natanael Copa's avatar
Natanael Copa committed
119
		--libdir=lib \
Natanael Copa's avatar
Natanael Copa committed
120
		--openssldir=/etc/ssl \
121
		shared zlib enable-montasm enable-md2 $_optflags \
122
		enable-ssl2 \
123
		-DOPENSSL_NO_BUF_FREELISTS \
124
		$CPPFLAGS $CFLAGS $LDFLAGS -Wa,--noexecstack \
Natanael Copa's avatar
Natanael Copa committed
125
		|| return 1
Natanael Copa's avatar
Natanael Copa committed
126

Natanael Copa's avatar
Natanael Copa committed
127
	make && make build-shared || return 1
128 129 130 131
}

package() {
	cd "$_builddir"
132 133
	make INSTALL_PREFIX="$pkgdir" MANDIR=/usr/share/man install || return 1

134 135 136
	# c_rehash compat link
	ln -sf openssl "$pkgdir"/usr/bin/c_rehash

137 138 139 140 141 142 143
	# rename man pages that conflict with man-pages
	local m
	for m in rand.3 err.3 threads.3 passwd.1; do
		mv "$pkgdir"/usr/share/man/man${m/*.}/$m \
		   "$pkgdir"/usr/share/man/man${m/*.}/openssl-$m \
			|| return 1
	done
Natanael Copa's avatar
Natanael Copa committed
144 145
}

146 147
libcrypto() {
	pkgdesc="Crypto library from openssl"
148

149
	mkdir -p "$subpkgdir"/lib "$subpkgdir"/usr/lib
150 151 152 153
	for i in "$pkgdir"/usr/lib/libcrypto*; do
		mv $i "$subpkgdir"/lib/
		ln -s ../../lib/${i##*/} "$subpkgdir"/usr/lib/${i##*/}
	done
154 155 156
	mv "$pkgdir"/usr/lib/engines "$subpkgdir"/usr/lib/
}

Natanael Copa's avatar
Natanael Copa committed
157 158
libssl() {
	pkgdesc="SSL shared libraries"
159

Natanael Copa's avatar
Natanael Copa committed
160 161 162 163 164 165
	mkdir -p "$subpkgdir"/lib "$subpkgdir"/usr/lib
	for i in "$pkgdir"/usr/lib/libssl*; do
		mv $i "$subpkgdir"/lib/
		ln -s ../../lib/${i##*/} "$subpkgdir"/usr/lib/${i##*/}
	done
}
166 167

sha512sums="403e6cad42db3ba860c3fa4fa81c1b7b02f0b873259e5c19a7fc8e42de0854602555f1b1ca74f4e3a7737a4cbd3aac063061e628ec86534586500819fae7fec0  openssl-1.0.2q.tar.gz
168
80589e386fe57470818757a182f444a79050e1f19683650268d551d8aa436902b3bf565bb7a2aa8464013e50229c8bed5bb89fbd8387469cdfdcd3941eb3e5db  0001-fix-manpages.patch
169 170
2244f46cb18e6b98f075051dd2446c47f7590abccd108fbab707f168a20cad8d32220d704635973f09e3b2879f523be5160f1ffbc12ab3900f8a8891dc855c5c  0002-busybox-basename.patch
58e42058a0c8086c49d681b1e226da39a8cf8cb88c51cf739dec2ff12e1bb5d7208ac5033264b186d58e9bdfe992fe9ddb95701d01caf1824396b2cefe30c0a4  0003-use-termios.patch
171
c67472879a31b5dbdd313892df6d37e7c93e8c0237d406c30d50b1016c2618ead3c13277f5dc723ef1ceed092d36e3c15a9777daa844f59b9fa2b0a4f04fd9ae  0004-fix-default-ca-path-for-apps.patch
172
5d4191482f8bbf62c75fe6bc2d9587388022c3310703c2a913788a983b1d1406e706cf3916a5792604f0b0f220a87432d3b82b442cea9915f2abb6fdd8478fcb  0005-fix-parallel-build.patch
173 174 175
820d4ce1c222696fe3f1dd0d11815c06262ec230fdb174532fd507286667a0aefbf858ea5edac4245a54b950cd0556545ecd0c5cf494692a2ba131c667e7bcd5  0006-add-ircv3-tls-3.1-extension-support-to-s_client.patch
fc4e383ec85c6543e4e82520904122a5a5601c68042ece1e95a0cae95e02d89174f06f78ba2f8aacae8df16052df6ec628b568519a41706428a3fa07984cc8e3  0007-reimplement-c_rehash-in-C.patch
17ad683bb91a3a3c5bcc456c8aed7f0b42414c6de06ebafa4753af93c42d9827c9978a43d4d53d741a45df7f7895c6f6163172af57cc7b391cfd15f45ce6c351  0008-maintain-abi-compat-with-no-freelist-and-regular-bui.patch
176 177 178 179 180
5dbbc01985190ae1254350fb12565beb6abb916b6a7bb1f0f22d9762b1e575d124aaf9aa4cfe5f908e420978f691072d48c61a72660f09dfd6d9a2f83f862bc1  0009-no-rpath.patch
5febe20948e3f12d981e378e1f4ea538711657aacb6865a1aa91339d4a04277e250f490a1f2abc2c6f290bdc2b1bffdba1d00983b4c09f7ea983eef8163f9420  0010-ssl-env-zlib.patch
8c181760d7a149aa18d246d50f1c0438ffb63c98677b05306dfc00400ad0429b47d31e7c8d85126005c67f743d23e7a8a81174ffe98556f4caf9cf6b04d9ff17  1001-crypto-hmac-support-EVP_MD_CTX_FLAG_ONESHOT-and-set-.patch
a3555440b5f544bfd6b9ad97557d8f4c1d673f6a35219f65056a72035d186be5f354717ddf9784899b602464d48657b090ade24379552d43af97609c0f48c389  1002-backport-changes-from-upstream-padlock-module.patch
6353c7a94016c20db5d683dde37775f6780952ecdb1a5f39f878d04ba37f6ad79ae10fb6d65d181d912505a5d1e22463004cd855d548b364c00b120da2b0fdbc  1003-engines-e_padlock-implement-sha1-sha224-sha256-accel.patch
181
b72436eb8d4dac42d8da76a51d46cfc03e92e162f692a7a1761201221b9c6d66b738c08270b2260f02ce47b42043538474df73a7185dd4a809dd3b14cc8af7c3  1004-crypto-engine-autoload-padlock-dynamic-engine.patch"