Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove failure crate #564

Merged
merged 12 commits into from
Mar 13, 2024
68 changes: 23 additions & 45 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"
nshyrei marked this conversation as resolved.
Show resolved Hide resolved
version = "0.6.4"
nshyrei marked this conversation as resolved.
Show resolved Hide resolved
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.1", 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
4 changes: 2 additions & 2 deletions intel-sgx/dcap-provider/Cargo.toml
Original file line number Diff line number Diff line change
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.1", path = "../report-test" }
nshyrei marked this conversation as resolved.
Show resolved Hide resolved

# 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.7"
nshyrei marked this conversation as resolved.
Show resolved Hide resolved
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.1", path = "../report-test" }
nshyrei marked this conversation as resolved.
Show resolved Hide resolved
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
3 changes: 2 additions & 1 deletion intel-sgx/dcap-ql/src/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use serde::{Deserialize, Serialize};
use sgx_isa::Report;
use std::borrow::Cow;
use std::mem;
use anyhow::bail;

// ====================================================
// ================= TYPE DEFINITIONS =================
Expand Down Expand Up @@ -93,7 +94,7 @@ pub struct Qe3CertDataPckCertChain<'a> {

pub type RawQe3CertData<'a> = Cow<'a, [u8]>;

pub type Result<T> = ::std::result::Result<T, ::failure::Error>;
pub type Result<T> = ::std::result::Result<T, anyhow::Error>;

// ===========================================
// ================= PARSING =================
Expand Down
Loading