bowgotsai | b51722b | 2017-01-11 22:21:38 +0800 | [diff] [blame] | 1 | /* |
| 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 Tsai | 4caf4c0 | 2017-02-16 21:35:09 +0800 | [diff] [blame] | 52 | AvbOps* fs_mgr_dummy_avb_ops_new(struct fstab* fstab); |
bowgotsai | b51722b | 2017-01-11 22:21:38 +0800 | [diff] [blame] | 53 | |
| 54 | /* Frees an AvbOps instance previously allocated with fs_mgr_avb_ops_new(). */ |
Bowgo Tsai | 4caf4c0 | 2017-02-16 21:35:09 +0800 | [diff] [blame] | 55 | void fs_mgr_dummy_avb_ops_free(AvbOps* ops); |
bowgotsai | b51722b | 2017-01-11 22:21:38 +0800 | [diff] [blame] | 56 | |
| 57 | __END_DECLS |
| 58 | |
| 59 | #endif /* __CORE_FS_MGR_AVB_OPS_H */ |