blob: 8cbd9c757d6cf5f9443cd92e26ffd668bcf964d6 [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
Eric Biggersb5613da2024-03-13 19:31:42 +000017use crate::database::{KeyEntryLoadBits, KeyType};
David Drysdaledb7ddde2024-06-07 16:22:49 +010018use crate::error::into_logged_binder;
Satya Tangirala5b9e5b12021-03-09 12:54:21 -080019use crate::error::map_km_error;
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -070020use 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};
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +000023use crate::ks_err;
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -070024use crate::permission::{KeyPerm, KeystorePerm};
Eric Biggers9f7ebeb2024-06-20 14:59:32 +000025use crate::super_key::SuperKeyManager;
John Wu16db29e2022-01-13 15:21:43 -080026use crate::utils::{
Eran Messericfe79f12024-02-05 17:50:41 +000027 check_get_app_uids_affected_by_sid_permissions, check_key_permission,
28 check_keystore_permission, uid_to_android_user, watchdog as wd,
John Wu16db29e2022-01-13 15:21:43 -080029};
Paul Crowley46c703e2021-08-06 15:13:53 -070030use android_hardware_security_keymint::aidl::android::hardware::security::keymint::{
David Drysdalece2b90b2024-07-17 15:56:29 +010031 ErrorCode::ErrorCode, IKeyMintDevice::IKeyMintDevice, SecurityLevel::SecurityLevel,
Paul Crowley46c703e2021-08-06 15:13:53 -070032};
Eric Biggers2f9498a2023-10-09 23:16:05 +000033use android_security_maintenance::aidl::android::security::maintenance::IKeystoreMaintenance::{
34 BnKeystoreMaintenance, IKeystoreMaintenance,
Hasini Gunasingheda895552021-01-27 19:34:37 +000035};
Andrew Walbrande45c8b2021-04-13 14:42:38 +000036use android_security_maintenance::binder::{
37 BinderFeatures, Interface, Result as BinderResult, Strong, ThreadState,
38};
Janis Danisevskis5898d152021-06-15 08:23:46 -070039use android_system_keystore2::aidl::android::system::keystore2::KeyDescriptor::KeyDescriptor;
Hasini Gunasingheda895552021-01-27 19:34:37 +000040use android_system_keystore2::aidl::android::system::keystore2::ResponseCode::ResponseCode;
41use anyhow::{Context, Result};
Paul Crowleyf61fee72021-03-17 14:38:44 -070042use keystore2_crypto::Password;
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
Janis Danisevskis5898d152021-06-15 08:23:46 -070072 fn add_or_remove_user(&self, user_id: i32) -> 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.
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +000075 check_keystore_permission(KeystorePerm::ChangeUser).context(ks_err!())?;
Janis Danisevskis0fd25a62022-01-04 19:53:37 -080076
Janis Danisevskiseed69842021-02-18 20:04:10 -080077 DB.with(|db| {
Nathan Huckleberry204a0442023-03-30 17:27:47 +000078 SUPER_KEY.write().unwrap().remove_user(
Janis Danisevskiseed69842021-02-18 20:04:10 -080079 &mut db.borrow_mut(),
Janis Danisevskis0ffb8a82022-02-06 22:37:21 -080080 &LEGACY_IMPORTER,
Janis Danisevskiseed69842021-02-18 20:04:10 -080081 user_id as u32,
Janis Danisevskiseed69842021-02-18 20:04:10 -080082 )
83 })
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +000084 .context(ks_err!("Trying to delete keys from db."))?;
Janis Danisevskis5898d152021-06-15 08:23:46 -070085 self.delete_listener
86 .delete_user(user_id as u32)
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +000087 .context(ks_err!("While invoking the delete listener."))
Hasini Gunasingheda895552021-01-27 19:34:37 +000088 }
Janis Danisevskisddd6e752021-02-22 18:46:55 -080089
Eric Biggersb0478cf2023-10-27 03:55:29 +000090 fn init_user_super_keys(
91 &self,
92 user_id: i32,
93 password: Password,
94 allow_existing: bool,
95 ) -> Result<()> {
96 // Permission check. Must return on error. Do not touch the '?'.
97 check_keystore_permission(KeystorePerm::ChangeUser).context(ks_err!())?;
98
99 let mut skm = SUPER_KEY.write().unwrap();
100 DB.with(|db| {
101 skm.initialize_user(
102 &mut db.borrow_mut(),
103 &LEGACY_IMPORTER,
104 user_id as u32,
105 &password,
106 allow_existing,
107 )
108 })
109 .context(ks_err!("Failed to initialize user super keys"))
110 }
111
112 // Deletes all auth-bound keys when the user's LSKF is removed.
113 fn on_user_lskf_removed(user_id: i32) -> Result<()> {
114 // Permission check. Must return on error. Do not touch the '?'.
115 check_keystore_permission(KeystorePerm::ChangePassword).context(ks_err!())?;
116
117 LEGACY_IMPORTER
118 .bulk_delete_user(user_id as u32, true)
119 .context(ks_err!("Failed to delete legacy keys."))?;
120
121 DB.with(|db| db.borrow_mut().unbind_auth_bound_keys_for_user(user_id as u32))
122 .context(ks_err!("Failed to delete auth-bound keys."))
123 }
124
Janis Danisevskis5898d152021-06-15 08:23:46 -0700125 fn clear_namespace(&self, domain: Domain, nspace: i64) -> Result<()> {
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800126 // Permission check. Must return on error. Do not touch the '?'.
Janis Danisevskisa916d992021-10-19 15:46:09 -0700127 check_keystore_permission(KeystorePerm::ClearUID).context("In clear_namespace.")?;
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800128
Janis Danisevskis0ffb8a82022-02-06 22:37:21 -0800129 LEGACY_IMPORTER
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800130 .bulk_delete_uid(domain, nspace)
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +0000131 .context(ks_err!("Trying to delete legacy keys."))?;
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800132 DB.with(|db| db.borrow_mut().unbind_keys_for_namespace(domain, nspace))
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +0000133 .context(ks_err!("Trying to delete keys from db."))?;
Janis Danisevskis5898d152021-06-15 08:23:46 -0700134 self.delete_listener
135 .delete_namespace(domain, nspace)
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +0000136 .context(ks_err!("While invoking the delete listener."))
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800137 }
Hasini Gunasinghe9ee18412021-03-11 20:12:44 +0000138
Paul Crowley46c703e2021-08-06 15:13:53 -0700139 fn call_with_watchdog<F>(sec_level: SecurityLevel, name: &'static str, op: &F) -> Result<()>
140 where
Stephen Crane23cf7242022-01-19 17:49:46 +0000141 F: Fn(Strong<dyn IKeyMintDevice>) -> binder::Result<()>,
Paul Crowley46c703e2021-08-06 15:13:53 -0700142 {
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +0000143 let (km_dev, _, _) =
144 get_keymint_device(&sec_level).context(ks_err!("getting keymint device"))?;
Janis Danisevskis2ee014b2021-05-05 14:29:08 -0700145
David Drysdale387c85b2024-06-10 14:40:45 +0100146 let _wp = wd::watch_millis_with("In call_with_watchdog", 500, (sec_level, name));
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +0000147 map_km_error(op(km_dev)).with_context(|| ks_err!("calling {}", name))?;
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800148 Ok(())
149 }
150
Paul Crowley46c703e2021-08-06 15:13:53 -0700151 fn call_on_all_security_levels<F>(name: &'static str, op: F) -> Result<()>
152 where
Stephen Crane23cf7242022-01-19 17:49:46 +0000153 F: Fn(Strong<dyn IKeyMintDevice>) -> binder::Result<()>,
Paul Crowley46c703e2021-08-06 15:13:53 -0700154 {
155 let sec_levels = [
156 (SecurityLevel::TRUSTED_ENVIRONMENT, "TRUSTED_ENVIRONMENT"),
157 (SecurityLevel::STRONGBOX, "STRONGBOX"),
158 ];
James Farrelld77b97f2023-08-15 20:03:38 +0000159 sec_levels.iter().try_fold((), |_result, (sec_level, sec_level_string)| {
Paul Crowley46c703e2021-08-06 15:13:53 -0700160 let curr_result = Maintenance::call_with_watchdog(*sec_level, name, &op);
161 match curr_result {
162 Ok(()) => log::info!(
163 "Call to {} succeeded for security level {}.",
164 name,
165 &sec_level_string
166 ),
David Drysdalece2b90b2024-07-17 15:56:29 +0100167 Err(ref e) => {
168 if *sec_level == SecurityLevel::STRONGBOX
169 && e.downcast_ref::<Error>()
170 == Some(&Error::Km(ErrorCode::HARDWARE_TYPE_UNAVAILABLE))
171 {
172 log::info!("Call to {} failed for StrongBox as it is not available", name,)
173 } else {
174 log::error!(
175 "Call to {} failed for security level {}: {}.",
176 name,
177 &sec_level_string,
178 e
179 )
180 }
181 }
Paul Crowley46c703e2021-08-06 15:13:53 -0700182 }
James Farrelld77b97f2023-08-15 20:03:38 +0000183 curr_result
Paul Crowley46c703e2021-08-06 15:13:53 -0700184 })
185 }
186
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800187 fn early_boot_ended() -> Result<()> {
Janis Danisevskisa916d992021-10-19 15:46:09 -0700188 check_keystore_permission(KeystorePerm::EarlyBootEnded)
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +0000189 .context(ks_err!("Checking permission"))?;
Paul Crowley44c02da2021-04-08 17:04:43 +0000190 log::info!("In early_boot_ended.");
191
Janis Danisevskis0fd25a62022-01-04 19:53:37 -0800192 if let Err(e) =
193 DB.with(|db| SuperKeyManager::set_up_boot_level_cache(&SUPER_KEY, &mut db.borrow_mut()))
194 {
Paul Crowley44c02da2021-04-08 17:04:43 +0000195 log::error!("SUPER_KEY.set_up_boot_level_cache failed:\n{:?}\n:(", e);
196 }
Paul Crowley46c703e2021-08-06 15:13:53 -0700197 Maintenance::call_on_all_security_levels("earlyBootEnded", |dev| dev.earlyBootEnded())
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800198 }
199
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700200 fn migrate_key_namespace(source: &KeyDescriptor, destination: &KeyDescriptor) -> Result<()> {
John Wu889c1cc2022-03-14 16:02:56 -0700201 let calling_uid = ThreadState::get_calling_uid();
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700202
John Wu889c1cc2022-03-14 16:02:56 -0700203 match source.domain {
204 Domain::SELINUX | Domain::KEY_ID | Domain::APP => (),
John Wu16db29e2022-01-13 15:21:43 -0800205 _ => {
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +0000206 return Err(Error::Rc(ResponseCode::INVALID_ARGUMENT))
207 .context(ks_err!("Source domain must be one of APP, SELINUX, or KEY_ID."));
John Wu16db29e2022-01-13 15:21:43 -0800208 }
209 };
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700210
John Wu889c1cc2022-03-14 16:02:56 -0700211 match destination.domain {
212 Domain::SELINUX | Domain::APP => (),
John Wu16db29e2022-01-13 15:21:43 -0800213 _ => {
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +0000214 return Err(Error::Rc(ResponseCode::INVALID_ARGUMENT))
215 .context(ks_err!("Destination domain must be one of APP or SELINUX."));
John Wu16db29e2022-01-13 15:21:43 -0800216 }
217 };
218
John Wu889c1cc2022-03-14 16:02:56 -0700219 let user_id = uid_to_android_user(calling_uid);
Janis Danisevskisf84d0b02022-01-26 14:11:14 -0800220
Eric Biggers673d34a2023-10-18 01:54:18 +0000221 let super_key = SUPER_KEY.read().unwrap().get_after_first_unlock_key_by_user_id(user_id);
Janis Danisevskisf84d0b02022-01-26 14:11:14 -0800222
223 DB.with(|db| {
John Wu889c1cc2022-03-14 16:02:56 -0700224 let (key_id_guard, _) = LEGACY_IMPORTER
225 .with_try_import(source, calling_uid, super_key, || {
226 db.borrow_mut().load_key_entry(
227 source,
228 KeyType::Client,
229 KeyEntryLoadBits::NONE,
230 calling_uid,
231 |k, av| {
232 check_key_permission(KeyPerm::Use, k, &av)?;
233 check_key_permission(KeyPerm::Delete, k, &av)?;
234 check_key_permission(KeyPerm::Grant, k, &av)
235 },
236 )
Janis Danisevskisf84d0b02022-01-26 14:11:14 -0800237 })
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +0000238 .context(ks_err!("Failed to load key blob."))?;
John Wu889c1cc2022-03-14 16:02:56 -0700239 {
240 db.borrow_mut().migrate_key_namespace(key_id_guard, destination, calling_uid, |k| {
241 check_key_permission(KeyPerm::Rebind, k, &None)
242 })
Janis Danisevskisf84d0b02022-01-26 14:11:14 -0800243 }
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700244 })
245 }
Paul Crowley46c703e2021-08-06 15:13:53 -0700246
247 fn delete_all_keys() -> Result<()> {
248 // Security critical permission check. This statement must return on fail.
Janis Danisevskisa916d992021-10-19 15:46:09 -0700249 check_keystore_permission(KeystorePerm::DeleteAllKeys)
Shaquille Johnson9da2e1c2022-09-19 12:39:01 +0000250 .context(ks_err!("Checking permission"))?;
Paul Crowley46c703e2021-08-06 15:13:53 -0700251 log::info!("In delete_all_keys.");
252
253 Maintenance::call_on_all_security_levels("deleteAllKeys", |dev| dev.deleteAllKeys())
254 }
Eran Messeri4dc27b52024-01-09 12:43:31 +0000255
256 fn get_app_uids_affected_by_sid(
257 user_id: i32,
258 secure_user_id: i64,
259 ) -> Result<std::vec::Vec<i64>> {
260 // This method is intended to be called by Settings and discloses a list of apps
Eran Messericfe79f12024-02-05 17:50:41 +0000261 // associated with a user, so it requires the "android.permission.MANAGE_USERS"
262 // permission (to avoid leaking list of apps to unauthorized callers).
263 check_get_app_uids_affected_by_sid_permissions().context(ks_err!())?;
Eran Messeri4dc27b52024-01-09 12:43:31 +0000264 DB.with(|db| db.borrow_mut().get_app_uids_affected_by_sid(user_id, secure_user_id))
265 .context(ks_err!("Failed to get app UIDs affected by SID"))
266 }
Hasini Gunasingheda895552021-01-27 19:34:37 +0000267}
268
Janis Danisevskis34a0cf22021-03-08 09:19:03 -0800269impl Interface for Maintenance {}
Hasini Gunasingheda895552021-01-27 19:34:37 +0000270
Janis Danisevskis34a0cf22021-03-08 09:19:03 -0800271impl IKeystoreMaintenance for Maintenance {
Hasini Gunasingheda895552021-01-27 19:34:37 +0000272 fn onUserAdded(&self, user_id: i32) -> BinderResult<()> {
David Drysdalee85523f2023-06-19 12:28:53 +0100273 log::info!("onUserAdded(user={user_id})");
David Drysdale541846b2024-05-23 13:16:07 +0100274 let _wp = wd::watch("IKeystoreMaintenance::onUserAdded");
David Drysdaledb7ddde2024-06-07 16:22:49 +0100275 self.add_or_remove_user(user_id).map_err(into_logged_binder)
Hasini Gunasingheda895552021-01-27 19:34:37 +0000276 }
277
Eric Biggersb0478cf2023-10-27 03:55:29 +0000278 fn initUserSuperKeys(
279 &self,
280 user_id: i32,
281 password: &[u8],
282 allow_existing: bool,
283 ) -> BinderResult<()> {
284 log::info!("initUserSuperKeys(user={user_id}, allow_existing={allow_existing})");
David Drysdale541846b2024-05-23 13:16:07 +0100285 let _wp = wd::watch("IKeystoreMaintenance::initUserSuperKeys");
David Drysdaledb7ddde2024-06-07 16:22:49 +0100286 self.init_user_super_keys(user_id, password.into(), allow_existing)
287 .map_err(into_logged_binder)
Eric Biggersb0478cf2023-10-27 03:55:29 +0000288 }
289
Hasini Gunasingheda895552021-01-27 19:34:37 +0000290 fn onUserRemoved(&self, user_id: i32) -> BinderResult<()> {
David Drysdalee85523f2023-06-19 12:28:53 +0100291 log::info!("onUserRemoved(user={user_id})");
David Drysdale541846b2024-05-23 13:16:07 +0100292 let _wp = wd::watch("IKeystoreMaintenance::onUserRemoved");
David Drysdaledb7ddde2024-06-07 16:22:49 +0100293 self.add_or_remove_user(user_id).map_err(into_logged_binder)
Hasini Gunasingheda895552021-01-27 19:34:37 +0000294 }
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800295
Eric Biggersb0478cf2023-10-27 03:55:29 +0000296 fn onUserLskfRemoved(&self, user_id: i32) -> BinderResult<()> {
297 log::info!("onUserLskfRemoved(user={user_id})");
David Drysdale541846b2024-05-23 13:16:07 +0100298 let _wp = wd::watch("IKeystoreMaintenance::onUserLskfRemoved");
David Drysdaledb7ddde2024-06-07 16:22:49 +0100299 Self::on_user_lskf_removed(user_id).map_err(into_logged_binder)
Eric Biggersb0478cf2023-10-27 03:55:29 +0000300 }
301
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800302 fn clearNamespace(&self, domain: Domain, nspace: i64) -> BinderResult<()> {
David Drysdalee85523f2023-06-19 12:28:53 +0100303 log::info!("clearNamespace({domain:?}, nspace={nspace})");
David Drysdale541846b2024-05-23 13:16:07 +0100304 let _wp = wd::watch("IKeystoreMaintenance::clearNamespace");
David Drysdaledb7ddde2024-06-07 16:22:49 +0100305 self.clear_namespace(domain, nspace).map_err(into_logged_binder)
Janis Danisevskisddd6e752021-02-22 18:46:55 -0800306 }
Hasini Gunasinghe9ee18412021-03-11 20:12:44 +0000307
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800308 fn earlyBootEnded(&self) -> BinderResult<()> {
David Drysdalee85523f2023-06-19 12:28:53 +0100309 log::info!("earlyBootEnded()");
David Drysdale541846b2024-05-23 13:16:07 +0100310 let _wp = wd::watch("IKeystoreMaintenance::earlyBootEnded");
David Drysdaledb7ddde2024-06-07 16:22:49 +0100311 Self::early_boot_ended().map_err(into_logged_binder)
Satya Tangirala5b9e5b12021-03-09 12:54:21 -0800312 }
313
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700314 fn migrateKeyNamespace(
315 &self,
316 source: &KeyDescriptor,
317 destination: &KeyDescriptor,
318 ) -> BinderResult<()> {
David Drysdalee85523f2023-06-19 12:28:53 +0100319 log::info!("migrateKeyNamespace(src={source:?}, dest={destination:?})");
David Drysdale541846b2024-05-23 13:16:07 +0100320 let _wp = wd::watch("IKeystoreMaintenance::migrateKeyNamespace");
David Drysdaledb7ddde2024-06-07 16:22:49 +0100321 Self::migrate_key_namespace(source, destination).map_err(into_logged_binder)
Janis Danisevskiscdcf4e52021-04-14 15:44:36 -0700322 }
Paul Crowley46c703e2021-08-06 15:13:53 -0700323
324 fn deleteAllKeys(&self) -> BinderResult<()> {
David Drysdalece2b90b2024-07-17 15:56:29 +0100325 log::warn!("deleteAllKeys() invoked, indicating initial setup or post-factory reset");
David Drysdale541846b2024-05-23 13:16:07 +0100326 let _wp = wd::watch("IKeystoreMaintenance::deleteAllKeys");
David Drysdaledb7ddde2024-06-07 16:22:49 +0100327 Self::delete_all_keys().map_err(into_logged_binder)
Paul Crowley46c703e2021-08-06 15:13:53 -0700328 }
Eran Messeri4dc27b52024-01-09 12:43:31 +0000329
330 fn getAppUidsAffectedBySid(
331 &self,
332 user_id: i32,
333 secure_user_id: i64,
334 ) -> BinderResult<std::vec::Vec<i64>> {
335 log::info!("getAppUidsAffectedBySid(secure_user_id={secure_user_id:?})");
David Drysdale541846b2024-05-23 13:16:07 +0100336 let _wp = wd::watch("IKeystoreMaintenance::getAppUidsAffectedBySid");
David Drysdaledb7ddde2024-06-07 16:22:49 +0100337 Self::get_app_uids_affected_by_sid(user_id, secure_user_id).map_err(into_logged_binder)
Eran Messeri4dc27b52024-01-09 12:43:31 +0000338 }
Hasini Gunasingheda895552021-01-27 19:34:37 +0000339}