1 /* SPDX-License-Identifier: MIT */
3 * Copyright (C) 2016 The Android Open Source Project
6 #if !defined(AVB_INSIDE_LIBAVB_H) && !defined(AVB_COMPILATION)
7 #error "Never include this file directly, include libavb.h instead."
10 #ifndef AVB_CHAIN_PARTITION_DESCRIPTOR_H_
11 #define AVB_CHAIN_PARTITION_DESCRIPTOR_H_
13 #include "avb_descriptor.h"
19 /* A descriptor containing a pointer to signed integrity data stored
20 * on another partition. The descriptor contains the partition name in
21 * question (without the A/B suffix), the public key used to sign the
22 * integrity data, and rollback index location to use for rollback
25 * Following this struct are |partition_name_len| bytes of the
26 * partition name (UTF-8 encoded) and |public_key_len| bytes of the
29 * The |reserved| field is for future expansion and must be set to NUL
32 typedef struct AvbChainPartitionDescriptor {
33 AvbDescriptor parent_descriptor;
34 uint32_t rollback_index_location;
35 uint32_t partition_name_len;
36 uint32_t public_key_len;
38 } AVB_ATTR_PACKED AvbChainPartitionDescriptor;
40 /* Copies |src| to |dest| and validates, byte-swapping fields in the
41 * process if needed. Returns true if valid, false if invalid.
43 * Data following the struct is not validated nor copied.
45 bool avb_chain_partition_descriptor_validate_and_byteswap(
46 const AvbChainPartitionDescriptor* src,
47 AvbChainPartitionDescriptor* dest) AVB_ATTR_WARN_UNUSED_RESULT;
53 #endif /* AVB_CHAIN_PARTITION_DESCRIPTOR_H_ */