Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "Secure Socket Layer" |
| 2 | DESCRIPTION = "Secure Socket Layer (SSL) binary and related cryptographic tools." |
| 3 | HOMEPAGE = "http://www.openssl.org/" |
| 4 | BUGTRACKER = "http://www.openssl.org/news/vulnerabilities.html" |
| 5 | SECTION = "libs/network" |
| 6 | |
| 7 | # "openssl | SSLeay" dual license |
| 8 | LICENSE = "openssl" |
| 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=f9a8f968107345e0b75aa8c2ecaa7ec8" |
| 10 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 11 | DEPENDS = "makedepend-native hostperl-runtime-native" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 12 | DEPENDS_append_class-target = " openssl-native" |
| 13 | |
| 14 | SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \ |
| 15 | " |
| 16 | S = "${WORKDIR}/openssl-${PV}" |
| 17 | |
| 18 | PACKAGECONFIG[perl] = ",,," |
| 19 | |
| 20 | AR_append = " r" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 21 | TERMIO_libc-musl = "-DTERMIOS" |
| 22 | TERMIO ?= "-DTERMIO" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 23 | # Avoid binaries being marked as requiring an executable stack since it |
| 24 | # doesn't(which causes and this causes issues with SELinux |
| 25 | CFLAG = "${@base_conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 26 | ${TERMIO} ${CFLAGS} -Wall -Wa,--noexecstack" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | |
| 28 | export DIRS = "crypto ssl apps" |
| 29 | export EX_LIBS = "-lgcc -ldl" |
| 30 | export AS = "${CC} -c" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 31 | EXTRA_OEMAKE = "-e MAKEFLAGS=" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 32 | |
| 33 | inherit pkgconfig siteinfo multilib_header ptest |
| 34 | |
| 35 | PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 36 | FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}" |
| 37 | FILES_libssl = "${libdir}/libssl${SOLIBS}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 38 | FILES_${PN} =+ " ${libdir}/ssl/*" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 39 | FILES_${PN}-misc = "${libdir}/ssl/misc" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 40 | RDEPENDS_${PN}-misc = "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perl', '', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 41 | |
| 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 Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 46 | FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf" |
| 47 | CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 48 | RRECOMMENDS_libcrypto += "openssl-conf" |
| 49 | RDEPENDS_${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 |
| 53 | EXTRA_OECONF = " -no-ssl3" |
| 54 | |
| 55 | do_configure_prepend_darwin () { |
| 56 | sed -i -e '/version-script=openssl\.ld/d' Configure |
| 57 | } |
| 58 | |
| 59 | do_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 | ;; |
| 110 | linux-mips) |
| 111 | target=debian-mips |
| 112 | ;; |
| 113 | linux-mipsel) |
| 114 | target=debian-mipsel |
| 115 | ;; |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 116 | linux-*-mips64 | linux-mips64) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 117 | target=debian-mips64 |
| 118 | ;; |
| 119 | linux-*-mips64el | linux-mips64el) |
| 120 | target=debian-mips64el |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 121 | ;; |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 122 | linux-microblaze*|linux-nios2*) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 123 | target=linux-generic32 |
| 124 | ;; |
| 125 | linux-powerpc) |
| 126 | target=linux-ppc |
| 127 | ;; |
| 128 | linux-powerpc64) |
| 129 | target=linux-ppc64 |
| 130 | ;; |
| 131 | linux-supersparc) |
| 132 | target=linux-sparcv8 |
| 133 | ;; |
| 134 | linux-sparc) |
| 135 | target=linux-sparcv8 |
| 136 | ;; |
| 137 | darwin-i386) |
| 138 | target=darwin-i386-cc |
| 139 | ;; |
| 140 | esac |
| 141 | # inject machine-specific flags |
| 142 | sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure |
| 143 | useprefix=${prefix} |
| 144 | if [ "x$useprefix" = "x" ]; then |
| 145 | useprefix=/ |
| 146 | fi |
| 147 | perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=`basename ${libdir}` $target |
| 148 | } |
| 149 | |
| 150 | do_compile_prepend_class-target () { |
| 151 | sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile |
| 152 | } |
| 153 | |
| 154 | do_compile () { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 155 | oe_runmake depend |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 156 | oe_runmake |
| 157 | } |
| 158 | |
| 159 | do_compile_ptest () { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 160 | # build dependencies for test directory too |
| 161 | export DIRS="$DIRS test" |
| 162 | oe_runmake depend |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 163 | oe_runmake buildtest |
| 164 | } |
| 165 | |
| 166 | do_install () { |
| 167 | # Create ${D}/${prefix} to fix parallel issues |
| 168 | mkdir -p ${D}/${prefix}/ |
| 169 | |
| 170 | oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install |
| 171 | |
| 172 | oe_libinstall -so libcrypto ${D}${libdir} |
| 173 | oe_libinstall -so libssl ${D}${libdir} |
| 174 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 175 | install -d ${D}${includedir} |
| 176 | cp --dereference -R include/openssl ${D}${includedir} |
| 177 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 178 | install -Dm 0755 ${WORKDIR}/openssl-c_rehash.sh ${D}${bindir}/c_rehash |
| 179 | sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash |
| 180 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 181 | oe_multilib_header openssl/opensslconf.h |
| 182 | if [ "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perl', '', d)}" = "perl" ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 183 | sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl |
| 184 | sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 185 | else |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 186 | rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget |
| 187 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 188 | |
| 189 | # Create SSL structure |
| 190 | install -d ${D}${sysconfdir}/ssl/ |
| 191 | mv ${D}${libdir}/ssl/openssl.cnf \ |
| 192 | ${D}${libdir}/ssl/certs \ |
| 193 | ${D}${libdir}/ssl/private \ |
| 194 | \ |
| 195 | ${D}${sysconfdir}/ssl/ |
| 196 | ln -sf ${sysconfdir}/ssl/certs ${D}${libdir}/ssl/certs |
| 197 | ln -sf ${sysconfdir}/ssl/private ${D}${libdir}/ssl/private |
| 198 | ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${libdir}/ssl/openssl.cnf |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | do_install_ptest () { |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 202 | cp -r -L Makefile.org Makefile test ${D}${PTEST_PATH} |
| 203 | cp Configure config e_os.h ${D}${PTEST_PATH} |
| 204 | cp -r -L include ${D}${PTEST_PATH} |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 205 | ln -sf ${libdir}/libcrypto.a ${D}${PTEST_PATH} |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 206 | ln -sf ${libdir}/libssl.a ${D}${PTEST_PATH} |
| 207 | mkdir -p ${D}${PTEST_PATH}/crypto |
| 208 | cp crypto/constant_time_locl.h ${D}${PTEST_PATH}/crypto |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 209 | cp -r certs ${D}${PTEST_PATH} |
| 210 | mkdir -p ${D}${PTEST_PATH}/apps |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 211 | ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 212 | ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 213 | ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 214 | cp apps/server.pem ${D}${PTEST_PATH}/apps |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 215 | cp apps/server2.pem ${D}${PTEST_PATH}/apps |
| 216 | mkdir -p ${D}${PTEST_PATH}/util |
| 217 | install util/opensslwrap.sh ${D}${PTEST_PATH}/util |
| 218 | install util/shlib_wrap.sh ${D}${PTEST_PATH}/util |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 219 | # Time stamps are relevant for "make alltests", otherwise |
| 220 | # make may try to recompile binaries. Not only must the |
| 221 | # binary files be newer than the sources, they also must |
| 222 | # be more recent than the header files in /usr/include. |
| 223 | # |
| 224 | # Using "cp -a" is not sufficient, because do_install |
| 225 | # does not preserve the original time stamps. |
| 226 | # |
| 227 | # So instead of using the original file stamps, we set |
| 228 | # the current time for all files. Binaries will get |
| 229 | # modified again later when stripping them, but that's okay. |
| 230 | touch ${D}${PTEST_PATH} |
| 231 | find ${D}${PTEST_PATH} -type f -print0 | xargs --verbose -0 touch -r ${D}${PTEST_PATH} |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | do_install_append_class-native() { |
| 235 | create_wrapper ${D}${bindir}/openssl \ |
| 236 | OPENSSL_CONF=${libdir}/ssl/openssl.cnf \ |
| 237 | SSL_CERT_DIR=${libdir}/ssl/certs \ |
| 238 | SSL_CERT_FILE=${libdir}/ssl/cert.pem \ |
| 239 | OPENSSL_ENGINES=${libdir}/ssl/engines |
| 240 | } |
| 241 | |
| 242 | BBCLASSEXTEND = "native nativesdk" |