blob: 39958a31c03a6f7ae4971da3d10d4853597c86a8 [file] [log] [blame]
Hasini Gunasingheda895552021-01-27 19:34:37 +00001// Copyright 2021, The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Janis Danisevskis34a0cf22021-03-08 09:19:03 -080015//! This module implements IKeystoreMaintenance AIDL interface.
Hasini Gunasingheda895552021-01-27 19:34:37 +000016
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -070017use crate::database::{KeyEntryLoadBits, KeyType, MonotonicRawTime};
Satya Tangirala5b9e5b12021-03-09 12:54:21 -080018use crate::error::map_km_error;
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -070019use crate::error::map_or_log_err;
20use crate::error::Error;
Satya Tangirala5b9e5b12021-03-09 12:54:21 -080021use crate::globals::get_keymint_device;
Hasini Gunasinghe3ed5da72021-02-04 15:18:54 +000022use crate::globals::{DB, LEGACY_MIGRATOR, SUPER_KEY};
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -070023use crate::permission::{KeyPerm, KeystorePerm};
Hasini Gunasingheda895552021-01-27 19:34:37 +000024use crate::super_key::UserState;
John Wu16db29e2022-01-13 15:21:43 -080025use crate::utils::{
26 check_key_permission, check_keystore_permission, list_key_entries, watchdog as wd,
27};
Paul Crowley46c703e2021-08-06 15:13:53 -070028use android_hardware_security_keymint::aidl::android::hardware::security::keymint::{
29 IKeyMintDevice::IKeyMintDevice, SecurityLevel::SecurityLevel,
30};
Hasini Gunasinghe9ee18412021-03-11 20:12:44 +000031use android_security_maintenance::aidl::android::security::maintenance::{
John Wu16db29e2022-01-13 15:21:43 -080032 IKeystoreMaintenance::{BnKeystoreMaintenance, IKeystoreMaintenance, UID_SELF},
Hasini Gunasinghe9ee18412021-03-11 20:12:44 +000033 UserState::UserState as AidlUserState,
Hasini Gunasingheda895552021-01-27 19:34:37 +000034};
Andrew Walbrande45c8b2021-04-13 14:42:38 +000035use android_security_maintenance::binder::{
36 BinderFeatures, Interface, Result as BinderResult, Strong, ThreadState,
37};
Janis Danisevskis5898d152021-06-15 08:23:46 -070038use android_system_keystore2::aidl::android::system::keystore2::KeyDescriptor::KeyDescriptor;
Hasini Gunasingheda895552021-01-27 19:34:37 +000039use android_system_keystore2::aidl::android::system::keystore2::ResponseCode::ResponseCode;
40use anyhow::{Context, Result};
Paul Crowleyf61fee72021-03-17 14:38:44 -070041use keystore2_crypto::Password;
John Wu16db29e2022-01-13 15:21:43 -080042use keystore2_selinux as selinux;
Hasini Gunasingheda895552021-01-27 19:34:37 +000043
Janis Danisevskis5898d152021-06-15 08:23:46 -070044/// Reexport Domain for the benefit of DeleteListener
45pub use android_system_keystore2::aidl::android::system::keystore2::Domain::Domain;
46
47/// The Maintenance module takes a delete listener argument which observes user and namespace
48/// deletion events.
49pub trait DeleteListener {
50 /// Called by the maintenance module when an app/namespace is deleted.
51 fn delete_namespace(&self, domain: Domain, namespace: i64) -> Result<()>;
52 /// Called by the maintenance module when a user is deleted.
53 fn delete_user(&self, user_id: u32) -> Result<()>;
54}
55
Hasini Gunasingheda895552021-01-27 19:34:37 +000056/// This struct is defined to implement the aforementioned AIDL interface.
Janis Danisevskis5898d152021-06-15 08:23:46 -070057pub struct Maintenance {
58 delete_listener: Box<dyn DeleteListener + Send + Sync + 'static>,
59}
Hasini Gunasingheda895552021-01-27 19:34:37 +000060
Janis Danisevskis34a0cf22021-03-08 09:19:03 -080061impl Maintenance {
Janis Danisevskis5898d152021-06-15 08:23:46 -070062 /// Create a new instance of Keystore Maintenance service.
63 pub fn new_native_binder(
64 delete_listener: Box<dyn DeleteListener + Send + Sync + 'static>,
65 ) -> Result<Strong<dyn IKeystoreMaintenance>> {
Andrew Walbrande45c8b2021-04-13 14:42:38 +000066 Ok(BnKeystoreMaintenance::new_binder(
Janis Danisevskis5898d152021-06-15 08:23:46 -070067 Self { delete_listener },
Andrew Walbrande45c8b2021-04-13 14:42:38 +000068 BinderFeatures { set_requesting_sid: true, ..BinderFeatures::default() },
69 ))
Hasini Gunasingheda895552021-01-27 19:34:37 +000070 }
71
Paul Crowleyf61fee72021-03-17 14:38:44 -070072 fn on_user_password_changed(user_id: i32, password: Option<Password>) -> Result<()> {
Hasini Gunasingheda895552021-01-27 19:34:37 +000073 //Check permission. Function should return if this failed. Therefore having '?' at the end
74 //is very important.
Janis Danisevskisa916d992021-10-19 15:46:09 -070075 check_keystore_permission(KeystorePerm::ChangePassword)
Hasini Gunasingheda895552021-01-27 19:34:37 +000076 .context("In on_user_password_changed.")?;
77
Paul Crowley7a658392021-03-18 17:08:20 -070078 if let Some(pw) = password.as_ref() {
79 DB.with(|db| {
Paul Crowley8d5b2532021-03-19 10:53:07 -070080 SUPER_KEY.unlock_screen_lock_bound_key(&mut db.borrow_mut(), user_id as u32, pw)
Paul Crowley7a658392021-03-18 17:08:20 -070081 })
Paul Crowley8d5b2532021-03-19 10:53:07 -070082 .context("In on_user_password_changed: unlock_screen_lock_bound_key failed")?;
Paul Crowley7a658392021-03-18 17:08:20 -070083 }
84
Hasini Gunasingheda895552021-01-27 19:34:37 +000085 match DB
86 .with(|db| {
87 UserState::get_with_password_changed(
88 &mut db.borrow_mut(),
Hasini Gunasinghe3ed5da72021-02-04 15:18:54 +000089 &LEGACY_MIGRATOR,
Hasini Gunasingheda895552021-01-27 19:34:37 +000090 &SUPER_KEY,
91 user_id as u32,
Paul Crowleyf61fee72021-03-17 14:38:44 -070092 password.as_ref(),
Hasini Gunasingheda895552021-01-27 19:34:37 +000093 )
94 })
95 .context("In on_user_password_changed.")?
96 {
97 UserState::LskfLocked => {
Janis Danisevskiseed69842021-02-18 20:04:10 -080098 // Error - password can not be changed when the device is locked
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -070099 Err(Error::Rc(ResponseCode::LOCKED))
Hasini Gunasingheda895552021-01-27 19:34:37 +0000100 .context("In on_user_password_changed. Device is locked.")
101 }
102 _ => {
Janis Danisevskiseed69842021-02-18 20:04:10 -0800103 // LskfLocked is the only error case for password change
Hasini Gunasingheda895552021-01-27 19:34:37 +0000104 Ok(())
105 }
106 }
107 }
108
Janis Danisevskis5898d152021-06-15 08:23:46 -0700109 fn add_or_remove_user(&self, user_id: i32) -> Result<()> {
Hasini Gunasingheda895552021-01-27 19:34:37 +0000110 // Check permission. Function should return if this failed. Therefore having '?' at the end
111 // is very important.
Janis Danisevskisa916d992021-10-19 15:46:09 -0700112 check_keystore_permission(KeystorePerm::ChangeUser).context("In add_or_remove_user.")?;
Janis Danisevskiseed69842021-02-18 20:04:10 -0800113 DB.with(|db| {
114 UserState::reset_user(
115 &mut db.borrow_mut(),
116 &SUPER_KEY,
117 &LEGACY_MIGRATOR,
118 user_id as u32,
119 false,
120 )
121 })
Janis Danisevskis5898d152021-06-15 08:23:46 -0700122 .context("In add_or_remove_user: Trying to delete keys from db.")?;
123 self.delete_listener
124 .delete_user(user_id as u32)
125 .context("In add_or_remove_user: While invoking the delete listener.")
Hasini Gunasingheda895552021-01-27 19:34:37 +0000126 }
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800127
Janis Danisevskis5898d152021-06-15 08:23:46 -0700128 fn clear_namespace(&self, domain: Domain, nspace: i64) -> Result<()> {
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800129 // Permission check. Must return on error. Do not touch the '?'.
Janis Danisevskisa916d992021-10-19 15:46:09 -0700130 check_keystore_permission(KeystorePerm::ClearUID).context("In clear_namespace.")?;
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800131
132 LEGACY_MIGRATOR
133 .bulk_delete_uid(domain, nspace)
134 .context("In clear_namespace: Trying to delete legacy keys.")?;
135 DB.with(|db| db.borrow_mut().unbind_keys_for_namespace(domain, nspace))
Janis Danisevskis5898d152021-06-15 08:23:46 -0700136 .context("In clear_namespace: Trying to delete keys from db.")?;
137 self.delete_listener
138 .delete_namespace(domain, nspace)
139 .context("In clear_namespace: While invoking the delete listener.")
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800140 }
Hasini Gunasinghe9ee18412021-03-11 20:12:44 +0000141
142 fn get_state(user_id: i32) -> Result<AidlUserState> {
143 // Check permission. Function should return if this failed. Therefore having '?' at the end
144 // is very important.
Janis Danisevskisa916d992021-10-19 15:46:09 -0700145 check_keystore_permission(KeystorePerm::GetState).context("In get_state.")?;
Hasini Gunasinghe9ee18412021-03-11 20:12:44 +0000146 let state = DB
147 .with(|db| {
148 UserState::get(&mut db.borrow_mut(), &LEGACY_MIGRATOR, &SUPER_KEY, user_id as u32)
149 })
150 .context("In get_state. Trying to get UserState.")?;
151
152 match state {
153 UserState::Uninitialized => Ok(AidlUserState::UNINITIALIZED),
154 UserState::LskfUnlocked(_) => Ok(AidlUserState::LSKF_UNLOCKED),
155 UserState::LskfLocked => Ok(AidlUserState::LSKF_LOCKED),
156 }
157 }
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700158
Paul Crowley46c703e2021-08-06 15:13:53 -0700159 fn call_with_watchdog<F>(sec_level: SecurityLevel, name: &'static str, op: &F) -> Result<()>
160 where
Stephen Cranea723ee22022-01-19 00:05:11 +0000161 F: Fn(Strong<dyn IKeyMintDevice>) -> binder::public_api::Result<()>,
Paul Crowley46c703e2021-08-06 15:13:53 -0700162 {
Janis Danisevskis5f3a0572021-06-18 11:26:42 -0700163 let (km_dev, _, _) = get_keymint_device(&sec_level)
Paul Crowley46c703e2021-08-06 15:13:53 -0700164 .context("In call_with_watchdog: getting keymint device")?;
Janis Danisevskis2ee014b2021-05-05 14:29:08 -0700165
Paul Crowley46c703e2021-08-06 15:13:53 -0700166 let _wp = wd::watch_millis_with("In call_with_watchdog", 500, move || {
167 format!("Seclevel: {:?} Op: {}", sec_level, name)
168 });
169 map_km_error(op(km_dev)).with_context(|| format!("In keymint device: calling {}", name))?;
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800170 Ok(())
171 }
172
Paul Crowley46c703e2021-08-06 15:13:53 -0700173 fn call_on_all_security_levels<F>(name: &'static str, op: F) -> Result<()>
174 where
Stephen Cranea723ee22022-01-19 00:05:11 +0000175 F: Fn(Strong<dyn IKeyMintDevice>) -> binder::public_api::Result<()>,
Paul Crowley46c703e2021-08-06 15:13:53 -0700176 {
177 let sec_levels = [
178 (SecurityLevel::TRUSTED_ENVIRONMENT, "TRUSTED_ENVIRONMENT"),
179 (SecurityLevel::STRONGBOX, "STRONGBOX"),
180 ];
181 sec_levels.iter().fold(Ok(()), move |result, (sec_level, sec_level_string)| {
182 let curr_result = Maintenance::call_with_watchdog(*sec_level, name, &op);
183 match curr_result {
184 Ok(()) => log::info!(
185 "Call to {} succeeded for security level {}.",
186 name,
187 &sec_level_string
188 ),
189 Err(ref e) => log::error!(
190 "Call to {} failed for security level {}: {}.",
191 name,
192 &sec_level_string,
193 e
194 ),
195 }
196 result.and(curr_result)
197 })
198 }
199
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800200 fn early_boot_ended() -> Result<()> {
Janis Danisevskisa916d992021-10-19 15:46:09 -0700201 check_keystore_permission(KeystorePerm::EarlyBootEnded)
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800202 .context("In early_boot_ended. Checking permission")?;
Paul Crowley44c02da2021-04-08 17:04:43 +0000203 log::info!("In early_boot_ended.");
204
205 if let Err(e) = DB.with(|db| SUPER_KEY.set_up_boot_level_cache(&mut db.borrow_mut())) {
206 log::error!("SUPER_KEY.set_up_boot_level_cache failed:\n{:?}\n:(", e);
207 }
Paul Crowley46c703e2021-08-06 15:13:53 -0700208 Maintenance::call_on_all_security_levels("earlyBootEnded", |dev| dev.earlyBootEnded())
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800209 }
210
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700211 fn on_device_off_body() -> Result<()> {
212 // Security critical permission check. This statement must return on fail.
Janis Danisevskisa916d992021-10-19 15:46:09 -0700213 check_keystore_permission(KeystorePerm::ReportOffBody).context("In on_device_off_body.")?;
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700214
Matthew Maurerd7815ca2021-05-06 21:58:45 -0700215 DB.with(|db| db.borrow_mut().update_last_off_body(MonotonicRawTime::now()));
216 Ok(())
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700217 }
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700218
219 fn migrate_key_namespace(source: &KeyDescriptor, destination: &KeyDescriptor) -> Result<()> {
Ashwini Orugantidaf73bc2021-11-15 10:46:31 -0800220 let migrate_any_key_permission =
221 check_keystore_permission(KeystorePerm::MigrateAnyKey).is_ok();
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700222
John Wu16db29e2022-01-13 15:21:43 -0800223 let src_uid = match source.domain {
224 Domain::SELINUX | Domain::KEY_ID => ThreadState::get_calling_uid(),
225 Domain::APP if source.nspace == UID_SELF.into() => ThreadState::get_calling_uid(),
226 Domain::APP if source.nspace != UID_SELF.into() && migrate_any_key_permission => {
227 source.nspace as u32
228 }
229 _ => {
230 return Err(Error::Rc(ResponseCode::INVALID_ARGUMENT)).context(
231 "In migrate_key_namespace:
232 Source domain must be one of APP, SELINUX, or KEY_ID.",
233 )
234 }
235 };
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700236
John Wu16db29e2022-01-13 15:21:43 -0800237 let dest_uid = match destination.domain {
238 Domain::SELINUX => ThreadState::get_calling_uid(),
239 Domain::APP if destination.nspace == UID_SELF.into() => ThreadState::get_calling_uid(),
240 Domain::APP if destination.nspace != UID_SELF.into() && migrate_any_key_permission => {
241 destination.nspace as u32
242 }
243 _ => {
244 return Err(Error::Rc(ResponseCode::INVALID_ARGUMENT)).context(
245 "In migrate_key_namespace:
246 Destination domain must be one of APP or SELINUX.",
247 )
248 }
249 };
250
251 DB.with(|db| {
252 let (key_id_guard, _) = LEGACY_MIGRATOR
253 .with_try_migrate(source, src_uid, || {
254 db.borrow_mut().load_key_entry(
255 source,
256 KeyType::Client,
257 KeyEntryLoadBits::NONE,
258 src_uid,
259 |k, av| {
260 if migrate_any_key_permission {
261 Ok(())
262 } else {
263 check_key_permission(KeyPerm::Use, k, &av)?;
264 check_key_permission(KeyPerm::Delete, k, &av)?;
265 check_key_permission(KeyPerm::Grant, k, &av)
266 }
267 },
268 )
269 })
270 .context("In migrate_key_namespace: Failed to load key blob.")?;
271
272 db.borrow_mut().migrate_key_namespace(key_id_guard, destination, dest_uid, |k| {
273 if migrate_any_key_permission {
274 Ok(())
275 } else {
276 check_key_permission(KeyPerm::Rebind, k, &None)
Ashwini Orugantidaf73bc2021-11-15 10:46:31 -0800277 }
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700278 })
279 })
280 }
Paul Crowley46c703e2021-08-06 15:13:53 -0700281
282 fn delete_all_keys() -> Result<()> {
283 // Security critical permission check. This statement must return on fail.
Janis Danisevskisa916d992021-10-19 15:46:09 -0700284 check_keystore_permission(KeystorePerm::DeleteAllKeys)
Paul Crowley46c703e2021-08-06 15:13:53 -0700285 .context("In delete_all_keys. Checking permission")?;
286 log::info!("In delete_all_keys.");
287
288 Maintenance::call_on_all_security_levels("deleteAllKeys", |dev| dev.deleteAllKeys())
289 }
John Wu16db29e2022-01-13 15:21:43 -0800290
291 fn list_entries(domain: Domain, nspace: i64) -> Result<Vec<KeyDescriptor>> {
292 let k = match domain {
293 Domain::APP | Domain::SELINUX => KeyDescriptor{domain, nspace, ..Default::default()},
294 _ => return Err(Error::perm()).context(
295 "In list_entries: List entries is only supported for Domain::APP and Domain::SELINUX."
296 ),
297 };
298
299 // The caller has to have either GetInfo for the namespace or List permission
300 check_key_permission(KeyPerm::GetInfo, &k, &None)
301 .or_else(|e| {
302 if Some(&selinux::Error::PermissionDenied)
303 == e.root_cause().downcast_ref::<selinux::Error>()
304 {
305 check_keystore_permission(KeystorePerm::List)
306 } else {
307 Err(e)
308 }
309 })
310 .context("In list_entries: While checking key and keystore permission.")?;
311
312 DB.with(|db| list_key_entries(&mut db.borrow_mut(), domain, nspace))
313 }
Hasini Gunasingheda895552021-01-27 19:34:37 +0000314}
315
Janis Danisevskis34a0cf22021-03-08 09:19:03 -0800316impl Interface for Maintenance {}
Hasini Gunasingheda895552021-01-27 19:34:37 +0000317
Janis Danisevskis34a0cf22021-03-08 09:19:03 -0800318impl IKeystoreMaintenance for Maintenance {
Hasini Gunasingheda895552021-01-27 19:34:37 +0000319 fn onUserPasswordChanged(&self, user_id: i32, password: Option<&[u8]>) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000320 let _wp = wd::watch_millis("IKeystoreMaintenance::onUserPasswordChanged", 500);
Paul Crowleyf61fee72021-03-17 14:38:44 -0700321 map_or_log_err(Self::on_user_password_changed(user_id, password.map(|pw| pw.into())), Ok)
Hasini Gunasingheda895552021-01-27 19:34:37 +0000322 }
323
324 fn onUserAdded(&self, user_id: i32) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000325 let _wp = wd::watch_millis("IKeystoreMaintenance::onUserAdded", 500);
Janis Danisevskis5898d152021-06-15 08:23:46 -0700326 map_or_log_err(self.add_or_remove_user(user_id), Ok)
Hasini Gunasingheda895552021-01-27 19:34:37 +0000327 }
328
329 fn onUserRemoved(&self, user_id: i32) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000330 let _wp = wd::watch_millis("IKeystoreMaintenance::onUserRemoved", 500);
Janis Danisevskis5898d152021-06-15 08:23:46 -0700331 map_or_log_err(self.add_or_remove_user(user_id), Ok)
Hasini Gunasingheda895552021-01-27 19:34:37 +0000332 }
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800333
334 fn clearNamespace(&self, domain: Domain, nspace: i64) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000335 let _wp = wd::watch_millis("IKeystoreMaintenance::clearNamespace", 500);
Janis Danisevskis5898d152021-06-15 08:23:46 -0700336 map_or_log_err(self.clear_namespace(domain, nspace), Ok)
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800337 }
Hasini Gunasinghe9ee18412021-03-11 20:12:44 +0000338
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700339 fn getState(&self, user_id: i32) -> BinderResult<AidlUserState> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000340 let _wp = wd::watch_millis("IKeystoreMaintenance::getState", 500);
Hasini Gunasinghe9ee18412021-03-11 20:12:44 +0000341 map_or_log_err(Self::get_state(user_id), Ok)
342 }
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700343
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800344 fn earlyBootEnded(&self) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000345 let _wp = wd::watch_millis("IKeystoreMaintenance::earlyBootEnded", 500);
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800346 map_or_log_err(Self::early_boot_ended(), Ok)
347 }
348
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700349 fn onDeviceOffBody(&self) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000350 let _wp = wd::watch_millis("IKeystoreMaintenance::onDeviceOffBody", 500);
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700351 map_or_log_err(Self::on_device_off_body(), Ok)
352 }
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700353
354 fn migrateKeyNamespace(
355 &self,
356 source: &KeyDescriptor,
357 destination: &KeyDescriptor,
358 ) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000359 let _wp = wd::watch_millis("IKeystoreMaintenance::migrateKeyNamespace", 500);
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700360 map_or_log_err(Self::migrate_key_namespace(source, destination), Ok)
361 }
Paul Crowley46c703e2021-08-06 15:13:53 -0700362
John Wu16db29e2022-01-13 15:21:43 -0800363 fn listEntries(&self, domain: Domain, namespace: i64) -> BinderResult<Vec<KeyDescriptor>> {
364 let _wp = wd::watch_millis("IKeystoreMaintenance::listEntries", 500);
365 map_or_log_err(Self::list_entries(domain, namespace), Ok)
366 }
367
Paul Crowley46c703e2021-08-06 15:13:53 -0700368 fn deleteAllKeys(&self) -> BinderResult<()> {
369 let _wp = wd::watch_millis("IKeystoreMaintenance::deleteAllKeys", 500);
370 map_or_log_err(Self::delete_all_keys(), Ok)
371 }
Hasini Gunasingheda895552021-01-27 19:34:37 +0000372}