Skip to content

Commit

Permalink
Merge pull request #564 from fortanix/ns/fix_failure_vulnerability
Browse files Browse the repository at this point in the history
Remove `failure` crate
  • Loading branch information
nshyrei authored Mar 13, 2024
2 parents 5317773 + 8016671 commit e3f87a0
Show file tree
Hide file tree
Showing 39 changed files with 250 additions and 274 deletions.
70 changes: 24 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions intel-sgx/aesm-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aesm-client"
version = "0.5.4"
version = "0.6.0"
authors = ["Fortanix, Inc."]
license = "MPL-2.0"
description = """
Expand All @@ -26,15 +26,15 @@ test-sgx = []

[dependencies]
# Project dependencies
sgxs = { version = "0.7.0", path = "../sgxs", optional = true }
sgxs = { version = "0.8.0", path = "../sgxs", optional = true }
sgx-isa = { version = "0.4.0", path = "../sgx-isa"}

# External dependencies
byteorder = "1.0" # Unlicense/MIT
lazy_static = "1" # MIT/Apache-2.0
protobuf = "2.22.1" # MIT/Apache-2.0
failure = "0.1.1" # MIT/Apache-2.0
failure_derive = "0.1.1" # MIT/Apache-2.0
thiserror = "1.0" # MIT/Apache-2.0
anyhow = "1.0" # MIT/Apache-2.0

[target.'cfg(unix)'.dependencies]
# We require a version of unix-socket with the following change:
Expand All @@ -54,5 +54,5 @@ protoc-rust = "2.8.0" # MIT/Apache-2.0

[dev-dependencies]
sgx-isa = { version = "0.4.0", path = "../sgx-isa" }
"report-test" = { version = "0.3.1", path = "../report-test" }
"sgxs-loaders" = { version = "0.3.0", path = "../sgxs-loaders" }
"report-test" = { version = "0.4.0", path = "../report-test" }
"sgxs-loaders" = { version = "0.4.0", path = "../sgxs-loaders" }
17 changes: 9 additions & 8 deletions intel-sgx/aesm-client/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use std::io::Error as IoError;
use std::result::Result as StdResult;
use thiserror::Error as ThisError;

pub type Result<T> = StdResult<T, Error>;

Expand Down Expand Up @@ -126,19 +127,19 @@ impl From<u32> for AesmError {
}
}

#[derive(Fail, Debug)]
#[derive(ThisError, Debug)]
pub enum Error {
#[fail(display = "aesm error code {:?}", _0)]
#[error("aesm error code {:?}", _0)]
AesmCode(AesmError),
#[fail(display = "error communicating with aesm")]
AesmCommunication(#[cause] IoError),
#[fail(display = "missing expected {} payload in response from aesm", _0)]
#[error("error communicating with aesm")]
AesmCommunication(#[source] IoError),
#[error("missing expected {} payload in response from aesm", _0)]
AesmBadResponse(String),
#[fail(display = "invalid quote type {}", _0)]
#[error("invalid quote type {}", _0)]
InvalidQuoteType(u32),
#[fail(display = "invalid quote size")]
#[error("invalid quote size")]
InvalidQuoteSize,
#[fail(display = "invalid token size")]
#[error("invalid token size")]
InvalidTokenSize,
}

Expand Down
7 changes: 3 additions & 4 deletions intel-sgx/aesm-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
#![deny(warnings)]

extern crate byteorder;
pub extern crate failure;
#[macro_use]
extern crate failure_derive;
pub extern crate anyhow;
pub extern crate thiserror;
#[macro_use]
#[cfg(unix)]
extern crate lazy_static;
Expand Down Expand Up @@ -269,7 +268,7 @@ impl EinittokenProvider for AesmClient {
sigstruct: &Sigstruct,
attributes: Attributes,
_retry: bool,
) -> StdResult<Einittoken, ::failure::Error> {
) -> StdResult<Einittoken, ::anyhow::Error> {
let token = self.get_launch_token(
sigstruct,
attributes,
Expand Down
6 changes: 3 additions & 3 deletions intel-sgx/dcap-provider/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dcap-provider"
version = "0.3.1"
version = "0.3.0"
authors = ["Fortanix, Inc."]
edition = "2018"
license = "MPL-2.0"
Expand Down Expand Up @@ -34,8 +34,8 @@ crate-type = ["cdylib"]

[dependencies]
# Project dependencies
"dcap-ql" = { version = "0.3.0", path = "../dcap-ql", features = ["link"] }
"report-test" = { version = "0.3.1", path = "../report-test" }
"dcap-ql" = { version = "0.4.0", path = "../dcap-ql", features = ["link"] }
"report-test" = { version = "0.4.0", path = "../report-test" }

# External dependencies
byteorder = "1.1.0" # Unlicense/MIT
Expand Down
10 changes: 5 additions & 5 deletions intel-sgx/dcap-ql/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dcap-ql"
version = "0.3.7"
version = "0.4.0"
authors = ["Fortanix, Inc."]
license = "MPL-2.0"
description = """
Expand Down Expand Up @@ -37,12 +37,12 @@ verify = ["mbedtls", "num", "yasna"]
[dependencies]
# Project dependencies
"dcap-ql-sys" = { version = "0.2.0", path = "../dcap-ql-sys", optional = true }
"sgxs-loaders" = { version = "0.3.0", path = "../sgxs-loaders", optional = true }
"sgxs-loaders" = { version = "0.4.0", path = "../sgxs-loaders", optional = true }
"sgx-isa" = { version = "0.4.0", path = "../sgx-isa" }

