blob: 23f97d76b31a43484e7b8a0be39d89501d59d269 [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001SUMMARY = "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 | SSLeay" dual license
8LICENSE = "openssl"
9LIC_FILES_CHKSUM = "file://LICENSE;md5=f9a8f968107345e0b75aa8c2ecaa7ec8"
10
11DEPENDS = "makedepend-native hostperl-runtime-native"
12DEPENDS_append_class-target = " openssl-native"
13
14PROVIDES += "openssl10"
15
16SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
17 "
18S = "${WORKDIR}/openssl-${PV}"
19
20PACKAGECONFIG ?= "cryptodev-linux"
21PACKAGECONFIG[perl] = ",,,"
22PACKAGECONFIG[cryptodev-linux] = "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS,,cryptodev-linux"
23
24TERMIO_libc-musl = "-DTERMIOS"
25TERMIO ?= "-DTERMIO"
26# Avoid binaries being marked as requiring an executable stack since it
27# doesn't(which causes and this causes issues with SELinux
28CFLAG = "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \
29 ${TERMIO} ${CFLAGS} -Wall -Wa,--noexecstack"
30
31export DIRS = "crypto ssl apps"
32export EX_LIBS = "-lgcc -ldl"
33export AS = "${CC} -c"
34
35inherit pkgconfig siteinfo multilib_header ptest relative_symlinks
36
37PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf"
38FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}"
39FILES_libssl = "${libdir}/libssl${SOLIBS}"
40FILES_${PN} =+ " ${libdir}/ssl/*"
41FILES_${PN}-misc = "${libdir}/ssl/misc"
42RDEPENDS_${PN}-misc = "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}"
43
44# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
45# package RRECOMMENDS on this package. This will enable the configuration
46# file to be installed for both the base openssl package and the libcrypto
47# package since the base openssl package depends on the libcrypto package.
48FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
49CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
50RRECOMMENDS_libcrypto += "openssl-conf"
51RDEPENDS_${PN}-ptest += "${PN}-misc make perl perl-module-filehandle bc"
52
53# Remove this to enable SSLv3. SSLv3 is defaulted to disabled due to the POODLE
54# vulnerability
55EXTRA_OECONF = " -no-ssl3"
56
57do_configure_prepend_darwin () {
58 sed -i -e '/version-script=openssl\.ld/d' Configure
59}
60
61do_configure () {
62 cd util
63 perl perlpath.pl ${STAGING_BINDIR_NATIVE}
64 cd ..
65 ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/
66
67 os=${HOST_OS}
68 case $os in
69 linux-gnueabi |\
70 linux-gnuspe |\
71 linux-musleabi |\
72 linux-muslspe |\
73 linux-musl )
74 os=linux
75 ;;
76 *)
77 ;;
78 esac
79 target="$os-${HOST_ARCH}"
80 case $target in
81 linux-arm)
82 target=linux-armv4
83 ;;
84 linux-armeb)
85 target=linux-elf-armeb
86 ;;
87 linux-aarch64*)
88 target=linux-aarch64
89 ;;
90 linux-sh3)
91 target=debian-sh3
92 ;;
93 linux-sh4)
94 target=debian-sh4
95 ;;
96 linux-i486)
97 target=debian-i386-i486
98 ;;
99 linux-i586 | linux-viac3)
100 target=debian-i386-i586
101 ;;
102 linux-i686)
103 target=debian-i386-i686/cmov
104 ;;
105 linux-gnux32-x86_64 | linux-muslx32-x86_64 )
106 target=linux-x32
107 ;;
108 linux-gnu64-x86_64)
109 target=linux-x86_64
110 ;;
111 linux-gnun32-mips*el)
112 target=debian-mipsn32el
113 ;;
114 linux-gnun32-mips*)
115 target=debian-mipsn32
116 ;;
117 linux-mips*64*el)
118 target=debian-mips64el
119 ;;
120 linux-mips*64*)
121 target=debian-mips64
122 ;;
123 linux-mips*el)
124 target=debian-mipsel
125 ;;
126 linux-mips*)
127 target=debian-mips
128 ;;
129 linux-microblaze*|linux-nios2*|linux-gnu*ilp32**)
130 target=linux-generic32
131 ;;
132 linux-powerpc)
133 target=linux-ppc
134 ;;
135 linux-powerpc64)
136 target=linux-ppc64
137 ;;
138 linux-supersparc)
139 target=linux-sparcv8
140 ;;
141 linux-sparc)
142 target=linux-sparcv8
143 ;;
144 darwin-i386)
145 target=darwin-i386-cc
146 ;;
147 esac
148 # inject machine-specific flags
149 sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure
150 useprefix=${prefix}
151 if [ "x$useprefix" = "x" ]; then
152 useprefix=/
153 fi
154 perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=`basename ${libdir}` $target
155}
156
157do_compile_prepend_class-target () {
158 sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile
159}
160
161do_compile () {
162 oe_runmake depend
163 oe_runmake
164}
165
166do_compile_ptest () {
167 # build dependencies for test directory too
168 export DIRS="$DIRS test"
169 oe_runmake depend
170 oe_runmake buildtest
171}
172
173do_install () {
174 # Create ${D}/${prefix} to fix parallel issues
175 mkdir -p ${D}/${prefix}/
176
177 oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install
178
179 oe_libinstall -so libcrypto ${D}${libdir}
180 oe_libinstall -so libssl ${D}${libdir}
181
182 install -d ${D}${includedir}
183 cp --dereference -R include/openssl ${D}${includedir}
184
185 install -Dm 0755 ${WORKDIR}/openssl-c_rehash.sh ${D}${bindir}/c_rehash
186 sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash
187
188 oe_multilib_header openssl/opensslconf.h
189 if [ "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}" ]; then
190 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl
191 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget
192 else
193 rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget
194 fi
195
196 # Create SSL structure
197 install -d ${D}${sysconfdir}/ssl/
198 mv ${D}${libdir}/ssl/openssl.cnf \
199 ${D}${libdir}/ssl/certs \
200 ${D}${libdir}/ssl/private \
201 \
202 ${D}${sysconfdir}/ssl/
203 ln -sf ${sysconfdir}/ssl/certs ${D}${libdir}/ssl/certs
204 ln -sf ${sysconfdir}/ssl/private ${D}${libdir}/ssl/private
205 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${libdir}/ssl/openssl.cnf
206
207 # Rename man pages to prefix openssl10-*
208 for f in `find ${D}${mandir} -type f`; do
209 mv $f $(dirname $f)/openssl10-$(basename $f)
210 done
211 for f in `find ${D}${mandir} -type l`; do
212 ln_f=`readlink $f`
213 rm -f $f
214 ln -s openssl10-$ln_f $(dirname $f)/openssl10-$(basename $f)
215 done
216}
217
218do_install_ptest () {
219 cp -r -L Makefile.org Makefile test ${D}${PTEST_PATH}
220
221 # Replace the path to native perl with the path to target perl
222 sed -i 's,^PERL=.*,PERL=${bindir}/perl,' ${D}${PTEST_PATH}/Makefile
223
224 cp Configure config e_os.h ${D}${PTEST_PATH}
225 cp -r -L include ${D}${PTEST_PATH}
226 ln -sf ${libdir}/libcrypto.a ${D}${PTEST_PATH}
227 ln -sf ${libdir}/libssl.a ${D}${PTEST_PATH}
228 mkdir -p ${D}${PTEST_PATH}/crypto
229 cp crypto/constant_time_locl.h ${D}${PTEST_PATH}/crypto
230 cp -r certs ${D}${PTEST_PATH}
231 mkdir -p ${D}${PTEST_PATH}/apps
232 ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps
233 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps
234 ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps
235 cp apps/server.pem ${D}${PTEST_PATH}/apps
236 cp apps/server2.pem ${D}${PTEST_PATH}/apps
237 mkdir -p ${D}${PTEST_PATH}/util
238 install util/opensslwrap.sh ${D}${PTEST_PATH}/util
239 install util/shlib_wrap.sh ${D}${PTEST_PATH}/util
240 # Time stamps are relevant for "make alltests", otherwise
241 # make may try to recompile binaries. Not only must the
242 # binary files be newer than the sources, they also must
243 # be more recent than the header files in /usr/include.
244 #
245 # Using "cp -a" is not sufficient, because do_install
246 # does not preserve the original time stamps.
247 #
248 # So instead of using the original file stamps, we set
249 # the current time for all files. Binaries will get
250 # modified again later when stripping them, but that's okay.
251 touch ${D}${PTEST_PATH}
252 find ${D}${PTEST_PATH} -type f -print0 | xargs --verbose -0 touch -r ${D}${PTEST_PATH}
253
254 # exclude binary files or the package won't install
255 for d in ssltest_old v3ext x509aux; do
256 rm -rf ${D}${libdir}/${BPN}/ptest/test/$d
257 done
258
259 # Remove build host references
260 sed -i \
261 -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
262 -e 's|${DEBUG_PREFIX_MAP}||g' \
263 ${D}${PTEST_PATH}/Makefile ${D}${PTEST_PATH}/Configure
264}
265
266do_install_append_class-native() {
267 create_wrapper ${D}${bindir}/openssl \
268 OPENSSL_CONF=${libdir}/ssl/openssl.cnf \
269 SSL_CERT_DIR=${libdir}/ssl/certs \
270 SSL_CERT_FILE=${libdir}/ssl/cert.pem \
271 OPENSSL_ENGINES=${libdir}/ssl/engines
272}
273
274BBCLASSEXTEND = "native nativesdk"
275