-
Notifications
You must be signed in to change notification settings - Fork 0
/
event_log.rs
35 lines (28 loc) · 934 Bytes
/
event_log.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use clap::Parser;
use std::fs;
use cca_realm_measurements::{DTBTemplates, EventLogParser, MeasurementImages, Realm};
#[derive(Debug, Parser)]
/// Parse an event log, try to construct the reference values
struct Args {
/// Log file in the TCG2 format
log_file: String,
/// Checksums file
checksums_file: Option<String>,
/// DTB list
dtb_list: Option<String>,
}
fn main() {
stderrlog::new().verbosity(5).init().unwrap();
let args = Args::parse();
let mut parser = EventLogParser::new();
if let Some(f) = args.checksums_file {
parser.images(MeasurementImages::from_checksums(&f).unwrap());
}
if let Some(f) = args.dtb_list {
parser.dtbs(DTBTemplates::from_file_list(&f).unwrap());
}
let mut realm = Realm::new();
let log = fs::read(args.log_file).unwrap();
parser.parse_tcg_log(&log, &mut realm).unwrap();
println!("{:?}", realm.measurements);
}