1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright (C) 2016 The Android Open Source Project 4 */ 5 6 #if !defined(AVB_INSIDE_LIBAVB_H) && !defined(AVB_COMPILATION) 7 #error "Never include this file directly, include libavb.h instead." 8 #endif 9 10 #ifndef AVB_CHAIN_PARTITION_DESCRIPTOR_H_ 11 #define AVB_CHAIN_PARTITION_DESCRIPTOR_H_ 12 13 #include "avb_descriptor.h" 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 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 23 * protection. 24 * 25 * Following this struct are |partition_name_len| bytes of the 26 * partition name (UTF-8 encoded) and |public_key_len| bytes of the 27 * public key. 28 * 29 * The |reserved| field is for future expansion and must be set to NUL 30 * bytes. 31 */ 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; 37 uint8_t reserved[64]; 38 } AVB_ATTR_PACKED AvbChainPartitionDescriptor; 39 40 /* Copies |src| to |dest| and validates, byte-swapping fields in the 41 * process if needed. Returns true if valid, false if invalid. 42 * 43 * Data following the struct is not validated nor copied. 44 */ 45 bool avb_chain_partition_descriptor_validate_and_byteswap( 46 const AvbChainPartitionDescriptor* src, 47 AvbChainPartitionDescriptor* dest) AVB_ATTR_WARN_UNUSED_RESULT; 48 49 #ifdef __cplusplus 50 } 51 #endif 52 53 #endif /* AVB_CHAIN_PARTITION_DESCRIPTOR_H_ */ 54