Coder Social home page Coder Social logo

stefanberger / swtpm Goto Github PK

View Code? Open in Web Editor NEW
559.0 22.0 136.0 3.42 MB

Libtpms-based TPM emulator with socket, character device, and Linux CUSE interface.

License: Other

Shell 36.29% C 60.46% Makefile 1.20% M4 1.49% Python 0.43% Dockerfile 0.13%
vtpm swtpm qemu tpm crypto security tpm2

swtpm's Introduction

SWTPM - Software TPM Emulator
      David Safford [email protected]
      Stefan Berger [email protected]

The SWTPM package provides TPM emulators with different front-end interfaces
to libtpms. TPM emulators provide socket interfaces (TCP/IP and Unix) and
the Linux CUSE interface for the creation of multiple native /dev/vtpm* devices.

The SWTPM package also provides several tools for using the TPM emulator,
creating certificates for a TPM, and simulating the manufacturing of
a TPM by creating a TPM's EK and platform certificates etc. Please read 
the READMEs in the individual tool's directory under src/.

Please consult the Wiki for information about swtpm:

   https://github.com/stefanberger/swtpm/wiki

swtpm's People

Contributors

andreabolognani avatar avalluri avatar ben-dav-lytle avatar diabonas avatar dissoupov avatar elmarco avatar elms avatar ethan-thompson avatar etsukata avatar franciozzy avatar glimchb avatar hnj2 avatar iccaszhulili avatar kkamagui avatar kloczek avatar liujiong63 avatar lvoytek avatar marckleinebudde avatar nabijaczleweli avatar nchevsky avatar nicholasbishop avatar nicowilliams avatar pimaker avatar pohly avatar rosslagerwall avatar stefanberger avatar thomaslamprecht avatar wrabcak avatar xennifer avatar zippy2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swtpm's Issues

Virtual Machine startup hangs when attaching a new TPM 2.0

Hi,

First of all, thank you for the great work you've put into this project, I am able to have a fully working TPM 2.0 in a Windows 10 VM!

I am using:

To attach a new TPM, I edit the VM configuration with virsh and add the following:

<tpm model='tpm-crb'>
  <backend type='emulator' version='2.0'/>
</tpm>

When I start the VM, libvirt just hangs (i.e. it does not respond to any actions), there is no qemu process started even though swtpm_setup.sh and swtpm are running, the tpmstate directory has been created, it contains both tpm2-00.permall and .lock, and swtpm has the write lock on .lock.

To circumvent the issue, I keep note of the tpmstate directory, I kill both swtpm_setup.sh and swtpm processes. At that point, libvirt complains about the exit status of swtpm_setup and responds again, and the tpmstate directory is no longer present. So I manually create the directory and set the correct permissions and ownership. After that, I am able to start the VM with the TPM normally.

I am not sure whether it is a libvirt issue or a swtpm one, I'll try here first.

Unable to start vtpm vm through libvirt xml file

I have made a /dev/vptm0 device through our documentation and start a vm using qemu-system-x86_64 command. Then, I have a try to start vtpm vm through libvirt xml. But I meet an error which I can't solve it. The error is "qemu-system-x86_64: -tpmdev cuse-tpm,id=tpm0,path=/dev/vtpm0: Cannot access TPM device using '/dev/vtpm0': Operation not permitted".
I edit a test.txt file and use "virsh domxml-from-native qemu-argv" command to create libvirt xml file.
The contents of test.txt file and commands I used is as follows:
test.txt
LC_ALL=C PATH=/usr/local/bin HOME=/root LOGNAME=root /usr/local/bin/qemu-system-x86_64 -display sdl -enable-kvm -m 1024 -boot c -bios /root/tpm-test/seabios-tpm/out/bios.bin -boot menu=on -tpmdev cuse-tpm,id=tpm0,path=/dev/vtpm0 -device tpm-tis,tpmdev=tpm0 /tmp/tpm-test/centos.img

virsh domxml-from-native qemu-argv test.txt > my.xml
virsh create my.xml.
After excute these operations, the error above-mentioned occured.

no details in /sys/kernel/security/tpm0/ascii_bios_measurements

I have installed qemu, seabios and swtpm etc in host os, and can see /dev/tpm0 in guest os.
IMA works well, cat /sys/kernel/security/tpm0/ascii_bios_measurements can show many details,
however, there is nothing in /sys/kernel/security/tpm0/ascii_bios_measurements.
tpm_ command could be used too. Could you help me ? thanks

tpm2: swtpm asserts during startup in debug build

When building swtpm = 2dfd15d and libtpms = 14cb73d6658a9baa41a5e2ff542168463b7becf0 with --enable-debug and then running swtpm2 --tpm2, startup fails with an assertion:

