Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KBS (protocol) enhancements to reportdata generation #242

Closed
2 tasks
mythi opened this issue Nov 27, 2023 · 6 comments · Fixed by #491
Closed
2 tasks

KBS (protocol) enhancements to reportdata generation #242

mythi opened this issue Nov 27, 2023 · 6 comments · Fixed by #491

Comments

@mythi
Copy link
Contributor

mythi commented Nov 27, 2023

The original case was reported in #162 triggered by my work on #159 and a bit of #151 too. This issue is an RFC proposal based on ideas I've prepared with @Xynnn007 to get CoCo attesters to generate quotes/reportdata in a generic way so that they can be made consumable by different AS backends.

The source of the problem is: hash(nonce || runtime data) and how to keep the attester vs verifier in sync. Current CoCo setup uses sha384 hash for all TEEs and the nonce is from the KBS session. This fails with Intel trust authority that expects sha256 and sha512 for SGX and TDX, respectively. IOW: CoCo attester generated evidence cannot be verified by Intel Trustauthority.

For this to work with non-CoCo attestation-services, two problems need to be sorted out:

  1. it must be possible to seed nonce from the Attestation service
  2. it must be possible to specify hash algorithm to be used by the attester.

This focuses on 2.

Current RCAR handshake protocol

  1. Request from Client to Server
{
    "version": "0.1.0",
    "tee": "$tee",
    "extra-params": {}
}
  1. Challenge from Server to Client:
{
    "nonce": "$nonce",
    "extra-params": {}
}
  1. Attestation from Client to Server
{
    "tee-pubkey": "$pubkey",
    "tee-evidence": {}
}
  1. Response from Server to Client:
{
    "protected": "$jose_header",
    "encrypted_key": "$encrypted_key",
    "iv": "$iv",
    "ciphertext": "$ciphertext",
    "tag": "$tag"
}

Suggested protocol changes

  1. add an extra param "supported-hash-algorithms" to Request. This
    helps the client to tell the server what hash algorithms are supported.
{
    "version": "0.1.0",
    "tee": "$tee",
    "extra-params": {
        "supported-hash-algorithms": ["sha256", "sha384", "sha512"]
    }
}
  1. add an extra param "selected-hash-algorithm" to Challenge. This
    tells the hash algorithm that the server selects from the ones that
    client supports.
{
    "nonce": "$nonce",
    "extra-params": {
        "selected-hash-algorithm": "sha512"
    }
}

In this way, the KBS could select the hash algorithm depending on the TEE type and attestation service used.

For forward compatibility, the server should NOT response a Challenge with
selected-hash-algorithm param when receiving a Request without supported-hash-algorithms param. Instead, a Challenge without selected-hash-algorithm should be sent.

Tasks

@Xynnn007
Copy link
Member

cc @sameo @slp @tylerfanelli @Lu-Biao

@Xynnn007
Copy link
Member

If 1 is agreed. We should also add Nonce endpint to CoCo-AS. cc @jialez0

@Xynnn007
Copy link
Member

Xynnn007 commented Jun 4, 2024

btw, we need to raise a PR/issue in kbs-types repo to update the structure of both Challenge and Request, extending extra_params from String to HashMap or better serde_json::Value

Xynnn007 added a commit to Xynnn007/kbs-types that referenced this issue Jun 4, 2024
serde_json::Value is a flexible structure that could be a string and
even a nested map. This helps us to give more structured context of the
message.

confidential-containers/trustee#242 is an
example issue

Signed-off-by: Xynnn007 <[email protected]>
Xynnn007 added a commit to Xynnn007/kbs-types that referenced this issue Jun 11, 2024
serde_json::Value is a flexible structure that could be a string and
even a nested map. This helps us to give more structured context of the
message.

confidential-containers/trustee#242 is an
example issue

Signed-off-by: Xynnn007 <[email protected]>
tylerfanelli pushed a commit to virtee/kbs-types that referenced this issue Jun 12, 2024
serde_json::Value is a flexible structure that could be a string and
even a nested map. This helps us to give more structured context of the
message.

confidential-containers/trustee#242 is an
example issue

Signed-off-by: Xynnn007 <[email protected]>
@mythi
Copy link
Contributor Author

mythi commented Jun 19, 2024

We are going to start working on the implementation of the "suggested protocol changes" now that the kbs-types updates and the IBM SE refactoring are merged. Are there any objections?

