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