All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][VTPM] re-send:Fix vTPM function in HVM domain
@ 2007-09-18  0:04 Kouichi Yasaki
  2007-12-20  0:53 ` [PATCH][BIOS]Fix TPMD and QEMU connection Kouichi Yasaki
  0 siblings, 1 reply; 4+ messages in thread
From: Kouichi Yasaki @ 2007-09-18  0:04 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

Hi,

In Windows on HVM domain, GetPubkey function and Seal function become an error.
Attached is a patch that fixes the error.

In this patch, I use tpm-emulator0.5 code that fixed this bug.

Signed-off-by: Kouichi YASAKI <yasaki.kouichi@jp.fujitsu.com>

Thanks
  Kouichi YASAKI

[-- Attachment #2: fix_vtpmd.patch --]
[-- Type: text/plain, Size: 3111 bytes --]

diff -r 9071521d4864 tools/vtpm/tpm_emulator.patch
--- a/tools/vtpm/tpm_emulator.patch	Fri Sep 07 11:39:10 2007 +0100
+++ b/tools/vtpm/tpm_emulator.patch	Wed Sep 12 20:29:16 2007 +0900
@@ -547,10 +547,31 @@ diff -uprN orig/tpm_emulator-0.4/README 
  Installation
  --------------------------------------------------------------------------
  The compilation and installation process uses the build environment for 
+diff -uprN orig/tpm_emulator-0.4/tpm/tpm_cmd_handler.c tpm_emulator/tpm/tpm_cmd_handler.c
+--- orig/tpm_emulator-0.4/tpm/tpm_cmd_handler.c	2006-06-23 19:37:07.000000000 +0900
++++ tpm_emulator/tpm/tpm_cmd_handler.c	2007-09-12 20:23:00.000000000 +0900
+@@ -565,7 +565,7 @@ static TPM_RESULT execute_TPM_Seal(TPM_R
+   if (tpm_unmarshal_TPM_KEY_HANDLE(&ptr, &len, &keyHandle)
+       || tpm_unmarshal_TPM_ENCAUTH(&ptr, &len, &encAuth)
+       || tpm_unmarshal_UINT32(&ptr, &len, &pcrInfoSize)
+-      || tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo)
++      || (pcrInfoSize >0 && tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo))
+       || tpm_unmarshal_UINT32(&ptr, &len, &inDataSize)
+       || tpm_unmarshal_BLOB(&ptr, &len, &inData, inDataSize)
+       || len != 0) return TPM_BAD_PARAMETER;
+@@ -798,7 +798,7 @@ static TPM_RESULT execute_TPM_Sealx(TPM_
+   if (tpm_unmarshal_TPM_KEY_HANDLE(&ptr, &len, &keyHandle)
+       || tpm_unmarshal_TPM_ENCAUTH(&ptr, &len, &encAuth)
+       || tpm_unmarshal_UINT32(&ptr, &len, &pcrInfoSize)
+-      || tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo)
++      || (pcrInfoSize > 0 && tpm_unmarshal_TPM_PCR_INFO(&ptr, &len, &pcrInfo))
+       || tpm_unmarshal_UINT32(&ptr, &len, &inDataSize)
+       || tpm_unmarshal_BLOB(&ptr, &len, &inData, inDataSize)
+       || len != 0) return TPM_BAD_PARAMETER;
 diff -uprN orig/tpm_emulator-0.4/tpm/tpm_credentials.c tpm_emulator/tpm/tpm_credentials.c
---- orig/tpm_emulator-0.4/tpm/tpm_credentials.c	2006-06-23 03:37:07.000000000 -0700
-+++ tpm_emulator/tpm/tpm_credentials.c	2006-07-24 14:35:35.000000000 -0700
-@@ -47,16 +47,16 @@ int tpm_compute_pubkey_checksum(TPM_NONC
+--- orig/tpm_emulator-0.4/tpm/tpm_credentials.c	2006-06-23 19:37:07.000000000 +0900
++++ tpm_emulator/tpm/tpm_credentials.c	2007-09-12 20:23:30.000000000 +0900
+@@ -47,20 +47,20 @@ int tpm_compute_pubkey_checksum(TPM_NONC
  
  TPM_RESULT tpm_get_pubek(TPM_PUBKEY *pubEndorsementKey)
  {
@@ -572,6 +593,11 @@ diff -uprN orig/tpm_emulator-0.4/tpm/tpm
    pubEndorsementKey->algorithmParms.algorithmID = TPM_ALG_RSA;
    pubEndorsementKey->algorithmParms.encScheme = TPM_ES_RSAESOAEP_SHA1_MGF1;
    pubEndorsementKey->algorithmParms.sigScheme = TPM_SS_NONE;
+-  pubEndorsementKey->algorithmParms.parms.rsa.keyLength = key_length;
++  pubEndorsementKey->algorithmParms.parms.rsa.keyLength = key_length << 3;
+   pubEndorsementKey->algorithmParms.parms.rsa.numPrimes = 2;
+   pubEndorsementKey->algorithmParms.parms.rsa.exponentSize = 0;
+   pubEndorsementKey->algorithmParms.parms.rsa.exponent = NULL;
 @@ -175,6 +175,7 @@ TPM_RESULT TPM_OwnerReadInternalPub(TPM_
  {
    TPM_RESULT res;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* [PATCH][BIOS]Fix TPMD and QEMU connection
  2007-09-18  0:04 [PATCH][VTPM] re-send:Fix vTPM function in HVM domain Kouichi Yasaki
@ 2007-12-20  0:53 ` Kouichi Yasaki
  2007-12-20  2:20   ` Stefan Berger
  0 siblings, 1 reply; 4+ messages in thread
From: Kouichi Yasaki @ 2007-12-20  0:53 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

Hi,

In HVM domain, MA_Transmit function in tcgbios sometimes become an error
(TCG_NO_RESPONSE). The cause of the error is not to make connection of
QEMU and TPMD instance within a timeout of MA_Transmit function.

Before the MA_Transmit function was called, the attached patch corrected so
that connection of QEMU and TPMD might be completed.

Signed-off-by: Kouichi YASAKI <yasaki.kouichi@jp.fujitsu.com>

Thanks
  Kouichi YASAKI


[-- Attachment #2: tpm_tis_fix.diff --]
[-- Type: text/x-patch, Size: 507 bytes --]

diff -r d9ab9eb2bfee tools/ioemu/hw/tpm_tis.c
--- a/tools/ioemu/hw/tpm_tis.c	Sat Dec 15 18:29:27 2007 +0000
+++ b/tools/ioemu/hw/tpm_tis.c	Mon Dec 17 19:46:42 2007 +0900
@@ -904,6 +904,10 @@ void tpm_tis_init(SetIRQFunc *set_irq, v
     memset(s->buffer.buf,0,sizeof(s->buffer.buf));
 
     register_savevm("tpm-tis", 0, 1, tpm_save, tpm_load, s);
+
+    while(!IS_COMM_WITH_VTPM(s)){
+       open_vtpm_channel(s);
+    }
 }
 
 /****************************************************************************/

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: [PATCH][BIOS]Fix TPMD and QEMU connection
  2007-12-20  0:53 ` [PATCH][BIOS]Fix TPMD and QEMU connection Kouichi Yasaki
