1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Permission is hereby granted, free of charge, to any person
5  * obtaining a copy of this software and associated documentation
6  * files (the "Software"), to deal in the Software without
7  * restriction, including without limitation the rights to use, copy,
8  * modify, merge, publish, distribute, sublicense, and/or sell copies
9  * of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 
25 #ifndef AVB_USER_VERITY_H_
26 #define AVB_USER_VERITY_H_
27 
28 #include <libavb/libavb.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /* Function to enable or disable dm-verity for an entire slot. The
35  * passed in |ops| should be obtained via avb_ops_user_new(). The
36  * |ab_suffix| parameter should specify the slot to modify including
37  * the leading underscore (e.g. "_a" or "_b"). The |enable_verity|
38  * parameter should be set to |true| to enable dm-verity and |false|
39  * to disable.
40  *
41  * Returns |true| if the operation succeeded, otherwise |false|.
42  */
43 bool avb_user_verity_set(AvbOps* ops,
44                          const char* ab_suffix,
45                          bool enable_verity);
46 
47 /* Gets whether dm-verity is enabled for an entire slot. The passed in
48  * |ops| should be obtained via avb_ops_user_new(). The |ab_suffix|
49  * parameter should specify the slot to query including the leading
50  * underscore (e.g. "_a" or "_b"). The result is returned in the
51  * |out_verity_enabled| parameter.
52  *
53  * Returns |true| if the operation succeeded, otherwise |false|.
54  */
55 bool avb_user_verity_get(AvbOps* ops,
56                          const char* ab_suffix,
57                          bool* out_verity_enabled);
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 #endif /* AVB_USER_VERITY_H_ */
64