# External dependencies
byteorder = "1.1.0" # Unlicense/MIT
failure = "0.1.1" # MIT/Apache-2.0
anyhow = "1.0" # MIT/Apache-2.0
lazy_static = "1" # MIT/Apache-2.0
libc = { version = "0.2", optional = true } # MIT/Apache-2.0
mbedtls = { version = ">=0.8.0, <0.10.0", default-features = false, features = ["std"], optional = true }
Expand All @@ -54,7 +54,7 @@ yasna = { version = "0.3", features = ["num-bigint", "bit-vec"], optional = true

[dev-dependencies]
mbedtls = { version = ">=0.8.0, <0.10.0" }
report-test = { version = "0.3.1", path = "../report-test" }
sgxs = { version = "0.7.0", path = "../sgxs" }
report-test = { version = "0.4.0", path = "../report-test" }
sgxs = { version = "0.8.0", path = "../sgxs" }
serde = { version = "1.0.104", features = ["derive"] }
serde_json = { version = "1.0" }
5 changes: 3 additions & 2 deletions intel-sgx/dcap-ql/src/bindings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ extern crate libc;

extern crate sgxs_loaders;

use failure::Error;
use anyhow::Error;
use anyhow::anyhow;
use num_traits::FromPrimitive;

pub use self::dcap_ql_sys::Quote3Error;
Expand Down Expand Up @@ -76,7 +77,7 @@ pub fn is_loaded() -> bool {
/// Since DCAP is being used, assume that no EINITTOKEN provider is necessary.
pub fn enclave_loader() -> Result<EnclaveCommonLibrary, Error> {
#[cfg(not(feature = "link"))]
dl::load().map_err(failure::err_msg)?;
dl::load().map_err(|e| anyhow!(e))?;
// NB. libsgx_dcap_ql.so.1 transitively links to libsgx_enclave_common.so.1
// so we should be able to find it already loaded.
// We can't use the library from `mod dl` if `not(feature = "link")`,
Expand Down
2 changes: 1 addition & 1 deletion intel-sgx/dcap-ql/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

extern crate byteorder;
#[macro_use]
extern crate failure;
extern crate anyhow;
#[cfg(all(feature="bindings", not(feature = "link")))]
#[macro_use]
extern crate lazy_static;
Expand Down
Loading

0 comments on commit e3f87a0

Please sign in to comment.