2 * Copyright (C) 2016 The Android Open Source Project
4 * SPDX-License-Identifier: MIT
7 #if !defined(AVB_INSIDE_LIBAVB_H) && !defined(AVB_COMPILATION)
8 #error "Never include this file directly, include libavb.h instead."
14 #include "avb_sysdeps.h"
20 /* Magic for the footer. */
21 #define AVB_FOOTER_MAGIC "AVBf"
22 #define AVB_FOOTER_MAGIC_LEN 4
24 /* Size of the footer. */
25 #define AVB_FOOTER_SIZE 64
27 /* The current footer version used - keep in sync with avbtool. */
28 #define AVB_FOOTER_VERSION_MAJOR 1
29 #define AVB_FOOTER_VERSION_MINOR 0
31 /* The struct used as a footer used on partitions, used to find the
32 * AvbVBMetaImageHeader struct. This struct is always stored at the
35 typedef struct AvbFooter {
36 /* 0: Four bytes equal to "AVBf" (AVB_FOOTER_MAGIC). */
37 uint8_t magic[AVB_FOOTER_MAGIC_LEN];
38 /* 4: The major version of the footer struct. */
39 uint32_t version_major;
40 /* 8: The minor version of the footer struct. */
41 uint32_t version_minor;
43 /* 12: The original size of the image on the partition. */
44 uint64_t original_image_size;
46 /* 20: The offset of the |AvbVBMetaImageHeader| struct. */
47 uint64_t vbmeta_offset;
49 /* 28: The size of the vbmeta block (header + auth + aux blocks). */
52 /* 36: Padding to ensure struct is size AVB_FOOTER_SIZE bytes. This
53 * must be set to zeroes.
56 } AVB_ATTR_PACKED AvbFooter;
58 /* Copies |src| to |dest| and validates, byte-swapping fields in the
59 * process if needed. Returns true if valid, false if invalid.
61 bool avb_footer_validate_and_byteswap(const AvbFooter* src, AvbFooter* dest)
62 AVB_ATTR_WARN_UNUSED_RESULT;
68 #endif /* AVB_FOOTER_H_ */