Skip to content

Commit 6a1f1bf

Browse files
committed
Added support for AMD SEV SNP
1 parent a3ebe1d commit 6a1f1bf

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/lib.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,22 @@ pub fn complete_proxy_attestation_linux(
103103
_ => return Err(anyhow!(ProxyAttestationClientError::BadResponse)),
104104
}
105105
}
106+
107+
pub fn complete_proxy_attestation_sev(
108+
proxy_attestation_server_url: &str,
109+
report: &[u8],
110+
csr: &[u8],
111+
challenge_id: Uuid,
112+
) -> AnyhowResult<Vec<u8>> {
113+
let url = format!("http://{:}/proxy/v1/SEV/{:}", proxy_attestation_server_url, challenge_id);
114+
let mut form_fields: HashMap<String, String> = HashMap::new();
115+
form_fields.insert("token".to_string(), base64::encode(report));
116+
form_fields.insert("csr".to_string(), base64::encode(csr));
117+
118+
let response = http::post_form(url, &form_fields)
119+
.map_err(|err| ProxyAttestationClientError::HttpError(err))?;
120+
match response {
121+
http::HttpResponse::Ok(data) => return Ok(data),
122+
_ => return Err(anyhow!(ProxyAttestationClientError::BadResponse)),
123+
}
124+
}

0 commit comments

Comments
 (0)