xref: /xnu-11215.81.4/bsd/sys/lockdown_mode.h (revision d4514f0bc1d3f944c22d92e68b646ac3fb40d452)
1 /*
2  * Copyright (c) 2022 Apple Computer, Inc. All rights reserved.
3  *
4  * @APPLE_LICENSE_HEADER_START@
5  *
6  * The contents of this file constitute Original Code as defined in and
7  * are subject to the Apple Public Source License Version 1.1 (the
8  * "License").  You may not use this file except in compliance with the
9  * License.  Please obtain a copy of the License at
10  * http://www.apple.com/publicsource and read it before using this file.
11  *
12  * This Original Code and all software distributed under the License are
13  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
17  * License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * @APPLE_LICENSE_HEADER_END@
21  */
22 
23 #ifndef _KERN_LOCKDOWN_MODE_H_
24 #define _KERN_LOCKDOWN_MODE_H_
25 
26 #include <sys/cdefs.h>
27 __BEGIN_DECLS
28 
29 #if KERNEL_PRIVATE
30 /* XNU and Kernel extensions */
31 
32 #if XNU_KERNEL_PRIVATE
33 
34 // Whether Lockdown Mode is enabled via the "ldm" nvram variable
35 extern int lockdown_mode_state;
36 
37 /**
38  * Initalizes Lockdown Mode
39  */
40 void lockdown_mode_init(void);
41 
42 #endif /* XNU_KERNEL_PRIVATE */
43 
44 /**
45  * Returns the Lockdown Mode enablement state
46  */
47 int get_lockdown_mode_state(void);
48 
49 /**
50  * Enable Lockdown Mode by setting the nvram variable
51  */
52 void enable_lockdown_mode(void);
53 
54 /**
55  * Disable Lockdown Mode by setting the nvram variable
56  */
57 void disable_lockdown_mode(void);
58 
59 #endif /* KERNEL_PRIVATE */
60 __END_DECLS
61 
62 #endif /* _KERN_LOCKDOWN_MODE_H_ */
63