xref: /openbmc/linux/security/apparmor/include/secid.h (revision c092921219d227b13cb80dbecd3545ee66ab89b3)
1121d4a91SJohn Johansen /*
2121d4a91SJohn Johansen  * AppArmor security module
3121d4a91SJohn Johansen  *
4121d4a91SJohn Johansen  * This file contains AppArmor security identifier (secid) definitions
5121d4a91SJohn Johansen  *
6*c0929212SJohn 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 
17*c0929212SJohn Johansen #include <linux/slab.h>
18121d4a91SJohn Johansen #include <linux/types.h>
19121d4a91SJohn Johansen 
20*c0929212SJohn Johansen struct aa_label;
21*c0929212SJohn Johansen 
22121d4a91SJohn Johansen /* secid value that will not be allocated */
23121d4a91SJohn Johansen #define AA_SECID_INVALID 0
24121d4a91SJohn Johansen 
25*c0929212SJohn Johansen struct aa_label *aa_secid_to_label(u32 secid);
26*c0929212SJohn Johansen int apparmor_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
27*c0929212SJohn Johansen int apparmor_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
28*c0929212SJohn Johansen void apparmor_release_secctx(char *secdata, u32 seclen);
29*c0929212SJohn Johansen 
30*c0929212SJohn Johansen 
31*c0929212SJohn Johansen u32 aa_alloc_secid(struct aa_label *label, gfp_t gfp);
32121d4a91SJohn Johansen void aa_free_secid(u32 secid);
33*c0929212SJohn Johansen void aa_secid_update(u32 secid, struct aa_label *label);
34121d4a91SJohn Johansen 
35121d4a91SJohn Johansen #endif /* __AA_SECID_H */
36