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

svsm: add SVSM VTPM Service Attestation #541

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ intrusive-collections = "0.9.6"
libfuzzer-sys = "0.4"
log = "0.4.17"
p384 = { version = "0.13.0" }
sha2 = "0.10.8"
uuid = "1.6.1"
sha2 = { version = "0.10.8", default-features = false }
uuid = { version = "1.6.1", default-features = false }
# Add the derive feature by default because all crates use it.
zerocopy = { version = "0.8.2", features = ["alloc", "derive"] }

Expand Down
2 changes: 1 addition & 1 deletion igvmbuilder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bootlib.workspace = true
clap = { workspace = true, default-features = true, features = ["derive"] }
igvm_defs.workspace = true
igvm.workspace = true
uuid.workspace = true
uuid = { workspace = true, default-features = true }
zerocopy.workspace = true
zerocopy07 = { package = "zerocopy", version = "0.7" }

Expand Down
3 changes: 3 additions & 0 deletions kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ log = { workspace = true, features = ["max_level_info", "release_max_level_info"
packit.workspace = true
libtcgtpm = { workspace = true, optional = true }
zerocopy.workspace = true
# Need "force-soft", see https://github.com/RustCrypto/hashes/issues/446
sha2 = { workspace = true, features = ["force-soft"] }
uuid.workspace = true

builtin = { workspace = true, optional = true }
builtin_macros = { workspace = true }
Expand Down
21 changes: 21 additions & 0 deletions kernel/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ pub enum ApicError {
Registration,
}

/// Errors related to Attestation handling. These may originate from multiple
/// layers in the system.
#[derive(Clone, Copy, Debug)]
pub enum AttestationError {
/// An error related to attestation report.
Report,

/// An error related to attestation manifest.
Manifest,
}

/// A generic error during SVSM operation.
#[derive(Clone, Copy, Debug)]
pub enum SvsmError {
Expand Down Expand Up @@ -98,6 +109,10 @@ pub enum SvsmError {
NotSupported,
/// Generic errors related to APIC emulation.
Apic(ApicError),
/// Generic errors related to attestation handling.
Attestation(AttestationError),
/// Errors related to Hyper-V.
HyperV(u16),
}

impl From<ElfError> for SvsmError {
Expand All @@ -112,6 +127,12 @@ impl From<ApicError> for SvsmError {
}
}

impl From<AttestationError> for SvsmError {
fn from(err: AttestationError) -> Self {
Self::Attestation(err)
}
}

impl From<ObjError> for SvsmError {
fn from(err: ObjError) -> Self {
Self::Obj(err)
Expand Down
Loading