swtpm: tpmlib.c:127: tpmlib_get_tpm_property: Assertion `res == TPM_SUCCESS' failed.

That's because swtpm.c asks for properties which aren't supported by TPM2_GetTPMProperty:

421	    TPM_DEBUG("Main: Compiled for %u auth, %u transport, and %u DAA session slots\n",
422	           tpmlib_get_tpm_property(TPMPROP_TPM_MIN_AUTH_SESSIONS),
423	           tpmlib_get_tpm_property(TPMPROP_TPM_MIN_TRANS_SESSIONS),
424	           tpmlib_get_tpm_property(TPMPROP_TPM_MIN_DAA_SESSIONS));

swtpm_cert fails test test_swtpm_cert: Certificate file has wrong size.

Hi,

My build fails test test_swtpm_cert. Relevant excerpt from tests/test-suite.log:

FAIL: test_swtpm_cert
=====================

Error: Certificate file has wrong size.
       Expected: 1224;  found: 1216
FAIL test_swtpm_cert (exit status: 1)

I checked and it is not just the first certificate that's problematic. All four certificates generated have different sizes than expected: always 4 less than the test case expects, except in the first case where it's 8 less than it should be. The generated certificates seem to be ok by simple visual inspection (attached the first one for reference; please excuse the file extension: cert1.txt), and the output of openssl x509 -text -in cert1.txt (see below) seems mostly plausible to me as well. However, there are some strange characters (terminal escape sequences?) in the SAN field, the like of which I have not seen before. Is that intentional?

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 1 (0x1)
    Signature Algorithm: sha1WithRSAEncryption
        Issuer: CN=swtpm-localca
        Validity
            Not Before: Dec 14 00:34:10 2015 GMT
            Not After : Dec 11 00:34:10 2025 GMT
        Subject: 
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    00:b9:dd:a8:30:72:9d:e5:8f:9f:5b:ed:2b:3b:93:
                    94:ad:4e:c5:af:b9:c3:90:b8:9a:33:37:25:0c:bc:
                    57:5c:fc:8f:31:f7:ff:d3:f0:5f:41:55:07:6f:7d:
                    16:05:38:1c:d2:81:b7:f1:47:b8:01:15:4e:4f:89:
                    ee:52:9f:e3:6e:ae:50:f7:95:61:85:0e:5b:63:03:
                    7e:da:ac:bb:39:0e:a3:fc:d0:37:e6:74:fb:17:9e:
                    3c:5a:fe:31:21:4d:78:a7:56:ca:44:cc:6c:f2:54:
                    21:b5:14:20:ed:e5:48:31:0c:92:b0:8a:51:3c:cc:
                    62:fd:0e:f4:5d:cf:65:46:f6:e8:65:be:6a:66:1d:
                    04:5d:1c:47:b6:0b:42:8d:11:dc:97:cb:9f:35:ee:
                    7c:38:5b:b2:03:20:93:4b:01:5f:80:14:e8:fb:19:
                    85:1c:2a:f3:07:e1:e6:46:48:c1:42:17:5e:40:b6:
                    06:15:dc:49:4f:db:09:ea:5d:5a:6f:32:73:b6:5a:
                    24:1e:3c:f3:0c:c4:49:b9:fb:3f:90:0d:1e:d4:be:
                    96:7b:32:b1:6f:95:a1:d7:32:db:fa:14:3e:aa:1c:
                    20:17:55:61:17:f7:0f:ae:e5:d7:7f:83:67:05:d0:
                    54:05:36:1a:d5:87:1a:32:16:1f:a5:a1:23:4c:fa:
                    b4:97
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Extended Key Usage: 
                rsaesOaep
            X509v3 Subject Alternative Name: 
                URI:0*0^L^F^Eg<81>^E^B^A^L^CIBM0^L^F^Eg<81>^E^B^B^L^CIBM0^L^F^Eg<81>^E^B^C^L^CIBM
            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Authority Key Identifier: 
                keyid:67:2D:C2:5E:CB:61:DF:51:D3:72:30:A2:58:D0:06:A0:8D:8F:69:91

            X509v3 Key Usage: critical
                Key Encipherment
    Signature Algorithm: sha1WithRSAEncryption
         65:65:8a:d9:c4:b7:d8:d0:56:4e:1d:ca:63:73:01:89:33:7b:
         8b:80:52:38:df:61:58:a5:0e:10:ba:f2:e7:48:fc:cc:7d:11:
         42:3f:41:2c:5e:1e:6f:c3:5c:62:0e:57:1f:6f:da:52:f3:a1:
         84:8e:57:c9:51:9c:92:a3:99:53:c8:b3:02:8c:99:21:1d:04:
         89:dd:ab:33:70:0a:b4:49:26:cf:c3:56:0b:15:cd:1b:67:72:
         22:55:16:2d:90:ea:f4:62:06:8f:15:59:eb:11:88:9d:61:c1:
         17:76:83:ad:b3:69:eb:c4:5b:5f:0e:1d:35:28:10:36:8b:1f:
         dd:47:c0:79:3d:59:67:36:0f:4d:4d:38:83:e6:54:78:a9:2b:
         38:0a:3a:c9:1b:f3:8c:35:56:28:09:15:f9:c5:68:40:e6:9d:
         f1:c3:cc:cd:7c:43:61:19:c0:3d:68:58:2c:75:30:c6:e7:2b:
         44:1e:c1:69:b3:5a:a4:83:03:03:88:ab:bc:b3:f2:2d:dc:f0:
         11:7e:e6:76:85:74:06:0f:ad:ce:15:94:78:bd:a5:e4:c3:c2:
         cf:10:c1:a1:57:39:44:f1:1c:8f:74:a7:8d:22:6e:d5:bf:29:
         30:84:f0:e2:c8:c3:f4:4d:bf:ea:3a:11:c2:fd:d9:72:7b:8a:
         9e:60:2b:a5:7d:89:cb:ef:74:5b:fd:31:06:a2:4d:a0:4d:67:
         5a:63:51:83:19:5f:3d:ef:d3:59:da:fb:6e:68:21:e2:9a:3e:
         f1:6b:1c:1f:da:c4:03:e6:dc:8b:68:5c:b8:57:ba:9c
-----BEGIN CERTIFICATE-----
MIIDVjCCAg6gAwIBAgIBATANBgkqhkiG9w0BAQUFADAYMRYwFAYDVQQDEw1zd3Rw
bS1sb2NhbGNhMB4XDTE1MTIxNDAwMzQxMFoXDTI1MTIxMTAwMzQxMFowADCCASIw
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALndqDByneWPn1vtKzuTlK1Oxa+5
w5C4mjM3JQy8V1z8jzH3/9PwX0FVB299FgU4HNKBt/FHuAEVTk+J7lKf426uUPeV
YYUOW2MDftqsuzkOo/zQN+Z0+xeePFr+MSFNeKdWykTMbPJUIbUUIO3lSDEMkrCK
UTzMYv0O9F3PZUb26GW+amYdBF0cR7YLQo0R3JfLnzXufDhbsgMgk0sBX4AU6PsZ
hRwq8wfh5kZIwUIXXkC2BhXcSU/bCepdWm8yc7ZaJB488wzESbn7P5ANHtS+lnsy
sW+Vodcy2/oUPqocIBdVYRf3D67l13+DZwXQVAU2GtWHGjIWH6WhI0z6tJcCAwEA
AaOBkjCBjzAUBgNVHSUEDTALBgkqhkiG9w0BAQcwNwYDVR0RBDAwLoYsMCowDAYF
Z4EFAgEMA0lCTTAMBgVngQUCAgwDSUJNMAwGBWeBBQIDDANJQk0wDAYDVR0TAQH/
BAIwADAfBgNVHSMEGDAWgBRnLcJey2HfUdNyMKJY0AagjY9pkTAPBgNVHQ8BAf8E
BQMDByAAMA0GCSqGSIb3DQEBBQUAA4IBMQBlZYrZxLfY0FZOHcpjcwGJM3uLgFI4
32FYpQ4QuvLnSPzMfRFCP0EsXh5vw1xiDlcfb9pS86GEjlfJUZySo5lTyLMCjJkh
HQSJ3aszcAq0SSbPw1YLFc0bZ3IiVRYtkOr0YgaPFVnrEYidYcEXdoOts2nrxFtf
Dh01KBA2ix/dR8B5PVlnNg9NTTiD5lR4qSs4CjrJG/OMNVYoCRX5xWhA5p3xw8zN
fENhGcA9aFgsdTDG5ytEHsFps1qkgwMDiKu8s/It3PARfuZ2hXQGD63OFZR4vaXk
w8LPEMGhVzlE8RyPdKeNIm7VvykwhPDiyMP0Tb/qOhHC/dlye4qeYCulfYnL73Rb
/TEGok2gTWdaY1GDGV8979NZ2vtuaCHimj7xaxwf2sQD5tyLaFy4V7qc
-----END CERTIFICATE-----

Code was compiled from commit 86b6ffc with the openssl crypto backend (openssl version 1.0.2.e from Arch Linux). Please let me know if I can provide any more information which may be useful.

hard dependency to tss user account

It seems that there is a hard dependency to fixed a user account

$ swtpm_setup
Could not get account data of user tss.

I'd use this for kernel testing without any specific user space stack.

/sys/class/misc/vtpm0/device/cancel No such file or directory

Hi, I don't think this issue relates to swtpm, but I was wondering if you had an idea what the issue would be.

I'm running Fedora 21, libvirtd (libvirt) 1.2.9.3, QEMU emulator version 2.1.3 (qemu-2.1.3-9.fc21).

I compiled and checked the tpm emulator and all tests passed. I modprobe, and rebooted.

Then did (as root):

export TPM_PATH=/tmp/myvtpm0 
swtpm_cuse -n vtpm0
systemctl restart libvirtd

ls /dev/vtpm* shows the /dev/vtpm0 as expected

I added the tpm device to the vm using the virtual machine manager, only option available was pass-through and I typed the /dev/vtpm0 path. Applied changes and everything seemed fine. However, when I try to start the VM I guess the issue mentioned below, any suggestions?

Error starting domain: unable to set security context 'system_u:object_r:svirt_image_t:s0:c480,c764' on '/sys/class/misc/vtpm0/device/cancel': No such file or directory

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 89, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 125, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1381, in startup
    self._backend.create()
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 999, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: unable to set security context 'system_u:object_r:svirt_image_t:s0:c480,c764' on '/sys/class/misc/vtpm0/device/cancel': No such file or directory

Can't get swtpm to run on Fedora 23

Hello!

I am trying to install swtpm on Fedora 23 and I can't seem to get it to run or find help online. After building, the command 'make check' fails nearly everything. Additionally, 'modprobe cuse' doesn't work because cuse is not a module in 23, and I haven't been able to find documentation on what has replaced it.

Does anyone have experience with getting this library to work?

Can I use TrouSerS on swtpm emulated TPM device

Hi,

I have set up the swtpm on my ubuntu. I can see /dev/vtpm0 on my machine. I want to run TrouSerS test suit on vtpm. Can I do that?

If I can, when I try to connect tpm device using command "sudo tcsd -f". The error message shows "could not find a device to open!". But I can see /dev/vtpm0 on my machine.

Any suggestion are welcomed. Thanks.

Not able to read /sys/kernel/security/tpm0/ascii_runtime_measurements

Hi, I just reproduced the install process @stenioaraujo described at #4 (comment) (swtpm 2.0+QEMU+OVMF) but I ended up with no pcrs file inside /sys/class/tpm/tpm0/device/ and no tpm0 folder inside /sys/kernel/security/ only an ima folder containing a single measurement for boot_aggregate.

After installing tpm2-tools from apt, I managed to print pcrs with sudo resourcemgr & tpm2_listpcrs and PCRs 0-7 are actually being used.

Have you ever experienced this behavior? I'd really appreciate if someone could point me in some direction to solve this... as I'm not even sure if it is a IMA problem or something I'm missing in wiring the emulator, qemu and OVMF.

migration on cuse + capabilities

I have libvirt setup with hooks to create a cuse tpm on the prepare/start phase,
I'm trying to do a live migration on a tpm2 software only system:

virsh migrate --live --p2p --verbose guest qemu+tcp://128.224.56.52/system

error: internal error: unable to execute QEMU command 'migrate': Migration disabled: CUSE TPM lacks necessary capabilities

swtpm_ioctl -c --tpm-device /dev/tpm0

ptm capability is 0xcbf

At first I thought that I need to setup state blobs for the device, so what I did is in the prepare/start phase
of libvirt's hook, I create a daemon to periodically call swtpm_ioctl --save for all valid state blob names
in files (stopped/end hook kills this daemon):

file /guest/blob/*

/guest/blob/permanent: PDP-11 UNIX/RT ldp
/guest/blob/savestate: empty
/guest/blob/volatile: ASCII text

But I still get the migration error message.

Do I need to do something else to make migration work?

Compiling swtpm-tpm2-preview.rev146.v2

I am trying to build swtpm-tpm2-preview.rev146.v2 on RHEL7.4 with tpm2 support, and I am getting the following configure error:

./configure: line 13140: syntax error near unexpected token libtpms_cryptolib,' ./configure: line 13140: PKG_CHECK_VAR(libtpms_cryptolib, libtpms, cryptolib,'

I am running configure with the "--with-openssl --prefix=/usr" options. The latest libtpms (libtpms-tpm2-preview.rev146.v2) is installed with openssl support. I don't see any dependency in the documentation on cryptolib. What am I doing wrong?

swtpm make error when using libtpms-tpm2-preview.rev142 and .rev146

I got a error in making swtpm after using new libtpms. The terminal output is below:

ctrlchannel.c: In function ‘ctrlchannel_process_fd’:
ctrlchannel.c:785:22: error: implicit declaration of function ‘TPMLIB_SetBufferSize’; did you mean ‘TPMLIB_GetVersion’? [-Werror=implicit-function-declaration]
         buffersize = TPMLIB_SetBufferSize(buffersize,
                      ^~~~~~~~~~~~~~~~~~~~
                      TPMLIB_GetVersion
cc1: all warnings being treated as errors
Makefile:663: recipe for target 'libswtpm_libtpms_la-ctrlchannel.lo' failed
make[3]: *** [libswtpm_libtpms_la-ctrlchannel.lo] Error 1

I got this error in using libtpms-tpm2-preview.rev142 as well as libtpms-tpm2-preview.rev146.

swtpm master: fails to build with libtpms master

Commit f1389af starts using TPMLIB_TPMVersion, which is not yet in libtpms master (was added later, for the TPM2 preview code).

Should that particular commit perhaps get reverted on the master branch and be added back specifically on the TPM2 preview branch?

Issue with migration + cuse tpm

When I tried to migrate, it failed with the following error message on the target host (libvirt log):
(error telling me that the vtpm device is missing - note that there is no hw TPM on my machine)
This is using the tpm2 preview for libtpms/swtpm, qemu-tpm (2.6).

Is there a something else that I need to do to make this happen?

virsh migrate --live --p2p --verbose guest qemu+tcp://128.224.56.52/system

2017-03-09 21:47:39.627+0000: 2164: debug : virCommandRunAsync:2448 : About to run LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin
:/usr/bin:/sbin:/bin QEMU_AUDIO_DRV=none /home/afong/TPM/bin/qemu-system-x86_64 -name guest=guest,debug-threads=on -S -object secret,id=m
asterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-3-guest/master-key.aes -machine pc-i440fx-2.6,accel=kvm,usb=off,dump-guest-core=of
f -cpu kvm64 -m 2000 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid 6be4dda6-e775-4f5e-b142-57e5892b2a08 -display none -no-
user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-3-guest/monitor.sock,server,nowait -mon chardev=
charmonitor,id=monitor,mode=control -rtc base=utc -no-reboot -boot menu=on,strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2
-drive file=/home/afong/TPM/tmp/CentOS-7-x86_64-GenericCloud.qcow2,format=qcow2,if=none,id=drive-virtio-disk0,cache=none,aio=native -dev
ice virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=26,id=hostnet0,vhost=o
n,vhostfd=28 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:0c:44:05,bus=pci.0,addr=0x2 -chardev pty,id=charserial0 -device
isa-serial,chardev=charserial0,id=serial0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 -bios /home/afong/TPM/seabios/out/bio
s.bin -tpmdev cuse-tpm,id=tpm-tpm0,path=/dev/tpm0,cancel-path=/dev/null -device tpm-tis,tpmdev=tpm-tpm0,id=tpm0 -msg timestamp=on
error : qemuProcessReportLogError:1792 : internal error: qemu unexpectedly closed the monitor: 2017-03-09T21:47:39.688989Z qemu-system-x86_64: -tpmdev cuse-tpm,id=tpm-tpm0,path=/dev/tpm0,cancel-path=/dev/null: Cannot access TPM device using '/dev/tpm0': No such file or directory
debug : qemuMonitorIO:743 : Error on monitor internal error: qemu unexpectedly closed the monitor: 2017-03-09T21:47:39.688989Z qemu-system-x86_64: -tpmdev cuse-tpm,id=tpm-tpm0,path=/dev/tpm0,cancel-path=/dev/null: Cannot access TPM device using '/dev/tpm0': No such file or directory
2017-03-09 21:47:39.767+0000: 1863: debug : qemuMonitorIO:774 : Triggering error callback
2017-03-09 21:47:39.767+0000: 1863: debug : qemuProcessHandleMonitorError:338 : Received error on 0x7f4538002fb0 'guest'
2017-03-09 21:47:39.767+0000: 2164: debug : qemuMonitorSend:1021 : Send command resulted in error internal error: qemu unexpectedly closed the monitor: 2017-03-09T21:47:39.688989Z qemu-system-x86_64: -tpmdev cuse-tpm,id=tpm-tpm0,path=/dev/tpm0,cancel-path=/dev/null: Cannot access TPM device using '/dev/tpm0': No such file or directory

TPM 2.0 support

Just saw the tpm2-preview branch. 2.0 would be a nice addition. How far is the TPM 2.0 support?

Enabling SHA512 in TPM 2 will break compatibility

I updated the TPM 2 code and it can be compiled with TPM 2 support now. However, enabling this would break backwards compatibility since previous state did not write SHA512 related data and thus the TPM 2 would not initialize. TPM 2 is currently in 'preview' and I think if we ever wanted to enable it, we have to do it now, because later on it cannot be done anymore.

Thoughts?

undefined reference to 'TPMLIB_GetInfo' and 'TPMLIB_SetState'

I need to build a version of swtpm that supports TPM2. I am using using the swtpm-tpm2-preview.v2 branch from today. As far as libtpms, I am using the libtpms-tpm2-preview.rev146.v2 branch from today. The following error is occurring when I am trying to do a compile/build:

libtool: link: gcc -I../../include -I../../include/swtpm -fstack-protector-strong -Wstack-protector -Wl,-z -Wl,relro -Wl,-z -Wl,now -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -DHAVE_SWTPM_CUSE_MAIN -g -O2 -Wreturn-type -Wsign-compare -Wswitch-enum -Wmissing-prototypes -Wall -Werror -Wformat -Wformat-security -o .libs/swtpm swtpm-main.o swtpm-swtpm.o swtpm-swtpm_chardev.o swtpm-cuse_tpm.o -pthread -pthread -L/os/files/swtpm-tpm2-preview.v2/src/swtpm/.libs /os/files/swtpm-tpm2-preview.v2/src/swtpm/.libs/libswtpm_libtpms.so -lfuse -lgthread-2.0 -lglib-2.0 -ltpms -lcrypto -pthread swtpm-cuse_tpm.o: In function 'ptm_ioctl': /os/files/swtpm-tpm2-preview.v2/src/swtpm/cuse_tpm.c:1211: undefined reference to 'TPMLIB_GetInfo' /os/files/swtpm-tpm2-preview.v2/src/swtpm/.libs/libswtpm_libtpms.so: undefined reference to 'TPMLIB_SetState'

The missing references appear to be defined correctly in the header files.

What am I doing wrong?

Replace tpm private key

Hi,

I know in real TPM, the private key is sit inside TPM. I am wondering for the software emulated TPM, is the private key also hard coded inside swtpm source code or swtpm will randomly generate a new private key everytime the swtpm is installed?
Can I dump out the private key somewhere from my machine after I setup the swtpm? Or can I dump out the private key in swtpm source code?

Because I want to design a lab task for graduate students to understand private key sit inside TPM and somehow replace with a new private key. I am not sure whether it is doable with the software emulated TPM.

Thanks in advance for any suggestion

swtpm: Error: Could not choose TPM 2 implementation.

Here is what I do on a shell:

#!/bin/bash
mkdir /tmp/vtpm0

chown -R tss:root /tmp/vtpm0
swtpm_setup --tpm2 --tpm-state /tmp/vtpm0 --createek
export TPM_PATH=/tmp/vtpm0
swtpm_cuse -n vtpm0

And here is its output:

Starting vTPM manufacturing as tss:tss @ 2017年04月11日 星期二
20时01分10秒
swtpm: Error: Could not choose TPM 2 implementation.
swtpm: Error: Could not choose TPM 2 implementation.
swtpm: Error: Could not choose TPM 2 implementation.
swtpm: Error: Could not choose TPM 2 implementation.

No errors while creating vtpm but bios says TPM is not working correctly

Hi Stefan,
I hope you can help me once more, because vtpm does not work and I have no idea where is the problem:
OS is ubuntu with your qemu-tpm running. Configure, building and make install worked fine.
Additionally, your swtpm is cloned and build as well and the qemu images uses the seabios-tpm binary as well.
There is no error if creating the vtpm, but other than that all communication failed.
Here is what I do:

root@LZ-QEMU1 ~ # cat createTPM
export TPM_PATH=/tpm/vtpm0
rm -r /tmp/vtpm0
mkdir /tmp/vtpm0
chown -R tss:root /tmp/vtpm0
swtpm_setup --display --tpm-state /tmp/vtpm0 --createek
swtpm_cuse -n vtpm0
root@LZ-QEMU1 ~ # ./createTPM
Starting vTPM manufacturing as tss:tss @ Mon 12 Sep 2016 10:09:53 AM CEST
TPM is listening on TCP port 42390.
Successfully created EK.
TSS is listening on TCP port 57035.
Successfully took ownership of the TPM.
Successfully gave up ownership of the TPM.
TPM is listening on TCP port 42128.
Successfully enabled and activated the TPM
Successfully authored TPM state.
Ending vTPM manufacturing @ Mon 12 Sep 2016 10:09:53 AM CEST

Looks ok so far, but neither qemu nor swtpm_bios can use the vTPM:
swtpm_bios --tpm /dev/vtpm0
TPM_Startup(0x01) returned error code 0x00000009
TSC_PhysicalPresence(CMD_ENABLE) returned error code 0x00000009
TSC_PhysicalPresence(PRESENT) returned error code 0x00000009
TPM_PhysicalEnable returned error code 0x00000009
TPM_PhysicalSetDeactivated returned error code 0x00000009

root@LZ-QEMU1 ~ # /repos/qemu-tpm/build/x86_64-softmmu/qemu-system-x86_64 -rtc base=localtime -net nic,macaddr=DE:AD:BE:EF:0A:B1 -net bridge,br=br0 -vga qxl -spice port=5804,disable-ticketing -machine accel=kvm -boot c -m 3G -bios /repos/seabios-tpm/out/bios.bin -nographic -hda /data/hdd/fedora42.img -boot menu=on -tpmdev cuse-tpm,id=tpm0,path=/dev/vtpm0 -device tpm-tis,tpmdev=tpm0

The bios has the t menu, but if I use it I only get the message TPM is not working correctly.
I build qemu-tpm again and installed it to be sure it is the proper qemu version.
Do you have an idea where could be the problem?

tpm_cuse: Detected CUSE TPM but could not send INIT

Hi, I tried to build the vTPM environment with swtpm、libtpms and qemu-tpm, but when I launched the qemu with the following command, it shows, "tpm_cuse: Detected CUSE TPM but could not send INIT: software caused connection abort".

Here are the commands I used. Thanks.

"qemu-boot-centos")
qemu-system-x86_64 -display sdl -enable-kvm -cdrom /home/luowu/CentOS-7-x86_64-DVD-1511.iso
-m 1024 -boot d -bios $SEABIOS/bios.bin -boot menu=on -tpmdev
cuse-tpm,id=tpm1,path=/dev/vtpm1
-device tpm-tis,tpmdev=tpm1 /qemu/image/centos.img
;;
"qemu-start-centos")
qemu-system-x86_64 -display sdl -enable-kvm
-m 1024 -boot c -bios $SEABIOS/bios.bin -boot menu=on -tpmdev
cuse-tpm,id=tpm1,path=/dev/vtpm1
-device tpm-tis,tpmdev=tpm1 /qemu/image/centos.img
;;
"create-vtpm1")
chown -R tss:root /tmp/myvtpm1
swtpm_setup --tpm-state /tmp/myvtpm1 --createek
export TPM_PATH=/tmp/myvtpm1
swtpm_cuse -n vtpm1
;;

TCSD ERROR: TCSD config file error

Hello,

when I tried such cmd as below:

# swtpm_setup --tpm-state /tmp/myvtpm1  --createek

the logs shows that

Starting vTPM manufacturing as root:root @ Wed 12 Sep 2018 10:00:26 PM CST
swtpm: main: Initializing TPM at Wed Sep 12 22:00:26 2018
swtpm: TPM 1.2: Compiled for 16 auth, 16 transport, and 2 DAA session slots
swtpm: TPM 1.2: Compiled for 20 key slots, 10 owner evict slots
swtpm: TPM 1.2: Compiled for 8 counters, 128 saved sessions
swtpm: TPM 1.2: Compiled for 16 family, 4 delegate table entries
swtpm: TPM 1.2: Compiled for 40960 total NV, 21088 savestate, 21319 volatile space
swtpm: TPM_NVRAM_Init: Rooted state path /tmp/myvtpm1
TPM is listening on TCP port 31011.
swtpm: SWTPM_NVRAM_LoadData: No such file /tmp/myvtpm1/tpm-00.permall
swtpm: SWTPM_NVRAM_LoadData: No such file /tmp/myvtpm1/tpm-00.volatilestate
swtpm: mainLoop:
Successfully created EK.
**TCSD ERROR: TCSD config file (/tmp/tmp.pTh15ttfij) must be user/group tss/tss
TCSD ERROR: TCSD config file (/tmp/tmp.pTh15ttfij) must be user/group tss/tss
TCSD ERROR: TCSD config file (/tmp/tmp.pTh15ttfij) must be user/group tss/tss**
......
Ending vTPM manufacturing @ Wed 12 Sep 2018 10:00:40 PM CST
swtpm: Terminating...

actually the config file seems already to be tss:tss

linux: /tmp/myvtpm1 # ls /etc/tcsd.conf -la
-rw------- 1 tss tss 6411 Mar 16 02:44 /etc/tcsd.conf

THANK YOU

autogen fails checking for python on ubuntu 18.04

Hi @stefanberger,

./autogen.sh is failing when I run on a new ubuntu 18.04 server with the following error:

checking for python... no
configure: error: python is required: python2 or python3 package

I think the cause is that there is no python alias... I solved it by installing python 2.7 with apt install python but I thought it was worth mentioning here.

Cannot do anything with the vTPM on host and in VM because of weird TPM state

Hi,

I want to use the vTPM in a qemu Windows image. Unfortunately, I don't get it running.
First, the software:
Ubuntu 16.04.1
Qemu v2.6.0+tpm
libtpm
and swtpm.
I set-up the qemu and swtpm with ./configure, make and so on.
Did not get swtpm running until I used the dep package.
Eventually, all works without errors. Create vtpm works with:
mkdir /tmp/myvtpm0
chown -R tss:root /tmp/myvtpm0
swtpm_setup --tpm-state /tmp/myvtpm0 --createek

export TPM_PATH=/tmp/myvtpm0
swtpm_cuse -n vtpm0

and then start the Widnows image with:
qemu-system-x86_64 -vga qxl -spice port=5959 -machine accel=kvm -m 3G -nographic -bios /seabios-1.9.2/out/bios.bin
-tpmdev
cuse-tpm,id=tpm0,path=/dev/vtpm0 -device tpm-tis,tpmdev=tpm0 test.img

First it looks all fine. Windows booted up and in the TPM Administration window is the TPM ready. But if you want to do anything with it that fails and WIndows shows an error message like this:
Cannot change TPM owner password
The TPM may not be in the correct state to perform this action. An internal error has occurred within the Trusted Platform Module support program. Error code 0x80284001

I do not blame Windows because on the host I cannot initialize the vTPM as well. tpm_clear ask for the owner password but ooo is not accepted.
If I set another password with the swtpm_setup program it does not work neither :-(

So, what could be the problem?
Thanks,
Wolfgang

tpm_tools requirement for tpm2-preview.X

When building tpm2-preview.X, "./configure" fails when tpm_nvdefine is not found in the environment.

AC_PATH_PROG([TPM_NVDEFINE], tpm_nvdefine)

tpm tools are not listed in the required-package list in INSTALL. Also, the tpm-tools are intended for TPM1.2 and the purpose of this dependency in the tpm2-X branches is not entirely clear.

Too many PCR banks -> disabling some will cause compatibility to break

libtpms currently enables PCR banks for SHA{1,256,384,512}. This has an impact on performance. I may have to disable some of these PCR banks and will break compatibility with the state.

The PCR_Allocate() function would allow a user to disable PCR banks he does not want to use. However, this command prevents suspend/resume from working since TPM2_Shutdown(SU_STATE) doesn't work anymore once this has been used.

Another issue with the swtpm is that its state has to be upgradeable from any initial version to any version in the future. Some of the features of the TPM 2 cannot be enabled anymore in the future since VMs may be suspended and would then for example resume with some PCR bank that was not enabled before. What this means is that we have to choose the PCR banks for the swtpm now and live with them in the future. Therefore my current plan is to enable SHA256 for 'now' and either SHA384 or SHA512 for 'the future'.

Tool dependencies and development branch for vTPM 2.0 instance

I am trying to compile and deploy the an swtpm instance based on TPM 2.0 specifications, and I cannot find on the wiki which is the suggested development branch for swtpm and libtpms. I see that there are multiple preview branches on both projects, and I would suggest to improve the Wiki (or README) to make it clearer for testers.

Test for tpm(v1) vs tpm2 tools

I am building the swtpm-tpm2-preview.v2 version, and the autoconf test for tpm tools runs the command:

AC_PATH_PROG([TPM_NVDEFINE], tpm_nvdefine)

Which makes sense for tpm v1. Is this how the test should be when building support for tpm2?

INSTALL: ./dist/control is missing for Ubuntu

I'm following the INSTALL steps on Ubuntu 16.0

sudo mk-build-deps --install ./dist/control
W: Unable to locate package ./dist/control
mk-build-deps: Unable to find package name in `apt-cache showsrc ./dist/control'

