Skip to contentSkip to conversation

PCI/TSM: Add CTLV attestation

RFC PATCH In review Aneesh Kumar K.V (Arm) 8 participants 129 messages Oct 28 – Nov 23 Page 2 of 2

Subsystems (11)
lore
Share & tools
lore
#104 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

In reply to Jason Gunthorpe
Quoted 203 lines · Jason Gunthorpe
Quoted 34 lines · Elena
Quoted 34 lines · Elena
Quoted 6 lines
Quoted 2 lines

1) No easy way to get the VCA, no easy way to do capture

My understanding is that VCA must have been included into SPDM_DEVICE_ATTESTATION_INFO_T from the beginning, it was omitted by mistake and we asked to fix it as Dave already pointed out.

That makes some sense, but it just makes this struct bigger and worser. As I explained ot Aneesh I'd rather not have a VCA at all but the transcript that includes VCA (or is maybe only VCA) with preserved message boundary markers. Userspace can compute VCA for the purposes of the signature hash.

Quoted 1 line
Quoted 1 line

2) Wrong digests design for the guest.

SPDM_DEVICE_ATTESTATION_INFO_T

Quoted 10 lines
Quoted 9 lines

is a terrible idea since it is not grounded in any spec. The other two have multiple guest digests computed directly over spec defined objects.

3) Even if you like SPDM_DEVICE_ATTESTATION_INFO_T it includes TDISP_CAPABILITIES for some bad reason. Nobody else even exports this info from their TSM or digests it. Thus Intel would need unique API for the VMM to even build SPDM_DEVICE_ATTESTATION_INFO_T. Not nice.

Quoted 5 lines

I dont think there is an expectation that there needs to be unique API to build this structure (I think we can hide it in the tdx-specific code), but your point below is valid: this SPDM_DEVICE_ATTESTATION_INFO_T blob needs to end up on the guest side because only using this blob the guest can currently verify the evidence of the SPDM connection establishment.

Right.

Quoted 7 lines
Quoted 2 lines

Any every other arch can build their digested data in the VMM using the standard APIs because all their digests are over standard things.

So, yes, if we dissect this structure, then the unique fields that Intel has are:
HEARTBEAT_PERIOD, TDISP_CAPABILITIES, TDISP_VERSION
(I am not listing SPDM_CAPABILITIES, this must be part of VCA)

HEARTBEAT_PERIOD will come out of the transcript as a field in KEY_EXCHANGE_RSP

SPDM_CAPABILITIES is in the VCA

TDISP_VERSION is in the data from GET_INTERFACE_REPORT which needs to be a common API. Though this is probably the selected version not the offered version.

Only TDSIP_CAPABILITIES is unknown to userspace. I don't know why anyone needs this or why it needs to be digested. Nobody else did this.

Quoted 4 lines

Here I also have a generic question: does Linux plan for the host to implement heartbeat (can be very useful to understand whenever the device is still alive and didnt silently terminated session) or not? And if needed, how do other coco arches expose this info?

I don't know. I haven't investigated this question..

Quoted 5 lines

TDISP_VERSION is more interesting.
It may be security sensitive, i.e. assuming some
problems later on found in existing version of TDSIP, new version is released, etc. So, downgrade attack is possible from the host side and the guest wont know, if vulnerable version is in use.

Huh? TDX module is trusted to negotiate the TDSIP_VERSION, host has nothing to do with this? The selected vesion is reported in GET_INTERFACE_REPORT and that must be digested.

AFAICT we don't need to double check the TDX modules work by seeing the TDISP_VERSION from earlier in the exchange.

Quoted 7 lines

TDISP_CAPABILITIES are harder for me to judge, but I can imagine a scenario where a guest without this info can be led to believe that a reason that a given TDI is not locked with certain flags is because a device does not support such TDSIP capability (while it does in practice). But I think it is still guest decision to either accept such configuration or not regardless of what device supports. I will ask around more for potential problematic scenarios.

Right now I don't see a reason to even expose TDSIP_CAPABILITIES through the UAPI since no other arch will implement it and it isn't clear what it should be even used for.

Again the TSM is trusted to do the TDISP negotiation, we know this was done right because we will attest the TSM.

I don't see that we need to double check its work. None of this is even signed so a malfunctioning TSM or OS can simply lie in the report.

Quoted 13 lines
Quoted 13 lines

So if you keep this then you have to get a uAPI 'give me the intel blob' to build your VMM with. It is not impossible but it seems unnecessary if you'd just digest the right stuff instead of a giant struct.

ARM keeps several digests:

protocol_data_digest = H_rmm(VCA)

identity_digest      = H_rmm(cert_1 || ... || cert_n)
pubkey_digest        = H_rmm(<public key>)
meas_digest          = H_rmm(GET_MEASUREMENTS || MEASUREMENTS)
report_digest        = H_rmm(interface_report)
Quoted 5 lines
Quoted 2 lines

I'm not sure VCA is strictly necessary. pubkey_digest is because RMM does not parse x509, since TDX does it also isn't necessary.

Per SPDM the signed GET_MEASURMENTS || MEASUREMENTS transcript actually includes VCA.

This is the hash of the message bodies, which don't include VCA.

You need VCA to compute the signature hash which is why everyone ships it around.

Quoted 3 lines

And this is where in our original SPDM_DEVICE_ATTESTATION_INFO_T struct VCA should have lived instead of being a separate structure with digest. Would that be acceptable?

I'm not sure what you are proposing?

My concern is you have this digest over a struct that isn't a protocol struct, so we have to make a special API to pass your special struct.

Unless we can get rid of that I don't know if I care what you put in the struct, but the kernel will have to break it up and your driver will be more complicated than it needed to be.

VCA is immutable. It should be made available once and not repeated in every single measurement fetch.

Quoted 1 line

And yes, in our case pubkey_digest is not needed.

ARM's version of having the host parse the x509 is better, IMHO :)

Quoted 11 lines
Quoted 5 lines

What you want is an API to retrive measurements for a vdevice triggered by the guest that updates the guest visisble information

And another one to retrive measurements for the host pci device that doesn't change the vdevice at all.

Ok, so let me re-iterate to make sure I got it right. You want these three things:

1. No implicit TSM measurement collection at the time of SPDM.CONNECT (inside SPDM secure session) before or after LOCK

Yes. Host and VMM can manage evidence collection through the uAPI. We don't need to slow things down by doing collections that many use cases will simply discard.

Quoted 5 lines

2. Guest-requested (with a guest provided nonce) measurement collection that collects only SPDM signed measurement transcript (that includes VCA) and not certificates.
This collection refreshes the guest-visible digest of the SPDM signed measurement transcript.

Yes, certificates should be fixed during the plaintext setup sequence. We don't need to refresh them, or at least if we ever do want to refresh them that is some other independent activity from evidence collection.

IMHO devices that change their GET_DIGESTS output while a SPDM connection is active are broken.

Quoted 2 lines

The purpose of this collection is for guest to obtain fresh device measurements after the lock in trusted way.

Yes.

Quoted 3 lines

3. Host-requested (with a host provided nonce? I would rather not, because it feels we need a clear way to distinguish collection 2 and 3, so I would keep nonce fixed to zero in this case or any other fixed pattern)

No good, it must be a host provide nonce. This is a host evidence collection and it must have a fresh nonce to have any security. If everything uses the same nonce it can be replayed.

Collection 2 and 3 are the same action. Anyone who can make measurements can provide the nonce and generate a replayed nonce. The only difference is if the vdevice digests are changed.

I don't see a reason to tag them, the mechanisms we have in userspace to ensure the nonce is legit and bound to the VM are sufficient.

Quoted 4 lines

measurement collection that collects only SPDM signed measurement
transcript (that includes VCA) and not certificates. This collection does not refresh the guest-visible digest of the SPDM signed measurement transcript.

Yes

Quoted 4 lines

The purpose of this collection is to allow host to discover device measurements by itself and potentially make its own independent security decision like it would do for native SPDM case (without TEE-IO) where host is a decision maker.

Yes

Quoted 8 lines
Quoted 2 lines

Btw, does any other arch provide #3 today? I am not able to see this in ARM spec at least.

It is coming, currently ARM doesn't even allow the host to see the measurements *at all* which is a really big miss on their part.

AMD is probably broken the same way as TDX is right now from what I can tell.

The PSP always takes nonce in DEV_MEASUREMENTS and updates the digest. Nonce comes from the initiator, the updated digest is reported back to the guest via encrypted VM<->PSP GuestRequest mechanism.

Quoted 8 lines

You probably also want

4. TSM controlled nonce

A way to put the vdevice into "tsm controlled nonce" where the vdevice evidence collection no longer accepts a guest nonce and the TSM provides its own random one. This would be a permanent choice when the vdevice is created.

Is this any better that the initiator's nonce? Thanks,

Quoted 6 lines

You may also want a way for #3 to run as "tsm controlled nonce" and set the initial digest for all future vdevices. I'm not really sure I understand how this "single collection" flow is supposed to work though to be sure.

Jason

Signature · 1 line
Alexey
maintainer
#105 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 6 lines · Alexey Kardashevskiy
Quoted 6 lines
Quoted 2 lines

Btw, does any other arch provide #3 today? I am not able to see this in ARM spec at least.

It is coming, currently ARM doesn't even allow the host to see the measurements *at all* which is a really big miss on their part.

Quoted 7 lines
Quoted 2 lines

AMD is probably broken the same way as TDX is right now from what I can tell.

The PSP always takes nonce in DEV_MEASUREMENTS and updates the digest. Nonce comes from the initiator, the updated digest is reported back to the guest via encrypted VM<->PSP GuestRequest mechanism.

Okay, so that means it is broken too. You will have to disable host evidence collection once a VM starts using the device.

Quoted 10 lines
Quoted 8 lines

You probably also want

4. TSM controlled nonce

A way to put the vdevice into "tsm controlled nonce" where the vdevice evidence collection no longer accepts a guest nonce and the TSM provides its own random one. This would be a permanent choice when the vdevice is created.

Is this any better that the initiator's nonce? Thanks,

There is a certain customer that wants this weird flow. Ask your architects they probably know.

Jason

#106 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 10 lines · Jason Gunthorpe
Quoted 9 lines · Alexey Kardashevskiy
Quoted 8 lines
Quoted 2 lines

Btw, does any other arch provide #3 today? I am not able to see this in ARM spec at least.

It is coming, currently ARM doesn't even allow the host to see the measurements *at all* which is a really big miss on their part.

AMD is probably broken the same way as TDX is right now from what I can tell.

Quoted 7 lines
Quoted 4 lines

The PSP always takes nonce in DEV_MEASUREMENTS and updates the digest. Nonce comes from the initiator, the updated digest is reported back to the guest via encrypted VM<->PSP GuestRequest mechanism.

Okay, so that means it is broken too. You will have to disable host evidence collection once a VM starts using the device.

Why? Because of concurrent DEV_MEASUREMENTS from the host and the guest, or something else?

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

You probably also want

4. TSM controlled nonce

A way to put the vdevice into "tsm controlled nonce" where the vdevice evidence collection no longer accepts a guest nonce and the TSM provides its own random one. This would be a permanent choice when the vdevice is created.

Quoted 4 lines
Quoted 1 line

Is this any better that the initiator's nonce? Thanks,

There is a certain customer that wants this weird flow. Ask your architects they probably know.

ah right :)

Quoted 2 lines

Jason

Signature · 1 line
Alexey
maintainer
#107 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 16 lines · Alexey Kardashevskiy
Quoted 15 lines · Jason Gunthorpe
Quoted 13 lines · Alexey Kardashevskiy
Quoted 8 lines
Quoted 2 lines

Btw, does any other arch provide #3 today? I am not able to see this in ARM spec at least.

It is coming, currently ARM doesn't even allow the host to see the measurements *at all* which is a really big miss on their part.

AMD is probably broken the same way as TDX is right now from what I can tell.

The PSP always takes nonce in DEV_MEASUREMENTS and updates the digest. Nonce comes from the initiator, the updated digest is reported back to the guest via encrypted VM<->PSP GuestRequest mechanism.

Quoted 4 lines
Quoted 2 lines

Okay, so that means it is broken too. You will have to disable host evidence collection once a VM starts using the device.

Why? Because of concurrent DEV_MEASUREMENTS from the host and the guest, or something else?

Yes, host measurement collection cannot impact a running guest in any way. If your system can't guarentee that then it must be blocked.

Jason

#108 lore raw

RE: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

In reply to Jason Gunthorpe
Quoted 60 lines

