Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,712 changes: 1,645 additions & 67 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions attest-time/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ dice-verifier = { path = "../verifier" }
env_logger.workspace = true
log.workspace = true
tokio = { workspace = true, features = ["full"] }
slog.workspace = true
slog-async.workspace = true
slog-envlogger.workspace = true
slog-stdlog.workspace = true
slog-term.workspace = true

[features]
ipcc = ["dice-verifier/ipcc"]
18 changes: 16 additions & 2 deletions attest-time/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use dice_verifier::{
Attest, Nonce,
hiffy::{AttestHiffy, AttestTask},
};
use slog::Drain;
use std::{
fmt,
io::{self, Write},
Expand Down Expand Up @@ -88,14 +89,27 @@ async fn main() -> Result<()> {
})
.context("set Ctrl-C handler")?;

let stderr_decorator = slog_term::TermDecorator::new().build();
let stderr_drain =
slog_term::FullFormat::new(stderr_decorator).build().fuse();
let drain = slog_envlogger::LogBuilder::new(stderr_drain)
.parse("RUST_LOG")
.filter(None, slog::FilterLevel::Warning)
.build()
.fuse();
let drain = slog_async::Async::new(drain).build().fuse();
let logger = slog::Logger::root(drain, slog::o!());

// use stdout & `writeln!` so we can handle errors that would panic
// `println!`
let mut stdout = io::stdout().lock();

let attest: Box<dyn Attest> = match args.interface {
let mut attest: Box<dyn Attest> = match args.interface {
#[cfg(feature = "ipcc")]
Interface::Ipcc => Box::new(AttestIpcc::new()),
Interface::Hiffy => Box::new(AttestHiffy::new(AttestTask::Rot)),
Interface::Hiffy => {
Box::new(AttestHiffy::new(AttestTask::Rot, &logger))
}
};

// we do not care about the nonce, all 0's will require the same amount of
Expand Down
18 changes: 10 additions & 8 deletions verifier-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ fn get_attest(interface: Interface, log: &Logger) -> Result<Box<dyn Attest>> {
match interface {
#[cfg(feature = "ipcc")]
Interface::Ipcc => Ok(Box::new(AttestIpcc::new())),
Interface::Rot => Ok(Box::new(AttestHiffy::new(AttestTask::Rot))),
Interface::Rot => Ok(Box::new(AttestHiffy::new(AttestTask::Rot, log))),
#[cfg(feature = "sled-agent")]
Interface::SledAgent(addr) => {
Ok(Box::new(AttestSledAgent::new(addr, log)))
}
Interface::Sprot => Ok(Box::new(AttestHiffy::new(AttestTask::Sprot))),
Interface::Sprot => {
Ok(Box::new(AttestHiffy::new(AttestTask::Sprot, log)))
}
}
}

Expand Down Expand Up @@ -237,7 +239,7 @@ async fn main() -> Result<()> {
}
InterfaceArg::Sprot => Interface::Sprot,
};
let attest = get_attest(interface, &logger)?;
let mut attest = get_attest(interface, &logger)?;

match args.command {
AttestCommand::Attest { nonce } => {
Expand Down Expand Up @@ -317,7 +319,7 @@ async fn main() -> Result<()> {
let platform_id = match work_dir {
Some(w) => {
verify(
attest.as_ref(),
attest.as_mut(),
ca_cert.as_deref(),
corpus.as_deref(),
self_signed,
Expand All @@ -331,7 +333,7 @@ async fn main() -> Result<()> {
}
let work_dir = tempfile::tempdir()?;
verify(
attest.as_ref(),
attest.as_mut(),
ca_cert.as_deref(),
corpus.as_deref(),
self_signed,
Expand Down Expand Up @@ -366,7 +368,7 @@ async fn main() -> Result<()> {
verify_measurements(&cert_chain, &log, &corpus)?;
}
AttestCommand::MeasurementSet => {
let set = measurement_set(attest.as_ref()).await?;
let set = measurement_set(attest.as_mut()).await?;
for item in set.into_iter() {
println!("* {item}");
}
Expand All @@ -376,7 +378,7 @@ async fn main() -> Result<()> {
Ok(())
}

async fn measurement_set(attest: &dyn Attest) -> Result<MeasurementSet> {
async fn measurement_set(attest: &mut dyn Attest) -> Result<MeasurementSet> {
info!("getting measurement log");
let log = attest
.get_measurement_log()
Expand Down Expand Up @@ -442,7 +444,7 @@ fn verify_measurements(
}

async fn verify(
attest: &dyn Attest,
attest: &mut dyn Attest,
ca_cert: Option<&Path>,
corpus: Option<&Path>,
self_signed: bool,
Expand Down
7 changes: 7 additions & 0 deletions verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ tokio = { workspace = true, features = [ "net", "rt", "time", "process" ] }
tempfile.workspace = true
thiserror.workspace = true
x509-cert = { workspace = true, default-features = true }
# Fix the hashes once the bump is tested/merged
humility-probes-core = { git = "https://github.com/oxidecomputer/humility", rev = "ea8aa6325117da014c473748b24045dfdf04f8fb" }
humility-core = { git = "https://github.com/oxidecomputer/humility" , rev = "ea8aa6325117da014c473748b24045dfdf04f8fb" }
humility-idol = { git = "https://github.com/oxidecomputer/humility", rev = "ea8aa6325117da014c473748b24045dfdf04f8fb" }
humility-hiffy = { git = "https://github.com/oxidecomputer/humility" , rev = "ea8aa6325117da014c473748b24045dfdf04f8fb" }
# This is only for handling some of the errors from humility
anyhow.workspace = true

[build-dependencies]
anyhow.workspace = true
Expand Down
Loading
Loading