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.

6 changes: 3 additions & 3 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.5.5"
authors = ["Fortanix, Inc."]
license = "MPL-2.0"
description = """
Expand Down Expand Up @@ -33,8 +33,8 @@ sgx-isa = { version = "0.4.0", path = "../sgx-isa"}
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 Down
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-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.3.8"
authors = ["Fortanix, Inc."]
license = "MPL-2.0"
description = """
Expand Down Expand Up @@ -42,7 +42,7 @@ verify = ["mbedtls", "num", "yasna"]

# 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 Down
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
4 changes: 2 additions & 2 deletions intel-sgx/dcap-retrieve-pckid/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dcap-retrieve-pckid"
version = "0.1.3"
version = "0.1.4"
authors = ["Fortanix, Inc."]
license = "MPL-2.0"
edition = "2018"
Expand All @@ -21,4 +21,4 @@ categories = ["command-line-utilities"]
"sgxs-loaders" = { version = "0.3.0", path = "../sgxs-loaders" }

# External dependencies
failure = "0.1.1" # MIT/Apache-2.0
anyhow = "1.0" # MIT/Apache-2.0
Loading