18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * AppArmor security module
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This file contains AppArmor security identifier (secid) definitions
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright 2009-2018 Canonical Ltd.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef __AA_SECID_H
118c2ecf20Sopenharmony_ci#define __AA_SECID_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <linux/slab.h>
148c2ecf20Sopenharmony_ci#include <linux/types.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistruct aa_label;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* secid value that will not be allocated */
198c2ecf20Sopenharmony_ci#define AA_SECID_INVALID 0
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* secid value that matches any other secid */
228c2ecf20Sopenharmony_ci#define AA_SECID_WILDCARD 1
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistruct aa_label *aa_secid_to_label(u32 secid);
258c2ecf20Sopenharmony_ciint apparmor_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
268c2ecf20Sopenharmony_ciint apparmor_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
278c2ecf20Sopenharmony_civoid apparmor_release_secctx(char *secdata, u32 seclen);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciint aa_alloc_secid(struct aa_label *label, gfp_t gfp);
318c2ecf20Sopenharmony_civoid aa_free_secid(u32 secid);
328c2ecf20Sopenharmony_civoid aa_secid_update(u32 secid, struct aa_label *label);
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_civoid aa_secids_init(void);
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#endif /* __AA_SECID_H */
37