Skip to content

Commit

Permalink
kbs: let the attestation-service to define token tee-pubkey path
Browse files Browse the repository at this point in the history
Attestation service provided tokens carry tee-pubkey under a different
claims structure. Piggyback the existing cargo features to let each AS
implementation define their own search paths compile time.

Signed-off-by: Mikko Ylinen <[email protected]>
  • Loading branch information
mythi committed Jun 17, 2024
1 parent 432f3d7 commit b7cf5f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions kbs/src/api/src/attestation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ use intel_trust_authority::*;
use kbs_types::{Challenge, Tee};
use rand::{thread_rng, Rng};

#[cfg(any(feature = "coco-as-builtin", feature = "coco-as-grpc"))]
pub const AS_TOKEN_TEE_PUBKEY_PATH: &str = "/customized_claims/runtime_data/tee-pubkey";
#[cfg(feature = "intel-trust-authority-as")]
pub const AS_TOKEN_TEE_PUBKEY_PATH: &str = "/attester_runtime_data/tee-pubkey";

#[cfg(feature = "coco-as")]
#[allow(missing_docs)]
pub mod coco;
Expand Down
2 changes: 1 addition & 1 deletion kbs/src/api/src/http/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

#[cfg(feature = "as")]
use crate::attestation::AttestationService;
use crate::attestation::{AttestationService, AS_TOKEN_TEE_PUBKEY_PATH};
use crate::auth::validate_auth;
#[cfg(feature = "policy")]
use crate::policy_engine::PolicyEngine;
Expand Down
3 changes: 3 additions & 0 deletions kbs/src/api/src/http/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ use crate::raise_error;

use super::*;

#[cfg(feature = "as")]
const TOKEN_TEE_PUBKEY_PATH: &str = AS_TOKEN_TEE_PUBKEY_PATH;
#[cfg(not(feature = "as"))]
const TOKEN_TEE_PUBKEY_PATH: &str = "/customized_claims/runtime_data/tee-pubkey";

#[allow(unused_assignments)]
Expand Down

0 comments on commit b7cf5f3

Please sign in to comment.