Is this file missing?

Error message even the proper package is installed

Hi,

I am trying to install qemu-tpm, swtpm and libtpms. At the moment I cannot build swtpm and libtpms because I always get following error when I call ./configure --perfix=/usr:
configure: error: "Could not find AES_CreateContext(). Is nss-softokn-freebl-devel/libnss3-dev installed?"
I am running Ubuntu 16.04 and of course, the libnss3-dev with and without -dev is installed.
Any hint or idea what could be the problem here?
Thanks

F28: GnuTLS regression causes tests/test_tpm2_swtpm_cert_ecc to fail

https://gitlab.com/gnutls/gnutls/issues/538

Email sent to GnuTLS:

Hello,
   the following key in tests/data/ecpubek.pem

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEne14S57Dr9tYfw2PtsVoaC0IrHji
EFKihkvMeimuYRVxYkZh5kmZfwcOIKlGawAo1JhUgA3iYSlLi3ho71aq0g==
-----END PUBLIC KEY-----

cannot be read with certtool from gnutls-utils-3.6.3-2.fc28.x86_64::

# certtool --load-pubkey ./tests/data/ecpubek.pem --pubkey-info
Public Key Information:
	Public Key Algorithm: EC/ECDSA
	Algorithm Security Level: Unknown (0 bits)
		Curve:	(null)
		X:
			00:9d:ed:78:4b:9e:c3:af:db:58:7f:0d:8f:b6:c5:68
			68:2d:08:ac:78:e2:10:52:a2:86:4b:cc:7a:29:ae:61
			15
		Y:
			71:62:46:61:e6:49:99:7f:07:0e:20:a9:46:6b:00:28
			d4:98:54:80:0d:e2:61:29:4b:8b:78:68:ef:56:aa:d2

