Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
smtmfft committed Apr 20, 2024
1 parent a361dbd commit 278dfd6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion provers/sgx/guest/src/one_shot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn bootstrap(global_opts: GlobalOpts) -> Result<()> {
pub async fn one_shot(global_opts: GlobalOpts, args: OneShotArgs) -> Result<()> {
// Make sure this SGX instance was bootstrapped
let prev_privkey = load_bootstrap(&global_opts.secrets_dir)
.or_else(|_| bail!("Application was not bootstrapped. Bootstrap it first."))
.or_else(|_| bail!("Application was not bootstrapped or has a deprecated bootstrap."))
.unwrap();

println!("Global options: {global_opts:?}, OneShot options: {args:?}");
Expand Down
11 changes: 6 additions & 5 deletions provers/sgx/prover/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,18 @@ impl Prover for SgxProver {
setup(&cur_dir, direct_mode).await?;
}

let sgx_proof = if config.bootstrap {
let mut sgx_proof = if config.bootstrap {
bootstrap(cur_dir.clone(), gramine_cmd()).await
} else if config.prove {
// now prove can not go with bootstrap as we need manually register sgx id.
// TODO: auto register sgx id
prove(gramine_cmd(), input.clone(), config.instance_id).await
} else {
// Dummy proof: it's ok when only setup/bootstrap was requested
Ok(SgxResponse::default())
};

if config.prove {
// overwirte sgx_proof as the bootstrap quote stays the same in bootstrap & prove.
sgx_proof = prove(gramine_cmd(), input.clone(), config.instance_id).await
}

to_proof(sgx_proof)
}

Expand Down

0 comments on commit 278dfd6

Please sign in to comment.