-----Original Message-----
From: Jason Gunthorpe <[email protected]>
Sent: Tuesday, November 17, 2026 4:20 PM
To: Reshetova, Elena <[email protected]>
Cc: Aneesh Kumar K.V <[email protected]>; Jiang, Dave <[email protected]>; Xu Yilun <[email protected]>; linux- [email protected]; Jiri Pirko <[email protected]>; Tian, Kevin <[email protected]>; Alexey Kardashevskiy <[email protected]>; Catalin Marinas <[email protected]>; Suzuki K Poulose <[email protected]>; Steven Price <[email protected]>; Kiryl Shutsemau <[email protected]>; Edgecombe, Rick P <[email protected]>; Dave Hansen <[email protected]>; Jonathan Cameron <[email protected]>; Bjorn Helgaas <[email protected]>; Ashish Kalra <[email protected]>; Tom Lendacky <[email protected]>; John Allen <[email protected]>; Will Deacon <[email protected]>; Mark Rutland <[email protected]>; [email protected]; Alistair <[email protected]>
Subject: Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 37 lines · Elena
Quoted 36 lines · Elena
Quoted 6 lines
Quoted 2 lines

1) No easy way to get the VCA, no easy way to do capture

My understanding is that VCA must have been included into SPDM_DEVICE_ATTESTATION_INFO_T from the beginning, it was omitted by mistake and we asked to fix it as Dave already pointed out.

That makes some sense, but it just makes this struct bigger and worser. As I explained ot Aneesh I'd rather not have a VCA at all but the transcript that includes VCA (or is maybe only VCA) with preserved message boundary markers. Userspace can compute VCA for the purposes of the signature hash.

Quoted 1 line
Quoted 1 line

2) Wrong digests design for the guest.

SPDM_DEVICE_ATTESTATION_INFO_T

Quoted 10 lines
Quoted 9 lines

is a terrible idea since it is not grounded in any spec. The other two have multiple guest digests computed directly over spec defined objects.

3) Even if you like SPDM_DEVICE_ATTESTATION_INFO_T it includes TDISP_CAPABILITIES for some bad reason. Nobody else even exports this info from their TSM or digests it. Thus Intel would need unique API for the VMM to even build SPDM_DEVICE_ATTESTATION_INFO_T. Not nice.

Quoted 5 lines

I dont think there is an expectation that there needs to be unique API to build this structure (I think we can hide it in the tdx-specific code), but your point below is valid: this SPDM_DEVICE_ATTESTATION_INFO_T blob needs to end up on the guest side because only using this blob the guest can currently verify the evidence of the SPDM connection establishment.

Right.

Any every other arch can build their digested data in the VMM using the standard APIs because all their digests are over standard things.

Quoted 7 lines
Quoted 4 lines

So, yes, if we dissect this structure, then the unique fields that Intel has are:
HEARTBEAT_PERIOD, TDISP_CAPABILITIES, TDISP_VERSION
(I am not listing SPDM_CAPABILITIES, this must be part of VCA)

HEARTBEAT_PERIOD will come out of the transcript as a field in KEY_EXCHANGE_RSP

Yes, if host parses the whole transcript or TSM exposes it. Did we conclude that it is a must or do we trust TSM to verify it?

Quoted 2 lines

SPDM_CAPABILITIES is in the VCA

Agree, as I wrote above.

Quoted 4 lines

TDISP_VERSION is in the data from GET_INTERFACE_REPORT which needs to be a common API. Though this is probably the selected version not the offered version.

It is in the header of that message, but it is not in report itself in my understanding, and since guest only sees report (and its trusted digest) it wont see version.

Quoted 18 lines

Only TDSIP_CAPABILITIES is unknown to userspace. I don't know why anyone needs this or why it needs to be digested. Nobody else did this.

Quoted 4 lines

Here I also have a generic question: does Linux plan for the host to implement heartbeat (can be very useful to understand whenever the device is still alive and didnt silently terminated session) or not? And if needed, how do other coco arches expose this info?

I don't know. I haven't investigated this question..

Quoted 5 lines

TDISP_VERSION is more interesting.
It may be security sensitive, i.e. assuming some
problems later on found in existing version of TDSIP, new version is released, etc. So, downgrade attack is possible from the host side and the guest wont know, if vulnerable version is in use.

Quoted 3 lines

Huh? TDX module is trusted to negotiate the TDSIP_VERSION, host has nothing to do with this? The selected vesion is reported in GET_INTERFACE_REPORT and that must be digested.

Again, in my understanding it is not in the report so guest has no trusted way to know the TDISP version.
But yes, we can make a decision that we trust TSM to always negotiate latest version and we can attest TSM. We just need to be explicit in this.

Quoted 16 lines

AFAICT we don't need to double check the TDX modules work by seeing the TDISP_VERSION from earlier in the exchange.

Quoted 7 lines

TDISP_CAPABILITIES are harder for me to judge, but I can imagine a scenario where a guest without this info can be led to believe that a reason that a given TDI is not locked with certain flags is because a device does not support such TDSIP capability (while it does in practice). But I think it is still guest decision to either accept such configuration or not regardless of what device supports. I will ask around more for potential problematic scenarios.

Right now I don't see a reason to even expose TDSIP_CAPABILITIES through the UAPI since no other arch will implement it and it isn't clear what it should be even used for.

Quoted 6 lines

Again the TSM is trusted to do the TDISP negotiation, we know this was done right because we will attest the TSM.

I don't see that we need to double check its work. None of this is even signed so a malfunctioning TSM or OS can simply lie in the report.

OS cannot lie, because information is protected by TSM provided digest, but yes, we can decide we trust TSM with it.

Quoted 17 lines
Quoted 17 lines
Quoted 16 lines

So if you keep this then you have to get a uAPI 'give me the intel blob' to build your VMM with. It is not impossible but it seems unnecessary if you'd just digest the right stuff instead of a giant struct.

ARM keeps several digests:

protocol_data_digest = H_rmm(VCA)

identity_digest      = H_rmm(cert_1 || ... || cert_n)
pubkey_digest        = H_rmm(<public key>)
meas_digest          = H_rmm(GET_MEASUREMENTS || MEASUREMENTS)
report_digest        = H_rmm(interface_report)

I'm not sure VCA is strictly necessary. pubkey_digest is because RMM does not parse x509, since TDX does it also isn't necessary.

Quoted 7 lines
Quoted 2 lines

Per SPDM the signed GET_MEASURMENTS || MEASUREMENTS transcript actually includes VCA.

This is the hash of the message bodies, which don't include VCA.

You need VCA to compute the signature hash which is why everyone ships it around.

What I meant is L1/L2 transcript that is signed in last MEASUREMENET response, it has VCA:

L1/L2 = Concatenate(VCA, GET_MEASUREMENTS_REQUEST1, MEASUREMENTS_RESPONSE1, ..., GET_MEASUREMENTS_REQUESTn-1, MEASUREMENTS_RESPONSEn-1, GET_MEASUREMENTS_REQUESTn, MEASUREMENTS_RESPONSEn)

Quoted 5 lines
Quoted 4 lines

And this is where in our original SPDM_DEVICE_ATTESTATION_INFO_T struct VCA should have lived instead of being a separate structure with digest. Would that be acceptable?

Quoted 8 lines

I'm not sure what you are proposing?

My concern is you have this digest over a struct that isn't a protocol struct, so we have to make a special API to pass your special struct.

Unless we can get rid of that I don't know if I care what you put in the struct, but the kernel will have to break it up and your driver will be more complicated than it needed to be.

I am trying to see how break this struct the best. And the only open question I have so far is where to plug VCA (rest is clear).

Quoted 3 lines

VCA is immutable. It should be made available once and not repeated in every single measurement fetch.

Yes, this can be an argument against providing it as part of measurement fetch. Then the only other clean option is a standalone VCA with it own digest.

Quoted 46 lines
Quoted 2 lines

And yes, in our case pubkey_digest is not needed.

ARM's version of having the host parse the x509 is better, IMHO :)

Quoted 11 lines
Quoted 5 lines

What you want is an API to retrive measurements for a vdevice triggered by the guest that updates the guest visisble information

And another one to retrive measurements for the host pci device that doesn't change the vdevice at all.

Ok, so let me re-iterate to make sure I got it right. You want these three things:

1. No implicit TSM measurement collection at the time of SPDM.CONNECT (inside SPDM secure session) before or after LOCK

Yes. Host and VMM can manage evidence collection through the uAPI. We don't need to slow things down by doing collections that many use cases will simply discard.

Quoted 4 lines

2. Guest-requested (with a guest provided nonce) measurement collection that collects only SPDM signed measurement transcript (that includes VCA) and not certificates.
This collection refreshes the guest-visible digest of the SPDM signed

measurement

Quoted 1 line

transcript.

Yes, certificates should be fixed during the plaintext setup sequence. We don't need to refresh them, or at least if we ever do want to refresh them that is some other independent activity from evidence collection.

IMHO devices that change their GET_DIGESTS output while a SPDM connection is active are broken.

Quoted 1 line

The purpose of this collection is for guest to obtain fresh device

measurements

Quoted 1 line

after the lock in trusted way.

Yes.

Quoted 3 lines

3. Host-requested (with a host provided nonce? I would rather not, because it feels we need a clear way to distinguish collection 2 and 3, so I would keep nonce fixed to zero in this case or any other fixed pattern)

Quoted 7 lines

No good, it must be a host provide nonce. This is a host evidence collection and it must have a fresh nonce to have any security. If everything uses the same nonce it can be replayed.

Collection 2 and 3 are the same action. Anyone who can make measurements can provide the nonce and generate a replayed nonce. The only difference is if the vdevice digests are changed.

Yes, but this difference makes me want to separate these two cases, but I cannot provide you a concrete attack right now. I need to think more about it. But it does feel scary that we have the same interface for a trusted and untrusted entities, which has different security properties, but non- distinguishable otherwise (when you look just at a signed transcript).

Quoted 28 lines

I don't see a reason to tag them, the mechanisms we have in userspace to ensure the nonce is legit and bound to the VM are sufficient.

Quoted 4 lines

measurement collection that collects only SPDM signed measurement
transcript (that includes VCA) and not certificates. This collection does not refresh the guest-visible digest of the SPDM signed measurement transcript.

Yes

Quoted 1 line

The purpose of this collection is to allow host to discover device

measurements

Quoted 3 lines

by itself and potentially make its own independent security decision like it would do for native SPDM case (without TEE-IO) where host is a decision maker.

Yes

Quoted 2 lines

Btw, does any other arch provide #3 today? I am not able to see this in ARM spec at least.

It is coming, currently ARM doesn't even allow the host to see the measurements *at all* which is a really big miss on their part.

AMD is probably broken the same way as TDX is right now from what I can tell.

Quoted 8 lines

You probably also want

4. TSM controlled nonce

A way to put the vdevice into "tsm controlled nonce" where the vdevice evidence collection no longer accepts a guest nonce and the TSM provides its own random one. This would be a permanent choice when the vdevice is created.

What is the usecase for this given we have above 3 items?

Quoted 5 lines

You may also want a way for #3 to run as "tsm controlled nonce" and set the initial digest for all future vdevices. I'm not really sure I understand how this "single collection" flow is supposed to work though to be sure.

Since I dont understand the usecase, it is hard for me to judge what is required here or how it should work.

Best Regards,
Elena.

Quoted 2 lines

Jason

maintainer
#109 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 10 lines · Elena
Quoted 7 lines
Quoted 4 lines

So, yes, if we dissect this structure, then the unique fields that Intel has are:
HEARTBEAT_PERIOD, TDISP_CAPABILITIES, TDISP_VERSION
(I am not listing SPDM_CAPABILITIES, this must be part of VCA)

HEARTBEAT_PERIOD will come out of the transcript as a field in KEY_EXCHANGE_RSP

Yes, if host parses the whole transcript or TSM exposes it. Did we conclude that it is a must or do we trust TSM to verify it?

We trust TSM to verify it.

If a full transcript is available the only thing that might re-check the siganture is an external verifier. I don't have a good use case for that in mind today.

Quoted 7 lines
Quoted 3 lines

TDISP_VERSION is in the data from GET_INTERFACE_REPORT which needs to be a common API. Though this is probably the selected version not the offered version.

It is in the header of that message, but it is not in report itself in my understanding, and since guest only sees report (and its trusted digest) it wont see version.

So, there is an annoying spec unclarity on all three vendors exactly what they include in these blobs. Is this header included or not? I cannot tell you the answer, we will have to find out as we go along :|

Quoted 5 lines

Again, in my understanding it is not in the report so guest has no trusted way to know the TDISP version.
But yes, we can make a decision that we trust TSM to always negotiate latest version and we can attest TSM. We just need to be explicit in this.