error: get_key_id(sha1): ASN1 parser: Generic parsing error.

export error: The request is invalid.


It  works with certtoll from gnutls-utils-3.5.18-2.fc27.x86_64:


# certtool --load-pubkey ./tests/data/ecpubek.pem --pubkey-info
Public Key Information:
        Public Key Algorithm: EC/ECDSA
        Algorithm Security Level: High (256 bits)
                Curve:  SECP256R1
                X:
                        00:9d:ed:78:4b:9e:c3:af:db:58:7f:0d:8f:b6:c5:68
                        68:2d:08:ac:78:e2:10:52:a2:86:4b:cc:7a:29:ae:61
                        15
                Y:
                        71:62:46:61:e6:49:99:7f:07:0e:20:a9:46:6b:00:28
                        d4:98:54:80:0d:e2:61:29:4b:8b:78:68:ef:56:aa:d2

Public Key ID:
        sha1:02f886dc56421b061b8ec2544f2433ee49a1d80e
        sha256:ea8456b1378f13acf91cff3eedda26c485aa937763506ffa85d16922001d238f
Public Key PIN:
        pin-sha256:6oRWsTePE6z5HP8+7domxIWqk3djUG/6hdFpIgAdI48=


-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEne14S57Dr9tYfw2PtsVoaC0IrHji
EFKihkvMeimuYRVxYkZh5kmZfwcOIKlGawAo1JhUgA3iYSlLi3ho71aq0g==
-----END PUBLIC KEY-----

