mirror of
https://github.com/AmbiML/sparrow-kata-full.git
synced 2025-07-14 22:44:13 +00:00
kata-security-coordinator::fakeimpl: construct unique bundle id's
Fake bundle id's are now "fake.X" where X is the CPtr for the package contents' CNode (which is known unique). While here fix some whitespace bogons. Change-Id: I84c586e11f56c416d9bad667cae8e4cecba5dca2 GitOrigin-RevId: 0cec9e3308d9f3fe019af666dea583f92b3735b4
This commit is contained in:
parent
066d37db24
commit
ae3de25663
@ -1,6 +1,7 @@
|
|||||||
//! Kata OS security coordinator fake support
|
//! Kata OS security coordinator fake support
|
||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
use alloc::fmt;
|
||||||
use alloc::string::{String, ToString};
|
use alloc::string::{String, ToString};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use kata_memory_interface::ObjDescBundle;
|
use kata_memory_interface::ObjDescBundle;
|
||||||
@ -22,16 +23,16 @@ impl BundleData {
|
|||||||
pkg_size: size,
|
pkg_size: size,
|
||||||
manifest: String::from(
|
manifest: String::from(
|
||||||
"# Comments like this
|
"# Comments like this
|
||||||
[Manifest]
|
[Manifest]
|
||||||
BundleId=com.google.cerebra.hw.HelloWorld
|
BundleId=com.google.cerebra.hw.HelloWorld
|
||||||
|
|
||||||
[Binaries]
|
[Binaries]
|
||||||
App=HelloWorldBin
|
App=HelloWorldBin
|
||||||
Model=NeuralNetworkName
|
Model=NeuralNetworkName
|
||||||
|
|
||||||
[Storage]
|
[Storage]
|
||||||
Required=1
|
Required=1
|
||||||
",
|
",
|
||||||
),
|
),
|
||||||
keys: HashMap::with_capacity(2),
|
keys: HashMap::with_capacity(2),
|
||||||
}
|
}
|
||||||
@ -78,7 +79,9 @@ pub type KataSecurityCoordinatorInterface = FakeSecurityCoordinator;
|
|||||||
|
|
||||||
impl SecurityCoordinatorInterface for FakeSecurityCoordinator {
|
impl SecurityCoordinatorInterface for FakeSecurityCoordinator {
|
||||||
fn install(&mut self, pkg_contents: &ObjDescBundle) -> Result<String, SecurityRequestError> {
|
fn install(&mut self, pkg_contents: &ObjDescBundle) -> Result<String, SecurityRequestError> {
|
||||||
let bundle_id = "fubar".to_string(); // XXX
|
// TODO(sleffler): get bundle_id from the manifest; for now use the
|
||||||
|
// cnode's CPtr since it is unique wrt all installed packages
|
||||||
|
let bundle_id = fmt::format(format_args!("fake.{}", pkg_contents.cnode));
|
||||||
if self.bundles.contains_key(&bundle_id) {
|
if self.bundles.contains_key(&bundle_id) {
|
||||||
return Err(SecurityRequestError::SreDeleteFirst);
|
return Err(SecurityRequestError::SreDeleteFirst);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user