forked from tokio-rs/tokio
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the
x86_64-fortanix-unknown-sgx
target
- Loading branch information
1 parent
eaf81ed
commit b578adc
Showing
73 changed files
with
373 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "enclave-runner" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
aesm-client = { version = "0.5", features = ["sgxs"] } | ||
clap = "4.4" | ||
enclave-runner = "0.5" | ||
sgxs-loaders = "0.3.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use aesm_client::AesmClient; | ||
use clap::{Command, Arg, ArgAction}; | ||
use enclave_runner::EnclaveBuilder; | ||
|
||
#[cfg(windows)] | ||
use sgxs_loaders::enclaveapi::Sgx as IsgxDevice; | ||
#[cfg(unix)] | ||
use sgxs_loaders::isgx::Device as IsgxDevice; | ||
|
||
fn main() { | ||
let args = Command::new("runner") | ||
.arg(Arg::new("file").required(true)) | ||
.arg( | ||
Arg::new("enclave-args") | ||
.help( | ||
"Arguments passed to the enclave. \ | ||
Note that this is not an appropriate channel for passing \ | ||
secrets or security configurations to the enclave.", | ||
) | ||
.action(ArgAction::Append) | ||
) | ||
.get_matches(); | ||
|
||
let file = args.get_one::<String>("file").unwrap(); | ||
|
||
let mut device = IsgxDevice::new() | ||
.expect("failed to open SGX device") | ||
.einittoken_provider(AesmClient::new()) | ||
.build(); | ||
|
||
let mut enclave_builder = EnclaveBuilder::new(file.as_ref()); | ||
if let Err(_) = enclave_builder.coresident_signature() { | ||
enclave_builder.dummy_signature(); | ||
} | ||
|
||
if let Some(enclave_args) = args.get_many::<String>("enclave-args") { | ||
enclave_builder.args(enclave_args); | ||
} | ||
|
||
let enclave = enclave_builder | ||
.build(&mut device) | ||
.expect("failed to load SGX enclave"); | ||
|
||
match enclave.run() { | ||
Err(e) => { | ||
eprintln!("Error while executing SGX enclave.\n{}", e); | ||
std::process::exit(-1) | ||
} | ||
Ok(()) => {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.