blob: 62ca653bbdbc18ffd2f6b3520b06678dfad02b97 [file] [log] [blame]
Janis Danisevskis2ded9cb2021-10-20 08:39:30 -07001// 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
15//! This crate provides convenience wrappers for the SELinux permission
16//! defined in the diced SELinux access class.
17
18use keystore2_selinux as selinux;
19use selinux::{implement_class, ClassPermission};
20
21implement_class!(
22 /// Permission provides a convenient abstraction from the SELinux class `diced`.
23 #[selinux(class_name = diced)]
Chris Wailes263de9f2022-08-11 15:00:51 -070024 #[derive(Clone, Copy, Debug, PartialEq, Eq)]
Janis Danisevskis2ded9cb2021-10-20 08:39:30 -070025 pub enum Permission {
26 /// Checked when a client attempts to call seal or unseal.
27 #[selinux(name = use_seal)]
28 UseSeal,
29 /// Checked when a client attempts to call IDiceNode::sign.
30 #[selinux(name = use_sign)]
31 UseSign,
32 /// Checked when a client attempts to call IDiceNode::getAttestationChain.
33 #[selinux(name = get_attestation_chain)]
34 GetAttestationChain,
35 /// Checked when a client attempts to call IDiceNode::derive.
36 #[selinux(name = derive)]
37 Derive,
38 /// Checked when a client wants to demote itself by calling IDiceNode::demote.
39 #[selinux(name = demote)]
40 Demote,
41 /// Checked when a client calls IDiceMaintenance::demote in an attempt to
42 /// demote this dice node.
43 #[selinux(name = demote_self)]
44 DemoteSelf,
45 }
46);