blob: 534be57540fa5bc7ad8d61c70e54e7e176230edd [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001SUMMARY = "Secure Socket Layer"
2DESCRIPTION = "Secure Socket Layer (SSL) binary and related cryptographic tools."
3HOMEPAGE = "http://www.openssl.org/"
4BUGTRACKER = "http://www.openssl.org/news/vulnerabilities.html"
5SECTION = "libs/network"
6
7# "openssl" here actually means both OpenSSL and SSLeay licenses apply
8# (see meta/files/common-licenses/OpenSSL to which "openssl" is SPDXLICENSEMAPped)
9LICENSE = "openssl"
10LIC_FILES_CHKSUM = "file://LICENSE;md5=d343e62fc9c833710bbbed25f27364c8"
11
12DEPENDS = "hostperl-runtime-native"
13
14SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
15 file://run-ptest \
16 file://0001-skip-test_symbol_presence.patch \
17 file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \
18 file://afalg.patch \
Brad Bishop19323692019-04-05 15:28:33 -040019 "
20
21SRC_URI_append_class-nativesdk = " \
22 file://environment.d-openssl.sh \
23 "
24
Brad Bishop15ae2502019-06-18 21:44:24 -040025SRC_URI[md5sum] = "15e21da6efe8aa0e0768ffd8cd37a5f6"
26SRC_URI[sha256sum] = "f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90"
Brad Bishop19323692019-04-05 15:28:33 -040027
28inherit lib_package multilib_header ptest
29
30PACKAGECONFIG ?= ""
31PACKAGECONFIG_class-native = ""
32PACKAGECONFIG_class-nativesdk = ""
33
34PACKAGECONFIG[cryptodev-linux] = "enable-devcryptoeng,disable-devcryptoeng,cryptodev-linux"
35
36B = "${WORKDIR}/build"
37do_configure[cleandirs] = "${B}"
38
39#| ./libcrypto.so: undefined reference to `getcontext'
40#| ./libcrypto.so: undefined reference to `setcontext'
41#| ./libcrypto.so: undefined reference to `makecontext'
42EXTRA_OECONF_append_libc-musl = " no-async"
43EXTRA_OECONF_append_libc-musl_powerpc64 = " no-asm"
44
45# This prevents openssl from using getrandom() which is not available on older glibc versions
46# (native versions can be built with newer glibc, but then relocated onto a system with older glibc)
47EXTRA_OECONF_class-native = "--with-rand-seed=devrandom"
48EXTRA_OECONF_class-nativesdk = "--with-rand-seed=devrandom"
49
50# Relying on hardcoded built-in paths causes openssl-native to not be relocateable from sstate.
51CFLAGS_append_class-native = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
52CFLAGS_append_class-nativesdk = " -DOPENSSLDIR=/not/builtin -DENGINESDIR=/not/builtin"
53
54do_configure () {
55 os=${HOST_OS}
56 case $os in
57 linux-gnueabi |\
58 linux-gnuspe |\
59 linux-musleabi |\
60 linux-muslspe |\
61 linux-musl )
62 os=linux
63 ;;
64 *)
65 ;;
66 esac
67 target="$os-${HOST_ARCH}"
68 case $target in
69 linux-arm*)
70 target=linux-armv4
71 ;;
72 linux-aarch64*)
73 target=linux-aarch64
74 ;;
75 linux-i?86 | linux-viac3)
76 target=linux-x86
77 ;;
78 linux-gnux32-x86_64 | linux-muslx32-x86_64 )
79 target=linux-x32
80 ;;
81 linux-gnu64-x86_64)
82 target=linux-x86_64
83 ;;
84 linux-mips | linux-mipsel)
85 # specifying TARGET_CC_ARCH prevents openssl from (incorrectly) adding target architecture flags
86 target="linux-mips32 ${TARGET_CC_ARCH}"
87 ;;
88 linux-gnun32-mips*)
89 target=linux-mips64
90 ;;
91 linux-*-mips64 | linux-mips64 | linux-*-mips64el | linux-mips64el)
92 target=linux64-mips64
93 ;;
94 linux-microblaze* | linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*)
95 target=linux-generic32
96 ;;
97 linux-powerpc)
98 target=linux-ppc
99 ;;
100 linux-powerpc64)
101 target=linux-ppc64
102 ;;
103 linux-riscv32)
104 target=linux-generic32
105 ;;
106 linux-riscv64)
107 target=linux-generic64
108 ;;
109 linux-sparc | linux-supersparc)
110 target=linux-sparcv9
111 ;;
112 esac
113
114 useprefix=${prefix}
115 if [ "x$useprefix" = "x" ]; then
116 useprefix=/
117 fi
118 # WARNING: do not set compiler/linker flags (-I/-D etc.) in EXTRA_OECONF, as they will fully replace the
119 # environment variables set by bitbake. Adjust the environment variables instead.
120 PERL5LIB="${S}/external/perl/Text-Template-1.46/lib/" \
121 perl ${S}/Configure ${EXTRA_OECONF} ${PACKAGECONFIG_CONFARGS} --prefix=$useprefix --openssldir=${libdir}/ssl-1.1 --libdir=${libdir} $target
122 perl ${B}/configdata.pm --dump
123}
124
125do_install () {
126 oe_runmake DESTDIR="${D}" MANDIR="${mandir}" MANSUFFIX=ssl install
127
128 oe_multilib_header openssl/opensslconf.h
129
130 # Create SSL structure for packages such as ca-certificates which
131 # contain hard-coded paths to /etc/ssl. Debian does the same.
132 install -d ${D}${sysconfdir}/ssl
133 mv ${D}${libdir}/ssl-1.1/certs \
134 ${D}${libdir}/ssl-1.1/private \
135 ${D}${libdir}/ssl-1.1/openssl.cnf \
136 ${D}${sysconfdir}/ssl/
137
138 # Although absolute symlinks would be OK for the target, they become
139 # invalid if native or nativesdk are relocated from sstate.
140 ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/certs')} ${D}${libdir}/ssl-1.1/certs
141 ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/private')} ${D}${libdir}/ssl-1.1/private
142 ln -sf ${@oe.path.relative('${libdir}/ssl-1.1', '${sysconfdir}/ssl/openssl.cnf')} ${D}${libdir}/ssl-1.1/openssl.cnf
143}
144
145do_install_append_class-native () {
146 create_wrapper ${D}${bindir}/openssl \
147 OPENSSL_CONF=${libdir}/ssl-1.1/openssl.cnf \
148 SSL_CERT_DIR=${libdir}/ssl-1.1/certs \
149 SSL_CERT_FILE=${libdir}/ssl-1.1/cert.pem \
150 OPENSSL_ENGINES=${libdir}/ssl-1.1/engines
151}
152
153do_install_append_class-nativesdk () {
154 mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
155 install -m 644 ${WORKDIR}/environment.d-openssl.sh ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
156 sed 's|/usr/lib/ssl/|/usr/lib/ssl-1.1/|g' -i ${D}${SDKPATHNATIVE}/environment-setup.d/openssl.sh
157}
158
159PTEST_BUILD_HOST_FILES += "configdata.pm"
160PTEST_BUILD_HOST_PATTERN = "perl_version ="
161do_install_ptest () {
162 # Prune the build tree
163 rm -f ${B}/fuzz/*.* ${B}/test/*.*
164
165 cp ${S}/Configure ${B}/configdata.pm ${D}${PTEST_PATH}
166 cp -r ${S}/external ${B}/test ${S}/test ${B}/fuzz ${S}/util ${B}/util ${D}${PTEST_PATH}
167
168 # For test_shlibload
Brad Bishop15ae2502019-06-18 21:44:24 -0400169 ln -s ${libdir}/libcrypto.so.1.1 ${D}${PTEST_PATH}/
170 ln -s ${libdir}/libssl.so.1.1 ${D}${PTEST_PATH}/
Brad Bishop19323692019-04-05 15:28:33 -0400171
172 install -d ${D}${PTEST_PATH}/apps
173 ln -s ${bindir}/openssl ${D}${PTEST_PATH}/apps
174 install -m644 ${S}/apps/*.pem ${S}/apps/*.srl ${S}/apps/openssl.cnf ${D}${PTEST_PATH}/apps
175 install -m755 ${B}/apps/CA.pl ${D}${PTEST_PATH}/apps
176
177 install -d ${D}${PTEST_PATH}/engines
178 install -m755 ${B}/engines/ossltest.so ${D}${PTEST_PATH}/engines
179}
180
181# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
182# package RRECOMMENDS on this package. This will enable the configuration
183# file to be installed for both the openssl-bin package and the libcrypto
184# package since the openssl-bin package depends on the libcrypto package.
185
186PACKAGES =+ "libcrypto libssl openssl-conf ${PN}-engines ${PN}-misc"
187
188FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}"
189FILES_libssl = "${libdir}/libssl${SOLIBS}"
190FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
191FILES_${PN}-engines = "${libdir}/engines-1.1"
192FILES_${PN}-misc = "${libdir}/ssl-1.1/misc"
193FILES_${PN} =+ "${libdir}/ssl-1.1/*"
194FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/openssl.sh"
195
196CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
197
198RRECOMMENDS_libcrypto += "openssl-conf"
199RDEPENDS_${PN}-ptest += "openssl-bin perl perl-modules bash"
200
Brad Bishop19323692019-04-05 15:28:33 -0400201BBCLASSEXTEND = "native nativesdk"