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