openssl.inc 6.9 KB

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