WIP
This commit is contained in:
parent
84dac5a47e
commit
23e085b70d
1 changed files with 6 additions and 4 deletions
|
@ -64,7 +64,7 @@ async fn upsert_tcbinfo() -> Result<(), &'static str> {
|
|||
|
||||
for fmspc in fmspc_list {
|
||||
let tcbinfo = get_tcbinfo(fmspc.clone(), "standard".to_string()).await;
|
||||
verify_signature(tcbinfo.clone(), key);
|
||||
assert!(verify_signature(tcbinfo.clone(), key));
|
||||
let store_entry = &store[&fmspc];
|
||||
if *store_entry != tcbinfo {
|
||||
println!("updating local TCBInfo for FMSPC: {fmspc}");
|
||||
|
@ -97,14 +97,16 @@ async fn upsert_tcbinfo() -> Result<(), &'static str> {
|
|||
// }
|
||||
}
|
||||
|
||||
fn verify_signature (tcbinfo: Value, key: VerifyingKey) {
|
||||
fn verify_signature (tcbinfo: Value, key: VerifyingKey) -> bool {
|
||||
let tcbinfo_str = tcbinfo.as_str();
|
||||
if let Some(st) = tcbinfo_str {
|
||||
let signed_tcbinfo = SignedTcbInfo::try_from(st).expect("tcbinfo string parsing failed");
|
||||
signed_tcbinfo.verify(Some(&key), None).expect("could not verify signature");
|
||||
signed_tcbinfo.verify(Some(&key), None).expect("could not verify signature");
|
||||
true
|
||||
}
|
||||
else {
|
||||
println!("{tcbinfo:?}");
|
||||
println!("{tcbinfo:?}");
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue