xref: /aosp_15_r20/system/vold/FsCrypt.h (revision f40fafd4c6c2594924d919feffc1a1fd6e3b30f3)
1*f40fafd4SAndroid Build Coastguard Worker /*
2*f40fafd4SAndroid Build Coastguard Worker  * Copyright (C) 2015 The Android Open Source Project
3*f40fafd4SAndroid Build Coastguard Worker  *
4*f40fafd4SAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*f40fafd4SAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*f40fafd4SAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*f40fafd4SAndroid Build Coastguard Worker  *
8*f40fafd4SAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*f40fafd4SAndroid Build Coastguard Worker  *
10*f40fafd4SAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*f40fafd4SAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*f40fafd4SAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*f40fafd4SAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*f40fafd4SAndroid Build Coastguard Worker  * limitations under the License.
15*f40fafd4SAndroid Build Coastguard Worker  */
16*f40fafd4SAndroid Build Coastguard Worker 
17*f40fafd4SAndroid Build Coastguard Worker #include <string>
18*f40fafd4SAndroid Build Coastguard Worker #include <vector>
19*f40fafd4SAndroid Build Coastguard Worker 
20*f40fafd4SAndroid Build Coastguard Worker #include <cutils/multiuser.h>
21*f40fafd4SAndroid Build Coastguard Worker 
22*f40fafd4SAndroid Build Coastguard Worker bool fscrypt_initialize_systemwide_keys();
23*f40fafd4SAndroid Build Coastguard Worker 
24*f40fafd4SAndroid Build Coastguard Worker bool fscrypt_init_user0();
25*f40fafd4SAndroid Build Coastguard Worker extern bool fscrypt_init_user0_done;
26*f40fafd4SAndroid Build Coastguard Worker bool fscrypt_create_user_keys(userid_t user_id, bool ephemeral);
27*f40fafd4SAndroid Build Coastguard Worker bool fscrypt_destroy_user_keys(userid_t user_id);
28*f40fafd4SAndroid Build Coastguard Worker bool fscrypt_set_ce_key_protection(userid_t user_id, const std::vector<uint8_t>& secret);
29*f40fafd4SAndroid Build Coastguard Worker void fscrypt_deferred_fixate_ce_keys();
30*f40fafd4SAndroid Build Coastguard Worker 
31*f40fafd4SAndroid Build Coastguard Worker std::vector<int> fscrypt_get_unlocked_users();
32*f40fafd4SAndroid Build Coastguard Worker bool fscrypt_unlock_ce_storage(userid_t user_id, const std::vector<uint8_t>& secret);
33*f40fafd4SAndroid Build Coastguard Worker bool fscrypt_lock_ce_storage(userid_t user_id);
34*f40fafd4SAndroid Build Coastguard Worker 
35*f40fafd4SAndroid Build Coastguard Worker bool fscrypt_prepare_user_storage(const std::string& volume_uuid, userid_t user_id, int flags);
36*f40fafd4SAndroid Build Coastguard Worker bool fscrypt_destroy_user_storage(const std::string& volume_uuid, userid_t user_id, int flags);
37*f40fafd4SAndroid Build Coastguard Worker 
38*f40fafd4SAndroid Build Coastguard Worker bool fscrypt_destroy_volume_keys(const std::string& volume_uuid);
39