3 * (C) Copyright 2018, Linaro Limited
5 * SPDX-License-Identifier: GPL-2.0+
11 #include <../lib/libavb/libavb.h>
14 #define AVB_MAX_ARGS 1024
15 #define VERITY_TABLE_OPT_RESTART "restart_on_corruption"
16 #define VERITY_TABLE_OPT_LOGGING "ignore_corruption"
17 #define ALLOWED_BUF_ALIGN 8
29 enum avb_boot_state boot_state;
35 struct blk_desc *mmc_blk;
36 disk_partition_t info;
44 AvbOps *avb_ops_alloc(int boot_device);
45 void avb_ops_free(AvbOps *ops);
47 char *avb_set_state(AvbOps *ops, enum avb_boot_state boot_state);
48 char *avb_set_enforce_verity(const char *cmdline);
49 char *avb_set_ignore_corruption(const char *cmdline);
51 char *append_cmd_line(char *cmdline_orig, char *cmdline_new);
54 * ============================================================================
55 * I/O helper inline functions
56 * ============================================================================
58 static inline uint64_t calc_offset(struct mmc_part *part, int64_t offset)
60 u64 part_size = part->info.size * part->info.blksz;
63 return part_size + offset;
68 static inline size_t get_sector_buf_size(void)
70 return (size_t)CONFIG_FASTBOOT_BUF_SIZE;
73 static inline void *get_sector_buf(void)
75 return (void *)CONFIG_FASTBOOT_BUF_ADDR;
78 static inline bool is_buf_unaligned(void *buffer)
80 return (bool)((uintptr_t)buffer % ALLOWED_BUF_ALIGN);
83 static inline int get_boot_device(AvbOps *ops)
85 struct AvbOpsData *data;
88 data = ops->user_data;
96 #endif /* _AVB_VERIFY_H */