This is what everyone else has done

Quoted 6 lines
Quoted 3 lines

I don't see that we need to double check its work. None of this is even signed so a malfunctioning TSM or OS can simply lie in the report.

OS cannot lie, because information is protected by TSM provided digest, but yes, we can decide we trust TSM with it.

Once we accept devices OS can become compromised by device DMA and start being hostile. Once we pass that threshold none of this unsigned information has any value in establishing integrity.

Quoted 11 lines
Quoted 4 lines

This is the hash of the message bodies, which don't include VCA.

You need VCA to compute the signature hash which is why everyone ships it around.

What I meant is L1/L2 transcript that is signed in last MEASUREMENET response, it has VCA:

L1/L2 = Concatenate(VCA, GET_MEASUREMENTS_REQUEST1, MEASUREMENTS_RESPONSE1, ..., GET_MEASUREMENTS_REQUESTn-1, MEASUREMENTS_RESPONSEn-1, GET_MEASUREMENTS_REQUESTn, MEASUREMENTS_RESPONSEn)

Right, it is a transcript, you are expected to already have VCA from the initial transcript when you compute this. It doesn't re-transfer VCA.

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

And this is where in our original SPDM_DEVICE_ATTESTATION_INFO_T struct VCA should have lived instead of being a separate structure with digest. Would that be acceptable?

I'm not sure what you are proposing?

My concern is you have this digest over a struct that isn't a protocol struct, so we have to make a special API to pass your special struct.

Quoted 6 lines
Quoted 3 lines

Unless we can get rid of that I don't know if I care what you put in the struct, but the kernel will have to break it up and your driver will be more complicated than it needed to be.

I am trying to see how break this struct the best. And the only open question I have so far is where to plug VCA (rest is clear).

ARM has it nearly right, VCA is captured in plain text as the session transcript. This TSM directed capture primitive is what you need for 1.3 because we want to capture GET_DIGESTS and then pause.

Building some other way to get VCA out after the fact might be easier from what you have now but it is only useful for a 1.2 implementation.

Plus it means you have to store VCA, certificates, etc in TDX module memory, instead of just fixed size small digests, which seems pretty undesirable to me.

It is up to Intel how you want to sequence spec changes, but I'd take a serious look at doing the transcript capture right now and use that to capture VCA, then you are well set to expand easier in to 1.3 topics. Especially since you brough up multi-slot as a key requirement :) :)

Of course you can add a new command to get the VCA and do transcript capture later and have a more complex driver and module.

Quoted 6 lines
Quoted 2 lines

VCA is immutable. It should be made available once and not repeated in every single measurement fetch.

Yes, this can be an argument against providing it as part of measurement fetch. Then the only other clean option is a standalone VCA with it own digest.

Still not sure we need to digest it. I know ARM did, but I don't know why.

There is a merkle tree from the digest of the measurement to the hash in the signature to the L1/L2 above which hashes the VCA.

It doesn't hurt anything, but again to be forward looking you'd want to hash the entire captured transcript, including any future 1.3/5/6/7 things like GET_DIGESTS. Not just VCA.

Quoted 6 lines
Quoted 3 lines

Collection 2 and 3 are the same action. Anyone who can make measurements can provide the nonce and generate a replayed nonce. The only difference is if the vdevice digests are changed.

Yes, but this difference makes me want to separate these two cases, but I cannot provide you a concrete attack right now.

The only purpose of the digests is to authenticate the guest/host/TDX channel.

It doesn't do anything else, and even with the design you have today the host can issue measurements independently and then hide that behind a legitimate guest measurement request which refreshes the digest.

Quoted 4 lines

I need to think more about it. But it does feel scary that we have the same interface for a trusted and untrusted entities, which has different security properties, but non- distinguishable otherwise (when you look just at a signed transcript).

You can never look at a naked signed measurement and make a security decision. It always has to be bound to the VM's quote/signature by trusted software.

Since only a legitimate VM can establish this binding it is how we prove the signed measurement is made by trusted software inside a VM and not in the host. We trust that software to have checked the digest to make sure the guest/host/TDX channel wasn't tampered with before it binds it.

Quoted 8 lines
Quoted 6 lines

4. TSM controlled nonce

A way to put the vdevice into "tsm controlled nonce" where the vdevice evidence collection no longer accepts a guest nonce and the TSM provides its own random one. This would be a permanent choice when the vdevice is created.

What is the usecase for this given we have above 3 items?

The one you mentioned, single evidence collection. If the device is in "TSM Controlled nonce" mode then the host can make a single collection and present it to the guest over and over again.

Guest can see it was an authentic measurement with an authentic random nonce because TDX module tells it this is happening and gives it the digest.

Jason

#110 lore raw

RE: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 15 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

And this is where in our original SPDM_DEVICE_ATTESTATION_INFO_T struct VCA should have lived instead of being a separate structure with

digest.

Quoted 11 lines
Quoted 10 lines
Quoted 1 line

Would that be acceptable?

I'm not sure what you are proposing?

My concern is you have this digest over a struct that isn't a protocol struct, so we have to make a special API to pass your special struct.

Unless we can get rid of that I don't know if I care what you put in the struct, but the kernel will have to break it up and your driver will be more complicated than it needed to be.

Quoted 6 lines
Quoted 2 lines

I am trying to see how break this struct the best. And the only open question I have so far is where to plug VCA (rest is clear).

ARM has it nearly right, VCA is captured in plain text as the session transcript. This TSM directed capture primitive is what you need for 1.3 because we want to capture GET_DIGESTS and then pause.

Small question here: why does the host need to capture GET_DIGESTS given that we trust TSM to verify the transcript and integrity of provided cert chains to the host?

I understand it doesnt hurt anything, but I would like to also understand the purpose of each step.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

4. TSM controlled nonce

A way to put the vdevice into "tsm controlled nonce" where the vdevice evidence collection no longer accepts a guest nonce and the TSM provides its own random one. This would be a permanent choice when the vdevice is created.

Quoted 5 lines
Quoted 1 line

What is the usecase for this given we have above 3 items?

The one you mentioned, single evidence collection. If the device is in "TSM Controlled nonce" mode then the host can make a single collection and present it to the guest over and over again.

So, you mean here like "initial device attestation evidence at the SPDM connect establishment time"? If yes, then I think TSM controlled nonce is misleading, i.e. it is not about nonce, it is about the time when evidence was collected.
And do you plan to support this model in Linux?

Best Regards,
Elena.

Quoted 6 lines

Guest can see it was an authentic measurement with an authentic random nonce because TDX module tells it this is happening and gives it the digest.

Jason

maintainer
#111 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 18 lines · Elena
Quoted 18 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

And this is where in our original SPDM_DEVICE_ATTESTATION_INFO_T struct VCA should have lived instead of being a separate structure with

digest.

Quoted 13 lines
Quoted 10 lines
Quoted 1 line

Would that be acceptable?

I'm not sure what you are proposing?

My concern is you have this digest over a struct that isn't a protocol struct, so we have to make a special API to pass your special struct.

Unless we can get rid of that I don't know if I care what you put in the struct, but the kernel will have to break it up and your driver will be more complicated than it needed to be.

I am trying to see how break this struct the best. And the only open question I have so far is where to plug VCA (rest is clear).

Quoted 7 lines
Quoted 3 lines

ARM has it nearly right, VCA is captured in plain text as the session transcript. This TSM directed capture primitive is what you need for 1.3 because we want to capture GET_DIGESTS and then pause.

Small question here: why does the host need to capture GET_DIGESTS given that we trust TSM to verify the transcript and integrity of provided cert chains to the host?

We need the slot mask in the OS to present to the uAPI so we can know what slots are valid to fetch certificates for. DIGESTS is the message that has it. This all has to be done before telling the TSM what the slot is, before key exchange.

Yes you can make this more convoluted by having more TSM API surface for the TSM to report things already in plaintext messages, but that does not seem good from a TCB perspective, plus it means every TSM would have various bits of unique code to do these entirely standard things.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

What is the usecase for this given we have above 3 items?

The one you mentioned, single evidence collection. If the device is in "TSM Controlled nonce" mode then the host can make a single collection and present it to the guest over and over again.

So, you mean here like "initial device attestation evidence at the SPDM connect establishment time"?

I don't want the TSM to have any opinion when the evidence is collected. The OS/user will decide when this happens. If OS wants it to be 'initial' then it can ask for it them.

Quoted 3 lines

If yes, then I think TSM controlled nonce is misleading, i.e. it is not about nonce, it is about the time when evidence was collected. And do you plan to support this model in Linux?

It starts with the nonce, if we want to mess with the collection time the first issue is the guest cannot supply a nonce. We can't trust the host to provide a nonce, so it must come from the TSM.

If the TSM provides a nonce then there is a host based command to get a new TSM nonce and perform an evidence collection. Obviously we need to offer a way to freshen the evidence if the user so desires.

The userspace should control when the VDEV's digests visible to the guest get updated. The host decides when this happens, but it must not do it asynchronously from the guest's perspective otherwise there are unsolvable races.

Yes, the feature seems to be about controlling the time of evidence collection, but the actual mechanism is giving the TSM control over the nonce.

I still don't know if that is what that user wants, hopefully we will have more clarity soon.

Jason

#112 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

In reply to Jason Gunthorpe
Quoted 15 lines · Jason Gunthorpe
Quoted 6 lines · Aneesh Kumar K.V
Quoted 1 line

Like a whole bunch of TSM FW API just to do this:

Can you help me understand why we need to snoop the DOE messages? IIUC, the earlier proposal for 1.2 was to use Rust SPDM to perform the following:

Quoted 7 lines

GET_VERSION
GET_CAPABILITIES
NEGOTIATE_ALGORITHMS
GET_DIGESTS
GET_CERTIFICATE for all slots in the slot_mask returned by GET_DIGESTS CHALLENGE using the slot 0 key (At this point, we can also verify that we received the certificates for all slots supported by the device.)

Quoted 7 lines

At least I wasn't proposing exactly this.. CHALLENGE ideally has to be connected to KEY_EXCHANGE, ie they use the same nonce or get digests is hashed by the TSM or something to have the full value that 1.3 brings.

I've also been told that not many devices are implementing CHALLENGE, so this may not be that useful to invest in..

I've heard of those devices too but never heard of devices with more than one certificate chain btw.

Quoted 18 lines

But the main issue is we have to use the TSM to initiate NEGOTIATE_ALGORITHMS because that defines what the contents of the slots will be, and a rustspdm has to follow the TSM's selection.

So, any version of this flow would require capture as a building block anyhow, and you have this awkward version where TSM does all the negotiation then rustspdm injects its own messages according to the TSM selected rules.

It is possible but very hard, so I think we should set it aside. This is something to reach for if the vendors don't want to agree on FW changes as part of the 1.3 upgrade to improve things.

Quoted 4 lines

The host then select a slot and use it to establish the IDE connection? (For intel we can only select slot 0 here?)

What does snooping provide in this context?

Quoted 8 lines

Capturing the transcript makes everything 100% perfectly consistent for everyone. Userspace sees *the transcript* as defined by SPDM not some mangled, truncated or processed version that the TSM decides to provide.

Userspace gets to see KEY_EXCHANGE which means the verifier can prove the certificate binding, this is the ONLY way to let the verifier do this proof if it wants.

Say, the guest userspace can see the certificate chain and the measurements signed with the key from slotidX used for the session. The PSP promised it is the same slotid. Which part does this verifier not trust?

Quoted 4 lines

Further with capture we have a nice primitive to pause and do slot selection before going to KEY_EXCHANGE. If we know the kernel has capture then the ideal FW design for 1.3 multikey is much simpler and clearer (more like ARM).

No CHALLENGE, then we read digests and certificates before KEY_EXHANGE so the digests won't come signed and you stated before you wanted them signed. I am confused.

https://lore.kernel.org/r/[email protected]

Quoted 33 lines

Also, ARM decided to do capture already, but directed by the TSM. I think it is the right and best idea, they just made the implementation too narrowly specific. eg it doesn't split up VCA, it doesn't capture 100% of everything to get KEY_EXCHANGE, etc. Trivial to fix while upgrading to support 1.3

Finally, Intel actually seems to need Linux managed capture (Seriously Intel, WTF?) as they don't have any other way to get the VCA, and without the VCA the measurement signature cannot be checked. I hope they still have time in their spec process to adopt the ARM approach.

The ultimate goal is to get *consistency*, especially a consistent uAPI. The second long term goal is I want the guest and host to show the same data out of the same uAPI for attestation. The guest should not have an inferior view.. It will take some spec changes to get there.

