From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "Matthew.Fioravante@jhuapl.edu" <Matthew.Fioravante@jhuapl.edu>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
"JBeulich@suse.com" <JBeulich@suse.com>,
"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>
Subject: Re: [PATCH v5.1 01/12] mini-os/tpm{back, front}: Change shared page ABI
Date: Thu, 11 Apr 2013 11:10:03 -0400 [thread overview]
Message-ID: <5166D24B.2040409@tycho.nsa.gov> (raw)
In-Reply-To: <1365690471.8126.12.camel@zakaz.uk.xensource.com>
On 04/11/2013 10:27 AM, Ian Campbell wrote:
> On Fri, 2013-03-22 at 22:30 +0000, Daniel De Graaf wrote:
>>
>> +struct vtpm_shared_page {
>> + uint32_t length; /* request/response length in bytes */
>
> The data is inline immediately after this struct? How does it interact
> with the extra_pages stuff?
The data follows immediately after the extra_pages array whose size is
visible in nr_extra_pages. The current code only supports skipping the
right number of bytes if this array is filled in, it doesn't actually
read or write the grant IDs.
>> +
>> + uint8_t state; /* enum vtpm_state */
>> + uint8_t locality; /* for the current request */
>
> I've had a look at the 7/12 and 10/12 and I'm still not sure how this
> byte is used -- it's looked up in the XSM label as a string but how does
> it become a uint8_t agreed by both the front and backend?
The frontend can set this byte (the existing Linux patch does not do so,
but the v2 includes a sysfs attribute that allows you to set the locality
for a given request). In the hardware TPM 1.2 interface, the TPM exposes
a distinct MMIO page for each locality and the chipset provides limits on
when writes to locality 4 (and possibly 3) are allowed.
> Could we perhaps get a few more words on the protocol in general? Or
> have I missed some existing doc?
This protocol emulates the request/response behavior of a TPM using a Xen
shared memory interface. All interaction with the TPM is at the direction
of the frontend, since a TPM (hardware or virtual) is a passive device -
the backend only processes commands as requested by the frontend.
The frontend sends a request to the TPM by populating the shared page with
the request packet, changing the state to VTPM_STATE_SUBMIT, and sending
and event channel notification. When the backend is finished, it will set
the state to VTPM_STATE_FINISH and send an event channel notification.
In order to allow long-running commands to be canceled, the frontend can
at any time change the state to VTPM_STATE_CANCEL and send a notification.
The TPM can either finish the command (changing state to VTPM_STATE_FINISH)
or can cancel the command and change the state to VTPM_STATE_IDLE. The TPM
can also change the state to VTPM_STATE_IDLE instead of VTPM_STATE_FINISH
if another reason for cancellation is required - for example, a physical
TPM may cancel a command if the interface is seized by another locality.
If you would like this description in the Xen tree, where is the best place
to locate it? The existing docs/misc/vtpm.txt is more focused on the use of
the TPM domains, not the protocol, but an additional section could be added
for documenting the Xen protocol.
> What is the format of the payload, is it defined by some independent TPM
> standard?
The payload is a TPM packet as defined by the TPM specification:
http://www.trustedcomputinggroup.org/resources/tpm_main_specification
(part 3 defines the packet format).
>> + uint8_t pad; /* should be zero */
>> +
>> + uint8_t nr_extra_pages; /* extra pages for long packets; may be zero */
>> + uint32_t extra_pages[0]; /* grant IDs; length is actually nr_extra_pages */
>
> Not actually used AFAICT? Future expansion I presume?
Yes. While normally TPM packets are all under 4000 bytes, the specification allows
larger packets (the TPM itself defines the maximum), and future versions of the
TPM specification that do not limit the TPM to 2048-bit RSA keys may require using
larger packets. Some commands (such as GetRandom) can produce packets of arbitrary
size, although it is reasonable for an implementation to limit what it returns so
this is not a problem for the vTPM.
--
Daniel De Graaf
National Security Agency
next prev parent reply other threads:[~2013-04-11 15:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 22:28 [PATCH RFC] drivers/tpm: add xen tpmfront interface Daniel De Graaf
2013-03-22 22:30 ` [PATCH v5.1 01/12] mini-os/tpm{back, front}: Change shared page ABI Daniel De Graaf
2013-04-11 14:00 ` Ian Campbell
2013-04-11 14:11 ` Daniel De Graaf
2013-04-11 14:14 ` Ian Campbell
2013-04-11 14:38 ` Daniel De Graaf
2013-04-11 15:25 ` Ian Campbell
2013-04-11 15:46 ` Daniel De Graaf
2013-04-11 14:27 ` Ian Campbell
2013-04-11 15:10 ` Daniel De Graaf [this message]
2013-04-11 15:22 ` Ian Campbell
2013-04-11 16:18 ` Daniel De Graaf
2013-04-11 16:20 ` [PATCH v5.2] " Daniel De Graaf
2013-04-11 14:17 ` [PATCH RFC] drivers/tpm: add xen tpmfront interface Ian Campbell
2013-04-11 14:38 ` Daniel De Graaf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5166D24B.2040409@tycho.nsa.gov \
--to=dgdegra@tycho.nsa.gov \
--cc=Ian.Campbell@citrix.com \
--cc=JBeulich@suse.com \
--cc=Matthew.Fioravante@jhuapl.edu \
--cc=konrad.wilk@oracle.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.