Coverage Report

Created: 2026-10-13 06:38

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/barebox/include/security/policy.h
Line
Count
Source
1
/* SPDX-License-Identifier: GPL-2.0 */
2
#ifndef __BAREBOX_SECURITY_POLICY_H
3
#define __BAREBOX_SECURITY_POLICY_H
4
5
/*
6
 * Security policies is an access control mechanism to control when
7
 * security-sensitive code is allowed to run.
8
 *
9
 * This header is included by board code that registers and
10
 * selects (activates) these security policies.
11
 */
12
13
#include <linux/types.h>
14
#include <linux/errno.h>
15
#include <notifier.h>
16
#include <security/defs.h>
17
18
/*
19
 * It's recommended to use the following names for the
20
 * "standard" policies
21
 */
22
#define POLICY_DEVEL    "devel"
23
#define POLICY_FACTORY    "factory"
24
#define POLICY_LOCKDOWN   "lockdown"
25
#define POLICY_TAMPER   "tamper"
26
#define POLICY_FIELD_RETURN "return"
27
28
const struct security_policy *security_policy_get(const char *name);
29
const struct security_policy *security_policy_get_active(void);
30
31
int security_policy_activate(const struct security_policy *policy);
32
int security_policy_select(const char *name);
33
void security_policy_list(void);
34
35
#ifdef CONFIG_SECURITY_POLICY
36
int __security_policy_register(const struct security_policy policy[]);
37
#else
38
static inline int __security_policy_register(const struct security_policy policy[])
39
0
{
40
0
  return -ENOSYS;
41
0
}
42
#endif
43
44
#ifdef CONFIG_CMD_SCONFIG
45
void security_policy_unregister_one(const struct security_policy *policy);
46
#endif
47
48
#define security_policy_add(name) ({        \
49
  extern const struct security_policy __policy_##name[];  \
50
  __security_policy_register(__policy_##name);    \
51
})
52
53
#endif /* __BAREBOX_SECURITY_POLICY_H */