@ 2007-12-20  2:20   ` Stefan Berger
  2007-12-20  3:12     ` Kouichi Yasaki
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Berger @ 2007-12-20  2:20 UTC (permalink / raw)
  To: Kouichi Yasaki; +Cc: xen-devel, xen-devel-bounces


[-- Attachment #1.1: Type: text/plain, Size: 1736 bytes --]

xen-devel-bounces@lists.xensource.com wrote on 12/19/2007 07:53:11 PM:

> Hi,
> 
> In HVM domain, MA_Transmit function in tcgbios sometimes become an error
> (TCG_NO_RESPONSE). The cause of the error is not to make connection of
> QEMU and TPMD instance within a timeout of MA_Transmit function.
> 
> Before the MA_Transmit function was called, the attached patch corrected 
so
> that connection of QEMU and TPMD might be completed.
> 
> Signed-off-by: Kouichi YASAKI <yasaki.kouichi@jp.fujitsu.com>
> 
> Thanks
>   Kouichi YASAKI
> 
> diff -r d9ab9eb2bfee tools/ioemu/hw/tpm_tis.c
> --- a/tools/ioemu/hw/tpm_tis.c   Sat Dec 15 18:29:27 2007 +0000
> +++ b/tools/ioemu/hw/tpm_tis.c   Mon Dec 17 19:46:42 2007 +0900
> @@ -904,6 +904,10 @@ void tpm_tis_init(SetIRQFunc *set_irq, v
>      memset(s->buffer.buf,0,sizeof(s->buffer.buf));
> 
>      register_savevm("tpm-tis", 0, 1, tpm_save, tpm_load, s);
> +
> +    while(!IS_COMM_WITH_VTPM(s)){
> +       open_vtpm_channel(s);
> +    }
>  }

I'll have a look at this. The problem probably stems from the vTPM manager 
starting the vTPM up too late while qemu is already up and running, so 
it's a timing problem between the two processes. I don't think it should 
try to connect endlessly in a busy loop. At least there should be a 
counter that tries this for maybe 5 times followed by a [u]sleep() in the 
loop.

    int ctr = 0;
    while(!IS_COMM_WITH_VTPM(s) && ctr < 5){
       open_vtpm_channel(s);
       ctr ++;
       sleep(1);
    }


   Stefan

> 
> 
> 
/****************************************************************************/
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

[-- Attachment #1.2: Type: text/html, Size: 2488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: [PATCH][BIOS]Fix TPMD and QEMU connection
  2007-12-20  2:20   ` Stefan Berger
@ 2007-12-20  3:12     ` Kouichi Yasaki
  0 siblings, 0 replies; 4+ messages in thread
From: Kouichi Yasaki @ 2007-12-20  3:12 UTC (permalink / raw)
  To: Stefan Berger; +Cc: xen-devel

[-- Attachment #1: Type: text/plain, Size: 2068 bytes --]

Hi Stefan-san,

Thank you for correcting my patch.
I also think that it should not try to connect endlessly in a busy loop.

attached file is the corrected patch.

Thanks
   Kouichi YASAKI

> 
> xen-devel-bounces@lists.xensource.com wrote on 12/19/2007 07:53:11 PM:
> 
>  > Hi,
>  >
>  > In HVM domain, MA_Transmit function in tcgbios sometimes become an error
>  > (TCG_NO_RESPONSE). The cause of the error is not to make connection of
>  > QEMU and TPMD instance within a timeout of MA_Transmit function.
>  >
>  > Before the MA_Transmit function was called, the attached patch 
> corrected so
>  > that connection of QEMU and TPMD might be completed.
>  >
>  > Signed-off-by: Kouichi YASAKI <yasaki.kouichi@jp.fujitsu.com>
>  >
>  > Thanks
>  >   Kouichi YASAKI
>  >
>  > diff -r d9ab9eb2bfee tools/ioemu/hw/tpm_tis.c
>  > --- a/tools/ioemu/hw/tpm_tis.c   Sat Dec 15 18:29:27 2007 +0000
>  > +++ b/tools/ioemu/hw/tpm_tis.c   Mon Dec 17 19:46:42 2007 +0900
>  > @@ -904,6 +904,10 @@ void tpm_tis_init(SetIRQFunc *set_irq, v
>  >      memset(s->buffer.buf,0,sizeof(s->buffer.buf));
>  >  
>  >      register_savevm("tpm-tis", 0, 1, tpm_save, tpm_load, s);
>  > +
>  > +    while(!IS_COMM_WITH_VTPM(s)){
>  > +       open_vtpm_channel(s);
>  > +    }
>  >  }
> 
> I'll have a look at this. The problem probably stems from the vTPM 
> manager starting the vTPM up too late while qemu is already up and 
> running, so it's a timing problem between the two processes. I don't 
> think it should try to connect endlessly in a busy loop. At least there 
> should be a counter that tries this for maybe 5 times followed by a 
> [u]sleep() in the loop.
> 
>     int ctr = 0;
>     while(!IS_COMM_WITH_VTPM(s) && ctr < 5){
>       open_vtpm_channel(s);
>        ctr ++;
>        sleep(1);
>    }
> 
> 
>    Stefan
> 
>  >  
>  >  
>  > 
> /****************************************************************************/
>  > _______________________________________________
>  > Xen-devel mailing list
>  > Xen-devel@lists.xensource.com
>  > http://lists.xensource.com/xen-devel

[-- Attachment #2: tpm_tis_fix.diff --]
[-- Type: text/x-patch, Size: 569 bytes --]

diff -r 966a6d3b7408 tools/ioemu/hw/tpm_tis.c
--- a/tools/ioemu/hw/tpm_tis.c	Fri Dec 14 11:50:24 2007 +0000
+++ b/tools/ioemu/hw/tpm_tis.c	Thu Dec 20 11:56:24 2007 +0900
@@ -904,6 +904,13 @@ void tpm_tis_init(SetIRQFunc *set_irq, v
     memset(s->buffer.buf,0,sizeof(s->buffer.buf));
 
     register_savevm("tpm-tis", 0, 1, tpm_save, tpm_load, s);
+
+    int ctr = 0;
+    while(!IS_COMM_WITH_VTPM(s) && ctr < 5){
+       open_vtpm_channel(s);
+       ctr++;
+       sleep(1);
+    }
 }
 
 /****************************************************************************/

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

end of thread, other threads:[~2007-12-20  3:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-18  0:04 [PATCH][VTPM] re-send:Fix vTPM function in HVM domain Kouichi Yasaki
2007-12-20  0:53 ` [PATCH][BIOS]Fix TPMD and QEMU connection Kouichi Yasaki
2007-12-20  2:20   ` Stefan Berger
2007-12-20  3:12     ` Kouichi Yasaki

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.