From: Dov Murik <dovmurik@linux.ibm.com>
To: Christophe de Dinechin <cdupontd@redhat.com>
Cc: jejb@linux.ibm.com, Tom Lendacky <thomas.lendacky@amd.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"amd-sev-snp@lists.suse.com" <amd-sev-snp@lists.suse.com>,
"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
Dov Murik <dovmurik@linux.ibm.com>
Subject: Re: SVSM vTPM specification
Date: Wed, 19 Oct 2022 09:39:30 +0300 [thread overview]
Message-ID: <50d4c2e4-701f-681e-df5a-7c73012f69bf@linux.ibm.com> (raw)
In-Reply-To: <679C87ED-6D21-4D0A-9537-9910A6F802ED@redhat.com>
On 19/10/2022 8:47, Christophe de Dinechin wrote:
>
>
>> On 18 Oct 2022, at 22:22, Dov Murik <dovmurik@linux.ibm.com> wrote:
>>
>>
>>
>> On 13/10/2022 18:30, James Bottomley wrote:
>>> On Thu, 2022-10-13 at 10:14 -0500, Tom Lendacky wrote:
>>>> On 10/12/22 13:44, James Bottomley wrote:
>>>>> On Wed, 2022-10-12 at 18:33 +0100, Dr. David Alan Gilbert wrote:
>>>>>> * Tom Lendacky (thomas.lendacky@amd.com) wrote:
>>>>> [...]
>>>>>> It's important that the VMPL level in the attestation report
>>>>>> reflects the side asking for the attestation; in particular one
>>>>>> TPM story goes that the firmware (in VMPL0) would ask for an
>>>>>> attestation and the attestor would return the vTPM stored
>>>>>> state. It's important that the state could only be returned to
>>>>>> the vTPM not the guest, so the attestor would check that the VMPL
>>>>>> level in the attestation was 0; any guest attestation would have
>>>>>> a VMPL>0 and so the attestor wouldn't hand it the vTPM state.
>>>>>> Hmm or are you saying such a report would be triggered by the
>>>>>> guest rather than the firmware, but it would be protected by
>>>>>> VMPCK0 so the guest wouldn't be able to read it?
>>>>
>>>> No, the VMPCK0 key is just used for communication with the PSP.
>>>>
>>>> While the SVSM would request the attestation report from the PSP,
>>>> the guest would need to request it from the SVSM.
>>>
>>> I think this is fine. The SVSM would do the attestation as it starts
>>> the TPM but the guest would be able to retrieve it at any time.
>>> Essentially, if you use something like keylime, the agent would request
>>> it on start up to prove it should trust the vTPM, but that could occur
>>> way after VM boot.
>>>
>>>>
>>>>>> I think one of the vTPMs keys should be in the SNP attestation
>>>>>> report (the EK???) - I think that would allow you to attest that
>>>>>> the vTPM you're talking to is a vTPM running in an SNP protected
>>>>>> firmware.
>>>>>
>>>>> Traditionally the TPM identity is the public EK, so that should
>>>>> definitely be in the report. Ideally, I think the public storage
>>>>> root key (key derived from the owner seed) should be in there two
>>>>> because it makes it easy to create keys that can only be read by
>>>>> the TPM (keys should be in the owner hierarchy which means they
>>>>> have to be encrypted to the storage seed, so we need to know what a
>>>>> public key corresponding to it is).
>>>>>
>>>>> One wrinkle of the above is that, when provisioned, the TPM will
>>>>> only have the seeds, not the keys (the keys are derived from the
>>>>> seeds via a TPM2_CreatePrimary command). The current TPM
>>>>> provisioning guidance:
>>>>>
>>>>> https://trustedcomputinggroup.org/resource/tcg-tpm-v2-0-provisioning-guidance/
>>>>>
>>>>> Says that the EK should be at permanent handle
>>>>>
>>>>> 81010001
>>>>>
>>>>> And there's an update saying that should be the RSA-2048 key and
>>>>> there should be an EC (NIST-P256) one at 81010002. The
>>>>> corresponding storage keys should be at 81000001 and 81000002
>>>>> respectively. I think when the SVSM provisions the TPM, it should
>>>>> run TPM2_CreatePrimary for those four keys and put them into the
>>>>> persistent indexes, then insert the EC keys only for EK and SRK
>>>>> into the attestation report.
>>>>
>>>> We only have 512 bits to work with for the SVSM-provided data, so
>>>> would hashes of the keys be ok?
>>>
>>> Well, if you put the hashes in, the consuming entity would then have to
>>> find out via an additional channel what the actual keys were because
>>> you can't reverse the hash (it's possible, just more effort). If you
>>> use point compression, an EC key (for the NIST p-256 curve) is only 32
>>> bytes anyway, so it's the same size as a sha256 hash, so I'd say place
>>> the actual public keys into the report to give complete and usable
>>> information
>>>
>>
>> Do we need to leave room for a Guest-Owner-provided nonce? Guest owner
>> will provide it to the guest OS which will provide it to the SVSM to be
>> included in REPORT_DATA of the VMPL0 attestation report.
>>
> I think it’s a good idea, but I’m not clear on which component in the
> guest would be responsible for that exchange.
>
> You need a functioning networking stack, and you need a way to know what
> attestation server to talk to.
>
You're right. I was thinking about an attestation request coming later
during the guest OS boot (after bringing up networking).
> IIUC, at this stage, we have no valid storage yet, since that would
> require having received the response from the attestation server.
> So the only storage we have is host storage managed by the hypervisor,
> plus whatever fits in your SVSM-provided data.
>
> Can we send this data without additional encryption since it’s already
> cyphertext? Or do we want additional mechanisms, and if so, what root
> certificates do we use? Where do we get them from without guest storage?
>
> Do we rely on guest networking being up at that point? Or do we need
> to provide additional mechanisms in the hypervisor to perform this
> initial exchange on behalf of the guest?
>
If we need early-launch attestation and secret injection (to get the
confidential TPM state very early, before firmware starts), then we'll
need an SEV-like flow: SVSM will stop the boot sequence, wait for a
nonce from host (which will proxy to guest owner), produce attestation
report, wait for secret injection, and then resume boot to firmware.
(And maybe the nonce can be generated by SVSM, like in SEV's
LAUNCH_MEASURE; this removes one network round-trip to guest owner.)
We can try to reuse the existing QEMU commands and secret-injection
structures (we'll need to define a small protocol between HV and SVSM to
pass these buffers); or invent something new (vsock support in SVSM?).
I wonder if all of this complication (early-launch secret injection for
SNP) can be decoupled from SVSM vTPM spec effort. Other uses for these
early injected secrets?
-Dov
>
>
>> If we don't add a nonce not, how can the guest owner verify the
>> freshness of the report? Maybe the pub-EK is enough because it signs
>> the rest of the TPM-report and the guest-owner can somehow verify its
>> freshness?
>
> I think that would work for transient vTPMs. If we want a long-lived
> vTPM, then we’d need a mechanism for the guest owner to tell, ahead of
> time, when to regenerate a new vTPM state, and to independently get
> that state. In that case, the policy of when to update the vTPM state
> would be deferred to some external server, and the process would be:
>
> - Day 1: External server requests a new TPM state, stores state
> - Day N: Guest boots, uses that TPM state, which is then verified
> by the external server
> - Day M: External server decides to refresh the TPM state, will now
> only accept boots with fresher state
>
>
>>
>>
>> It looks like REPORT_DATA needs to be
>>
>> SHA512(guest_owner_nonce || pub_EK || pub_SRK)
>>
>> And the guest does this:
>>
>> 1. Receive nonce from guest owner
>> 2. Calls SVSM_GET_TPM_PUB_KEYS
>> 3. Constructs report_data=sha512(guest_owner_nonce || pub_EK || pub_SRK)
>> 4. Calls SVSM_GET_SNP_ATTESTATION_REPORT(report_data)
>> 5. Send back both the report and pub_* to guest owner
>>
>>
>> -Dov
>
next prev parent reply other threads:[~2022-10-19 6:39 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 16:38 SVSM vTPM specification Tom Lendacky
2022-10-12 17:33 ` Dr. David Alan Gilbert
2022-10-12 18:44 ` James Bottomley
2022-10-13 15:14 ` Tom Lendacky
2022-10-13 15:29 ` Daniele Buono
2022-10-13 15:30 ` James Bottomley
2022-10-18 20:22 ` Dov Murik
2022-10-19 5:47 ` Christophe de Dinechin
2022-10-19 6:39 ` Dov Murik [this message]
2022-10-19 8:08 ` Daniel P. Berrangé
2022-10-19 12:09 ` Christophe de Dinechin
2022-10-19 12:38 ` James Bottomley
2022-10-19 13:05 ` Daniel P. Berrangé
2022-10-19 14:43 ` Tom Lendacky
2022-10-19 15:20 ` James Bottomley
2022-10-19 21:58 ` Tom Lendacky
2022-10-19 20:57 ` Dov Murik
2022-10-19 22:04 ` Tom Lendacky
2022-10-19 22:14 ` Dionna Amalie Glaze
2022-10-19 23:38 ` James Bottomley
2022-10-19 22:36 ` [EXTERNAL] " David Altobelli
[not found] ` <CABayD+cYCj=uOtC5h1d781jh_B6XqxmZNfR69taEex7yvkizRw@mail.gmail.com>
[not found] ` <SJ0PR21MB132378C080FFED1E283B4051E92A9@SJ0PR21MB1323.namprd21.prod.outlook.com>
2022-10-20 20:29 ` James Bottomley
2022-10-21 0:02 ` [EXTERNAL] " Jon Lange
2022-10-21 13:04 ` James Bottomley
2022-10-21 16:31 ` [EXTERNAL] " Jon Lange
2022-10-22 3:20 ` James Bottomley
2022-10-24 4:51 ` [EXTERNAL] " Jon Lange
2022-10-24 10:59 ` Dr. David Alan Gilbert
2022-10-24 11:45 ` Dov Murik
2022-10-24 19:02 ` Tom Lendacky
2022-10-24 19:18 ` Dionna Amalie Glaze
2022-10-25 8:51 ` Dov Murik
2022-10-25 9:43 ` Christophe de Dinechin
2022-10-25 14:08 ` Tom Lendacky
2022-10-25 14:13 ` James Bottomley
2022-10-29 0:25 ` Steve Rutherford
2022-10-29 13:27 ` James Bottomley
2022-10-19 11:21 ` Dr. David Alan Gilbert
2022-10-19 11:45 ` James Bottomley
2022-10-12 19:05 ` James Bottomley
2022-10-13 18:54 ` Tom Lendacky
2022-10-13 19:20 ` James Bottomley
2022-10-13 20:54 ` Daniel P. Smith
2022-10-13 21:06 ` James Bottomley
2022-10-13 21:14 ` Daniel P. Smith
2022-10-13 21:41 ` James Bottomley
2022-10-14 17:16 ` Stuart Yoder
2022-10-14 21:46 ` Tom Lendacky
2022-10-16 16:29 ` Daniel P. Smith
2022-10-16 16:44 ` James Bottomley
2022-10-21 11:54 ` Daniel P. Smith
2022-10-21 12:31 ` James Bottomley
2022-10-18 20:45 ` Dov Murik
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=50d4c2e4-701f-681e-df5a-7c73012f69bf@linux.ibm.com \
--to=dovmurik@linux.ibm.com \
--cc=amd-sev-snp@lists.suse.com \
--cc=cdupontd@redhat.com \
--cc=dgilbert@redhat.com \
--cc=jejb@linux.ibm.com \
--cc=linux-coco@lists.linux.dev \
--cc=thomas.lendacky@amd.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).