Skip to content

Commit

Permalink
Verifier: change fn name from generate_challenge to generate_suppleme…
Browse files Browse the repository at this point in the history
…ntal_challenge

Signed-off-by: Qi Feng Huo <[email protected]>
  • Loading branch information
Qi Feng Huo committed Apr 18, 2024
1 parent c9d7bee commit b16cfb9
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl AttestationService for Arc<RwLock<AttestationServer>> {
.read()
.await
.attestation_service
.generate_challenge(tee, Some(request.tee_params.clone().into_bytes()))
.generate_supplemental_challenge(tee, Some(request.tee_params.clone().into_bytes()))
.await
.map_err(|e| Status::aborted(format!("Challenge: {e:?}")))?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pub async fn get_challenge(
let challenge = cocoas
.read()
.await
.generate_challenge(tee, Some(request.tee_params.clone().into_bytes()))
.generate_supplemental_challenge(tee, Some(request.tee_params.clone().into_bytes()))
.await
.context("generate challenge")?;
Ok(HttpResponse::Ok().body(challenge))
Expand Down
4 changes: 2 additions & 2 deletions attestation-service/attestation-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,13 @@ impl AttestationService {
self.rvps.verify_and_extract(message).await
}

pub async fn generate_challenge(
pub async fn generate_supplemental_challenge(
&self,
tee: Tee,
tee_parameters: Option<Vec<u8>>,
) -> Result<String> {
let verifier = verifier::to_verifier(&tee)?;
verifier.generate_challenge(tee_parameters).await
verifier.generate_supplemental_challenge(tee_parameters).await
}
}

Expand Down
2 changes: 1 addition & 1 deletion attestation-service/verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pub trait Verifier {
expected_init_data_hash: &InitDataHash,
) -> Result<TeeEvidenceParsedClaim>;

async fn generate_challenge(
async fn generate_supplemental_challenge(
&self,
_tee_parameters: Option<Vec<u8>>,
) -> Result<String> {
Expand Down
2 changes: 1 addition & 1 deletion attestation-service/verifier/src/se/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Verifier for SeVerifier {
verify_evidence(evidence, expected_report_data, expected_init_data_hash).await
}

async fn generate_challenge(
async fn generate_supplemental_challenge(
&self,
_tee_parameters: Option<Vec<u8>>,
) -> Result<String> {
Expand Down
4 changes: 2 additions & 2 deletions kbs/src/api/src/attestation/coco/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ impl Attest for BuiltInCoCoAs {
.await
}

async fn generate_challenge(
async fn generate_supplemental_challenge(
&self,
tee: Tee,
tee_parameters: Option<Vec<u8>>,
) -> Result<String> {
self.inner
.read()
.await
.generate_challenge(tee, tee_parameters)
.generate_supplemental_challenge(tee, tee_parameters)
.await
}
}
Expand Down
2 changes: 1 addition & 1 deletion kbs/src/api/src/attestation/coco/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Attest for GrpcClientPool {
Ok(token)
}

async fn generate_challenge(
async fn generate_supplemental_challenge(
&self,
tee: Tee,
tee_parameters: Option<Vec<u8>>,
Expand Down
2 changes: 1 addition & 1 deletion kbs/src/api/src/attestation/intel_trust_authority/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl Attest for IntelTrustAuthority {
Ok(resp_data.token.clone())
}

async fn generate_challenge(
async fn generate_supplemental_challenge(
&self,
_tee: Tee,
_tee_parameters: Option<Vec<u8>>,
Expand Down
10 changes: 5 additions & 5 deletions kbs/src/api/src/attestation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub trait Attest: Send + Sync {
async fn verify(&self, tee: Tee, nonce: &str, attestation: &str) -> Result<String>;

/// generate the challenge payload to pass to attester based on Tee and nonce
async fn generate_challenge(&self, tee: Tee, tee_parameters: Option<Vec<u8>>)
async fn generate_supplemental_challenge(&self, tee: Tee, tee_parameters: Option<Vec<u8>>)
-> Result<String>;
}

Expand Down Expand Up @@ -94,23 +94,23 @@ impl AttestationService {
}
}

pub async fn generate_challenge(
pub async fn generate_supplemental_challenge(
&self,
tee: Tee,
tee_parameters: Option<Vec<u8>>,
) -> Result<String> {
match self {
#[cfg(feature = "coco-as-grpc")]
AttestationService::CoCoASgRPC(inner) => {
inner.generate_challenge(tee, tee_parameters).await
inner.generate_supplemental_challenge(tee, tee_parameters).await
}
#[cfg(any(feature = "coco-as-builtin", feature = "coco-as-builtin-no-verifier"))]
AttestationService::CoCoASBuiltIn(inner) => {
inner.generate_challenge(tee, tee_parameters).await
inner.generate_supplemental_challenge(tee, tee_parameters).await
}
#[cfg(feature = "intel-trust-authority-as")]
AttestationService::IntelTA(inner) => {
inner.generate_challenge(tee, tee_parameters).await
inner.generate_supplemental_challenge(tee, tee_parameters).await
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion kbs/src/api/src/http/attest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub(crate) async fn auth(
debug!("Auth Request: {:?}", &request);

let extra_params = attestation_service
.generate_challenge(request.tee, Some(request.extra_params.clone().into_bytes()))
.generate_supplemental_challenge(request.tee, Some(request.extra_params.clone().into_bytes()))
.await
.unwrap();

Expand Down

0 comments on commit b16cfb9

Please sign in to comment.