I've now gone through all the exiting choices all the TSMs have made and here is what I'm thinking

1) The uAPI presents a transcript interface, every message and reply individually presented to userspace. Perfectly future extensible to include GET_DIGESTS with 1.3 and whatever else comes down the road. These are consistent spec defined message blobs 100% the same for every single SPDM implementation and TSM.
The kernel will start with a partial transcript, but the API can carry a full one as we improve with no uAPI change. The guest will see partial transcript until/if vmm/guest changes are made

2) The uAPI presents the x509 certificate chains in a consistent spec defined way that userspace can hash back to GET_DIGESTS

Quoted 7 lines

3) The uAPI presents the signed measurement result and tdisp in a consistent spec defined way

4) We have the four step
Start
Get certificate
Finish using slot

I am trying to think of a simple DEV_CONNECT modification.

DEV_CONNECT(slotidX) - let it do the current thing with SPDM, SecSPDM, IDE_KM, return the certificate chain for slotidX. I can propose modifying DEV_CONNECT to return the digests of all slots.

Then modify the existing DEV_CERTIFICATES to take a mask of slotids and return certificate chains (as a transcript?).

Then, if the userspace wanted another slotid - run DEV_CONNECT(slotidY). Slow but simple.

The AI tells me we cannot change the slot in SPDM (1.2 or 1.3) after KEY_EXCHANGE which means restarting the SPDM session so we cannot just change the key on the go, right?

Quoted 1 line

Accept

I keep missing the point of doing this on the host (in the TDISP or CMA case). The host "accepts" a PF by enabling IOMMU for that PF, not the PSP's (==TSM) job.

We can certainly make changes in the PSP but they are going to ask what exactly is missing now.

Quoted 27 lines

Flow I mentioned earlier

5) We start without complicated capture. ARM will collect VCA with its in built capture. AMD will do a measurement collection during 'Finish' and extract VCA from its blob. Common code will transform both VCAs into a truncated transcript.

Intel don't get a VCA at this point, so no signature verification.

7) We implement common direct capture and throw away the VCA code from the drivers. Intel can work. Every host driver has 100% perfect transcript.

8) We have a nice think and Linux sets a recommendation what the FW TSM interface should look like and try to badger the TSM FW spec authors into something more consistent than this mess as part of a 1.3 multikey update.

If everyone can standardize on ARM-like TSM managed capture, with the proper breakdown and data inclusion then we can get 100% consistency without a complicated capture process in the kernel.

9) The VMM uses the above common interface to reconstruct the RHI/GHCI/AMD. That mess doesn't leak into the kernel on the host. I checked this and everyone but Intel is fine to construct their host/guest channel from the common interface.

Quoted 7 lines

Ie fetch the x509 bundle and reform it into whatever was speced, then undo it and put it back into the x509 bundle for the guest attestation subsystem.

Except for Intel all the guest defined digests can be calculated from the common spec messages. Well, maybe AMD has an issue, their spec is too vauge to tell exactly what bytes are digested.

True, I asked for some clarifications there recently, the new SEV TIO spec update is on its way. Thanks,

ps. we really want you on these IOMMUFD calls :)

Quoted 36 lines

IMHO ARM has the design that is closest to perfect, a few tweaks and it would be excellent and support 1.3 multikey.

AMD's is weird but at least what they have for 1.2 can be made to work. Will need to be rethought to get get 1.3 multi-key. Copy ARM.

Intel.. Is wrong IMHO. It is still unreleased, is it too much to hope you could just copy more from ARM?
1) No easy way to get the VCA, no easy way to do capture

2) Wrong digests design for the guest. SPDM_DEVICE_ATTESTATION_INFO_T is a terrible idea since it is not grounded in any spec. The other two have multiple guest digests computed directly over spec defined objects.

3) Even if you like SPDM_DEVICE_ATTESTATION_INFO_T it includes TDISP_CAPABILITIES for some bad reason. Nobody else even exports this info from their TSM or digests it. Thus Intel would need unique API for the VMM to even build SPDM_DEVICE_ATTESTATION_INFO_T. Not nice.

4) How does future extension work? Oh you probably have to pass SPDM_DEVICE_ATTESTATION_INFO_T as an opaque blob through to the VMM. Lovely, so only Intel needs a special Intel specific blob uAPI? Bah. This is a very bad idea.

5) Several unnecessary collections during connection setup.

6) Confusing/bad implementation of 'TSM selected nonce' and "recollection"

7) Lack of an API to do evidence colllection for the host, the only provided API always changes the guest visible information. Not nice.

Jason

Signature · 1 line
Alexey
maintainer
#113 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 8 lines · Alexey Kardashevskiy
Quoted 3 lines

Userspace gets to see KEY_EXCHANGE which means the verifier can prove the certificate binding, this is the ONLY way to let the verifier do this proof if it wants.

Say, the guest userspace can see the certificate chain and the measurements signed with the key from slotidX used for the session. The PSP promised it is the same slotid. Which part does this verifier not trust?

In 1.2 there is only one device public key so all PSP knows is that the public key that signed the key exchange is the same public key that signed the measurement. It doesn't know what certificate chains are actually in the HW for the same reasons nobody else knows.

Further, from a verifier perspective we don't have any crypto evidence that the PSP was involved in this process, and we don't have any crypto evidence that the certificate chain was bound to the device. It is not optimal.

Quoted 8 lines
Quoted 4 lines

Further with capture we have a nice primitive to pause and do slot selection before going to KEY_EXCHANGE. If we know the kernel has capture then the ideal FW design for 1.3 multikey is much simpler and clearer (more like ARM).

No CHALLENGE, then we read digests and certificates before KEY_EXHANGE so the digests won't come signed and you stated before you wanted them signed. I am confused.

Without challenge you can get a weaker version of signing by fetching GET_DIGESTS again after KEY_EXCHANGE inside the encrypted session. If it is the same as the plaintext fetch then succeed KEY_EXCHANGE.

At least in 1.2 there is only one key and slot slection doesn't effect it. So you end up with the 2nd GET_DIGESTS indirectly signed because it is in the symmetric stream.

This is inferior to CHALLENGE or 1.3 multikey since there is no evidence of GET_DIGESTS binding in the transcript, but as part of a compatibility option so 1.2 can have the same flow as 1.3 it would be helpful.

Quoted 16 lines
Quoted 16 lines

1) The uAPI presents a transcript interface, every message and reply individually presented to userspace. Perfectly future extensible to include GET_DIGESTS with 1.3 and whatever else comes down the road. These are consistent spec defined message blobs 100% the same for every single SPDM implementation and TSM.
The kernel will start with a partial transcript, but the API can carry a full one as we improve with no uAPI change. The guest will see partial transcript until/if vmm/guest changes are made

2) The uAPI presents the x509 certificate chains in a consistent spec defined way that userspace can hash back to GET_DIGESTS

3) The uAPI presents the signed measurement result and tdisp in a consistent spec defined way

Quoted 6 lines
Quoted 4 lines

4) We have the four step
Start
Get certificate
Finish using slot

I am trying to think of a simple DEV_CONNECT modification.

You'll have to do the full picture to support 1.3, I don't see a reason to do a half job right now. See my answer to Aneesh.

Quoted 2 lines

Then, if the userspace wanted another slotid - run DEV_CONNECT(slotidY). Slow but simple.

Oh? Since you setup IDE during DEV_CONNECT I'm surprised you can tear it down and reconnect it? I thought there were significant spec issues with resetting IDE?

Anyhow, assuming this somehow works for you and interoperates with other devices, userspace would have to do it and you won't be able to present the same interface as better drivers. Start -> Finish has to be under a single SPDM session protected by one signed transcript. You can't split it into two sessions and still have things make any sense from an API perspective.

Quoted 3 lines

The AI tells me we cannot change the slot in SPDM (1.2 or 1.3) after KEY_EXCHANGE which means restarting the SPDM session so we cannot just change the key on the go, right?

The slot isn't used in 1.2 once the connection is up. I guess this is correct in the sense you can't change the key being used, but in 1.3 you can get the measurement signed by different slots and thus keys.

But without establishing a GET_DIGESTS binding this is not a good idea. Part of the reason we want to ensure the verifier sees the GET_DIGEST binding is so we could use a different slot for GET_MEASUREMENTS and the verifier can tell the cert chain is still bound to the connection. Especially for auditing after booting when we can no longer trust that the OS is not lying.

Quoted 5 lines
Quoted 1 line

Accept

I keep missing the point of doing this on the host (in the TDISP or CMA case). The host "accepts" a PF by enabling IOMMU for that PF, not the PSP's (==TSM) job.

This is the standard SPDM flow. You do all the measurements then you ack back to the kernel that they are OK so can it should proceed to the next security step.

For IDE I can't think of any strong reason why it *has* to be setup after accept, but since other CPUs have split things up then they should get the right flow. Not doing IDE setup during accept means you are committed to and stuck in IDE mode during finish, which is not really the intended API design. See above.

However for something like NVMe OPAL key release we *must* have accept and it *must* gate sending the media decryption keys. Pretty much every other use of SPDM will have some step that follows accept that we don't want to happen before.

Remember this is intended to be a general interface for all SPDM use cases in the kernel.

Quoted 6 lines
Quoted 3 lines

Except for Intel all the guest defined digests can be calculated from the common spec messages. Well, maybe AMD has an issue, their spec is too vauge to tell exactly what bytes are digested.

True, I asked for some clarifications there recently, the new SEV TIO spec update is on its way. Thanks,

Hopefully they choose to digest the right things :\

Jason

maintainer
#114 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

In reply to Dave Jiang
Quoted 8 lines · Dave Jiang

(6) SPDM_DEVICE_ATTESTATION_INFO_T [ABI 3.3.2.4]: SPDM and TDISP capabilities, TDISP version, the requested chains, and MEASUREMENT. MEASUREMENT is the signed SPDM measurement log, Concatenate(VCA, GET_MEASUREMENTS_REQUEST1, MEASUREMENTS_RESPONSE1, ..., GET_MEASUREMENTS_REQUESTn, MEASUREMENTS_RESPONSEn) [SPDM 10.12.3]. The last MEASUREMENTS carries the signature. The TDX Module keeps the info's digest. The kernel keeps the info as immutable startup data.

I threw all this at AI and it could not answer a question..

If the guest obtains a SPDM_DEVICE_ATTESTATION_INFO_T where does it get the VCA and other transcript information from to validate the device signature? VCA transfer should be defined in the GHCI calls.

AI also complained about inconsistencies in the spec versions I grabbed around if the recollection also updates the GET_DEVICE_ATTESTATION_INFO_HASH. Your message says it does, and that is what I would require, FWIW.

*Every* GET_MEASUREMENT in the guest kernel needs to trace back to some crypto binding that TDX module was in fact the one that issued it on the given device in the current session.

I also think it is a mistake for TDX to hold only one digest over a large report that includes a measurement. That is going to be difficult to use in the guest and requires transfering an unlocked measurement to the guest which I really am really strongly against.

The other arches split the digests to cover SPDM defined objects directly and you can transfer them out of the transcript from GHCI.

Jason

#115 lore raw

RE: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

In reply to Jason Gunthorpe

snip

Quoted 9 lines
Quoted 9 lines

The flow really becomes as:

1) Do via RustSPDM:
GET_CERTIFICATE / CERTIFICATE
2) Userspace selects slots
3) TSM module does startup
4) Verify the cert chain of public key used for SPDM session establishment to determine if the key is trusted

Quoted 8 lines
Quoted 4 lines

For this TSM must expose in a trusted way the full cert chain and pub key used for SPDM session establishment or only a full cert chain and guarantee that the pub key on left cert chain was used for session establishment. This is doable for TSM.

There is no signature covering the slots in this case. Userspace tested them blind without knowing they are actually in the device. It is not ideal.

Actually you are right, I re-read SPDM 1.2 now and realized that I forgot that the final key exchange signature *only* covers the chain selected for the authentication and not the whole message exchange (including GET_CERTIFICATES). I have been teaching people secure design of crypto protocols for quite a while in past and usually take it for granted that any final transcript must cover *all* exchanged messages within AKE (this is quite basic security principle that people usually try to follow.. ). Not sure why SPDM 1.2 did it differently. That said, I understand now your points.

Quoted 8 lines
Quoted 4 lines

I am not very familiar with RMM, but if you do things within a single SPDM session (just stopping after you have fetched the certs from all slots and passed it to userspace to select the key/slot), then you dont need to complicate matters by including GET_DIGESTS/CHALLENGE.

