Skip to content

Commit

Permalink
Merge pull request #3 from veracruz-project/dreemkiller_add_sev
Browse files Browse the repository at this point in the history
Added support for AMD SEV SNP
  • Loading branch information
dreemkiller authored Dec 6, 2023
2 parents a3ebe1d + 6a1f1bf commit 03cd0ab
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,22 @@ pub fn complete_proxy_attestation_linux(
_ => return Err(anyhow!(ProxyAttestationClientError::BadResponse)),
}
}

pub fn complete_proxy_attestation_sev(
proxy_attestation_server_url: &str,
report: &[u8],
csr: &[u8],
challenge_id: Uuid,
) -> AnyhowResult<Vec<u8>> {
let url = format!("http://{:}/proxy/v1/SEV/{:}", proxy_attestation_server_url, challenge_id);
let mut form_fields: HashMap<String, String> = HashMap::new();
form_fields.insert("token".to_string(), base64::encode(report));
form_fields.insert("csr".to_string(), base64::encode(csr));

let response = http::post_form(url, &form_fields)
.map_err(|err| ProxyAttestationClientError::HttpError(err))?;
match response {
http::HttpResponse::Ok(data) => return Ok(data),
_ => return Err(anyhow!(ProxyAttestationClientError::BadResponse)),
}
}

0 comments on commit 03cd0ab

Please sign in to comment.