| Crates.io | tcg-log-core-rs |
| lib.rs | tcg-log-core-rs |
| version | 0.1.2 |
| created_at | 2025-08-31 06:13:22.859462+00 |
| updated_at | 2025-08-31 14:02:40.996782+00 |
| description | A library to parse measured boot logs |
| homepage | |
| repository | https://github.com/markusstoller/tcg-log-core-rs |
| max_upload_size | |
| id | 1818193 |
| size | 83,958 |
A small Rust library for parsing Trusted Computing Group (TCG) Windows Boot Configuration Logs (WBCL). It provides a safe, idiomatic wrapper for iterating through PCR event entries from a WBCL buffer, supporting legacy PC Client (TCG1.2) and TCG2 formats with multiple digest algorithms.
&[u8].WbclIterator and helper free functions.This is an early crate (0.1.2) intended for experimentation, learning, or narrow tooling purposes. The public API may change.
Add to your Cargo.toml:
[dependencies]
tcg-log-core-rs = "0.1.2"
Rust edition: 2024 (as per Cargo.toml).
The API works over an in-memory WBCL buffer, commonly read from a file (on Windows, for example, from the WBCL exported by system tools).
use tcg_log_core_rs::{parse, EventRecord}; // crate name is tcg-log-core-rs in Cargo.toml
fn main() {
let path = "//your//wbcl.file"; // adjust to your WBCL path
match parse(path) {
Ok(events) => {
for e in events {
println!("PCR: {}, Type: 0x{:x}", e.pcr_index, e.event_type);
}
}
Err(err) => eprintln!("Error: {}", err),
}
}
wbcl::WbclIterator<'a>: Stateful iterator over a WBCL byte buffer used by the crate internally. It validates headers, keeps current offset, and exposes helpers to read the current element. Its module is not currently public; prefer the high-level parse function.WbclIterator::new(log_buffer: &'a [u8]) -> Result<Self, u32>
has_next(&self) -> bool — Whether another event can be read.move_to_next_element(&mut self) -> Result<(), u32> — Advance to the next event.get_current_element(&self) -> Result<(u32, u32, Option<&'a [u8]>, u32, Option<&'a [u8]>), u32>
(pcr_index, event_type, digest_slice_opt, event_data_size, event_data_slice_opt)The crate contains internal helper functions around the WBCL iterator for experimentation. These are not part of the public API and may change or be made public in a future release.
parse(path: &str) -> Result<Vec<EventRecord>, String> returns a String on error (e.g., I/O issues, parse failures).Result<_, u32> where the u32 is an error code. Common conditions include:
During development, you can consult the tests in src/lib.rs for behavior expectations. If working with internal error codes, they are hex-friendly; when printing, use 0x{code:08x} to make debugging easier.
D:/temp/your.log) which work on Windows Rust as well; backslashes also work if properly escaped.Run the test suite:
cargo test
Note: Some tests assume presence of a local WBCL file; you may skip or adjust those if you do not have one.
Issues and PRs are welcome. Please:
Licensed under either of
license field.