blob: fa2062711b63e75a9cf6598c979de04ffd0d3e40 [file] [log] [blame]
John Johansen121d4a92017-01-16 00:42:17 -08001/*
2 * AppArmor security module
3 *
4 * This file contains AppArmor security identifier (secid) definitions
5 *
John Johansenc0929212017-07-31 17:36:45 -07006 * Copyright 2009-2018 Canonical Ltd.
John Johansen121d4a92017-01-16 00:42:17 -08007 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation, version 2 of the
11 * License.
12 */
13
14#ifndef __AA_SECID_H
15#define __AA_SECID_H
16
John Johansenc0929212017-07-31 17:36:45 -070017#include <linux/slab.h>
John Johansen121d4a92017-01-16 00:42:17 -080018#include <linux/types.h>
19
John Johansenc0929212017-07-31 17:36:45 -070020struct aa_label;
21
John Johansen121d4a92017-01-16 00:42:17 -080022/* secid value that will not be allocated */
23#define AA_SECID_INVALID 0
John Johansen121d4a92017-01-16 00:42:17 -080024
Matthew Garrett617a6292018-05-24 13:27:45 -070025/* secid value that matches any other secid */
26#define AA_SECID_WILDCARD 1
27
John Johansenc0929212017-07-31 17:36:45 -070028struct aa_label *aa_secid_to_label(u32 secid);
29int apparmor_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
30int apparmor_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
31void apparmor_release_secctx(char *secdata, u32 seclen);
32
33
John Johansena4c3f892018-06-04 19:44:59 -070034int aa_alloc_secid(struct aa_label *label, gfp_t gfp);
John Johansen121d4a92017-01-16 00:42:17 -080035void aa_free_secid(u32 secid);
John Johansenc0929212017-07-31 17:36:45 -070036void aa_secid_update(u32 secid, struct aa_label *label);
John Johansen121d4a92017-01-16 00:42:17 -080037
John Johansena4c3f892018-06-04 19:44:59 -070038void aa_secids_init(void);
39
John Johansen121d4a92017-01-16 00:42:17 -080040#endif /* __AA_SECID_H */