-
Notifications
You must be signed in to change notification settings - Fork 132
vtpm: offline mitigation for vtpm corruption #1539
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
vtpm: offline mitigation for vtpm corruption #1539
Conversation
d5c979a
to
b5aefae
Compare
b5aefae
to
ce114e6
Compare
vm/vtpm-mitigation/Cargo.toml
Outdated
@@ -0,0 +1,19 @@ | |||
[package] | |||
name = "vtpm-mitigation" | |||
version = "0.1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the version - we explicitly don't allow versions here since we don't publish any crates externally
vm/vtpm-mitigation/Cargo.toml
Outdated
[package] | ||
name = "vtpm-mitigation" | ||
version = "0.1.0" | ||
edition = "2021" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove edition - should be inherited
vm/vtpm-mitigation/src/lib.rs
Outdated
use ms_tpm_20_ref::MsTpm20RefPlatform; | ||
use parking_lot::Mutex; | ||
use core::fmt; | ||
use std::{borrow::Cow, sync::Arc, time::Instant}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these need to be split on different lines
vm/vtpm-mitigation/src/lib.rs
Outdated
|
||
/// status codes for tpm state blob validation | ||
/// STATUS_VALID_TPM_STATE: The input blob is a valid TPM state blob | ||
pub const STATUS_VALID_TPM_STATE: u64 = 0x0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make this status code an enum, or something?
vm/vtpm-mitigation/src/lib.rs
Outdated
} | ||
|
||
/// Recover the given blob and return the recovered blob | ||
fn recover_vtpm_blob(original_blob: &[u8]) -> Result<Vec<u8>, bool> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use bool as an error type, make an explicit error type that is clear about what kind of error is being represented here.
vm/vtpm-mitigation/src/lib.rs
Outdated
#[test] | ||
fn test_corrupted_tpm_state_is_revovered() { | ||
setup_logging(); | ||
let path: &'static str ="./test-data/corrupted_blob.bin"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you want to do fs reads in tests like this, should we use include_bytes!
instead? @smalis-msft thoughts?
dbe7f42
to
a3c2bee
Compare
a3c2bee
to
ab9f9e2
Compare
ab9f9e2
to
1624128
Compare
Adding an offline mitigation library for recovering from vtpm state corruption.