All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-security][PATCH 1/3] tpm2-pkcs11: tpm2-pkcs11 module missing
@ 2022-05-19 22:35 Armin Kuster
  2022-05-19 22:35 ` [meta-security][PATCH 2/3] tpm2-tools: Add missing rdepends Armin Kuster
  2022-05-19 22:35 ` [meta-security][PATCH 3/3] oeqa/cases/tpm2: fix and enhance test suite Armin Kuster
  0 siblings, 2 replies; 3+ messages in thread
From: Armin Kuster @ 2022-05-19 22:35 UTC (permalink / raw)
  To: yocto

Correctly fix symlink issue by putting module in -dev pkg.

Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
 meta-tpm/recipes-tpm2/tpm2-pkcs11/tpm2-pkcs11_1.8.0.bb | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/meta-tpm/recipes-tpm2/tpm2-pkcs11/tpm2-pkcs11_1.8.0.bb b/meta-tpm/recipes-tpm2/tpm2-pkcs11/tpm2-pkcs11_1.8.0.bb
index a9174e6..e8812d0 100644
--- a/meta-tpm/recipes-tpm2/tpm2-pkcs11/tpm2-pkcs11_1.8.0.bb
+++ b/meta-tpm/recipes-tpm2/tpm2-pkcs11/tpm2-pkcs11_1.8.0.bb
@@ -27,8 +27,13 @@ do_compile:append() {
 do_install:append() {
     install -d ${D}${libdir}/pkcs11
     install -d ${D}${datadir}/p11-kit
+
+    # remove symlinks
     rm -f ${D}${libdir}/pkcs11/libtpm2_pkcs11.so
 
+    #install lib
+    install -m 755 ${B}/src/.libs/libtpm2_pkcs11.so ${D}${libdir}/pkcs11/libtpm2_pkcs11.so
+
     cd ${S}/tools
     export PYTHONPATH="${D}${PYTHON_SITEPACKAGES_DIR}"
     ${PYTHON_PN} setup.py install --root="${D}" --prefix="${prefix}" --install-lib="${PYTHON_SITEPACKAGES_DIR}" --optimize=1 --skip-build
@@ -48,5 +53,5 @@ FILES:${PN} += "\
     ${datadir}/p11-kit/* \
     "
 
-RDEPENDS:${PN} = "tpm2-tools"
-RDEPENDS:${PN}-tools += "${PYTHON_PN}-setuptools ${PYTHON_PN}-pyyaml ${PYTHON_PN}-cryptography ${PYTHON_PN}-pyasn1-modules"
+RDEPENDS:${PN} = "p11-kit tpm2-tools "
+RDEPENDS:${PN}-tools = "${PYTHON_PN}-pyyaml ${PYTHON_PN}-cryptography ${PYTHON_PN}-pyasn1-modules"
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [meta-security][PATCH 2/3] tpm2-tools: Add missing rdepends
  2022-05-19 22:35 [meta-security][PATCH 1/3] tpm2-pkcs11: tpm2-pkcs11 module missing Armin Kuster
@ 2022-05-19 22:35 ` Armin Kuster
  2022-05-19 22:35 ` [meta-security][PATCH 3/3] oeqa/cases/tpm2: fix and enhance test suite Armin Kuster
  1 sibling, 0 replies; 3+ messages in thread
From: Armin Kuster @ 2022-05-19 22:35 UTC (permalink / raw)
  To: yocto

Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
 meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.2.bb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.2.bb b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.2.bb
index f924038..c20af7e 100644
--- a/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.2.bb
+++ b/meta-tpm/recipes-tpm2/tpm2-tools/tpm2-tools_5.2.bb
@@ -16,3 +16,6 @@ do_configure:prepend() {
     # do not extract the version number from git
     sed -i -e 's/m4_esyscmd_s(\[git describe --tags --always --dirty\])/${PV}/' ${S}/configure.ac
 }
+
+# need tss-esys
+RDEPENDS:${PN} = "libtss2 tpm2-abrmd"
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [meta-security][PATCH 3/3] oeqa/cases/tpm2: fix and enhance test suite
  2022-05-19 22:35 [meta-security][PATCH 1/3] tpm2-pkcs11: tpm2-pkcs11 module missing Armin Kuster
  2022-05-19 22:35 ` [meta-security][PATCH 2/3] tpm2-tools: Add missing rdepends Armin Kuster
@ 2022-05-19 22:35 ` Armin Kuster
  1 sibling, 0 replies; 3+ messages in thread
From: Armin Kuster @ 2022-05-19 22:35 UTC (permalink / raw)
  To: yocto

local.conf
TEST_SUITES = "ssh ping tpm2"
IMAGE_INSTALL:append = " swtpm tpm2-pkcs11"

RESULTS:
RESULTS - ping.PingTest.test_ping: PASSED (0.05s)
RESULTS - ssh.SSHTest.test_ssh: PASSED (2.19s)
RESULTS - tpm2.Tpm2Test.test_tpm2_pcrread: PASSED (1.06s)
RESULTS - tpm2.Tpm2Test.test_tpm2_pkcs11: PASSED (1.17s)
RESULTS - tpm2.Tpm2Test.test_tpm2_swtpm_reset: PASSED (0.59s)
RESULTS - tpm2.Tpm2Test.test_tpm2_swtpm_socket: PASSED (307.72s)

Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
 meta-tpm/lib/oeqa/runtime/cases/tpm2.py | 41 +++++++++++++++++--------
 1 file changed, 29 insertions(+), 12 deletions(-)

diff --git a/meta-tpm/lib/oeqa/runtime/cases/tpm2.py b/meta-tpm/lib/oeqa/runtime/cases/tpm2.py
index c6f9d92..c2c95e7 100644
--- a/meta-tpm/lib/oeqa/runtime/cases/tpm2.py
+++ b/meta-tpm/lib/oeqa/runtime/cases/tpm2.py
@@ -16,28 +16,45 @@ class Tpm2Test(OERuntimeTestCase):
         if expected_endlines:
             self.fail('Missing expected line endings:\n  %s' % '\n  '.join(expected_endlines))
 
-    @OEHasPackage(['tpm2-tss'])
-    @OEHasPackage(['tpm2-abrmd'])
     @OEHasPackage(['tpm2-tools'])
-    @OEHasPackage(['ibmswtpm2'])
+    @OEHasPackage(['tpm2-abrmd'])
+    @OEHasPackage(['swtpm'])
     @OETestDepends(['ssh.SSHTest.test_ssh'])
-    def test_tpm2_sim(self):
+    def test_tpm2_swtpm_socket(self):
         cmds = [
-                'tpm_server &',
-                'tpm2-abrmd --allow-root --tcti=mssim &'
+                'mkdir /tmp/myvtpm',
+                'swtpm socket --tpmstate dir=/tmp/myvtpm --tpm2 --ctrl type=tcp,port=2322 --server type=tcp,port=2321 --flags not-need-init &',
+                'export TPM2TOOLS_TCTI="swtpm:port=2321"',
+                'tpm2_startup -c'
                ]
 
         for cmd in cmds:
             status, output = self.target.run(cmd)
             self.assertEqual(status, 0, msg='\n'.join([cmd, output]))
 
-    @OETestDepends(['tpm2.Tpm2Test.test_tpm2_sim'])
-    def test_tpm2(self):
-         (status, output) = self.target.run('tpm2_pcrlist')
+    @OETestDepends(['tpm2.Tpm2Test.test_tpm2_swtpm_socket'])
+    def test_tpm2_pcrread(self):
+         (status, output) = self.target.run('tpm2_pcrread')
          expected_endlines = []
-         expected_endlines.append('sha1 :')
-         expected_endlines.append('  0  : 0000000000000000000000000000000000000003')
-         expected_endlines.append('  1  : 0000000000000000000000000000000000000000')
+         expected_endlines.append('  sha1:')
+         expected_endlines.append('    0 : 0x0000000000000000000000000000000000000000')
+         expected_endlines.append('    1 : 0x0000000000000000000000000000000000000000')
+         expected_endlines.append('  sha256:')
+         expected_endlines.append('    0 : 0x0000000000000000000000000000000000000000000000000000000000000000')
+         expected_endlines.append('    1 : 0x0000000000000000000000000000000000000000000000000000000000000000')
+
 
          self.check_endlines(output, expected_endlines)
 
+
+    @OEHasPackage(['p11-kit'])
+    @OEHasPackage(['tpm2-pkcs11'])
+    @OETestDepends(['tpm2.Tpm2Test.test_tpm2_swtpm_socket'])
+    def test_tpm2_pkcs11(self):
+         (status, output) = self.target.run('p11-kit list-modules -v')
+         self.assertEqual(status, 0, msg="Modules missing: %s" % output)
+
+    @OETestDepends(['tpm2.Tpm2Test.test_tpm2_pkcs11'])
+    def test_tpm2_swtpm_reset(self):
+         (status, output) = self.target.run('swtpm_ioctl -i --tcp :2322')
+         self.assertEqual(status, 0, msg="swtpm reset failed: %s" % output)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-19 22:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 22:35 [meta-security][PATCH 1/3] tpm2-pkcs11: tpm2-pkcs11 module missing Armin Kuster
2022-05-19 22:35 ` [meta-security][PATCH 2/3] tpm2-tools: Add missing rdepends Armin Kuster
2022-05-19 22:35 ` [meta-security][PATCH 3/3] oeqa/cases/tpm2: fix and enhance test suite Armin Kuster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.