not able to install qemu_tpm to run swtpm

Hello Stefan,
I am trying to install the swtpm, I did all the installation but qemu_tpm is throwing an error with ucontext structure. I am using ubuntu 17.10.
Please mention which branch to use for tpm2.0 for qemu-tpm. For libtpm and swtpm I did it from correct br.
Also, what are the default authorization values in created TPM, I have one installation present which is a bit old with swtpm and in that, I am not able to clear the TPM with PLATFORM auth with a blank password.

Cannot find /dev/tpm0 in the guest

Hi, I've integrate swtpm and qemu-tpm in to nova-compute on devstack.
First, I create TPM_PATH and vtpm0 manually

# mkdir /tmp/vtpm0
# chown -R tss:root  /tmp/vtpm0
# swtpm_setup --tpm-state /tmp/vtpm0  --createek 
# swtpm_cuse --name vtpm0 --tpmstate dir=/tmp/vtpm0 --log file=/root/out.log

Then, I start the instance, the qemu comand is

/usr/bin/qemu-system-x86_64 -name instance-00000018 -S -machine pc-i440fx-2.4,accel=kvm,usb=off -bios /home/trust/seabios-tpm/out/bios.bin -m 1024 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -uuid c05f8b6d-f060-4f01-a91f-4c81b3a464b1 -smbios type=1,manufacturer=OpenStack Foundation,product=OpenStack Nova,version=13.1.3,serial=564d145f-6c15-1879-1d25-ca25bdf7a512,uuid=c05f8b6d-f060-4f01-a91f-4c81b3a464b1,family=Virtual Machine -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/instance-00000018.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/opt/stack/data/nova/instances/c05f8b6d-f060-4f01-a91f-4c81b3a464b1/disk,if=none,id=drive-virtio-disk0,format=qcow2,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=/opt/stack/data/nova/instances/c05f8b6d-f060-4f01-a91f-4c81b3a464b1/disk.config,if=none,id=drive-ide0-1-1,readonly=on,format=raw,cache=none -device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 -netdev tap,fd=24,id=hostnet0,vhost=on,vhostfd=25 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=fa:16:3e:16:f5:0c,bus=pci.0,addr=0x3 -chardev file,id=charserial0,path=/opt/stack/data/nova/instances/c05f8b6d-f060-4f01-a91f-4c81b3a464b1/console.log -device isa-serial,chardev=charserial0,id=serial0 -chardev pty,id=charserial1 -device isa-serial,chardev=charserial1,id=serial1 -chardev socket,id=charserial2,path=/tmp/virtualsocket/c05f8b6d-f060-4f01-a91f-4c81b3a464b1,server,nowait -device isa-serial,chardev=charserial2,id=serial2 -vnc 192.168.1.238:0 -k en-us -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -tpmdev cuse-tpm,id=tpm0,path=/dev/vtpm0 -device tpm-tis,tpmdev=tpm0

