blob: e8812d06d0bf1f3f0ba473fcb5e93fd2f7378d3e [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001SUMMARY = "A PKCS#11 interface for TPM2 hardware"
2DESCRIPTION = "PKCS #11 is a Public-Key Cryptography Standard that defines a standard method to access cryptographic services from tokens/ devices such as hardware security modules (HSM), smart cards, etc. In this project we intend to use a TPM2 device as the cryptographic token."
3SECTION = "security/tpm"
4LICENSE = "BSD-2-Clause"
Andrew Geissler064f75b2020-06-27 00:14:46 -05005LIC_FILES_CHKSUM = "file://LICENSE;md5=0fc19f620a102768d6dbd1e7166e78ab"
Brad Bishop19323692019-04-05 15:28:33 -04006
Armin Kusterca2f10c2022-01-29 15:44:29 -08007DEPENDS = "autoconf-archive pkgconfig sqlite3 openssl libtss2-dev tpm2-tools libyaml p11-kit python3-setuptools-native"
Brad Bishop19323692019-04-05 15:28:33 -04008
Patrick Williams03907ee2022-05-01 06:28:52 -05009SRC_URI = "https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz"
Brad Bishop19323692019-04-05 15:28:33 -040010
Patrick Williams03907ee2022-05-01 06:28:52 -050011SRC_URI[sha256sum] = "79f28899047defd6b4b72b7268dd56abf27774954022315f818c239af33e05bd"
Brad Bishop19323692019-04-05 15:28:33 -040012
Andrew Geissler015e6aa2021-01-08 16:10:30 -060013inherit autotools-brokensep pkgconfig python3native
Brad Bishop19323692019-04-05 15:28:33 -040014
Patrick Williams03907ee2022-05-01 06:28:52 -050015EXTRA_OECONF += "--disable-ptool-checks"
16
17do_configure:prepend() {
18 # do not extract the version number from git
19 sed -i -e 's/m4_esyscmd_s(\[git describe --tags --always --dirty\])/${PV}/' ${S}/configure.ac
Brad Bishop19323692019-04-05 15:28:33 -040020}
Andrew Geisslerd1d22e62020-10-16 10:14:32 -050021
Patrick Williams213cb262021-08-07 19:21:33 -050022do_compile:append() {
Andrew Geissler015e6aa2021-01-08 16:10:30 -060023 cd ${S}/tools
24 python3 setup.py build
25}
26
Patrick Williams213cb262021-08-07 19:21:33 -050027do_install:append() {
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070028 install -d ${D}${libdir}/pkcs11
29 install -d ${D}${datadir}/p11-kit
Andrew Geisslerd5838332022-05-27 11:33:10 -050030
31 # remove symlinks
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070032 rm -f ${D}${libdir}/pkcs11/libtpm2_pkcs11.so
33
Andrew Geisslerd5838332022-05-27 11:33:10 -050034 #install lib
35 install -m 755 ${B}/src/.libs/libtpm2_pkcs11.so ${D}${libdir}/pkcs11/libtpm2_pkcs11.so
36
Andrew Geissler015e6aa2021-01-08 16:10:30 -060037 cd ${S}/tools
38 export PYTHONPATH="${D}${PYTHON_SITEPACKAGES_DIR}"
39 ${PYTHON_PN} setup.py install --root="${D}" --prefix="${prefix}" --install-lib="${PYTHON_SITEPACKAGES_DIR}" --optimize=1 --skip-build
40
41 sed -i -e "s:${PYTHON}:${USRBINPATH}/env ${PYTHON_PN}:g" "${D}${bindir}"/tpm2_ptool
42}
43
Andrew Geissler015e6aa2021-01-08 16:10:30 -060044PACKAGES =+ "${PN}-tools"
Andrew Geissler015e6aa2021-01-08 16:10:30 -060045
Patrick Williams213cb262021-08-07 19:21:33 -050046FILES:${PN}-tools = "\
Andrew Geissler015e6aa2021-01-08 16:10:30 -060047 ${bindir}/tpm2_ptool \
48 ${libdir}/${PYTHON_DIR}/* \
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070049 "
50
Patrick Williams213cb262021-08-07 19:21:33 -050051FILES:${PN} += "\
William A. Kennington IIIee32beb2021-06-02 12:48:35 -070052 ${libdir}/pkcs11/* \
53 ${datadir}/p11-kit/* \
54 "
55
Andrew Geisslerd5838332022-05-27 11:33:10 -050056RDEPENDS:${PN} = "p11-kit tpm2-tools "
57RDEPENDS:${PN}-tools = "${PYTHON_PN}-pyyaml ${PYTHON_PN}-cryptography ${PYTHON_PN}-pyasn1-modules"