forked from coconut-svsm/svsm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,094 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pub mod monitor; | ||
pub mod process; | ||
pub mod policy; | ||
//pub mod ClientExchange { | ||
|
||
|
||
|
||
|
||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use crate::{address::PhysAddr, greq::services::{get_regular_report, REPORT_RESPONSE_SIZE}}; | ||
use crate::greq::pld_report::SnpReportResponse; | ||
use crate::protocols::errors::SvsmReqError; | ||
use crate::protocols::RequestParams; | ||
use crate::mm::PerCPUPageMappingGuard; | ||
|
||
pub fn attest_monitor(params: &mut RequestParams) -> Result<(), SvsmReqError>{ | ||
let mut rep: [u8; REPORT_RESPONSE_SIZE] = [0u8;REPORT_RESPONSE_SIZE]; | ||
|
||
rep[0] = 1; | ||
log::info!("Requesting Monitor Attestation Report"); | ||
let rep_size = get_regular_report(&mut rep)?; | ||
|
||
if params.rdx == 0 { | ||
/* Here we only query for the size of the report */ | ||
params.rdx = rep_size.try_into().unwrap(); | ||
return Ok(()); | ||
} | ||
|
||
params.rdx = rep_size.try_into().unwrap(); | ||
|
||
log::info!("Size of Report: {rep_size}"); | ||
let r = SnpReportResponse::try_from_as_ref(&mut rep)?; | ||
log::info!("Report: {:?}\n",r); | ||
log::info!("Report: {:?}\n",rep); | ||
//TODO: Check if address is valid for this request | ||
let target_address = PhysAddr::from(params.rcx); | ||
let mapped_target_page = PerCPUPageMappingGuard::create_4k(target_address).unwrap(); | ||
let target = unsafe {mapped_target_page.virt_addr().as_mut_ptr::<[u8;4096]>().as_mut().unwrap()}; | ||
target[0..rep_size].copy_from_slice(&rep); | ||
|
||
|
||
Ok(()) | ||
} | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use crate::process_manager::process::TrustedProcess; | ||
|
||
pub fn attest_process() -> bool { | ||
log::info!("attest(): Attesting Monitor"); | ||
true | ||
} | ||
|
||
pub fn hash_process(process: &mut TrustedProcess) { | ||
log::info!("Hash of Process is: 0"); | ||
process.hash = [0u8;32]; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//use crate::address::PhysAddr; | ||
use crate::protocols::errors::SvsmReqError; | ||
use crate::protocols::RequestParams; | ||
use crate::attestation; | ||
use crate::process_manager::process::TrustedProcessType; | ||
|
||
const MONITOR_INIT: u32 = 0; | ||
const ATTEST_MONITOR: u32 = 1; | ||
//const LOAD_POLICY: u32 = 2; | ||
const CREATE_ZYGOTE: u32 = 4; | ||
const DELETE_ZYGOTE: u32 = 5; | ||
const CREATE_TRUSTLET: u32 = 6; | ||
const DELETE_TRUSTLET: u32 = 7; | ||
|
||
pub fn attest_monitor(params: &mut RequestParams) -> Result<(), SvsmReqError>{ | ||
attestation::monitor::attest_monitor(params) | ||
} | ||
pub fn monitor_init(_params: &mut RequestParams) -> Result<(), SvsmReqError>{ | ||
|
||
log::info!("Initilization Monitor"); | ||
super::process::PROCESS_STORE.init(10); | ||
crate::sp_pagetable::set_ecryption_mask_address_size(); | ||
log::info!("Initilization Done"); | ||
Ok(()) | ||
} | ||
|
||
pub fn create_zygote(params: &mut RequestParams) -> Result<(), SvsmReqError>{ | ||
super::process::create_trusted_process(params,TrustedProcessType::Zygote) | ||
} | ||
|
||
pub fn delete_zygote(params: &mut RequestParams) -> Result<(), SvsmReqError> { | ||
super::process::delete_trusted_process(params) | ||
} | ||
|
||
pub fn create_trustlet(params: &mut RequestParams) -> Result<(), SvsmReqError> { | ||
super::process::create_trusted_process(params, TrustedProcessType::Trustlet) | ||
} | ||
|
||
pub fn delete_trustlet(params: &mut RequestParams) -> Result<(), SvsmReqError> { | ||
super::process::delete_trusted_process(params) | ||
} | ||
|
||
|
||
pub fn monitor_call_handler(request: u32, params: &mut RequestParams) -> Result<(), SvsmReqError> { | ||
match request { | ||
MONITOR_INIT => monitor_init(params), | ||
ATTEST_MONITOR => attest_monitor(params), | ||
CREATE_ZYGOTE => create_zygote(params), | ||
DELETE_ZYGOTE => delete_zygote(params), | ||
CREATE_TRUSTLET => create_trustlet(params), | ||
DELETE_TRUSTLET => delete_trustlet(params), | ||
_ => Err(SvsmReqError::unsupported_call()), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod call_handler; | ||
pub mod process; |
Oops, something went wrong.