blob: 2ef8b38be884474d4da484d4480de602e80eb29a [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -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
Patrick Williamsc0f7c042017-02-23 20:41:17 -060011DEPENDS = "makedepend-native hostperl-runtime-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012DEPENDS_append_class-target = " openssl-native"
13
14SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
15 "
16S = "${WORKDIR}/openssl-${PV}"
17
18PACKAGECONFIG[perl] = ",,,"
19
20AR_append = " r"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050021TERMIO_libc-musl = "-DTERMIOS"
22TERMIO ?= "-DTERMIO"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050023# Avoid binaries being marked as requiring an executable stack since it
24# doesn't(which causes and this causes issues with SELinux
25CFLAG = "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050026 ${TERMIO} ${CFLAGS} -Wall -Wa,--noexecstack"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027
28export DIRS = "crypto ssl apps"
29export EX_LIBS = "-lgcc -ldl"
30export AS = "${CC} -c"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050031EXTRA_OEMAKE = "-e MAKEFLAGS="
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032
33inherit pkgconfig siteinfo multilib_header ptest
34
35PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050036FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}"
37FILES_libssl = "${libdir}/libssl${SOLIBS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038FILES_${PN} =+ " ${libdir}/ssl/*"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060039FILES_${PN}-misc = "${libdir}/ssl/misc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050040RDEPENDS_${PN}-misc = "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perl', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050041
42# Add the openssl.cnf file to the openssl-conf package. Make the libcrypto
43# package RRECOMMENDS on this package. This will enable the configuration
44# file to be installed for both the base openssl package and the libcrypto
45# package since the base openssl package depends on the libcrypto package.
Patrick Williamsc0f7c042017-02-23 20:41:17 -060046FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
47CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048RRECOMMENDS_libcrypto += "openssl-conf"
49RDEPENDS_${PN}-ptest += "${PN}-misc make perl perl-module-filehandle bc"
50
51# Remove this to enable SSLv3. SSLv3 is defaulted to disabled due to the POODLE
52# vulnerability
53EXTRA_OECONF = " -no-ssl3"
54
55do_configure_prepend_darwin () {
56 sed -i -e '/version-script=openssl\.ld/d' Configure
57}
58
59do_configure () {
60 cd util
61 perl perlpath.pl ${STAGING_BINDIR_NATIVE}
62 cd ..
63 ln -sf apps/openssl.pod crypto/crypto.pod ssl/ssl.pod doc/
64
65 os=${HOST_OS}
66 case $os in
67 linux-uclibc |\
68 linux-uclibceabi |\
69 linux-gnueabi |\
70 linux-uclibcspe |\
71 linux-gnuspe |\
72 linux-musl*)
73 os=linux
74 ;;
75 *)
76 ;;
77 esac
78 target="$os-${HOST_ARCH}"
79 case $target in
80 linux-arm)
81 target=linux-armv4
82 ;;
83 linux-armeb)
84 target=linux-elf-armeb
85 ;;
86 linux-aarch64*)
87 target=linux-generic64
88 ;;
89 linux-sh3)
90 target=debian-sh3
91 ;;
92 linux-sh4)
93 target=debian-sh4
94 ;;
95 linux-i486)
96 target=debian-i386-i486
97 ;;
98 linux-i586 | linux-viac3)
99 target=debian-i386-i586
100 ;;
101 linux-i686)
102 target=debian-i386-i686/cmov
103 ;;
104 linux-gnux32-x86_64)
105 target=linux-x32
106 ;;
107 linux-gnu64-x86_64)
108 target=linux-x86_64
109 ;;
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500110 linux-gnun32-mips*el)
111 target=debian-mipsn32el
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500112 ;;
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500113 linux-gnun32-mips*)
114 target=debian-mipsn32
115 ;;
116 linux-mips*64*el)
117 target=debian-mips64el
118 ;;
119 linux-mips*64*)
120 target=debian-mips64
121 ;;
122 linux-mips*el)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500123 target=debian-mipsel
124 ;;
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500125 linux-mips*)
126 target=debian-mips
127 ;;
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500128 linux-microblaze*|linux-nios2*)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500129 target=linux-generic32
130 ;;
131 linux-powerpc)
132 target=linux-ppc
133 ;;
134 linux-powerpc64)
135 target=linux-ppc64
136 ;;
137 linux-supersparc)
138 target=linux-sparcv8
139 ;;
140 linux-sparc)
141 target=linux-sparcv8
142 ;;
143 darwin-i386)
144 target=darwin-i386-cc
145 ;;
146 esac
147 # inject machine-specific flags
148 sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure
149 useprefix=${prefix}
150 if [ "x$useprefix" = "x" ]; then
151 useprefix=/
152 fi
153 perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=`basename ${libdir}` $target
154}
155
156do_compile_prepend_class-target () {
157 sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile
158}
159
160do_compile () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600161 oe_runmake depend
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500162 oe_runmake
163}
164
165do_compile_ptest () {
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600166 # build dependencies for test directory too
167 export DIRS="$DIRS test"
168 oe_runmake depend
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500169 oe_runmake buildtest
170}
171
172do_install () {
173 # Create ${D}/${prefix} to fix parallel issues
174 mkdir -p ${D}/${prefix}/
175
176 oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install
177
178 oe_libinstall -so libcrypto ${D}${libdir}
179 oe_libinstall -so libssl ${D}${libdir}
180
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500181 install -d ${D}${includedir}
182 cp --dereference -R include/openssl ${D}${includedir}
183
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600184 install -Dm 0755 ${WORKDIR}/openssl-c_rehash.sh ${D}${bindir}/c_rehash
185 sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash
186
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500187 oe_multilib_header openssl/opensslconf.h
188 if [ "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perl', '', d)}" = "perl" ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500189 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl
190 sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500191 else
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500192 rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget
193 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600194
195 # Create SSL structure
196 install -d ${D}${sysconfdir}/ssl/
197 mv ${D}${libdir}/ssl/openssl.cnf \
198 ${D}${libdir}/ssl/certs \
199 ${D}${libdir}/ssl/private \
200 \
201 ${D}${sysconfdir}/ssl/
202 ln -sf ${sysconfdir}/ssl/certs ${D}${libdir}/ssl/certs
203 ln -sf ${sysconfdir}/ssl/private ${D}${libdir}/ssl/private
204 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${libdir}/ssl/openssl.cnf
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500205}
206
207do_install_ptest () {
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500208 cp -r -L Makefile.org Makefile test ${D}${PTEST_PATH}
209 cp Configure config e_os.h ${D}${PTEST_PATH}
210 cp -r -L include ${D}${PTEST_PATH}
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600211 ln -sf ${libdir}/libcrypto.a ${D}${PTEST_PATH}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500212 ln -sf ${libdir}/libssl.a ${D}${PTEST_PATH}
213 mkdir -p ${D}${PTEST_PATH}/crypto
214 cp crypto/constant_time_locl.h ${D}${PTEST_PATH}/crypto
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500215 cp -r certs ${D}${PTEST_PATH}
216 mkdir -p ${D}${PTEST_PATH}/apps
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500217 ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600218 ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500219 ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600220 cp apps/server.pem ${D}${PTEST_PATH}/apps
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500221 cp apps/server2.pem ${D}${PTEST_PATH}/apps
222 mkdir -p ${D}${PTEST_PATH}/util
223 install util/opensslwrap.sh ${D}${PTEST_PATH}/util
224 install util/shlib_wrap.sh ${D}${PTEST_PATH}/util
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600225 # Time stamps are relevant for "make alltests", otherwise
226 # make may try to recompile binaries. Not only must the
227 # binary files be newer than the sources, they also must
228 # be more recent than the header files in /usr/include.
229 #
230 # Using "cp -a" is not sufficient, because do_install
231 # does not preserve the original time stamps.
232 #
233 # So instead of using the original file stamps, we set
234 # the current time for all files. Binaries will get
235 # modified again later when stripping them, but that's okay.
236 touch ${D}${PTEST_PATH}
237 find ${D}${PTEST_PATH} -type f -print0 | xargs --verbose -0 touch -r ${D}${PTEST_PATH}
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500238}
239
240do_install_append_class-native() {
241 create_wrapper ${D}${bindir}/openssl \
242 OPENSSL_CONF=${libdir}/ssl/openssl.cnf \
243 SSL_CERT_DIR=${libdir}/ssl/certs \
244 SSL_CERT_FILE=${libdir}/ssl/cert.pem \
245 OPENSSL_ENGINES=${libdir}/ssl/engines
246}
247
248BBCLASSEXTEND = "native nativesdk"