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 | ;; |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 110 | linux-gnun32-mips*el) |
| 111 | target=debian-mipsn32el |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 112 | ;; |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 113 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 123 | target=debian-mipsel |
| 124 | ;; |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 125 | linux-mips*) |
| 126 | target=debian-mips |
| 127 | ;; |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 128 | linux-microblaze*|linux-nios2*) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 129 | 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 | |
| 156 | do_compile_prepend_class-target () { |
| 157 | sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile |
| 158 | } |
| 159 | |
| 160 | do_compile () { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 161 | oe_runmake depend |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 162 | oe_runmake |
| 163 | } |
| 164 | |
| 165 | do_compile_ptest () { |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 166 | # build dependencies for test directory too |
| 167 | export DIRS="$DIRS test" |
| 168 | oe_runmake depend |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 169 | oe_runmake buildtest |
| 170 | } |
| 171 | |
| 172 | do_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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 181 | install -d ${D}${includedir} |
| 182 | cp --dereference -R include/openssl ${D}${includedir} |
| 183 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 184 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 187 | oe_multilib_header openssl/opensslconf.h |
| 188 | if [ "${@bb.utils.contains('PACKAGECONFIG', 'perl', 'perl', '', d)}" = "perl" ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 189 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 191 | else |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 192 | rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget |
| 193 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 194 | |
| 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 205 | } |
| 206 | |
| 207 | do_install_ptest () { |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 208 | 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 Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 211 | ln -sf ${libdir}/libcrypto.a ${D}${PTEST_PATH} |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 212 | 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 215 | cp -r certs ${D}${PTEST_PATH} |
| 216 | mkdir -p ${D}${PTEST_PATH}/apps |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 217 | ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 218 | ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 219 | ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 220 | cp apps/server.pem ${D}${PTEST_PATH}/apps |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 221 | 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 Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 225 | # 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | do_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 | |
| 248 | BBCLASSEXTEND = "native nativesdk" |