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

intel-trust-authority-as: add runtime data to attestation request #406

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

mythi
Copy link
Contributor

@mythi mythi commented Jun 7, 2024

Closes: #151

By adding runtime data to the appraisal request and having the reportdata
correctly hashed in the quote, ITA returns it back in the token claims
under attester_runtime_data.

For this to work, the Kata rootfs must be built with a modified
guest-components with sha512 hashing:

--- a/attestation-agent/kbs_protocol/src/client/rcar_client.rs
+++ b/attestation-agent/kbs_protocol/src/client/rcar_client.rs
@@ -13,7 +13,7 @@ use log::{debug, warn};
 use resource_uri::ResourceUri;
 use serde::Deserialize;
 use serde_json::json;
-use sha2::{Digest, Sha384};
+use sha2::{Digest, Sha512};
    
 use crate::{
     api::KbsClientCapabilities,
@@ -189,7 +189,7 @@ impl KbsClient<Box<dyn EvidenceProvider>> {
         nonce: String,
     ) -> Result<String> {
         debug!("Challenge nonce: {nonce}");
-        let mut hasher = Sha384::new();
+        let mut hasher = Sha512::new();
         hasher.update(runtime_data);

         let ehd = match tee {

Otherwise, ITA responds 400 / bad request.

This change is still safe because ITA AS with KBS get-resource isn't working without this either.

By adding runtime data to the appraisal request and having the reportdata
correctly hashed in the quote, ITA returns it back in the token claims
under attester_runtime_data.

For this to work, the Kata rootfs must be built with a modified
guest-components with sha512 hashing:

--- a/attestation-agent/kbs_protocol/src/client/rcar_client.rs
+++ b/attestation-agent/kbs_protocol/src/client/rcar_client.rs
@@ -13,7 +13,7 @@ use log::{debug, warn};
 use resource_uri::ResourceUri;
 use serde::Deserialize;
 use serde_json::json;
-use sha2::{Digest, Sha384};
+use sha2::{Digest, Sha512};

 use crate::{
     api::KbsClientCapabilities,
@@ -189,7 +189,7 @@ impl KbsClient<Box<dyn EvidenceProvider>> {
         nonce: String,
     ) -> Result<String> {
         debug!("Challenge nonce: {nonce}");
-        let mut hasher = Sha384::new();
+        let mut hasher = Sha512::new();
         hasher.update(runtime_data);

         let ehd = match tee {

Otherwise, ITA responds 400 / bad request.

This change is still safe because ITA AS with KBS get-resource
isn't working without this either.

Signed-off-by: Mikko Ylinen <[email protected]>
@mythi mythi marked this pull request as ready for review June 19, 2024 17:18
@mythi mythi changed the title WIP: intel-trust-authority-as fixing intel-trust-authority-as: add runtime data to attestation request Jun 19, 2024
Copy link
Member

@fitzthum fitzthum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I assume the changes you mention for guest components are just an example. We'll need to come up with a better way to negotiate the hashing method.

@mythi
Copy link
Contributor Author

mythi commented Jun 20, 2024

We'll need to come up with a better way to negotiate the hashing method.

Yes, it's just an example/test setup that makes, e.g., kbs-client to work. Proper fixing will be implemented as part of #242

@Xynnn007 Xynnn007 merged commit 8d26472 into confidential-containers:main Jun 21, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nonce is not used in Amber AS
3 participants