The purpose of CHALLENGE is to authenticate the certificates to prevent any MIM from tampering them. It is cheap and closes this hole, I would definately expect it.

Agree now given that GET_CERTIFICATES are not authenticated.

Quoted 26 lines
Quoted 5 lines

TSM in this case just must ensure that SPDM session establishment has happened using the key corresponding to selected slot. TSM can do things like this because it has the final SPDM transcript as result of session establishment and can verify it by itself.

At least in the RMM flow the OS provides the PUBKEY to the RMM so this is never in any doubt. I agree that the TSM implementation has to provide the property that the PUBKEY's signature is checked during KEY_EXCHANGE and the OS must definitively know what PUBKEY was used.

Quoted 9 lines
Quoted 6 lines

Further, if you have a transcript that includes GET_DIGESTS then you don't *have* to select the slot early. The early slot selection mixes the certificate hash into the KEY_EXCHANGE, but if we did GET_DIGESTS then we already have that mixed in. Once you have a signed GET_DIGESTS then you can just request measurements on whatever slot you like without any relay attack.

You lost me on this. If you mean final SPDM transcript in step 3, I dont understand how having GET_DIGESTS helps....

One of the issues with 1.2 is you get a signature over only one slot's certificates during KEY_EXCHANGE. So you can't use the other slots certificates because you don't have any signed evidence to share with the verifier.

Quoted 7 lines

In 1.3 we can do GET_DIGESTS and include it in the transcript that KEY_EXCHANGE signs. The clear purpose of this spec change is to sign all the slots certificates in a way the verifier can see.

The net result is you can now freely use GET_MEASUREMENTS with any slot without any binding issue. Both the slot's leaf key and the certificate chain are signed by KEY_EXCHANGE.

Again, makes sense now in the light that it wasn’t done in SPDM 1.2.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

Unfortunately RMM doesn't provide an API for the guest to select the slot during GET_MEASUREMENTs and we don't have any way to pass the certificates from other slots to the guest. So from a guest RMM perspective the slot is fixed, attestation subsystem should report the single fixed slot (maybe not zero) and the other slots are blocked.

Quoted 7 lines
Quoted 4 lines

TDX currently also uses a fixed slot 0 also for step 3, BUT it does return you all cert chains from all slots, so you can actually make a full decision after step 3 whenever you trust the single key using any available cert chain slot.

IMHO this is not useful. Again without signing it is all forgable from the verifier perspective.

Agree.

Best Regards,
Elena

maintainer
#116 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 8 lines · Elena
Quoted 3 lines

There is no signature covering the slots in this case. Userspace tested them blind without knowing they are actually in the device. It is not ideal.

Actually you are right, I re-read SPDM 1.2 now and realized that I forgot that the final key exchange signature *only* covers the chain selected for the authentication and not the whole message exchange (including GET_CERTIFICATES).

Yeah, exactly, I was rather surprised by this too since it is such an modern obvious requirement in crypto design. It got fixed in 1.3 when you opt into multikey, and you can patch it with CHALLENGE on 1.2

So, unless anyone knows otherwise, my feeling is we should treat 1.3 multi-key as the target/goal implementation and make 1.2 look more like it using CHALLENGE. Working to obtain the end goal that a signature covers all certificates userspace sees, and userspace does not see unsigned certificates.

Jason

author maintainer
#117 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

In reply to Jason Gunthorpe
Quoted 16 lines · Jason Gunthorpe

On Tue, Nov 03, 2026 at 12:01:43PM +0000, Reshetova, Elena wrote:

We will need some multi-step sequence from the uABI perspective:

1) CTLV command START CONNECT:
TSM does:
GET_VERSION / VERSION (VCA: Version)
GET_CAPABILITIES / CAPABILITIES (VCA: Capabilities)
NEGOTIATE_ALGORITHMS / ALGORITHMS (VCA: Algorithms)
GET_DIGESTS / DIGESTS

2) CTLV commands:
query certificates. TSM will issue on demand:
GET_CERTIFICATE / CERTIFICATE (every slot in the slot mask, all chunks)
query VCA items

Quoted 10 lines

3) CTLV commands:
FINISH CONNECT with slot:
TSM for 1.2 does:
CHALLENGE(slot 0, fresh nonce) / CHALLENGE_AUTH
KEY_EXCHANGE(slot S) / KEY_EXCHANGE_RSP (clear text)
FINISH / FINISH_RSP (in session, opaque to host)
Or for 1.3 multi-key does:
KEY_EXCHANGE(slot S) / KEY_EXCHANGE_RSP (now includes DIGESTS and CERTIFICATE)
FINISH / FINISH_RSP (in session, opaque to host)

Does this split require us to guarantee that no GET_VERSION can be issued in between? Another GET_VERSION in the same requester context between START CONNECT and FINISH CONNECT would reset the responder's negotiated state and transcript, right?

If so, can we avoid this split and always use RustSPDM, with or without multi-key support?

Something like:
Kc: public key used to verify CHALLENGE_AUTH from slot C.
Ks: public key selected for session establishment by user using slot S. C and S may be different slots.

Host / RustSPDM:

    VCA -> GET_DIGESTS -> fetch certificate chains
    CHALLENGE(C) -> retain the messages and CHALLENGE_AUTH signature
    Stop communicating with the device.

Host / userspace:
Examine the discovery results.
Select slot S and validate its certificate chain/key Ks.

Host -> RMM/firmware:
Supply:
- C and Kc, S and Ks
- Algorithms

Fresh GET_VERSION -> CAPABILITIES -> ALGORITHMS
GET_DIGESTS immediately after VCA
GET_CERTIFICATE(C), GET_CERTIFICATE(S)
Check that Kc is the leaf public key in chain C. // Can the slot number change by now ? // Do we need rust spdm challenge auth response here?

Is it possible to validate Kc and Ks in the step above?

-aneesh

#118 lore raw

RE: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 27 lines
Quoted 11 lines · Jason Gunthorpe

On Tue, Nov 03, 2026 at 12:01:43PM +0000, Reshetova, Elena wrote:

We will need some multi-step sequence from the uABI perspective:

1) CTLV command START CONNECT:
TSM does:
GET_VERSION / VERSION (VCA: Version)
GET_CAPABILITIES / CAPABILITIES (VCA: Capabilities)
NEGOTIATE_ALGORITHMS / ALGORITHMS (VCA: Algorithms)
GET_DIGESTS / DIGESTS

Quoted 3 lines

2) CTLV commands:
query certificates. TSM will issue on demand:
GET_CERTIFICATE / CERTIFICATE (every slot in the slot mask, all

chunks)

Quoted 10 lines

query VCA items

3) CTLV commands:
FINISH CONNECT with slot:
TSM for 1.2 does:
CHALLENGE(slot 0, fresh nonce) / CHALLENGE_AUTH
KEY_EXCHANGE(slot S) / KEY_EXCHANGE_RSP (clear text)
FINISH / FINISH_RSP (in session, opaque to host)
Or for 1.3 multi-key does:
KEY_EXCHANGE(slot S) / KEY_EXCHANGE_RSP (now includes DIGESTS

Quoted 7 lines

and CERTIFICATE)

Quoted 2 lines

FINISH / FINISH_RSP (in session, opaque to host)

Does this split require us to guarantee that no GET_VERSION can be issued in between?

Yes, in my opinion TSM must enforce it because as you said, GET_VERSION resets everything.

Another GET_VERSION in the same requester context

Quoted 11 lines

between START CONNECT and FINISH CONNECT would reset the responder's negotiated state and transcript, right?

If so, can we avoid this split and always use RustSPDM, with or without multi-key support?

Something like:
Kc: public key used to verify CHALLENGE_AUTH from slot C.
Ks: public key selected for session establishment by user using slot S. C and S may be different slots.

Quoted 4 lines

Host / RustSPDM:

    VCA -> GET_DIGESTS -> fetch certificate chains
    CHALLENGE(C) -> retain the messages and CHALLENGE_AUTH signature
    Stop communicating with the device.

GET_DIGESTS only gets you digests, you still need GET_CERTIFICATES to actually fetch certs.

Quoted 11 lines

Host / userspace:
Examine the discovery results.
Select slot S and validate its certificate chain/key Ks.

Host -> RMM/firmware:
Supply:
- C and Kc, S and Ks
- Algorithms

Fresh GET_VERSION -> CAPABILITIES -> ALGORITHMS

How do you propose to deal with the fact that here TSM may agree with a device on different params than rustSPDM above?

Quoted 4 lines

GET_DIGESTS immediately after VCA
GET_CERTIFICATE(C), GET_CERTIFICATE(S)
Check that Kc is the leaf public key in chain C. // Can the slot number change
by now ?

In addition to VCA influencing the content of the slots, a device could have a FW upgrade in between rustSPDM step and this step and this could change the content of the slots.
But if you fully verify the actual cert chain and key itself you can reject such cases. So your way is also doable with additional checks, but I am worried about the problem to agree on the same VCA.

Best Regards,
Elena

Quoted 7 lines
    // Do we need rust spdm challenge auth response here?

Is it possible to validate Kc and Ks in the step above?

-aneesh

author maintainer
#119 lore raw

RE: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 32 lines · Elena
Quoted 32 lines
Quoted 11 lines · Jason Gunthorpe

On Tue, Nov 03, 2026 at 12:01:43PM +0000, Reshetova, Elena wrote:

We will need some multi-step sequence from the uABI perspective:

1) CTLV command START CONNECT:
TSM does:
GET_VERSION / VERSION (VCA: Version)
GET_CAPABILITIES / CAPABILITIES (VCA: Capabilities)
NEGOTIATE_ALGORITHMS / ALGORITHMS (VCA: Algorithms)
GET_DIGESTS / DIGESTS

Quoted 3 lines

2) CTLV commands:
query certificates. TSM will issue on demand:
GET_CERTIFICATE / CERTIFICATE (every slot in the slot mask, all

chunks)

Quoted 10 lines

query VCA items

3) CTLV commands:
FINISH CONNECT with slot:
TSM for 1.2 does:
CHALLENGE(slot 0, fresh nonce) / CHALLENGE_AUTH
KEY_EXCHANGE(slot S) / KEY_EXCHANGE_RSP (clear text)
FINISH / FINISH_RSP (in session, opaque to host)
Or for 1.3 multi-key does:
KEY_EXCHANGE(slot S) / KEY_EXCHANGE_RSP (now includes DIGESTS

and CERTIFICATE)

Quoted 2 lines

FINISH / FINISH_RSP (in session, opaque to host)

Quoted 6 lines
Quoted 2 lines

Does this split require us to guarantee that no GET_VERSION can be issued in between?

Yes, in my opinion TSM must enforce it because as you said, GET_VERSION resets everything.

How can TSM enforce this? Another subsystem could issue GET_VERSION through the DOE mailbox. IIUC, TSM would only detect a transcript mismatch when KEY_EXCHANGE_RSP validation fails. Is that correct?

Quoted 13 lines
Quoted 13 lines

Another GET_VERSION in the same requester context
between START CONNECT and FINISH CONNECT would reset the responder's negotiated state and transcript, right?

If so, can we avoid this split and always use RustSPDM, with or without multi-key support?

Something like:
Kc: public key used to verify CHALLENGE_AUTH from slot C.
Ks: public key selected for session establishment by user using slot S. C and S may be different slots.

Quoted 8 lines
Quoted 4 lines

Host / RustSPDM:

    VCA -> GET_DIGESTS -> fetch certificate chains
    CHALLENGE(C) -> retain the messages and CHALLENGE_AUTH signature
    Stop communicating with the device.

GET_DIGESTS only gets you digests, you still need GET_CERTIFICATES to actually fetch certs.

yes that is correct.

Quoted 11 lines
Quoted 11 lines

Host / userspace:
Examine the discovery results.
Select slot S and validate its certificate chain/key Ks.

Host -> RMM/firmware:
Supply:
- C and Kc, S and Ks
- Algorithms

Quoted 6 lines
Quoted 1 line
    Fresh GET_VERSION -> CAPABILITIES -> ALGORITHMS

How do you propose to deal with the fact that here TSM may agree with a device on different params than rustSPDM above?

I suppose we would need to pass all of those parameters for the host -> RMM/firmware interaction. I had assumed that the algorithms were the only negotiated parameters needed for SPDM session establishment. Would validating Kc and Ks require passing additional details from the RustSPDM exchange to the firmware?

Quoted 7 lines
Quoted 6 lines

GET_DIGESTS immediately after VCA
GET_CERTIFICATE(C), GET_CERTIFICATE(S)
Check that Kc is the leaf public key in chain C. // Can the slot number change
by now ?

Quoted 9 lines

In addition to VCA influencing the content of the slots, a device could have a FW upgrade in between rustSPDM step and this step and this could change the content of the slots.
But if you fully verify the actual cert chain and key itself you can reject such cases. So your way is also doable with additional checks, but I am worried about the problem to agree on the same VCA.

My main question is whether we should avoid splitting the context and relying on the host not to disrupt the sequence. I wonder whether that would be a poor API design and whether we can avoid it. Is that a goal we should pursue?

-aneesh

maintainer
#120 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 5 lines · Aneesh Kumar K.V
Quoted 5 lines
Quoted 2 lines

Does this split require us to guarantee that no GET_VERSION can be issued in between?

Yes, in my opinion TSM must enforce it because as you said, GET_VERSION resets everything.

+1

Quoted 3 lines

How can TSM enforce this? Another subsystem could issue GET_VERSION through the DOE mailbox. IIUC, TSM would only detect a transcript mismatch when KEY_EXCHANGE_RSP validation fails. Is that correct?

Firstly I think nothing but the attestation subsystem driver should operate the DOE mailbox, certainly not the SPDM flow inside it.

Secondly, yes, the KEY_EXCHANGE should blow up if the session is interfered with in some way, that is one of it's critical security tasks.

Third, the kernel needs to keep track of the SPDM session 'generation' directly and expose it to userspace so there is an unbreakable continuity from START CONNECT to the final ACCEPT.

Quoted 5 lines

I suppose we would need to pass all of those parameters for the host -> RMM/firmware interaction. I had assumed that the algorithms were the only negotiated parameters needed for SPDM session establishment. Would validating Kc and Ks require passing additional details from the RustSPDM exchange to the firmware?

This is just backwards. The TSM should be in control of the session from start to end, and the kernel should be inspecting the plain text messages it sends. We need the TSM to send all the messages we need, like GET_DIGESTS, GET_CERTIFICATES and so on.

Doing two sesssions is just an inherently less secure idea. We should not do this unless we get really really stuck. I prefer we change the TSM interfaces, ie in RMM, to work optimally so we don't need to try to do this.

Nobody has every done any of this before, all the specs are copying each other with incomplete implementations. Nobody should be insisting they can't change.

Quoted 4 lines

My main question is whether we should avoid splitting the context and relying on the host not to disrupt the sequence. I wonder whether that would be a poor API design and whether we can avoid it. Is that a goal we should pursue?

The host can interfere with the TSM's DOE operations, that is part of the threat model and countered by the KEY_EXCHANGE sequence. I don't see any reason to worry about this as a problem, and we should take advantage of it to make the flow work naturally under a single session.

Jason

author maintainer
#121 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

In reply to Jason Gunthorpe
Quoted 26 lines · Jason Gunthorpe
Quoted 16 lines · Elena
Quoted 16 lines
Quoted 13 lines

AI tells me there are a couple of reasonable ways to implement slot selection and avoid downgrade attacks:

1) With 1.4 match GET_DIGESTS and MULTI_KEY_CONN_RSP=true
1) Do via RustSPDM:
GET_DIGESTS / DIGESTS
GET_CERTIFICATE / CERTIFICATE
2) Userspace selects slots
3) TSM module does startup and also issues 'GET_DIGESTS' as part of the signed transcript
4) Confirm that the digests from #1 match the digests from #2 in the TSM transcript.

I am currently doing something similar to the above.

Quoted 8 lines
Quoted 2 lines

https://git.gitlab.arm.com/linux-arm/linux-cca/-
/commit/0657d167aee1ba43dd2765d99b5e3244b83c6ea6

If I understand this correctly, this is not quite the option 1 that Jason proposed above. You dont use GET_DIGESTS and I dont see a binding between cert chain discovered prior to TSM SPDM session and the one during the TSM SPDM session.
Or am I misunderstanding it?

Quoted 5 lines

Right..

I have poked at this alot more and it seems a bit different than I originally was told, especially if we narrow it to RMM only.

Wouldn't comparing the selected certificate chains, together with successful RMM session establishment, be sufficient to bind the selected chain?

IIUC RMM first retrieves the chain before establishing a secure session. We compare that chain with the one retrieved through Rust SPDM, then supply its leaf public key through SET_PUBKEY. RMM subsequently verifies the KEY_EXCHANGE_RSP signature using that key, with the selected certificate-chain hash included in the signed transcript.

The certificate chain comparison alone does not prove possession of the private key, but the subsequent key exchange should provide that proof right? A device returning another device’s certificate chain would therefore pass the comparison but fail session establishment unless it could authenticate using that key.

I haven't read the rest of your email yet. I need to review it and compare the SPDM versions you cited before making any changes.

-aneesh

maintainer
#122 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 30 lines · Aneesh Kumar K.V
Quoted 28 lines · Jason Gunthorpe
Quoted 16 lines · Elena
Quoted 16 lines
Quoted 13 lines

AI tells me there are a couple of reasonable ways to implement slot selection and avoid downgrade attacks:

1) With 1.4 match GET_DIGESTS and MULTI_KEY_CONN_RSP=true
1) Do via RustSPDM:
GET_DIGESTS / DIGESTS
GET_CERTIFICATE / CERTIFICATE
2) Userspace selects slots
3) TSM module does startup and also issues 'GET_DIGESTS' as part of the signed transcript
4) Confirm that the digests from #1 match the digests from #2 in the TSM transcript.

I am currently doing something similar to the above.

Quoted 8 lines
Quoted 2 lines

https://git.gitlab.arm.com/linux-arm/linux-cca/-
/commit/0657d167aee1ba43dd2765d99b5e3244b83c6ea6

If I understand this correctly, this is not quite the option 1 that Jason proposed above. You dont use GET_DIGESTS and I dont see a binding between cert chain discovered prior to TSM SPDM session and the one during the TSM SPDM session.
Or am I misunderstanding it?

Right..

Quoted 7 lines
Quoted 3 lines

I have poked at this alot more and it seems a bit different than I originally was told, especially if we narrow it to RMM only.

Wouldn't comparing the selected certificate chains, together with successful RMM session establishment, be sufficient to bind the selected chain?

Only one chain can be checked that way, the chain that was hashed into KEY_EXCHANGE.

The point is to avoid downgrade attacks where you are selecting chains but the "best" chain was hidden by an attacker so you use something weaker.

This is less important for 1.2 since there is only one private key, but it is essential for 1.3 with multi-key and crypto agility that we don't allow an attacker to hide a slot from the negotiation. Eg to hide the strong crypto slot option or something.

Quoted 3 lines

The certificate chain comparison alone does not prove possession of the private key, but the subsequent key exchange should provide that proof right?

Yes, there is only one private key in SPDM 1.2 and the initial KEY_EXCHANGE proves the remote possess it.

Read the later email to Elena first, it is better.

Jason

#123 lore raw

RE: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

In reply to Jason Gunthorpe
Quoted 45 lines · Elena
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

It can't defer the session. The TDX Module runs the whole SPDM session setup inside TDH.SPDM.CONNECT, and the host relays its DOE messages without interpreting them, so there is no defined point to stop after the certificates. The chains come back in the device info only once TDH.SPDM.CONNECT completes (TDX Connect ABI Reference

Spec

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

2.1 v0.66, 4.2.20.1).

Yeah, its fine. TDX will have to do what Aneesh proposed for ARM, and use use the Rust SPDM Driver to operate DOE prior to calling TDH.SPDM.CONNECT. This will allow discovering what is in the slots and passing that information to userspace.

Quoted 7 lines

I am somewhat confused by this.

1. You are saying that prior to establishing a
secure SPDM session, you will use unsecure DOE mechanism to discover available cert chains. Here you have to take into account that anything you get at this step is not trusted. A malicious device could send you any cert chains from another legitimate device.

I poked at this with AI for a while.. While nothing about SPDM slots seems particularly clean it can be made to work. It looks like 1.4 improves things meaningfully.

Quoted 3 lines

2. Next, you will choose a cert slot to be used for SPDM authentication and secure session establishment (slot 0 initially in this patch) and allow everything to happen.

Yep

Quoted 4 lines

Now, who guarantees that a cert chain that you saw
at step 1 for the selected slot is the same that is going to be used in actual SPDM connection? Who is verifying/ensuring this? Kernel? Userspace?

Not sure, it would make sense if the kernel can do some of this with rustspdm, but there are alot of details here that I can't guess what is best.

AI tells me there are a couple of reasonable ways to implement slot selection and avoid downgrade attacks:

Quoted 9 lines

1) With 1.4 match GET_DIGESTS and MULTI_KEY_CONN_RSP=true
1) Do via RustSPDM:
GET_DIGESTS / DIGESTS
GET_CERTIFICATE / CERTIFICATE
2) Userspace selects slots
3) TSM module does startup and also issues 'GET_DIGESTS' as part of the signed transcript
4) Confirm that the digests from #1 match the digests from #2 in the TSM transcript.

We don't issue GET_DIGESTS currently in our SPDM flow, but it could be changed in principle.

Quoted 14 lines

2) Do slot selection and use CHALLENGE to prevent downgrade attacks.
1) Do via RustSPDM:
GET_DIGESTS / DIGESTS
GET_CERTIFICATE / CERTIFICATE
CHALLENGE / CHALLENGE_AUTH (using slot 0)
3) Kernel RustSPDM can check that CHALENGE_AUTH is self consistent
2) Supply the certificates to userspace
3) Userspace choose a slot
4) TSM does KEY_EXCHANGE
5) Confirm the certificate of the selected slot signs the transcript from TSM
6) Verifier confirms that the #1 transcript is acceptable

Quoted 1 line

I think this is weaker than #1, but not that much..

It is definitely more complex overall. The only positive part of this option I can see so far is the absence of GET_DIGESTS in the step 4.

Quoted 6 lines

3) Do slot selection without CHALLENGE and then do it again after establishing the session to confirm nothing has changed.

Requires TSM to be able to return slots after opening the session, CCA can't at least.

TDX can return you all slots as a result of SPDM successful session establishment, but I do understand not everyone can.

Quoted 4 lines

It may be we simply don't securely support multi-slot until 1.4 spec support in TSMs. Per 1.2 can be flagged as less secure in the API or something?

We currently don't support multi-key either, so it is in control of both SPDM responder and requestor that such SPDM capability is not selected during initial exchange. If TSM refuses to enable it, it should be ok.
But the overall design and especially userspace ABIs should be imo future proof and we know multi-key is coming.

Best Regards,
Elena.

Quoted 2 lines

Jason

#124 lore raw

RE: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

In reply to Jason Gunthorpe
Quoted 65 lines

-----Original Message-----
From: Jason Gunthorpe <[email protected]>
Sent: Friday, October 30, 2026 3:16 PM
To: Reshetova, Elena <[email protected]>
Cc: Jiang, Dave <[email protected]>; Aneesh Kumar K.V (Arm) <[email protected]>; [email protected]; Jiri Pirko <[email protected]>; Tian, Kevin <[email protected]>; Alexey Kardashevskiy <[email protected]>; Xu Yilun <[email protected]>; Catalin Marinas <[email protected]>; Suzuki K Poulose <[email protected]>; Steven Price <[email protected]>; Kiryl Shutsemau <[email protected]>; Edgecombe, Rick P <[email protected]>; Dave Hansen <[email protected]>; Jonathan Cameron <[email protected]>; Bjorn Helgaas <[email protected]>; Ashish Kalra <[email protected]>; Tom Lendacky <[email protected]>; John Allen <[email protected]>; Will Deacon <[email protected]>; Mark Rutland <[email protected]>; [email protected]
Subject: Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 5 lines · Elena
Quoted 5 lines
Quoted 5 lines

It can't defer the session. The TDX Module runs the whole SPDM session setup inside TDH.SPDM.CONNECT, and the host relays its DOE messages without interpreting them, so there is no defined point to stop after the certificates. The chains come back in the device info only once TDH.SPDM.CONNECT completes (TDX Connect ABI Reference

Spec

Quoted 7 lines
Quoted 6 lines
Quoted 1 line

2.1 v0.66, 4.2.20.1).

Yeah, its fine. TDX will have to do what Aneesh proposed for ARM, and use use the Rust SPDM Driver to operate DOE prior to calling TDH.SPDM.CONNECT. This will allow discovering what is in the slots and passing that information to userspace.

Quoted 7 lines

I am somewhat confused by this.

1. You are saying that prior to establishing a
secure SPDM session, you will use unsecure DOE mechanism to discover available cert chains. Here you have to take into account that anything you get at this step is not trusted. A malicious device could send you any cert chains from another legitimate device.

