[PATCH] tpm2dtests: add missing start_sw_tpm.sh script

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] tpm2dtests: add missing start_sw_tpm.sh script

GnuPG - Dev mailing list
This accidentally got left out of the initial commit for testing
6720f1343 ("tpm2d: add tests for the tpm2daemon")

Signed-off-by: James Bottomley <[hidden email]>
---
 tests/tpm2dtests/start_sw_tpm.sh | 34 ++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100755 tests/tpm2dtests/start_sw_tpm.sh

diff --git a/tests/tpm2dtests/start_sw_tpm.sh b/tests/tpm2dtests/start_sw_tpm.sh
new file mode 100755
index 000000000..0fb8f79cb
--- /dev/null
+++ b/tests/tpm2dtests/start_sw_tpm.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# remove any prior TPM contents
+rm -f NVChip h*.bin *.permall
+if [ -x "${SWTPM}" ]; then
+    ${SWTPM} socket --tpm2 --server type=tcp,port=2321 --ctrl type=tcp,port=2322 --tpmstate dir=`pwd` &
+else
+    ${TPMSERVER} > /dev/null 2>&1  &
+fi
+pid=$!
+##
+# This powers on the tpm and starts it
+# then we derive the RSA version of the storage seed and
+# store it permanently at handle 81000001 and flush the transient
+##
+a=0; while [ $a -lt 10 ]; do
+    if [ -x "${SWTPM_IOCTL}" ]; then
+ ${SWTPM_IOCTL} --tcp 127.0.0.1:2322 -i > /dev/null 2>&1
+    else
+ tsspowerup > /dev/null 2>&1
+    fi
+    if [ $? -eq 0 ]; then
+ break;
+    fi
+    sleep 1
+    a=$[$a+1]
+done
+if [ $a -eq 10 ]; then
+    echo "Waited 10s for tpm_server to come up; exiting"
+    exit 1
+fi
+
+tssstartup || exit 1
+echo -n $pid
--
2.26.2



_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] tpm2dtests: add missing start_sw_tpm.sh script

GnuPG - Dev mailing list
On Mon, 15 Mar 2021 07:16, James Bottomley said:
> This accidentally got left out of the initial commit for testing
> 6720f1343 ("tpm2d: add tests for the tpm2daemon")

I just pushed it and added it to the Makefile.

> + ${SWTPM} socket --tpm2 --server type=tcp,port=2321 --ctrl
> type=tcp,port=2322 --tpmstate dir=`pwd` &

That line was broken; I used

    ${SWTPM} socket --tpm2 --server type=tcp,port=2321 \
         --ctrl type=tcp,port=2322 --tpmstate dir=`pwd` &

instead.

Note that this patch is not in the beta I released today.


Salam-Shalom,

   Werner

--
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (233 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] tpm2dtests: add missing start_sw_tpm.sh script

GnuPG - Dev mailing list
On Mon, 2021-03-15 at 17:12 +0100, Werner Koch via Gnupg-devel wrote:

> On Mon, 15 Mar 2021 07:16, James Bottomley said:
> > This accidentally got left out of the initial commit for testing
> > 6720f1343 ("tpm2d: add tests for the tpm2daemon")
>
> I just pushed it and added it to the Makefile.
>
> > + ${SWTPM} socket --tpm2 --server type=tcp,port=2321 --ctrl
> > type=tcp,port=2322 --tpmstate dir=`pwd` &
>
> That line was broken; I used
>
>     ${SWTPM} socket --tpm2 --server type=tcp,port=2321 \
>          --ctrl type=tcp,port=2322 --tpmstate dir=`pwd` &
That's fine.  Thanks for fixing this.

> instead.
>
> Note that this patch is not in the beta I released today.

I'm afraid there are going to be many more teething troubles with the
TPM testing infrastructure.  The distribution I use most frequently
(openSUSE) has both the Intel and the IBM TSS, but the Intel one is too
old to work, which is why I've only production tested the IBM one.

We also have two separate software TPM projects (both from IBM)
produced by Ken Goldman and Stefan Berger.  OpenSUSE only packages the
Ken Goldman one currently, so that's the one I've tested the best.
However, you can't power on and start the Ken Goldman one without the
IBM TSS tools.

James


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (235 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] tpm2dtests: add missing start_sw_tpm.sh script

GnuPG - Dev mailing list
On Mon, 15 Mar 2021 09:26, James Bottomley said:

> I'm afraid there are going to be many more teething troubles with the
> TPM testing infrastructure.  The distribution I use most frequently

I don;t think that is too much of a problem.  It should be clear tha
this is a new development and problems are expected.  Just in case of
build problems, I added --disable-tpmd2 configure option so pppl can
disable this part.


Salam-Shalom,

   Werner

--
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (233 bytes) Download Attachment