Blame view
include/avb_verify.h
1.93 KB
3af30e444 avb2.0: implement... |
1 2 3 4 5 6 7 8 9 10 11 |
/* * (C) Copyright 2018, Linaro Limited * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _AVB_VERIFY_H #define _AVB_VERIFY_H #include <../lib/libavb/libavb.h> |
bbddbef99 avb_verify: suppo... |
12 |
#include <mapmem.h> |
3af30e444 avb2.0: implement... |
13 |
#include <mmc.h> |
5d4fd8777 avb2.0: add boot ... |
14 15 16 17 18 19 20 21 22 23 24 |
#define AVB_MAX_ARGS 1024 #define VERITY_TABLE_OPT_RESTART "restart_on_corruption" #define VERITY_TABLE_OPT_LOGGING "ignore_corruption" #define ALLOWED_BUF_ALIGN 8 enum avb_boot_state { AVB_GREEN, AVB_YELLOW, AVB_ORANGE, AVB_RED, }; |
3af30e444 avb2.0: implement... |
25 26 27 28 |
struct AvbOpsData { struct AvbOps ops; int mmc_dev; |
5d4fd8777 avb2.0: add boot ... |
29 |
enum avb_boot_state boot_state; |
6663e0747 avb_verify: suppo... |
30 31 32 33 |
#ifdef CONFIG_OPTEE_TA_AVB struct udevice *tee; u32 session; #endif |
3af30e444 avb2.0: implement... |
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
}; struct mmc_part { int dev_num; struct mmc *mmc; struct blk_desc *mmc_blk; disk_partition_t info; }; enum mmc_io_type { IO_READ, IO_WRITE }; AvbOps *avb_ops_alloc(int boot_device); void avb_ops_free(AvbOps *ops); |
5d4fd8777 avb2.0: add boot ... |
50 51 52 53 54 |
char *avb_set_state(AvbOps *ops, enum avb_boot_state boot_state); char *avb_set_enforce_verity(const char *cmdline); char *avb_set_ignore_corruption(const char *cmdline); char *append_cmd_line(char *cmdline_orig, char *cmdline_new); |
3af30e444 avb2.0: implement... |
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
/** * ============================================================================ * I/O helper inline functions * ============================================================================ */ static inline uint64_t calc_offset(struct mmc_part *part, int64_t offset) { u64 part_size = part->info.size * part->info.blksz; if (offset < 0) return part_size + offset; return offset; } static inline size_t get_sector_buf_size(void) { return (size_t)CONFIG_FASTBOOT_BUF_SIZE; } static inline void *get_sector_buf(void) { |
bbddbef99 avb_verify: suppo... |
77 |
return map_sysmem(CONFIG_FASTBOOT_BUF_ADDR, CONFIG_FASTBOOT_BUF_SIZE); |
3af30e444 avb2.0: implement... |
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
} static inline bool is_buf_unaligned(void *buffer) { return (bool)((uintptr_t)buffer % ALLOWED_BUF_ALIGN); } static inline int get_boot_device(AvbOps *ops) { struct AvbOpsData *data; if (ops) { data = ops->user_data; if (data) return data->mmc_dev; } return -1; } #endif /* _AVB_VERIFY_H */ |