I poked at this with AI for a while.. While nothing about SPDM slots seems particularly clean it can be made to work. It looks like 1.4 improves things meaningfully.

Quoted 3 lines

2. Next, you will choose a cert slot to be used for SPDM authentication and secure session establishment (slot 0 initially in this patch) and allow everything to happen.

Yep

Quoted 4 lines

Now, who guarantees that a cert chain that you saw
at step 1 for the selected slot is the same that is going to be used in actual SPDM connection? Who is verifying/ensuring this? Kernel? Userspace?

Not sure, it would make sense if the kernel can do some of this with rustspdm, but there are alot of details here that I can't guess what is best.

AI tells me there are a couple of reasonable ways to implement slot selection and avoid downgrade attacks:

Quoted 9 lines

1) With 1.4 match GET_DIGESTS and MULTI_KEY_CONN_RSP=true
1) Do via RustSPDM:
GET_DIGESTS / DIGESTS
GET_CERTIFICATE / CERTIFICATE
2) Userspace selects slots
3) TSM module does startup and also issues 'GET_DIGESTS' as part of the signed transcript
4) Confirm that the digests from #1 match the digests from #2 in the TSM transcript.

We can also simplify this further by not using GET_DIEGESTS but assuming TSM can return the cert chain for selected slot back to kernel/userspace in a trusted way. TDX does it by returning the cert chain (actually for all slots if asked, but it is redundant here) on successful SPDM.CONNECT and there is a trusted TDX Module provided digest covering this info.

So, option 1 becomes like:

1) With 1.4 match GET_DIGESTS and MULTI_KEY_CONN_RSP=true
1) Do via RustSPDM:
GET_CERTIFICATE / CERTIFICATE
2) Userspace selects slots
2a) Calculate a digest for the selected slot
3) TSM module does startup
4) Extract cert chain (or only its digest) from info provided by TSM.
Verify that the digest from #2a match the digest calculated based on trusted info provided by TSM.

Opinions?

Best Regards,
Elena.

maintainer
#125 lore raw

Re: [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance

Quoted 9 lines · Elena

We can also simplify this further by not using GET_DIEGESTS but assuming TSM can return the cert chain for selected slot back to kernel/userspace in a trusted way. TDX does it by returning the cert chain (actually for all slots if asked, but it is redundant here) on successful SPDM.CONNECT and there is a trusted TDX Module provided digest covering this info.

So, option 1 becomes like:

Quoted 8 lines

1) With 1.4 match GET_DIGESTS and MULTI_KEY_CONN_RSP=true
1) Do via RustSPDM:
GET_CERTIFICATE / CERTIFICATE
2) Userspace selects slots
2a) Calculate a digest for the selected slot
3) TSM module does startup
4) Extract cert chain (or only its digest) from info provided by TSM.
Verify that the digest from #2a match the digest calculated based on trusted info provided by TSM.

See my larger email, I don't think this is how SPDM is intended to be used, you should have a GET_DIGESTS that is covered by a signature and included in a transcript..

I see only three options:
1) Use a single slot, so KEY_EXCHANGE includes a hash of the single slot cert chain
2) Use GET_DIGESTS/CHALLENGE on 1.2 followed by KEY_EXCHANGE. Maybe use the same nonce for both signatures so it can't be stale.
3) Use the new multi-key flow on 1.3 which already includes GET_DIGESTS in the transcript hashed by KEY_EXCHANGE

These all achieve the same end goal as what the 1.3 spec did, you end up with a transcript signed by KEY_EXCHANGE that identifies all the legal certificates.

IMHO there is no reason to deviate from this, so the uAPI should be designed around it.

Thus I don't think TDX should fake this with a second GET_CERTIFICATES pass inside the established session and try to skip the signed digests..

Jason

author maintainer
#126 lore raw

RFC PATCH 11/11 virt: coco: arm-cca-guest: Refresh selected evidence against trusted digests

In reply to Aneesh Kumar K.V (Arm)

Refresh either measurements with a 32-byte challenge or the interface report without one. Reject other objects and unsupported flags before issuing native requests.

Verify refreshed bytes against the trusted digest, hash algorithm, certificate slot and lock sequence. Check that the other cached object's sequence is unchanged, then replace only the verified selected cache entry. Keep the previous cache intact on failure and document refresh constraints and generation invalidation.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Jason Gunthorpe <[email protected]>
---
 drivers/virt/coco/arm-cca-guest/main.c | 134 +++++++++++++++----------
 1 file changed, 83 insertions(+), 51 deletions(-)
drivers/virt/coco/arm-cca-guest/main.c +83 -51
index f50f3e660bbc..d9de5d6c0e37 100644
@@ -174,86 +174,94 @@ static void unregister_cca_tsm_report(void *data)
 
 #ifdef CONFIG_PCI_TSM
 
