WIP async 2
This commit is contained in:
parent
cdd11858f6
commit
e84ef9b417
2 changed files with 5 additions and 3 deletions
|
@ -28,6 +28,7 @@ async fn get_tcbinfo(fmspc: Fmspc, update: Update) -> Value {
|
|||
.await
|
||||
.expect("url retrieval failed")
|
||||
.text()
|
||||
.await
|
||||
.expect("could not read https response");
|
||||
let tcbinfo: Value = serde_json::from_str(&body).expect("could not convert to JSON");
|
||||
tcbinfo
|
||||
|
@ -38,6 +39,7 @@ async fn get_fmspc_list() -> Vec<Fmspc> {
|
|||
reqwest::get("https://api.trustedservices.intel.com/sgx/certification/v4/fmspcs").await
|
||||
.expect("url retrieval failed")
|
||||
.text()
|
||||
.await
|
||||
.expect("could not read https response");
|
||||
let fmspc_data: Vec<Value> = serde_json::from_str(&body).expect("could not convert to JSON");
|
||||
let mut fmspc_list: Vec<Fmspc> = Vec::new();
|
||||
|
@ -54,9 +56,9 @@ async fn upsert_tcbinfo() -> Result<(), &'static str> {
|
|||
let data = fs::read_to_string("./standard").expect("Unable to read file");
|
||||
let mut store: HashMap<Fmspc, TcbInfo> = serde_json::from_str(&data).unwrap();
|
||||
|
||||
let fmspc_list = get_fmspc_list();
|
||||
let fmspc_list = get_fmspc_list().await;
|
||||
for fmspc in fmspc_list {
|
||||
let tcbinfo = get_tcbinfo(fmspc.clone(), "standard".to_string());
|
||||
let tcbinfo = get_tcbinfo(fmspc.clone(), "standard".to_string()).await;
|
||||
let store_entry = &store[&fmspc];
|
||||
if *store_entry != tcbinfo {
|
||||
println!("updating local TCBInfo for FMSPC: {fmspc}");
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue