blob: 1fca5d96ad64fc4fbcd844e73c9fa41993fc7edf [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;
Janis Danisevskis0ffb8a82022-02-06 22:37:21 -080022use crate::globals::{DB, LEGACY_IMPORTER, SUPER_KEY};
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -070023use crate::permission::{KeyPerm, KeystorePerm};
Janis Danisevskis0fd25a62022-01-04 19:53:37 -080024use crate::super_key::{SuperKeyManager, UserState};
John Wu16db29e2022-01-13 15:21:43 -080025use crate::utils::{
John Wu889c1cc2022-03-14 16:02:56 -070026 check_key_permission, check_keystore_permission, uid_to_android_user, watchdog as wd,
John Wu16db29e2022-01-13 15:21:43 -080027};
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 Wu889c1cc2022-03-14 16:02:56 -070032 IKeystoreMaintenance::{BnKeystoreMaintenance, IKeystoreMaintenance},
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;
Hasini Gunasingheda895552021-01-27 19:34:37 +000042
Janis Danisevskis5898d152021-06-15 08:23:46 -070043/// Reexport Domain for the benefit of DeleteListener
44pub use android_system_keystore2::aidl::android::system::keystore2::Domain::Domain;
45
46/// The Maintenance module takes a delete listener argument which observes user and namespace
47/// deletion events.
48pub trait DeleteListener {
49 /// Called by the maintenance module when an app/namespace is deleted.
50 fn delete_namespace(&self, domain: Domain, namespace: i64) -> Result<()>;
51 /// Called by the maintenance module when a user is deleted.
52 fn delete_user(&self, user_id: u32) -> Result<()>;
53}
54
Hasini Gunasingheda895552021-01-27 19:34:37 +000055/// This struct is defined to implement the aforementioned AIDL interface.
Janis Danisevskis5898d152021-06-15 08:23:46 -070056pub struct Maintenance {
57 delete_listener: Box<dyn DeleteListener + Send + Sync + 'static>,
58}
Hasini Gunasingheda895552021-01-27 19:34:37 +000059
Janis Danisevskis34a0cf22021-03-08 09:19:03 -080060impl Maintenance {
Janis Danisevskis5898d152021-06-15 08:23:46 -070061 /// Create a new instance of Keystore Maintenance service.
62 pub fn new_native_binder(
63 delete_listener: Box<dyn DeleteListener + Send + Sync + 'static>,
64 ) -> Result<Strong<dyn IKeystoreMaintenance>> {
Andrew Walbrande45c8b2021-04-13 14:42:38 +000065 Ok(BnKeystoreMaintenance::new_binder(
Janis Danisevskis5898d152021-06-15 08:23:46 -070066 Self { delete_listener },
Andrew Walbrande45c8b2021-04-13 14:42:38 +000067 BinderFeatures { set_requesting_sid: true, ..BinderFeatures::default() },
68 ))
Hasini Gunasingheda895552021-01-27 19:34:37 +000069 }
70
Paul Crowleyf61fee72021-03-17 14:38:44 -070071 fn on_user_password_changed(user_id: i32, password: Option<Password>) -> Result<()> {
Janis Danisevskis0fd25a62022-01-04 19:53:37 -080072 // Check permission. Function should return if this failed. Therefore having '?' at the end
73 // is very important.
Janis Danisevskisa916d992021-10-19 15:46:09 -070074 check_keystore_permission(KeystorePerm::ChangePassword)
Hasini Gunasingheda895552021-01-27 19:34:37 +000075 .context("In on_user_password_changed.")?;
76
Janis Danisevskis0fd25a62022-01-04 19:53:37 -080077 let mut skm = SUPER_KEY.write().unwrap();
78
Paul Crowley7a658392021-03-18 17:08:20 -070079 if let Some(pw) = password.as_ref() {
80 DB.with(|db| {
Janis Danisevskis0fd25a62022-01-04 19:53:37 -080081 skm.unlock_screen_lock_bound_key(&mut db.borrow_mut(), user_id as u32, pw)
Paul Crowley7a658392021-03-18 17:08:20 -070082 })
Paul Crowley8d5b2532021-03-19 10:53:07 -070083 .context("In on_user_password_changed: unlock_screen_lock_bound_key failed")?;
Paul Crowley7a658392021-03-18 17:08:20 -070084 }
85
Hasini Gunasingheda895552021-01-27 19:34:37 +000086 match DB
87 .with(|db| {
Janis Danisevskis0fd25a62022-01-04 19:53:37 -080088 skm.reset_or_init_user_and_get_user_state(
Hasini Gunasingheda895552021-01-27 19:34:37 +000089 &mut db.borrow_mut(),
Janis Danisevskis0ffb8a82022-02-06 22:37:21 -080090 &LEGACY_IMPORTER,
Hasini Gunasingheda895552021-01-27 19:34:37 +000091 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 Danisevskis0fd25a62022-01-04 19:53:37 -0800113
Janis Danisevskiseed69842021-02-18 20:04:10 -0800114 DB.with(|db| {
Janis Danisevskis0fd25a62022-01-04 19:53:37 -0800115 SUPER_KEY.write().unwrap().reset_user(
Janis Danisevskiseed69842021-02-18 20:04:10 -0800116 &mut db.borrow_mut(),
Janis Danisevskis0ffb8a82022-02-06 22:37:21 -0800117 &LEGACY_IMPORTER,
Janis Danisevskiseed69842021-02-18 20:04:10 -0800118 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
Janis Danisevskis0ffb8a82022-02-06 22:37:21 -0800132 LEGACY_IMPORTER
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800133 .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| {
Janis Danisevskis0fd25a62022-01-04 19:53:37 -0800148 SUPER_KEY.read().unwrap().get_user_state(
149 &mut db.borrow_mut(),
Janis Danisevskis0ffb8a82022-02-06 22:37:21 -0800150 &LEGACY_IMPORTER,
Janis Danisevskis0fd25a62022-01-04 19:53:37 -0800151 user_id as u32,
152 )
Hasini Gunasinghe9ee18412021-03-11 20:12:44 +0000153 })
154 .context("In get_state. Trying to get UserState.")?;
155
156 match state {
157 UserState::Uninitialized => Ok(AidlUserState::UNINITIALIZED),
158 UserState::LskfUnlocked(_) => Ok(AidlUserState::LSKF_UNLOCKED),
159 UserState::LskfLocked => Ok(AidlUserState::LSKF_LOCKED),
160 }
161 }
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700162
Paul Crowley46c703e2021-08-06 15:13:53 -0700163 fn call_with_watchdog<F>(sec_level: SecurityLevel, name: &'static str, op: &F) -> Result<()>
164 where
Stephen Crane23cf7242022-01-19 17:49:46 +0000165 F: Fn(Strong<dyn IKeyMintDevice>) -> binder::Result<()>,
Paul Crowley46c703e2021-08-06 15:13:53 -0700166 {
Janis Danisevskis5f3a0572021-06-18 11:26:42 -0700167 let (km_dev, _, _) = get_keymint_device(&sec_level)
Paul Crowley46c703e2021-08-06 15:13:53 -0700168 .context("In call_with_watchdog: getting keymint device")?;
Janis Danisevskis2ee014b2021-05-05 14:29:08 -0700169
Paul Crowley46c703e2021-08-06 15:13:53 -0700170 let _wp = wd::watch_millis_with("In call_with_watchdog", 500, move || {
171 format!("Seclevel: {:?} Op: {}", sec_level, name)
172 });
173 map_km_error(op(km_dev)).with_context(|| format!("In keymint device: calling {}", name))?;
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800174 Ok(())
175 }
176
Paul Crowley46c703e2021-08-06 15:13:53 -0700177 fn call_on_all_security_levels<F>(name: &'static str, op: F) -> Result<()>
178 where
Stephen Crane23cf7242022-01-19 17:49:46 +0000179 F: Fn(Strong<dyn IKeyMintDevice>) -> binder::Result<()>,
Paul Crowley46c703e2021-08-06 15:13:53 -0700180 {
181 let sec_levels = [
182 (SecurityLevel::TRUSTED_ENVIRONMENT, "TRUSTED_ENVIRONMENT"),
183 (SecurityLevel::STRONGBOX, "STRONGBOX"),
184 ];
185 sec_levels.iter().fold(Ok(()), move |result, (sec_level, sec_level_string)| {
186 let curr_result = Maintenance::call_with_watchdog(*sec_level, name, &op);
187 match curr_result {
188 Ok(()) => log::info!(
189 "Call to {} succeeded for security level {}.",
190 name,
191 &sec_level_string
192 ),
193 Err(ref e) => log::error!(
194 "Call to {} failed for security level {}: {}.",
195 name,
196 &sec_level_string,
197 e
198 ),
199 }
200 result.and(curr_result)
201 })
202 }
203
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800204 fn early_boot_ended() -> Result<()> {
Janis Danisevskisa916d992021-10-19 15:46:09 -0700205 check_keystore_permission(KeystorePerm::EarlyBootEnded)
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800206 .context("In early_boot_ended. Checking permission")?;
Paul Crowley44c02da2021-04-08 17:04:43 +0000207 log::info!("In early_boot_ended.");
208
Janis Danisevskis0fd25a62022-01-04 19:53:37 -0800209 if let Err(e) =
210 DB.with(|db| SuperKeyManager::set_up_boot_level_cache(&SUPER_KEY, &mut db.borrow_mut()))
211 {
Paul Crowley44c02da2021-04-08 17:04:43 +0000212 log::error!("SUPER_KEY.set_up_boot_level_cache failed:\n{:?}\n:(", e);
213 }
Paul Crowley46c703e2021-08-06 15:13:53 -0700214 Maintenance::call_on_all_security_levels("earlyBootEnded", |dev| dev.earlyBootEnded())
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800215 }
216
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700217 fn on_device_off_body() -> Result<()> {
218 // Security critical permission check. This statement must return on fail.
Janis Danisevskisa916d992021-10-19 15:46:09 -0700219 check_keystore_permission(KeystorePerm::ReportOffBody).context("In on_device_off_body.")?;
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700220
Matthew Maurerd7815ca2021-05-06 21:58:45 -0700221 DB.with(|db| db.borrow_mut().update_last_off_body(MonotonicRawTime::now()));
222 Ok(())
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700223 }
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700224
225 fn migrate_key_namespace(source: &KeyDescriptor, destination: &KeyDescriptor) -> Result<()> {
John Wu889c1cc2022-03-14 16:02:56 -0700226 let calling_uid = ThreadState::get_calling_uid();
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700227
John Wu889c1cc2022-03-14 16:02:56 -0700228 match source.domain {
229 Domain::SELINUX | Domain::KEY_ID | Domain::APP => (),
John Wu16db29e2022-01-13 15:21:43 -0800230 _ => {
231 return Err(Error::Rc(ResponseCode::INVALID_ARGUMENT)).context(
Janis Danisevskis478a9a22022-01-28 08:22:59 -0800232 "In migrate_key_namespace: \
John Wu16db29e2022-01-13 15:21:43 -0800233 Source domain must be one of APP, SELINUX, or KEY_ID.",
234 )
235 }
236 };
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700237
John Wu889c1cc2022-03-14 16:02:56 -0700238 match destination.domain {
239 Domain::SELINUX | Domain::APP => (),
John Wu16db29e2022-01-13 15:21:43 -0800240 _ => {
241 return Err(Error::Rc(ResponseCode::INVALID_ARGUMENT)).context(
Janis Danisevskis478a9a22022-01-28 08:22:59 -0800242 "In migrate_key_namespace: \
John Wu16db29e2022-01-13 15:21:43 -0800243 Destination domain must be one of APP or SELINUX.",
244 )
245 }
246 };
247
John Wu889c1cc2022-03-14 16:02:56 -0700248 let user_id = uid_to_android_user(calling_uid);
Janis Danisevskisf84d0b02022-01-26 14:11:14 -0800249
250 let super_key = SUPER_KEY.read().unwrap().get_per_boot_key_by_user_id(user_id);
251
252 DB.with(|db| {
John Wu889c1cc2022-03-14 16:02:56 -0700253 let (key_id_guard, _) = LEGACY_IMPORTER
254 .with_try_import(source, calling_uid, super_key, || {
255 db.borrow_mut().load_key_entry(
256 source,
257 KeyType::Client,
258 KeyEntryLoadBits::NONE,
259 calling_uid,
260 |k, av| {
261 check_key_permission(KeyPerm::Use, k, &av)?;
262 check_key_permission(KeyPerm::Delete, k, &av)?;
263 check_key_permission(KeyPerm::Grant, k, &av)
264 },
265 )
Janis Danisevskisf84d0b02022-01-26 14:11:14 -0800266 })
John Wu889c1cc2022-03-14 16:02:56 -0700267 .context("In migrate_key_namespace: Failed to load key blob.")?;
268 {
269 db.borrow_mut().migrate_key_namespace(key_id_guard, destination, calling_uid, |k| {
270 check_key_permission(KeyPerm::Rebind, k, &None)
271 })
Janis Danisevskisf84d0b02022-01-26 14:11:14 -0800272 }
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700273 })
274 }
Paul Crowley46c703e2021-08-06 15:13:53 -0700275
276 fn delete_all_keys() -> Result<()> {
277 // Security critical permission check. This statement must return on fail.
Janis Danisevskisa916d992021-10-19 15:46:09 -0700278 check_keystore_permission(KeystorePerm::DeleteAllKeys)
Paul Crowley46c703e2021-08-06 15:13:53 -0700279 .context("In delete_all_keys. Checking permission")?;
280 log::info!("In delete_all_keys.");
281
282 Maintenance::call_on_all_security_levels("deleteAllKeys", |dev| dev.deleteAllKeys())
283 }
Hasini Gunasingheda895552021-01-27 19:34:37 +0000284}
285
Janis Danisevskis34a0cf22021-03-08 09:19:03 -0800286impl Interface for Maintenance {}
Hasini Gunasingheda895552021-01-27 19:34:37 +0000287
Janis Danisevskis34a0cf22021-03-08 09:19:03 -0800288impl IKeystoreMaintenance for Maintenance {
Hasini Gunasingheda895552021-01-27 19:34:37 +0000289 fn onUserPasswordChanged(&self, user_id: i32, password: Option<&[u8]>) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000290 let _wp = wd::watch_millis("IKeystoreMaintenance::onUserPasswordChanged", 500);
Paul Crowleyf61fee72021-03-17 14:38:44 -0700291 map_or_log_err(Self::on_user_password_changed(user_id, password.map(|pw| pw.into())), Ok)
Hasini Gunasingheda895552021-01-27 19:34:37 +0000292 }
293
294 fn onUserAdded(&self, user_id: i32) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000295 let _wp = wd::watch_millis("IKeystoreMaintenance::onUserAdded", 500);
Janis Danisevskis5898d152021-06-15 08:23:46 -0700296 map_or_log_err(self.add_or_remove_user(user_id), Ok)
Hasini Gunasingheda895552021-01-27 19:34:37 +0000297 }
298
299 fn onUserRemoved(&self, user_id: i32) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000300 let _wp = wd::watch_millis("IKeystoreMaintenance::onUserRemoved", 500);
Janis Danisevskis5898d152021-06-15 08:23:46 -0700301 map_or_log_err(self.add_or_remove_user(user_id), Ok)
Hasini Gunasingheda895552021-01-27 19:34:37 +0000302 }
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800303
304 fn clearNamespace(&self, domain: Domain, nspace: i64) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000305 let _wp = wd::watch_millis("IKeystoreMaintenance::clearNamespace", 500);
Janis Danisevskis5898d152021-06-15 08:23:46 -0700306 map_or_log_err(self.clear_namespace(domain, nspace), Ok)
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800307 }
Hasini Gunasinghe9ee18412021-03-11 20:12:44 +0000308
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700309 fn getState(&self, user_id: i32) -> BinderResult<AidlUserState> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000310 let _wp = wd::watch_millis("IKeystoreMaintenance::getState", 500);
Hasini Gunasinghe9ee18412021-03-11 20:12:44 +0000311 map_or_log_err(Self::get_state(user_id), Ok)
312 }
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700313
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800314 fn earlyBootEnded(&self) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000315 let _wp = wd::watch_millis("IKeystoreMaintenance::earlyBootEnded", 500);
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800316 map_or_log_err(Self::early_boot_ended(), Ok)
317 }
318
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700319 fn onDeviceOffBody(&self) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000320 let _wp = wd::watch_millis("IKeystoreMaintenance::onDeviceOffBody", 500);
Janis Danisevskis333b7c02021-03-23 18:57:41 -0700321 map_or_log_err(Self::on_device_off_body(), Ok)
322 }
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700323
324 fn migrateKeyNamespace(
325 &self,
326 source: &KeyDescriptor,
327 destination: &KeyDescriptor,
328 ) -> BinderResult<()> {
Hasini Gunasinghe5a893e82021-05-05 14:32:32 +0000329 let _wp = wd::watch_millis("IKeystoreMaintenance::migrateKeyNamespace", 500);
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700330 map_or_log_err(Self::migrate_key_namespace(source, destination), Ok)
331 }
Paul Crowley46c703e2021-08-06 15:13:53 -0700332
333 fn deleteAllKeys(&self) -> BinderResult<()> {
334 let _wp = wd::watch_millis("IKeystoreMaintenance::deleteAllKeys", 500);
335 map_or_log_err(Self::delete_all_keys(), Ok)
336 }
Hasini Gunasingheda895552021-01-27 19:34:37 +0000337}