xref: /linux/security/apparmor/include/secid.h (revision 617a629c08bfffb05249131079d9a38322902e5b)
1121d4a91SJohn Johansen /*
2121d4a91SJohn Johansen  * AppArmor security module
3121d4a91SJohn Johansen  *
4121d4a91SJohn Johansen  * This file contains AppArmor security identifier (secid) definitions
5121d4a91SJohn Johansen  *
6c0929212SJohn Johansen  * Copyright 2009-2018 Canonical Ltd.
7121d4a91SJohn Johansen  *
8121d4a91SJohn Johansen  * This program is free software; you can redistribute it and/or
9121d4a91SJohn Johansen  * modify it under the terms of the GNU General Public License as
10121d4a91SJohn Johansen  * published by the Free Software Foundation, version 2 of the
11121d4a91SJohn Johansen  * License.
12121d4a91SJohn Johansen  */
13121d4a91SJohn Johansen 
14121d4a91SJohn Johansen #ifndef __AA_SECID_H
15121d4a91SJohn Johansen #define __AA_SECID_H
16121d4a91SJohn Johansen 
17c0929212SJohn Johansen #include <linux/slab.h>
18121d4a91SJohn Johansen #include <linux/types.h>
19121d4a91SJohn Johansen 
20c0929212SJohn Johansen struct aa_label;
21c0929212SJohn Johansen 
22121d4a91SJohn Johansen /* secid value that will not be allocated */
23121d4a91SJohn Johansen #define AA_SECID_INVALID 0
24121d4a91SJohn Johansen 
25*617a629cSMatthew Garrett /* secid value that matches any other secid */
26*617a629cSMatthew Garrett #define AA_SECID_WILDCARD 1
27*617a629cSMatthew Garrett 
28c0929212SJohn Johansen struct aa_label *aa_secid_to_label(u32 secid);
29c0929212SJohn Johansen int apparmor_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
30c0929212SJohn Johansen int apparmor_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
31c0929212SJohn Johansen void apparmor_release_secctx(char *secdata, u32 seclen);
32c0929212SJohn Johansen 
33c0929212SJohn Johansen 
34a4c3f89cSJohn Johansen int aa_alloc_secid(struct aa_label *label, gfp_t gfp);
35121d4a91SJohn Johansen void aa_free_secid(u32 secid);
36c0929212SJohn Johansen void aa_secid_update(u32 secid, struct aa_label *label);
37121d4a91SJohn Johansen 
38a4c3f89cSJohn Johansen void aa_secids_init(void);
39a4c3f89cSJohn Johansen 
40121d4a91SJohn Johansen #endif /* __AA_SECID_H */
41