The vtpm log

CUSE TPM successfully initialized.
CUSE TPM successfully initialized.

But I can't find tpm0 in the guest...Do you guys have any suggestions on this please?
How did the qemu create /dev/tpm0 with “-tpmdev cuse-tpm,id=tpm0,path=/dev/vtpm0 -device tpm-tis,tpmdev=tpm0”?

dpkg-buildpackage -us -uc fails

make[1]: Entering directory '/home/jsakkine/devel/swtpm'
EXCLUDES=""
if test -z ; then \
    EXCLUDES="-Xswtpm_cert"; \
fi ; \
dh_install $EXCLUDES --
dh_install: swtpm-tools missing files: /usr/bin/swtpm_cert
dh_install: missing files, aborting
debian/rules:11: recipe for target 'override_dh_install' failed
make[1]: *** [override_dh_install] Error 255
make[1]: Leaving directory '/home/jsakkine/devel/swtpm'
debian/rules:4: recipe for target 'binary' failed
make: *** [binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

Integrate swtpm into nova-compute

Hi, I've been trying to integrate swtpm into nova-compute. I added qemu commandline in libvirt.xml

<qemu:commandline>
    <qemu:arg value='-tpmdev'/>
    <qemu:arg value='cuse-tpm,id=tpm0,path=/dev/vtpm0'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='tpm-tis,tpmdev=tpm0'/>
</qemu:commandline>

Then I start the CUSE TPM manually.

# modprobe cuse
# mkdir /tmp/myvtpm0
# chown -R tss:root  /tmp/myvtpm0
# swtpm_setup --tpm-state /tmp/myvtpm0  --createek
# export TPM_PATH=/tmp/myvtpm0
# swtpm_cuse -n vtpm0

Then I start a nova instance, and got error

qemu-system-x86_64: -tpmdev cuse-tpm,id=tpm0,path=/dev/vtpm0: Cannot access TPM device using '/dev/vtpm0': Operation not permitted

I googled this error and got this Unable to start vtpm vm through libvirt xml file. I tried 'umount /sys/fs/cgroup/devices' as discribed in the issue. Then I start the nova instance again.

libvirtError: internal error: process exited while connecting to monitor: qemu-system-x86_64: -tpmdev cuse-tpm,id=tpm0,path=/dev/vtpm0: Cannot access TPM device using '/dev/vtpm0': Permission denied

I tried to chmod 777 to /tmp/myvtpm0 and /dev/vtpm0, it didn't work. Could someone please help me out?

Using SWTPM without virtualization

Is there anyway to use SWTPM without a guest-host virtualization setup? Is this anything like the IBM software TPM hosted at SourceForge?

Error code 0x000009a2 causes partial cases in the test/integration directory to fail

I worked on clean Ubuntu from qemu, following the deployment implementation of the VTPM.

Run tpm2-tss/script/int-log-compiler-ptpm.sh with target device "/dev/tpm0" to test all cases in directory test/integration or configure to configure "--with-ptpm" and "--with-ptpmtests" parameters, then make check. The following failure log is obtained:

FAIL: test/integration/esys-pcr-auth-value
Execute the test script
WARNING:esys:src/tss2-esys/api/Esys_PCR_SetAuthValue.c:294:Esys_PCR_SetAuthValue_Finish() Received TPM Error
ERROR:esys:src/tss2-esys/api/Esys_PCR_SetAuthValue.c:111:Esys_PCR_SetAuthValue() Esys Finish ErrorCode (0x000009a2)
ERROR:test:test/integration/esys-pcr-auth-value.int.c:67:test_esys_pcr_auth_value() Error: PCR_SetAuthValue ErrorCode (0x000009a2)
Script returned 1
FAIL test/integration/esys-pcr-auth-value.int (exit status: 1)

FAIL: test/integration/esys-clear
Execute the test script
WARNING:esys:src/tss2-esys/api/Esys_Clear.c:284:Esys_Clear_Finish() Received TPM Error
ERROR:esys:src/tss2-esys/api/Esys_Clear.c:103:Esys_Clear() Esys Finish ErrorCode (0x000009a2)
ERROR:test:test/integration/esys-clear.int.c:70:test_esys_clear() Error: Clear ErrorCode (0x000009a2)
Script returned 1
FAIL test/integration/esys-clear.int (exit status: 1)

Unable to compile on Fedora 25

Hello!
I am having trouble compiling on Fedora 25. I compiled libtpms from the most recent commit and in /usrl/local/lib i now have the following files

ibtpms.a  libtpms.la  libtpms.so  libtpms.so.0  libtpms.so.0.6.0

However when I try to compile swtpm I am getting the following error

swtpm/src/swtpm/.libs/libswtpm_libtpms.so: undefined reference to `TPMLIB_SetDebugPrefix'
swtpm/src/swtpm/.libs/libswtpm_libtpms.so: undefined reference to `TPMLIB_SetDebugPrefix'
swtpm/.libs/libswtpm_libtpms.so: undefined reference to `TPMLIB_SetDebugFD`

I also tried using the 0.5.2.1 release and making a debug build, but no luck. What do I do wrong?

Script for SWTPM on a new Fedora image

Hello,

Thank you for your work on a software TPM, this package has been very helpful. It did require a bit of setup.
To allow my research group to easily use the swTPM package I've created a Vagrantfile that installs it on Fedora 23. The file is located here (https://gist.github.com/gilhooleyd/03f47798eb63ef36d7f80575484fd117)

To install, simply run vagrant up, and wait for the provisioning to complete. The system needs to be restarted (vagrant halt followed by vagrant up again) for the changes to take effect. After that the machine can be accessed by vagrant ssh and the normal directions for accessing the SWTPM library follows.

I thought you may find this interesting because I had some trouble finding the documentation to get the system to run correctly, and this may be helpful to others.

Best,
David

tpm_ioctl.c: (uint32_t)-1 ?

In src/swtpm_ioctl/tpm_ioctl.c:do_save_state_blob(), the result of write() gets casted to uint32_t to avoid signed/unsigned comparison (commit 768d657):

         numbytes = write(file_fd, pgs.u.resp.data, recvd_bytes);
        if ((uint32_t)numbytes != recvd_bytes) {
             fprintf(stderr,
                     "Could not write to file '%s': %s\n",
                     filename, strerror(errno));

I wonder how that'll affect the case where write() returns -1. It'll still work, won't it?

It might be cleaner to do if(numbytes != (ssize_t)recvd_bytes) but it's probably not worth a patch.

I ran across this because meta-security had that as fix (without upstreaming it!), which I noticed while trying to update the build recipe.

FAIL: test_swtpm_cert, An unimplemented or disabled feature has been requested.

Hi.

gnutls_x509_crt_set_subject_alt_name() fails.

I played a little bit with the parameters, trying GNUTLS_SAN_{DNSNAME,RFC822NAME,OTHERNAME_XMPP} as payload, without success. Maybe the problem is not in ek-cert.c but in gnutls land.

FAIL: test_swtpm_cert
=====================

Could not set subject alt name: An unimplemented or disabled feature has been requested.
Error: ./../src/swtpm_cert/swtpm_cert returned error code.
FAIL test_swtpm_cert (exit status: 1)

Cannot use libtpms in custom location

If I install libtpms in custom location, e.g. configure --prefix=/specialdir, swtpm fails to configure because it only looks in the standard locations.

In configure, it looks for theSEARCH_DIR by running gcc ... -Xlinker --verbose and filtering for SEARCH_DIR. As far as I can tell, the response is the default, compiled-into-gcc (well, linker) search location. Nothing will change that: not command-line options (like -L), not env vars LD_LIBRARY_PATH or LIBRARY_PATH or LIBPATH.

If I had it compiled, I could point it anywhere for run-time using env vars (or static compilation).

So I can install libtpms wherever I want, but I cannot get swtpms to configure, let alone compile, because it cannot use it to check which crypto library it is using.

Where are the UUIDs stored in the Ubuntu?

Hi,

I'm using swtpm and it works well. I also use TrouSers to play with the emulated TPM.

But I cannot find where the UUIDs for registered keys are stored in the OS.

So for example one day I created a key with UUID 001 using TPM1, then I cannot use that UUID for other keys when I use TPM1. That makes sense. But when I delete all files about TPM1 and set up a new TPM, say TPM2, that UUID 001 still cannot be used. I think this is not good because each time I change a new TPM I cannot use the UUIDs once used by previous devices, even though the previous devices are never used again.

Could you tell me where the UUID are stored in the Ubuntu System?

Thanks so much!

TPM self test failed

When I create a vm with tpm device using swtpm. It occurs "TPM self test failed" occasionally. The detailed message is
"tpm_tis 00:06: 1.2 TPM (device-id 0x1, rev-id 1)
tpm_tis 00:06: A TPM error (28) occurred continue selftest
tpm_tis 00:06: TPM self test failed".
I have tried shutdown and boot vm for several times. The problem still appear. How can I deal with the problem, and ensure tpm device appear in vm?
My experiment environment is CentOS7.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.