diff --git a/crates/utils/tcbinfo-updater/src/main.rs b/crates/utils/tcbinfo-updater/src/main.rs index 1a19362..75f7587 100644 --- a/crates/utils/tcbinfo-updater/src/main.rs +++ b/crates/utils/tcbinfo-updater/src/main.rs @@ -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 } }