summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/openssl/openssl_1.0.2o.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl_1.0.2o.bb')
-rw-r--r--meta/recipes-connectivity/openssl/openssl_1.0.2o.bb310
1 files changed, 300 insertions, 10 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl_1.0.2o.bb b/meta/recipes-connectivity/openssl/openssl_1.0.2o.bb
index 7cae553f35..619f3d8bfa 100644
--- a/meta/recipes-connectivity/openssl/openssl_1.0.2o.bb
+++ b/meta/recipes-connectivity/openssl/openssl_1.0.2o.bb
@@ -1,17 +1,20 @@
1require openssl10.inc 1SUMMARY = "Secure Socket Layer"
2 2DESCRIPTION = "Secure Socket Layer (SSL) binary and related cryptographic tools."
3# For target side versions of openssl enable support for OCF Linux driver 3HOMEPAGE = "http://www.openssl.org/"
4# if they are available. 4BUGTRACKER = "http://www.openssl.org/news/vulnerabilities.html"
5 5SECTION = "libs/network"
6CFLAG += "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS"
7CFLAG_append_class-native = " -fPIC"
8 6
7# "openssl | SSLeay" dual license
8LICENSE = "openssl"
9LIC_FILES_CHKSUM = "file://LICENSE;md5=f475368924827d06d4b416111c8bdb77" 9LIC_FILES_CHKSUM = "file://LICENSE;md5=f475368924827d06d4b416111c8bdb77"
10 10
11export DIRS = "crypto ssl apps engines" 11DEPENDS = "makedepend-native hostperl-runtime-native"
12export OE_LDFLAGS="${LDFLAGS}" 12DEPENDS_append_class-target = " openssl-native"
13
14PROVIDES += "openssl10"
13 15
14SRC_URI += "file://find.pl;subdir=openssl-${PV}/util/ \ 16SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
17 file://find.pl;subdir=openssl-${PV}/util/ \
15 file://run-ptest \ 18 file://run-ptest \
16 file://openssl-c_rehash.sh \ 19 file://openssl-c_rehash.sh \
17 file://configure-targets.patch \ 20 file://configure-targets.patch \
@@ -55,9 +58,64 @@ SRC_URI_append_class-nativesdk = " \
55SRC_URI[md5sum] = "44279b8557c3247cbe324e2322ecd114" 58SRC_URI[md5sum] = "44279b8557c3247cbe324e2322ecd114"
56SRC_URI[sha256sum] = "ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d" 59SRC_URI[sha256sum] = "ec3f5c9714ba0fd45cb4e087301eb1336c317e0d20b575a125050470e8089e4d"
57 60
61S = "${WORKDIR}/openssl-${PV}"
62UPSTREAM_CHECK_REGEX = "openssl-(?P<pver>1\.0.+)\.tar"
63
64PACKAGECONFIG ?= "cryptodev-linux"
65PACKAGECONFIG[perl] = ",,,"
66PACKAGECONFIG[cryptodev-linux] = "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS,,cryptodev-linux"
67
68TERMIO_libc-musl = "-DTERMIOS"
69TERMIO ?= "-DTERMIO"
70# Avoid binaries being marked as requiring an executable stack since it
71# doesn't(which causes and this causes issues with SELinux
72CFLAG = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \
73 ${TERMIO} ${CFLAGS} -Wall -Wa,--noexecstack"
74
75# For target side versions of openssl enable support for OCF Linux driver
76# if they are available.
77
78CFLAG += "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS"
79CFLAG_append_class-native = " -fPIC"
80
81export DIRS = "crypto ssl apps engines"
82export EX_LIBS = "-lgcc -ldl"
83export AS = "${CC} -c"
84
85export OE_LDFLAGS = "${LDFLAGS}"
86
87# openssl fails with ccache: https://bugzilla.yoctoproject.org/show_bug.cgi?id=12810
88CCACHE = ""
89
90inherit pkgconfig siteinfo multilib_header ptest relative_symlinks
91
92PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf"
93FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}"
94FILES_libssl = "${libdir}/libssl${SOLIBS}"
95FILES_${PN} =+ " ${libdir}/ssl/*"
96FILES_${PN}-misc = "${libdir}/ssl/misc"
97RDEPENDS_${PN}-misc = "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}"
98
99# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
100# package RRECOMMENDS on this package. This will enable the configuration
101# file to be installed for both the base openssl package and the libcrypto
102# package since the base openssl package depends on the libcrypto package.
103FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
104CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
105RRECOMMENDS_libcrypto += "openssl-conf"
106RDEPENDS_${PN}-ptest += "${PN}-misc make perl perl-module-filehandle bc"
107
58PACKAGES =+ "${PN}-engines" 108PACKAGES =+ "${PN}-engines"
59FILES_${PN}-engines = "${libdir}/ssl/engines/*.so ${libdir}/engines" 109FILES_${PN}-engines = "${libdir}/ssl/engines/*.so ${libdir}/engines"
60 110
111# Remove this to enable SSLv3. SSLv3 is defaulted to disabled due to the POODLE
112# vulnerability
113EXTRA_OECONF = " -no-ssl3"
114
115do_configure_prepend_darwin () {
116 sed -i -e '/version-script=openssl\.ld/d' Configure
117}
118
61# The crypto_use_bigint patch means that perl's bignum module needs to be 119# The crypto_use_bigint patch means that perl's bignum module needs to be
62# installed, but some distributions (for example Fedora 23) don't ship it by 120# installed, but some distributions (for example Fedora 23) don't ship it by
63# default. As the resulting error is very misleading check for bignum before 121# default. As the resulting error is very misleading check for bignum before
@@ -67,3 +125,235 @@ do_configure_prepend() {
67 bbfatal "The perl module 'bignum' was not found but this is required to build openssl. Please install this module (often packaged as perl-bignum) and re-run bitbake." 125 bbfatal "The perl module 'bignum' was not found but this is required to build openssl. Please install this module (often packaged as perl-bignum) and re-run bitbake."
68 fi 126 fi
69} 127}
128
129do_configure () {
130 cd util
131 perl perlpath.pl ${STAGING_BINDIR_NATIVE}
132 cd ..
133 ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/
134
135 os=${HOST_OS}
136 case $os in
137 linux-gnueabi |\
138 linux-gnuspe |\
139 linux-musleabi |\
140 linux-muslspe |\
141 linux-musl )
142 os=linux
143 ;;
144 *)
145 ;;
146 esac
147 target="$os-${HOST_ARCH}"
148 case $target in
149 linux-arm)
150 target=linux-armv4
151 ;;
152 linux-armeb)
153 target=linux-elf-armeb
154 ;;
155 linux-aarch64*)
156 target=linux-aarch64
157 ;;
158 linux-sh3)
159 target=debian-sh3
160 ;;
161 linux-sh4)
162 target=debian-sh4
163 ;;
164 linux-i486)
165 target=debian-i386-i486
166 ;;
167 linux-i586 | linux-viac3)
168 target=debian-i386-i586
169 ;;
170 linux-i686)
171 target=debian-i386-i686/cmov
172 ;;
173 linux-gnux32-x86_64 | linux-muslx32-x86_64 )
174 target=linux-x32
175 ;;
176 linux-gnu64-x86_64)
177 target=linux-x86_64
178 ;;
179 linux-gnun32-mips*el)
180 target=debian-mipsn32el
181 ;;
182 linux-gnun32-mips*)
183 target=debian-mipsn32
184 ;;
185 linux-mips*64*el)
186 target=debian-mips64el
187 ;;
188 linux-mips*64*)
189 target=debian-mips64
190 ;;
191 linux-mips*el)
192 target=debian-mipsel
193 ;;
194 linux-mips*)
195 target=debian-mips
196 ;;
197 linux-microblaze*|linux-nios2*|linux-gnu*ilp32**)
198 target=linux-generic32
199 ;;
200 linux-powerpc)
201 target=linux-ppc
202 ;;
203 linux-powerpc64)
204 target=linux-ppc64
205 ;;
206 linux-riscv64)
207 target=linux-generic64
208 ;;
209 linux-riscv32)
210 target=linux-generic32
211 ;;
212 linux-supersparc)
213 target=linux-sparcv8
214 ;;
215 linux-sparc)
216 target=linux-sparcv8
217 ;;
218 darwin-i386)
219 target=darwin-i386-cc
220 ;;
221 esac
222 # inject machine-specific flags
223 sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure
224 useprefix=${prefix}
225 if [ "x$useprefix" = "x" ]; then
226 useprefix=/
227 fi
228 libdirleaf="$(echo ${libdir} | sed s:$useprefix::)"
229 perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=${libdirleaf} $target
230}
231
232do_compile_prepend_class-target () {
233 sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile
234 oe_runmake depend
235 cc_sanitized=`echo "${CC} ${CFLAG}" | sed -e 's,--sysroot=${STAGING_DIR_TARGET},,g' -e 's|${DEBUG_PREFIX_MAP}||g'`
236 oe_runmake CC_INFO="${cc_sanitized}"
237}
238
239do_compile () {
240 oe_runmake depend
241 oe_runmake
242}
243
244do_compile_ptest () {
245 # build dependencies for test directory too
246 export DIRS="$DIRS test"
247 oe_runmake depend
248 oe_runmake buildtest
249}
250
251do_install () {
252 # Create ${D}/${prefix} to fix parallel issues
253 mkdir -p ${D}/${prefix}/
254
255 oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install
256
257 oe_libinstall -so libcrypto ${D}${libdir}
258 oe_libinstall -so libssl ${D}${libdir}
259
260 install -d ${D}${includedir}
261 cp --dereference -R include/openssl ${D}${includedir}
262
263 install -Dm 0755 ${WORKDIR}/openssl-c_rehash.sh ${D}${bindir}/c_rehash
264 sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash
265
266 oe_multilib_header openssl/opensslconf.h
267 if [ "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}" ]; then
268 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl
269 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget
270 else
271 rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget
272 fi
273
274 # Create SSL structure
275 install -d ${D}${sysconfdir}/ssl/
276 mv ${D}${libdir}/ssl/openssl.cnf \
277 ${D}${libdir}/ssl/certs \
278 ${D}${libdir}/ssl/private \
279 \
280 ${D}${sysconfdir}/ssl/
281 ln -sf ${sysconfdir}/ssl/certs ${D}${libdir}/ssl/certs
282 ln -sf ${sysconfdir}/ssl/private ${D}${libdir}/ssl/private
283 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${libdir}/ssl/openssl.cnf
284
285 # Rename man pages to prefix openssl10-*
286 for f in `find ${D}${mandir} -type f`; do
287 mv $f $(dirname $f)/openssl10-$(basename $f)
288 done
289 for f in `find ${D}${mandir} -type l`; do
290 ln_f=`readlink $f`
291 rm -f $f
292 ln -s openssl10-$ln_f $(dirname $f)/openssl10-$(basename $f)
293 done
294}
295
296do_install_ptest () {
297 cp -r -L Makefile.org Makefile test ${D}${PTEST_PATH}
298
299 # Replace the path to native perl with the path to target perl
300 sed -i 's,^PERL=.*,PERL=${bindir}/perl,' ${D}${PTEST_PATH}/Makefile
301
302 cp Configure config e_os.h ${D}${PTEST_PATH}
303 cp -r -L include ${D}${PTEST_PATH}
304 ln -sf ${libdir}/libcrypto.a ${D}${PTEST_PATH}
305 ln -sf ${libdir}/libssl.a ${D}${PTEST_PATH}
306 mkdir -p ${D}${PTEST_PATH}/crypto
307 cp crypto/constant_time_locl.h ${D}${PTEST_PATH}/crypto
308 cp -r certs ${D}${PTEST_PATH}
309 mkdir -p ${D}${PTEST_PATH}/apps
310 ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps
311 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps
312 ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps
313 cp apps/server.pem ${D}${PTEST_PATH}/apps
314 cp apps/server2.pem ${D}${PTEST_PATH}/apps
315 mkdir -p ${D}${PTEST_PATH}/util
316 install util/opensslwrap.sh ${D}${PTEST_PATH}/util
317 install util/shlib_wrap.sh ${D}${PTEST_PATH}/util
318 # Time stamps are relevant for "make alltests", otherwise
319 # make may try to recompile binaries. Not only must the
320 # binary files be newer than the sources, they also must
321 # be more recent than the header files in /usr/include.
322 #
323 # Using "cp -a" is not sufficient, because do_install
324 # does not preserve the original time stamps.
325 #
326 # So instead of using the original file stamps, we set
327 # the current time for all files. Binaries will get
328 # modified again later when stripping them, but that's okay.
329 touch ${D}${PTEST_PATH}
330 find ${D}${PTEST_PATH} -type f -print0 | xargs --verbose -0 touch -r ${D}${PTEST_PATH}
331
332 # exclude binary files or the package won't install
333 for d in ssltest_old v3ext x509aux; do
334 rm -rf ${D}${libdir}/${BPN}/ptest/test/$d
335 done
336
337 # Remove build host references
338 sed -i \
339 -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
340 -e 's|${DEBUG_PREFIX_MAP}||g' \
341 ${D}${PTEST_PATH}/Makefile ${D}${PTEST_PATH}/Configure
342}
343
344do_install_append_class-native() {
345 create_wrapper ${D}${bindir}/openssl \
346 OPENSSL_CONF=${libdir}/ssl/openssl.cnf \
347 SSL_CERT_DIR=${libdir}/ssl/certs \
348 SSL_CERT_FILE=${libdir}/ssl/cert.pem \
349 OPENSSL_ENGINES=${libdir}/ssl/engines
350}
351
352do_install_append_class-nativesdk() {
353 mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
354 install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
355}
356
357FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh"
358
359BBCLASSEXTEND = "native nativesdk"