1 /*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 //! The library implementing the generic access policy for Keymint Rust.
17 //! This is a replication of `keymaster_generic_access_policy`.
18
19 use tipc::Uuid;
20
21 const ACCESSIBLE_UUIDS: [Uuid; 4] = [
22 /* gatekeeper uuid */
23 Uuid::new(0x38ba0cdc, 0xdf0e, 0x11e4, [0x98, 0x69, 0x23, 0x3f, 0xb6, 0xae, 0x47, 0x95]),
24 /* confirmation UI uuid */
25 Uuid::new(0x7dee2364, 0xc036, 0x425b, [0xb0, 0x86, 0xdf, 0x0f, 0x6c, 0x23, 0x3c, 0x1b]),
26 /* keymaster unit test uuid */
27 Uuid::new(0xf3ba7629, 0xe8cc, 0x44a0, [0x88, 0x4d, 0xf9, 0x16, 0xf7, 0x03, 0xa2, 0x00]),
28 /* keymint unit test uuid */
29 Uuid::new(0xd322eec9, 0x6d03, 0x49fa, [0x82, 0x1c, 0x1c, 0xcd, 0x27, 0x05, 0x71, 0x9c]),
30 ];
31
keymint_check_target_access_policy(uuid: &Uuid) -> bool32 pub fn keymint_check_target_access_policy(uuid: &Uuid) -> bool {
33 if ACCESSIBLE_UUIDS.contains(uuid) {
34 return true;
35 }
36 return false;
37 }
38
keymint_check_secure_target_access_policy_provisioning(_uuid: &Uuid) -> bool39 pub fn keymint_check_secure_target_access_policy_provisioning(_uuid: &Uuid) -> bool {
40 /* Not Supported */
41 return false;
42 }
43