Use CompOsKeyService as compsvc factory.
Define a Signer trait to encapsulate what we need to do to sign a
digest.
Modify compsvc to hold a signer.
Modify CompOsKeyService to be able to take in a keyblob and produce a
signer, then return a compsvc instance holding that signer.
This doesn't yet do anything with the signer. Eventually we will want
to use it to generate signatures on output artifacts.
Bug: 194267113
Test: atest ComposHostTestCases (with testOdrefesh un-ignored)
Change-Id: I72aead0280914987f7c8d1721c1e12ee0fad1af4
diff --git a/compos/src/compsvc.rs b/compos/src/compsvc.rs
index 3903cd0..24e52f5 100644
--- a/compos/src/compsvc.rs
+++ b/compos/src/compsvc.rs
@@ -30,6 +30,7 @@
use minijail::{self, Minijail};
use std::path::PathBuf;
+use crate::signer::Signer;
use compos_aidl_interface::aidl::com::android::compos::ICompService::{
BnCompService, ICompService,
};
@@ -46,8 +47,17 @@
/// Constructs a binder object that implements ICompService. task_bin is the path to the binary that will
/// be run when execute() is called. If debuggable is true then stdout/stderr from the binary will be
/// available for debugging.
-pub fn new_binder(task_bin: String, debuggable: bool) -> Strong<dyn ICompService> {
- let service = CompService { worker_bin: PathBuf::from(WORKER_BIN), task_bin, debuggable };
+pub fn new_binder(
+ task_bin: String,
+ debuggable: bool,
+ signer: Option<Box<dyn Signer>>,
+) -> Strong<dyn ICompService> {
+ let service = CompService {
+ worker_bin: PathBuf::from(WORKER_BIN.to_owned()),
+ task_bin,
+ debuggable,
+ signer,
+ };
BnCompService::new_binder(service, BinderFeatures::default())
}
@@ -55,6 +65,8 @@
task_bin: String,
worker_bin: PathBuf,
debuggable: bool,
+ #[allow(dead_code)] // TODO: Make use of this
+ signer: Option<Box<dyn Signer>>,
}
impl CompService {