-static int __maybe_unused
-cca_update_dev_measurements(struct pci_dev *pdev, const u8 *nonce)
+static int cca_refresh_dev_evidence(struct pci_dev *pdev,
+		enum pci_tsm_evidence_type type, const u8 *nonce)
 {
-	int ret;
-	void *measurements;
-	size_t measurements_size;
-	int vdev_id = rsi_vdev_id(pdev);
-	struct pci_tsm_evidence *evidence;
-	struct rsi_vdevice_info *dev_info;
-	struct pci_tsm_evidence_object *obj;
 	struct cca_guest_dsc *dsc = to_cca_guest_dsc(pdev);
+	struct pci_tsm_evidence *evidence = &dsc->pci.base_tsm.evidence;
+	struct pci_tsm_evidence_object *obj = &evidence->obj[type];
+	struct rsi_vdevice_info *dev_info;
+	bool report = type == PCI_TSM_EVIDENCE_TYPE_REPORT;
+	int vdev_id = rsi_vdev_id(pdev);
+	void *data;
+	u8 *digest;
+	u8 expected_hash_algo;
+	size_t size;
+	int object_type;
+	int ret;
 
-	/* Regenerate the measurement from the device */
-	ret = rhi_update_vdev_measurements_cache(pdev, nonce);
-	if (ret) {
-		pci_err(pdev, "failed to update device measurements from device (%d)\n", ret);
-		return ret;
+	if (report) {
+		object_type = RHI_DA_OBJECT_INTERFACE_REPORT;
+		ret = rhi_update_vdev_interface_report_cache(pdev);
+	} else {
+		object_type = RHI_DA_OBJECT_MEASUREMENT;
+		ret = rhi_update_vdev_measurements_cache(pdev, nonce);
 	}
-
-	ret = rhi_read_cached_object(vdev_id, RHI_DA_OBJECT_MEASUREMENT,
-				     &measurements, &measurements_size);
-	if (ret) {
-		pci_err(pdev, "failed to get device measurements from the host (%d)\n", ret);
+	if (ret)
 		return ret;
-	}
 
+	ret = rhi_read_cached_object(vdev_id, object_type, &data, &size);
+	if (ret)
+		return ret;
 	dev_info = kmalloc(sizeof(*dev_info), GFP_KERNEL);
 	if (!dev_info) {
 		ret = -ENOMEM;
-		goto free_measurements;
+		goto free_data;
 	}
-
 	if (rsi_vdev_get_info(vdev_id, virt_to_phys(dev_info))) {
-		pci_err(pdev, "failed to get device digests (%d)\n", ret);
 		ret = -EIO;
 		goto free_dev_info;
 	}
 
-	/* Make sure no unexpected lock/unlock operation happened from guest */
-	if (dsc->dev_info.lock_seq != dev_info->lock_seq) {
-		pci_err(pdev, "Unexpected lock/unlock operation from host (%d)\n", ret);
+	if (evidence->digest_algo == HASH_ALGO_SHA256)
+		expected_hash_algo = RSI_HASH_SHA_256;
+	else
+		expected_hash_algo = RSI_HASH_SHA_512;
+
+	/* Keep every cached object bound to the same locked device. */
+	if (dev_info->lock_seq != dsc->dev_info.lock_seq || dev_info->id_index ||
+	    dev_info->hash_algo != expected_hash_algo) {
 		ret = -EIO;
 		goto free_dev_info;
 	}
 
-	/*
-	 * Verify that the digests of the provided reports match with the
-	 * digests from RMM
-	 */
-	ret = cca_verify_digest(dev_info->hash_algo, measurements,
-				measurements_size, dev_info->meas_digest);
-	if (ret) {
-		pci_err(pdev, "RMM provided digest mismatch (%d)\n", ret);
-		goto free_dev_info;
+	if (report) {
+		if (dev_info->meas_seq != dsc->dev_info.meas_seq) {
+			ret = -EIO;
+			goto free_dev_info;
+		}
+		digest = dev_info->report_digest;
+	} else {
+		if (dev_info->report_seq != dsc->dev_info.report_seq) {
+			ret = -EIO;
+			goto free_dev_info;
+		}
+		digest = dev_info->meas_digest;
 	}
 
-	/* fill evidence details */
-	evidence = &dsc->pci.base_tsm.evidence;
+	ret = cca_verify_digest(dev_info->hash_algo, data, size, digest);
+	if (ret)
+		goto free_dev_info;
 
-	/* Now update the evidence under lock. */
+	/* Publish only after verification; failures preserve the old cache. */
 	down_write(&evidence->lock);
-	evidence->generation = dev_info->meas_seq;
-
-	obj = &evidence->obj[PCI_TSM_EVIDENCE_TYPE_MEASUREMENTS];
-	if (obj->data)
-		kvfree(obj->data);
-	obj->data = measurements;
-	obj->len = measurements_size;
-
-	dsc->dev_info.meas_seq = dev_info->meas_seq;
-	memcpy(dsc->dev_info.meas_digest, dev_info->meas_digest, SHA512_DIGEST_SIZE);
+	kvfree(obj->data);
+	obj->data = data;
+	obj->len = size;
+	memcpy(obj->digest, digest, SHA512_DIGEST_SIZE);
+	if (report)
+		dsc->dev_info.report_seq = dev_info->report_seq;
+	else
+		dsc->dev_info.meas_seq = dev_info->meas_seq;
+	evidence->generation++;
 	up_write(&evidence->lock);
-
 	kfree(dev_info);
 	return 0;
 
 free_dev_info:
 	kfree(dev_info);
-free_measurements:
-	kvfree(measurements);
+free_data:
+	kvfree(data);
 	return ret;
 }
 
@@ -506,6 +514,29 @@ static int cca_tsm_accept(struct pci_dev *pdev)
 	return __cca_tsm_accept(pdev, dsc->dev_info.lock_seq);
 }
 
+static int cca_tsm_refresh_evidence(struct pci_tsm *tsm,
+		enum pci_tsm_evidence_type type, unsigned long flags,
+		void *nonce, size_t nonce_len)
+{
+	if (flags)
+		return -EOPNOTSUPP;
+
+	switch (type) {
+	case PCI_TSM_EVIDENCE_TYPE_MEASUREMENTS:
+		if (nonce_len != 32)
+			return -EINVAL;
+		break;
+	case PCI_TSM_EVIDENCE_TYPE_REPORT:
+		if (nonce_len)
+			return -EINVAL;
+		break;
+	default:
+		return -EOPNOTSUPP;
+	}
+
+	return cca_refresh_dev_evidence(tsm->pdev, type, nonce);
+}
+
 static struct pci_tsm_ops cca_devsec_pci_ops = {
 	.owner = THIS_MODULE,
 	.evidence_types = BIT(PCI_TSM_EVIDENCE_TYPE_CERT0) |
@@ -515,6 +546,7 @@ static struct pci_tsm_ops cca_devsec_pci_ops = {
 	.lock = cca_tsm_lock,
 	.unlock = cca_tsm_unlock,
 	.accept	 = cca_tsm_accept,
+	.refresh_evidence = cca_tsm_refresh_evidence,
 };
 
 static void cca_devsec_tsm_remove(void *tsm_dev)
Signature · 1 line
2.43.0
#127 lore raw
In reply to Aneesh Kumar K.V (Arm)
Quoted 17 lines · Aneesh Kumar K.V (Arm)

This series connects PCI/TSM to the common CTLV attestation interface. Userspace can discover a device's evidence objects, retrieve them, and accept the evidence before the kernel establishes a secure link or moves a guest device into TDISP RUN. It replaces the PCI/TSM netlink evidence interface while retaining connect, disconnect, lock and unlock in sysfs.

This series builds on the CTLV attestation series [1] and Arm CCA device-assignment support. It covers PCI/TSM attestation through certificate slot-zero.

The development tree is available at:

https://gitlab.arm.com/linux-arm/linux-cca.git cca/topics/cca-da-attestation

That branch also includes the follow-up Rust SPDM certificate-slot discovery work, generic attestation fixes, and CTLV tooling fixes.

Quoted 8 lines

[1] https://lore.kernel.org/all/[email protected]

The host flow separates identity collection from session and IDE setup:

sysfs connect

    -> collect and cache the certificate chain
  DEVICE_GET / EVIDENCE_GET
    -> discover available objects and retrieve the chain for verification

Is it possible that these two steps combined to one? They collect, cache the certificates, then hand over the cache to userspace when requested. Why not just use one user interface to collect and hand over the certificates?

And I see a further action is to use kernel native SPDM (rust SPDM) to finish these 2 steps, so they will have nothing to do with TSM any more.

Could the flow be:

1. DEVICE_GET/EVIDENCE_GET

	-> collect and retrieve the certificates via native SPDM
2. sysfs connect
	-> establish the *TSM-based* secure session and IDE streams
3. sysfs disconnect
	-> release the *TSM-based* streams and identity context

This way we don't even touch the existing host side TSM.

Quoted 172 lines

EVIDENCE_ACCEPT

    -> establish the secure session and IDE streams
  sysfs disconnect
    -> release the identity context and any established streams

Both AMD SEV-TIO and Arm CCA host drivers implement this flow using their existing firmware interfaces. AMD pauses the firmware SPDM exchange after collecting the certificate chain, before sending authentication or session establishment requests. CCA creates the PDEV and collects its certificate chain during connect, then completes session and stream setup on acceptance. After both conversions, every link driver must supply an evidence_accept callback; connect collects identity evidence without establishing streams.

This is the slot-zero baseline: the AMD and CCA host drivers expose their slot-zero certificate chains. A follow-up series adds shared SPDM identity discovery and selection among discovered certificate slots. The common interface supports any certificate slot advertised by the driver, and the same evidence-get and evidence-accept commands apply to both series.

For a guest device, sysfs lock collects the initial evidence and creates the CTLV instance. Userspace can optionally refresh supported objects, retrieve the cached evidence, verify it, and issue EVIDENCE_ACCEPT to enter RUN. The CCA guest driver supports refreshing measurements with a 32-byte challenge or an interface report without a challenge. It checks the new bytes against trusted digests and device state before replacing the selected cached object. Refresh is disabled after the device enters RUN.

EVIDENCE_GET reads the cached snapshot, so its challenge attribute becomes optional. EVIDENCE_REFRESH requests new evidence and invalidates previous evidence generations and acceptance. A failed backend refresh also invalidates them and requires recovery.

EVIDENCE_ACCEPT replaces the separate DEVSEC_RUN operation. Clearing acceptance leaves the hardware state unchanged: a guest device can remain in RUN, and host IDE streams remain established. DEVSEC_STATE_GET therefore continues to report acceptance and device state separately. Disconnect and unlock perform teardown.

The common attestation changes let each instance expose the operations and evidence objects its device supports. This allows host links and guest devices to share the PCI attestation implementation while advertising different capabilities. Additional locking and generation helpers let PCI/TSM coordinate state changes, evidence invalidation and notifications with CTLV operations.

The PCI child family adds STATE_GET and EVIDENCE_REFRESH to the inherited attestation operations. An instance appears only after a successful connect or lock and is removed on disconnect or unlock. DEVICE_GET includes the PCI name so userspace can associate an instance with its device.

The first five patches prepare the common attestation interface. The next three define and implement the PCI integration, including its locking helpers. The final three convert AMD and CCA host link setup and add CCA guest evidence refresh. The series builds on the existing CTLV attestation and PCI/TSM device-assignment support.

Notes:
* I used Codex to help implement, review and organize the series.

Cc Jiri Pirko <[email protected]>
Cc Kevin Tian <[email protected]>
Cc Alexey Kardashevskiy <[email protected]>
Cc Xu Yilun <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Suzuki K Poulose <[email protected]>
Cc Steven Price <[email protected]>
Cc Kiryl Shutsemau <[email protected]>
Cc Rick Edgecombe <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Ashish Kalra <[email protected]>
Cc Tom Lendacky <[email protected]>
Cc John Allen <[email protected]>
Cc Will Deacon <[email protected]>
Cc Mark Rutland <[email protected]>

Aneesh Kumar K.V (Arm) (11):
attestation: Restrict inherited operations per instance
attestation: Filter evidence objects per instance
attestation: Enter secure operation when evidence is accepted
attestation: Bind object selection to accepted evidence snapshots
attestation: Make the evidence-get challenge attribute optional PCI/TSM: Describe the PCI attestation control family
attestation: Add attestation helpers for PCI/TSM integration PCI/TSM: Bind CTLV attestation to connected and locked contexts crypto/ccp: Defer SEV-TIO link setup until evidence acceptance
virt: coco: arm-cca-host: Publish slot zero and establish streams
after acceptance
virt: coco: arm-cca-guest: Refresh selected evidence against trusted
digests

 Documentation/ABI/testing/sysfs-bus-pci       |  108 +-
 Documentation/ABI/testing/sysfs-class-tsm     |    9 +-
 .../ctlv/abi/ctlv-attestation-pci.yaml        |   43 +
 Documentation/ctlv/abi/ctlv-attestation.yaml  |   59 +-
 Documentation/ctlv/abi/families.registry.yaml |    1 +
 Documentation/ctlv/families.yaml              |    1 +
 Documentation/ctlv/generated-files.yaml       |   11 +
 .../ctlv/specs/ctlv-attestation-pci.yaml      |   79 +
 .../ctlv/specs/ctlv-attestation.yaml          |   40 +-
 Documentation/driver-api/attestation.rst      |   56 +
 Documentation/driver-api/pci/tsm.rst          |  160 +-
 Documentation/netlink/specs/pci-tsm.yaml      |  151 --
 drivers/attestation/core/core.c               |  123 +-
 drivers/attestation/core/ctlv.c               |  156 +-
 drivers/attestation/core/internal.h           |    3 +
 .../generated/ctlv_attestation_gen.c          |   45 +-
 .../generated/ctlv_attestation_gen.h          |   76 +-
 drivers/attestation/providers/sim.c           |   40 +-
 drivers/attestation/tests/core_kunit.c        |   72 +-
 drivers/crypto/ccp/sev-dev-tio.c              |   17 +-
 drivers/crypto/ccp/sev-dev-tio.h              |    5 +
 drivers/crypto/ccp/sev-dev-tsm.c              |  188 +-
 drivers/pci/Kconfig                           |    3 +
 drivers/pci/tsm/Makefile                      |    6 +-
 drivers/pci/tsm/attestation.c                 |  525 +++++
 drivers/pci/tsm/core.c                        |  431 +++--
 drivers/pci/tsm/ctlv_attestation_pci_gen.c    |  111 ++
 drivers/pci/tsm/ctlv_attestation_pci_gen.h    |  100 +
 drivers/pci/tsm/evidence.c                    |  274 ---
 drivers/pci/tsm/internal.h                    |   26 +
 drivers/pci/tsm/netlink.c                     |   43 -
 drivers/pci/tsm/netlink.h                     |   23 -
 drivers/virt/coco/arm-cca-guest/main.c        |  168 +-
 drivers/virt/coco/arm-cca-guest/rsi-da.c      |   16 +-
 drivers/virt/coco/arm-cca-host/main.c         |  143 +-
 drivers/virt/coco/arm-cca-host/rmi-da.c       |    7 +-
 drivers/virt/coco/arm-cca-host/rmi-da.h       |    2 +
 include/linux/attestation.h                   |   93 +-
 include/linux/pci-tsm.h                       |   86 +-
 include/linux/pci.h                           |    2 +
 include/uapi/linux/ctlv_attestation_gen.h     |   25 +-
 include/uapi/linux/ctlv_attestation_pci_gen.h |   74 +
 include/uapi/linux/ctlv_families_gen.h        |    1 +
 include/uapi/linux/pci-tsm-netlink.h          |  101 -
 samples/devsec/common.c                       |    1 -
 samples/devsec/link_tsm.c                     |   17 +-
 samples/devsec/tsm.c                          |   32 +-
 tools/ctlv/tests/support.py                   |    3 +-
 tools/ctlv/tests/test_outputs.py              |    6 +-
 tools/ctlv/tests/test_semantics.py            |   38 +
 tools/ctlv/tests/test_spec.py                 |    1 +
 .../selftests/attestation/attestation_test.c  |   32 +-
 .../ctlv_attestation_pci_user_gen.c           | 1697 +++++++++++++++++
 .../ctlv_attestation_pci_user_gen.h           |  230 +++
 .../ctlv_attestation_sim_user_gen.c           |  161 +-
 .../ctlv_attestation_tdx_user_gen.c           |  161 +-
 .../attestation/ctlv_attestation_user_gen.c   |  161 +-
 .../attestation/ctlv_attestation_user_gen.h   |   70 +-
 .../attestation/tdx_attestation_test.c        |    9 +-
 59 files changed, 4678 insertions(+), 1644 deletions(-)
 create mode 100644 Documentation/ctlv/abi/ctlv-attestation-pci.yaml
 create mode 100644 Documentation/ctlv/specs/ctlv-attestation-pci.yaml
 delete mode 100644 Documentation/netlink/specs/pci-tsm.yaml
 create mode 100644 drivers/pci/tsm/attestation.c
 create mode 100644 drivers/pci/tsm/ctlv_attestation_pci_gen.c
 create mode 100644 drivers/pci/tsm/ctlv_attestation_pci_gen.h
 delete mode 100644 drivers/pci/tsm/evidence.c
 create mode 100644 drivers/pci/tsm/internal.h
 delete mode 100644 drivers/pci/tsm/netlink.c
 delete mode 100644 drivers/pci/tsm/netlink.h
 create mode 100644 include/uapi/linux/ctlv_attestation_pci_gen.h
 delete mode 100644 include/uapi/linux/pci-tsm-netlink.h
 create mode 100644 tools/testing/selftests/attestation/ctlv_attestation_pci_user_gen.c
 create mode 100644 tools/testing/selftests/attestation/ctlv_attestation_pci_user_gen.h
Signature · 1 line
2.43.0
maintainer
#128 lore raw
Quoted 22 lines · Xu Yilun
Quoted 21 lines · Aneesh Kumar K.V (Arm)

This series connects PCI/TSM to the common CTLV attestation interface. Userspace can discover a device's evidence objects, retrieve them, and accept the evidence before the kernel establishes a secure link or moves a guest device into TDISP RUN. It replaces the PCI/TSM netlink evidence interface while retaining connect, disconnect, lock and unlock in sysfs.

This series builds on the CTLV attestation series [1] and Arm CCA device-assignment support. It covers PCI/TSM attestation through certificate slot-zero.

The development tree is available at:

https://gitlab.arm.com/linux-arm/linux-cca.git cca/topics/cca-da-attestation

That branch also includes the follow-up Rust SPDM certificate-slot discovery work, generic attestation fixes, and CTLV tooling fixes.

[1] https://lore.kernel.org/all/[email protected]

The host flow separates identity collection from session and IDE setup:

Quoted 8 lines
Quoted 4 lines

sysfs connect

    -> collect and cache the certificate chain
  DEVICE_GET / EVIDENCE_GET
    -> discover available objects and retrieve the chain for verification

Is it possible that these two steps combined to one? They collect, cache the certificates, then hand over the cache to userspace when requested. Why not just use one user interface to collect and hand over the certificates?

Any caching needs a careful think.. We should be caching globally in the attestation subsystem things like certificate chains so we can do GET_DIGESTS and then skip the GET_CERTIFICATES if we already have it..

And if we are going to do this rustspdm + TSM stuff the certificate caching should be shared between those components too.

Other stuff is not caching, it is storing immutable data about a single SPDM session. Like the transcript.. This needs to be properly lifetime bound to the session itself through a session generation.

Quoted 10 lines

Could the flow be:

1. DEVICE_GET/EVIDENCE_GET

	-> collect and retrieve the certificates via native SPDM
2. sysfs connect
	-> establish the *TSM-based* secure session and IDE streams
3. sysfs disconnect
	-> release the *TSM-based* streams and identity context

This way we don't even touch the existing host side TSM.

I don't think this is a great idea, ideally we should be seeing the TSM world expand their APIs to support slot discovery properly and securely. Injecting rustspdm to make up those gaps should be seen as a temporary thing. Thus the uAPI presented should be uniform between and old and new TSM..

There should also be some continuity, possibly in the kernel, to bind the digests/certificates from the first phase through to the authenticated phase to avoid downgrade attacks. See my reply to Elena This is much harder to do if the tsm driver goes away in the middle of the process.

Jason