blob: bfdec9aefcf44354810186781d868e293fa5d45a [file] [log] [blame]
bowgotsaib51722b2017-01-11 22:21:38 +08001/*
2 * Copyright (C) 2016 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 __CORE_FS_MGR_AVB_OPS_H
26#define __CORE_FS_MGR_AVB_OPS_H
27
28#include <libavb/libavb.h>
29
30#include "fs_mgr.h"
31
32__BEGIN_DECLS
33
34/* Allocates a "dummy" AvbOps instance solely for use in user-space.
35 * Returns nullptr on OOM.
36 *
37 * It mainly provides read_from_partitions() for user-space to get
38 * AvbSlotVerifyData.vbmeta_images[] and the caller MUST check their
39 * integrity against the androidboot.vbmeta.{hash_alg, size, digest}
40 * values from /proc/cmdline, e.g. verify_vbmeta_images()
41 * in fs_mgr_avb.cpp.
42 *
43 * Other I/O operations are only required in boot loader so we set
44 * them as dummy operations here.
45 * - Will allow any public key for signing.
46 * - returns 0 for any rollback index location.
47 * - returns device is unlocked regardless of the actual state.
48 * - returns a dummy guid for any partition.
49 *
50 * Frees with fs_mgr_dummy_avb_ops_free().
51 */
Bowgo Tsai4caf4c02017-02-16 21:35:09 +080052AvbOps* fs_mgr_dummy_avb_ops_new(struct fstab* fstab);
bowgotsaib51722b2017-01-11 22:21:38 +080053
54/* Frees an AvbOps instance previously allocated with fs_mgr_avb_ops_new(). */
Bowgo Tsai4caf4c02017-02-16 21:35:09 +080055void fs_mgr_dummy_avb_ops_free(AvbOps* ops);
bowgotsaib51722b2017-01-11 22:21:38 +080056
57__END_DECLS
58
59#endif /* __CORE_FS_MGR_AVB_OPS_H */