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