I have verified that the hash algorithm negotiation is enough (see: mythi/guest-components@7b97a8b and #406)

@pawelpros
Copy link
Contributor

It's worth mentioning that - azure VTPM has limitation for get signed quote from TPM which in theory should be supported up to 64 bytes (Sha256/Sha385/Sha512) but in real case the limitation is 50 bytes so Sha512 will not pass through

@mythi mythi changed the title RFC: KBS (protocol) enhancements to reportdata generation KBS (protocol) enhancements to reportdata generation Sep 5, 2024
@mythi mythi moved this to 🆕 New in CoCo Releases Sep 5, 2024
@mkulke
Copy link
Contributor

mkulke commented Sep 6, 2024

It's worth mentioning that - azure VTPM has limitation for get signed quote from TPM which in theory should be supported up to 64 bytes (Sha256/Sha385/Sha512) but in real case the limitation is 50 bytes so Sha512 will not pass through

Note, this is a limitation in the tss API, since it uses a nonce buffer type that will be the size of the biggest hash algo available in a given TPM's PCR banks (which for azure vTPM is sha384) plus 2 additional header bytes (48 + 2). so, this limitation will most likely not be lifted anytime soon.

mythi pushed a commit to mythi/trustee that referenced this issue Sep 6, 2024
If the TEE specifies the hash algorithms it can use [1], add the appropriate
hash algorithm to the returned `Challenge` [2].

For backwards compatibility, do not return the selected hash algorithm
if the TEE does not provide the list of hash algorithms it can use.

Partially-fixes: confidential-containers#242.

[1] - In the optional `extra-params.supported-hash-algorithms` list.
[2] - In `extra-params.selected-hash-algorithm`.

Signed-off-by: James O. D. Hunt <[email protected]>
@mythi mythi moved this from 🏗 In progress to 👀 In review in CoCo Releases Sep 6, 2024
jodh-intel added a commit to jodh-intel/trustee that referenced this issue Sep 9, 2024
If the TEE specifies the hash algorithms it can use [1], add the appropriate
hash algorithm to the returned `Challenge` [2].

For backwards compatibility, do not return the selected hash algorithm
if the TEE does not provide the list of hash algorithms it can use.

Partially-fixes: confidential-containers#242.

[1] - In the optional `extra-params.supported-hash-algorithms` list.
[2] - In `extra-params.selected-hash-algorithm`.

Signed-off-by: James O. D. Hunt <[email protected]>
jodh-intel added a commit to jodh-intel/trustee that referenced this issue Sep 9, 2024
If the TEE specifies the hash algorithms it can use [1], add the appropriate
hash algorithm to the returned `Challenge` [2].

For backwards compatibility, do not return the selected hash algorithm
if the TEE does not provide the list of hash algorithms it can use.

Partially-fixes: confidential-containers#242.

[1] - In the optional `extra-params.supported-hash-algorithms` list.
[2] - In `extra-params.selected-hash-algorithm`.

Signed-off-by: James O. D. Hunt <[email protected]>
jodh-intel added a commit to jodh-intel/trustee that referenced this issue Sep 10, 2024
If the TEE specifies the hash algorithms it can use [1], add the appropriate
hash algorithm to the returned `Challenge` [2].

For backwards compatibility, do not return the selected hash algorithm
if the TEE does not provide the list of hash algorithms it can use.

Partially-fixes: confidential-containers#242.

[1] - In the optional `extra-params.supported-hash-algorithms` list.
[2] - In `extra-params.selected-hash-algorithm`.

Signed-off-by: James O. D. Hunt <[email protected]>
jodh-intel added a commit to jodh-intel/trustee that referenced this issue Sep 10, 2024
If the TEE specifies the hash algorithms it can use [1], add the appropriate
hash algorithm to the returned `Challenge` [2].

For backwards compatibility, do not return the selected hash algorithm
if the TEE does not provide the list of hash algorithms it can use.

Partially-fixes: confidential-containers#242.

[1] - In the optional `extra-params.supported-hash-algorithms` list.
[2] - In `extra-params.selected-hash-algorithm`.

Signed-off-by: James O. D. Hunt <[email protected]>
jodh-intel added a commit to jodh-intel/trustee that referenced this issue Sep 10, 2024
If the TEE specifies the hash algorithms it can use [1], add the appropriate
hash algorithm to the returned `Challenge` [2].

For backwards compatibility, do not return the selected hash algorithm
if the TEE does not provide the list of hash algorithms it can use.

Partially-fixes: confidential-containers#242.

[1] - In the optional `extra-params.supported-hash-algorithms` list.
[2] - In `extra-params.selected-hash-algorithm`.

Signed-off-by: James O. D. Hunt <[email protected]>
fidencio pushed a commit to fidencio/trustee that referenced this issue Sep 10, 2024
If the TEE specifies the hash algorithms it can use [1], add the appropriate
hash algorithm to the returned `Challenge` [2].

For backwards compatibility, do not return the selected hash algorithm
if the TEE does not provide the list of hash algorithms it can use.

Partially-fixes: confidential-containers#242.

[1] - In the optional `extra-params.supported-hash-algorithms` list.
[2] - In `extra-params.selected-hash-algorithm`.

Signed-off-by: James O. D. Hunt <[email protected]>
fidencio pushed a commit to fidencio/trustee that referenced this issue Sep 10, 2024
If the TEE specifies the hash algorithms it can use [1], add the appropriate
hash algorithm to the returned `Challenge` [2].

For backwards compatibility, do not return the selected hash algorithm
if the TEE does not provide the list of hash algorithms it can use.

Partially-fixes: confidential-containers#242.

[1] - In the optional `extra-params.supported-hash-algorithms` list.
[2] - In `extra-params.selected-hash-algorithm`.

Signed-off-by: James O. D. Hunt <[email protected]>
fidencio pushed a commit to fidencio/trustee that referenced this issue Sep 10, 2024
If the TEE specifies the hash algorithms it can use [1], add the appropriate
hash algorithm to the returned `Challenge` [2].

For backwards compatibility, do not return the selected hash algorithm
if the TEE does not provide the list of hash algorithms it can use.

Partially-fixes: confidential-containers#242.

[1] - In the optional `extra-params.supported-hash-algorithms` list.
[2] - In `extra-params.selected-hash-algorithm`.

Signed-off-by: James O. D. Hunt <[email protected]>
fidencio pushed a commit to fidencio/trustee that referenced this issue Sep 11, 2024
If the TEE specifies the hash algorithms it can use [1], add the appropriate
hash algorithm to the returned `Challenge` [2].

For backwards compatibility, do not return the selected hash algorithm
if the TEE does not provide the list of hash algorithms it can use.

Partially-fixes: confidential-containers#242.

[1] - In the optional `extra-params.supported-hash-algorithms` list.
[2] - In `extra-params.selected-hash-algorithm`.

Signed-off-by: James O. D. Hunt <[email protected]>
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in CoCo Releases Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants