diff options
Diffstat (limited to 'recipes-connectivity/openssl/openssl10.inc')
| -rw-r--r-- | recipes-connectivity/openssl/openssl10.inc | 285 |
1 files changed, 285 insertions, 0 deletions
diff --git a/recipes-connectivity/openssl/openssl10.inc b/recipes-connectivity/openssl/openssl10.inc new file mode 100644 index 0000000..645d64e --- /dev/null +++ b/recipes-connectivity/openssl/openssl10.inc | |||
| @@ -0,0 +1,285 @@ | |||
| 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 | |||
| 11 | DEPENDS = "makedepend-native hostperl-runtime-native" | ||
| 12 | DEPENDS_append_class-target = " openssl-native" | ||
| 13 | |||
| 14 | PROVIDES += "openssl10" | ||
| 15 | |||
| 16 | SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \ | ||
| 17 | " | ||
| 18 | S = "${WORKDIR}/openssl-${PV}" | ||
| 19 | |||
| 20 | PACKAGECONFIG ?= "cryptodev-linux" | ||
| 21 | PACKAGECONFIG[perl] = ",,," | ||
| 22 | PACKAGECONFIG[cryptodev-linux] = "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS,,cryptodev-linux" | ||
| 23 | |||
| 24 | TERMIO_libc-musl = "-DTERMIOS" | ||
| 25 | TERMIO ?= "-DTERMIO" | ||
| 26 | # Avoid binaries being marked as requiring an executable stack since it | ||
| 27 | # doesn't(which causes and this causes issues with SELinux | ||
| 28 | CFLAG = "${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', '-DL_ENDIAN', '-DB_ENDIAN', d)} \ | ||
| 29 | ${TERMIO} ${CFLAGS} -Wall -Wa,--noexecstack" | ||
| 30 | |||
| 31 | export DIRS = "crypto ssl apps" | ||
| 32 | export EX_LIBS = "-lgcc -ldl" | ||
| 33 | export AS = "${CC} -c" | ||
| 34 | |||
| 35 | inherit pkgconfig siteinfo multilib_header ptest relative_symlinks | ||
| 36 | |||
| 37 | PACKAGES =+ "libcrypto libssl ${PN}-misc openssl-conf" | ||
| 38 | FILES_libcrypto = "${libdir}/libcrypto${SOLIBS}" | ||
| 39 | FILES_libssl = "${libdir}/libssl${SOLIBS}" | ||
| 40 | FILES_${PN} =+ " ${libdir}/ssl/*" | ||
| 41 | FILES_${PN}-misc = "${libdir}/ssl/misc" | ||
| 42 | RDEPENDS_${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. | ||
| 48 | FILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf" | ||
| 49 | CONFFILES_openssl-conf = "${sysconfdir}/ssl/openssl.cnf" | ||
| 50 | RRECOMMENDS_libcrypto += "openssl-conf" | ||
| 51 | RDEPENDS_${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 | ||
| 55 | EXTRA_OECONF = " -no-ssl3" | ||
| 56 | |||
| 57 | do_configure_prepend_darwin () { | ||
| 58 | sed -i -e '/version-script=openssl\.ld/d' Configure | ||
| 59 | } | ||
| 60 | |||
| 61 | do_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-riscv64) | ||
| 139 | target=linux-generic64 | ||
| 140 | ;; | ||
| 141 | linux-riscv32) | ||
| 142 | target=linux-generic32 | ||
| 143 | ;; | ||
| 144 | linux-supersparc) | ||
| 145 | target=linux-sparcv8 | ||
| 146 | ;; | ||
| 147 | linux-sparc) | ||
| 148 | target=linux-sparcv8 | ||
| 149 | ;; | ||
| 150 | darwin-i386) | ||
| 151 | target=darwin-i386-cc | ||
| 152 | ;; | ||
| 153 | esac | ||
| 154 | # inject machine-specific flags | ||
| 155 | sed -i -e "s|^\(\"$target\",\s*\"[^:]\+\):\([^:]\+\)|\1:${CFLAG}|g" Configure | ||
| 156 | useprefix=${prefix} | ||
| 157 | if [ "x$useprefix" = "x" ]; then | ||
| 158 | useprefix=/ | ||
| 159 | fi | ||
| 160 | libdirleaf="$(echo ${libdir} | sed s:$useprefix::)" | ||
| 161 | perl ./Configure ${EXTRA_OECONF} shared --prefix=$useprefix --openssldir=${libdir}/ssl --libdir=${libdirleaf} $target | ||
| 162 | } | ||
| 163 | |||
| 164 | do_compile_prepend_class-target () { | ||
| 165 | sed -i 's/\((OPENSSL=\)".*"/\1"openssl"/' Makefile | ||
| 166 | oe_runmake depend | ||
| 167 | cc_sanitized=`echo "${CC} ${CFLAG}" | sed -e 's,--sysroot=${STAGING_DIR_TARGET},,g' -e 's|${DEBUG_PREFIX_MAP}||g'` | ||
| 168 | oe_runmake CC_INFO="${cc_sanitized}" | ||
| 169 | } | ||
| 170 | |||
| 171 | do_compile () { | ||
| 172 | oe_runmake depend | ||
| 173 | oe_runmake | ||
| 174 | } | ||
| 175 | |||
| 176 | do_compile_ptest () { | ||
| 177 | # build dependencies for test directory too | ||
| 178 | export DIRS="$DIRS test" | ||
| 179 | oe_runmake depend | ||
| 180 | oe_runmake buildtest | ||
| 181 | } | ||
| 182 | |||
| 183 | do_install () { | ||
| 184 | # Create ${D}/${prefix} to fix parallel issues | ||
| 185 | mkdir -p ${D}/${prefix}/ | ||
| 186 | |||
| 187 | oe_runmake INSTALL_PREFIX="${D}" MANDIR="${mandir}" install | ||
| 188 | |||
| 189 | oe_libinstall -so libcrypto ${D}${libdir} | ||
| 190 | oe_libinstall -so libssl ${D}${libdir} | ||
| 191 | |||
| 192 | install -d ${D}${includedir} | ||
| 193 | cp --dereference -R include/openssl ${D}${includedir} | ||
| 194 | |||
| 195 | install -Dm 0755 ${WORKDIR}/openssl-c_rehash.sh ${D}${bindir}/c_rehash | ||
| 196 | sed -i -e 's,/etc/openssl,${sysconfdir}/ssl,g' ${D}${bindir}/c_rehash | ||
| 197 | |||
| 198 | oe_multilib_header openssl/opensslconf.h | ||
| 199 | if [ "${@bb.utils.filter('PACKAGECONFIG', 'perl', d)}" ]; then | ||
| 200 | sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/CA.pl | ||
| 201 | sed -i -e '1s,.*,#!${bindir}/env perl,' ${D}${libdir}/ssl/misc/tsget | ||
| 202 | else | ||
| 203 | rm -f ${D}${libdir}/ssl/misc/CA.pl ${D}${libdir}/ssl/misc/tsget | ||
| 204 | fi | ||
| 205 | |||
| 206 | # Create SSL structure | ||
| 207 | install -d ${D}${sysconfdir}/ssl/ | ||
| 208 | mv ${D}${libdir}/ssl/openssl.cnf \ | ||
| 209 | ${D}${libdir}/ssl/certs \ | ||
| 210 | ${D}${libdir}/ssl/private \ | ||
| 211 | \ | ||
| 212 | ${D}${sysconfdir}/ssl/ | ||
| 213 | ln -sf ${sysconfdir}/ssl/certs ${D}${libdir}/ssl/certs | ||
| 214 | ln -sf ${sysconfdir}/ssl/private ${D}${libdir}/ssl/private | ||
| 215 | ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${libdir}/ssl/openssl.cnf | ||
| 216 | |||
| 217 | # Rename man pages to prefix openssl10-* | ||
| 218 | for f in `find ${D}${mandir} -type f`; do | ||
| 219 | mv $f $(dirname $f)/openssl10-$(basename $f) | ||
| 220 | done | ||
| 221 | for f in `find ${D}${mandir} -type l`; do | ||
| 222 | ln_f=`readlink $f` | ||
| 223 | rm -f $f | ||
| 224 | ln -s openssl10-$ln_f $(dirname $f)/openssl10-$(basename $f) | ||
| 225 | done | ||
| 226 | } | ||
| 227 | |||
| 228 | do_install_ptest () { | ||
| 229 | cp -r -L Makefile.org Makefile test ${D}${PTEST_PATH} | ||
| 230 | |||
| 231 | # Replace the path to native perl with the path to target perl | ||
| 232 | sed -i 's,^PERL=.*,PERL=${bindir}/perl,' ${D}${PTEST_PATH}/Makefile | ||
| 233 | |||
| 234 | cp Configure config e_os.h ${D}${PTEST_PATH} | ||
| 235 | cp -r -L include ${D}${PTEST_PATH} | ||
| 236 | ln -sf ${libdir}/libcrypto.a ${D}${PTEST_PATH} | ||
| 237 | ln -sf ${libdir}/libssl.a ${D}${PTEST_PATH} | ||
| 238 | mkdir -p ${D}${PTEST_PATH}/crypto | ||
| 239 | cp crypto/constant_time_locl.h ${D}${PTEST_PATH}/crypto | ||
| 240 | cp -r certs ${D}${PTEST_PATH} | ||
| 241 | mkdir -p ${D}${PTEST_PATH}/apps | ||
| 242 | ln -sf ${libdir}/ssl/misc/CA.sh ${D}${PTEST_PATH}/apps | ||
| 243 | ln -sf ${sysconfdir}/ssl/openssl.cnf ${D}${PTEST_PATH}/apps | ||
| 244 | ln -sf ${bindir}/openssl ${D}${PTEST_PATH}/apps | ||
| 245 | cp apps/server.pem ${D}${PTEST_PATH}/apps | ||
| 246 | cp apps/server2.pem ${D}${PTEST_PATH}/apps | ||
| 247 | mkdir -p ${D}${PTEST_PATH}/util | ||
| 248 | install util/opensslwrap.sh ${D}${PTEST_PATH}/util | ||
| 249 | install util/shlib_wrap.sh ${D}${PTEST_PATH}/util | ||
| 250 | # Time stamps are relevant for "make alltests", otherwise | ||
| 251 | # make may try to recompile binaries. Not only must the | ||
| 252 | # binary files be newer than the sources, they also must | ||
| 253 | # be more recent than the header files in /usr/include. | ||
| 254 | # | ||
| 255 | # Using "cp -a" is not sufficient, because do_install | ||
| 256 | # does not preserve the original time stamps. | ||
| 257 | # | ||
| 258 | # So instead of using the original file stamps, we set | ||
| 259 | # the current time for all files. Binaries will get | ||
| 260 | # modified again later when stripping them, but that's okay. | ||
| 261 | touch ${D}${PTEST_PATH} | ||
| 262 | find ${D}${PTEST_PATH} -type f -print0 | xargs --verbose -0 touch -r ${D}${PTEST_PATH} | ||
| 263 | |||
| 264 | # exclude binary files or the package won't install | ||
| 265 | for d in ssltest_old v3ext x509aux; do | ||
| 266 | rm -rf ${D}${libdir}/${BPN}/ptest/test/$d | ||
| 267 | done | ||
| 268 | |||
| 269 | # Remove build host references | ||
| 270 | sed -i \ | ||
| 271 | -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \ | ||
| 272 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
| 273 | ${D}${PTEST_PATH}/Makefile ${D}${PTEST_PATH}/Configure | ||
| 274 | } | ||
| 275 | |||
| 276 | do_install_append_class-native() { | ||
| 277 | create_wrapper ${D}${bindir}/openssl \ | ||
| 278 | OPENSSL_CONF=${libdir}/ssl/openssl.cnf \ | ||
| 279 | SSL_CERT_DIR=${libdir}/ssl/certs \ | ||
| 280 | SSL_CERT_FILE=${libdir}/ssl/cert.pem \ | ||
| 281 | OPENSSL_ENGINES=${libdir}/ssl/engines | ||
| 282 | } | ||
| 283 | |||
| 284 | BBCLASSEXTEND = "native nativesdk" | ||
| 285 | |||
