-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the `mc-sgx-core-build` crate to hold common build utilities used with other SGX crates.
- Loading branch information
1 parent
2be48af
commit 725fc73
Showing
16 changed files
with
128 additions
and
98 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = [ | ||
"sys/types", | ||
"sys/types", | ||
"build", | ||
] | ||
|
||
[profile.dev] | ||
|
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,4 @@ | ||
[package] | ||
name = "mc-sgx-core-build" | ||
version = "0.1.0" | ||
edition = "2021" |
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,20 @@ | ||
# Common build logic for SGX libraries | ||
|
||
This crate provides common logic to build and link against the Intel SGX SDK | ||
|
||
## Table of Contents | ||
|
||
- [License](#license) | ||
- [Build Instructions](#build-instructions) | ||
- [Intel SGX SDK](#intel-sgx-sdk) | ||
- [Features](#features) | ||
- [References](#references) | ||
|
||
## License | ||
|
||
Look for the *LICENSE* file at the root of the repo for more information. | ||
|
||
## References | ||
|
||
- <https://download.01.org/intel-sgx/sgx-dcap/1.13/linux/docs/Intel_SGX_Enclave_Common_Loader_API_Reference.pdf> | ||
- <https://github.com/intel/linux-sgx#build-the-intelr-sgx-sdk-and-intelr-sgx-psw-package> |
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,34 @@ | ||
// Copyright (c) 2022 The MobileCoin Foundation | ||
|
||
#![doc = include_str!("../README.md")] | ||
|
||
use std::{env, path::PathBuf}; | ||
|
||
static DEFAULT_SGX_SDK_PATH: &str = "/opt/intel/sgxsdk"; | ||
|
||
/// Return the SGX library path. | ||
/// | ||
/// Will first attempt to look at the environment variable `SGX_SDK`, if that | ||
/// isn't present then `/opt/intel/sgxsdk` will be used. | ||
pub fn sgx_library_path() -> String { | ||
env::var("SGX_SDK").unwrap_or_else(|_| DEFAULT_SGX_SDK_PATH.into()) | ||
} | ||
|
||
/// Return the build output path. | ||
pub fn build_output_path() -> PathBuf { | ||
PathBuf::from(env::var("OUT_DIR").expect("Missing env.OUT_DIR")) | ||
} | ||
|
||
/// Return the SGX library suffix | ||
/// | ||
/// Some SGX libraries have a suffix for example `sgx_trts.a` versus | ||
/// `sgx_trts_sim.a`. This will result the suffix based on the presence of the | ||
/// feature `hw`. | ||
pub fn sgx_library_suffix() -> &'static str { | ||
// See https://doc.rust-lang.org/cargo/reference/features.html#build-scripts | ||
// for description of `CARGO_FEATURE_<name>` | ||
match env::var("CARGO_FEATURE_HW") { | ||
Ok(_) => "", | ||
_ => "_sim", | ||
} | ||
} |
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ edition = "2021" | |
|
||
[build-dependencies] | ||
bindgen = "0.60.1" | ||
mc-sgx-core-build = { path = "../../build" } |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -17,3 +17,4 @@ cc = "1.0.73" | |
bindgen = "0.60.1" | ||
rsa = "0.6.1" | ||
rand = "0.8.5" | ||
mc-sgx-core-build = { path = "../../core/build" } |
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.