Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 675298 - app-crypt/swtpm - Libtpms-based TPM emulator
Summary: app-crypt/swtpm - Libtpms-based TPM emulator
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Virtualization Team
URL: https://github.com/stefanberger/swtpm
Whiteboard:
Keywords: EBUILD, PullRequest
Depends on: 675296
Blocks:
  Show dependency tree
 
Reported: 2019-01-13 00:12 UTC by Christopher Byrne
Modified: 2019-08-02 11:25 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
swtpm ebuild (0001-app-crypt-swtpm-inital-commit.patch,5.46 KB, patch)
2019-01-13 00:12 UTC, Christopher Byrne
Details | Diff
swtpm ebuild and files (0001-app-crypt-swtpm-inital-commit.patch,5.69 KB, patch)
2019-01-21 05:44 UTC, Christopher Byrne
Details | Diff
swtpm ebuild and files (0001-app-crypt-swtpm-inital-commit.patch,5.65 KB, patch)
2019-01-21 06:16 UTC, Christopher Byrne
Details | Diff
swtpm ebuild and files (0001-app-crypt-swtpm-inital-commit.patch,7.37 KB, patch)
2019-01-22 07:03 UTC, Christopher Byrne
Details | Diff
swtpm ebuild and files (swtpm.patch,6.35 KB, patch)
2019-02-02 01:35 UTC, Christopher Byrne
Details | Diff
Make swtpm work with libvirt 5.2.0 (libvirt-5.2.0-setup-emulator-threads-and-cpusets-mems-before-execing-qemu.patch,954 bytes, patch)
2019-06-20 04:30 UTC, Christopher Byrne
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Byrne 2019-01-13 00:12:59 UTC
Created attachment 560814 [details, diff]
swtpm ebuild

Hello, attached is swtpm-0.1.0_p20181212 as well as a live ebuild. swtpm requires libtpms. swtpm is a TPM emulator which is used by qemu to emulate a TPM inside a VM. swtpm also works on hosts a TPM emulator via sockets, and has an options FUSE/CUSE interface. 

This project hasn't made a stable release yet, however Fedora accepted a snapshot in their repository, so I used the same snapshot they did.
Comment 1 Alon Bar-Lev (RETIRED) gentoo-dev 2019-01-19 20:15:47 UTC
Hi,

Can you please compare to what tpm2-software[1] project is using[2]?

As far as I understand tpm2-software is a more or less authoritative effort of tpm2.

I started to add their releases into the tree.

Thanks!

[1] https://github.com/tpm2-software
[2] https://sourceforge.net/projects/ibmswtpm2/files/
Comment 2 Christopher Byrne 2019-01-19 21:16:43 UTC
The main difference is QEMU uses swtpm for TPM emulation. That's the purpose of this package, to use an emulated TPM in a QEMU guest.
Comment 3 Alon Bar-Lev (RETIRED) gentoo-dev 2019-01-19 21:30:29 UTC
ok, if it is just for qemu, maybe qemu maintainers can take care of it.
Comment 4 Christopher Byrne 2019-01-21 05:44:42 UTC
Created attachment 562362 [details, diff]
swtpm ebuild and files
Comment 5 Christopher Byrne 2019-01-21 06:16:27 UTC
Created attachment 562364 [details, diff]
swtpm ebuild and files

I updated the ebuild so that the tests work
Comment 6 Christopher Byrne 2019-01-22 07:03:20 UTC
Created attachment 562504 [details, diff]
swtpm ebuild and files

I polished the ebuild so it'll work with libvirt and virt-manager. TPM 2 should work out of the box, but TPM 1.2 does not unless running libvirt-4.10.0 or later (which is currently unstable). For older versions of libvirt, this can be worked around by uncommenting the "swtpm_user" and "swtpm_group" comments in /etc/libvirt/qemu.conf (should both be set to 'tss').
Comment 7 Christopher Byrne 2019-02-02 01:35:49 UTC
Created attachment 563466 [details, diff]
swtpm ebuild and files

Upstream has tagged and generated version 0.1.0, so i've created a new ebuild for it and removed the old Fedora git snapshot.
Comment 8 Christopher Byrne 2019-06-20 04:30:06 UTC
Created attachment 580206 [details, diff]
Make swtpm work with libvirt 5.2.0

The current version of libvirt (5.2.0) does not allow swtpm to work, see https://bugzilla.redhat.com/show_bug.cgi?id=1712556 

There are 3 solutions:

1) Apply the above patch picked from the upstream git tree (tested)
2) Upgrade to libvirt 5.4.0 (not in portage) (untested)
3) Apply the workaround in the bug above to /etc/libvirt/qemu.conf (tested)
Comment 9 Larry the Git Cow gentoo-dev 2019-08-02 11:25:27 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=29420beac9c404288d3c9577958515f6018abd46

commit 29420beac9c404288d3c9577958515f6018abd46
Author:     Salah Coronya <salah.coronya@gmail.com>
AuthorDate: 2019-08-02 01:55:12 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2019-08-02 11:25:05 +0000

    app-crypt/swtpm: New ebuild
    
    swtpm is a libtpms TPM emulator. It is used by qemu to emulate a TPM for
    guests.
    
    Closes: https://bugs.gentoo.org/675298
    Signed-off-by: Salah Coronya <salah.coronya@gmail.com>
    Package-Manager: Portage-2.3.66, Repoman-2.3.11
    Closes: https://github.com/gentoo/gentoo/pull/11247
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 app-crypt/swtpm/Manifest                           |  1 +
 .../files/swtpm-disable-test-dependencies.patch    | 36 +++++++++++++
 app-crypt/swtpm/files/swtpm-fix-localca-path.patch | 29 ++++++++++
 app-crypt/swtpm/metadata.xml                       | 16 ++++++
 app-crypt/swtpm/swtpm-0.2.0.ebuild                 | 63 ++++++++++++++++++++++
 5 files changed, 145 insertions(+)