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."
11 #ifndef AVB_KERNEL_CMDLINE_DESCRIPTOR_H_
12 #define AVB_KERNEL_CMDLINE_DESCRIPTOR_H_
14 #include "avb_descriptor.h"
20 /* Flags for kernel command-line descriptors.
22 * AVB_KERNEL_CMDLINE_FLAGS_USE_ONLY_IF_HASHTREE_NOT_DISABLED: The
23 * cmdline will only be applied if hashtree verification is not
24 * disabled (cf. AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED).
26 * AVB_KERNEL_CMDLINE_FLAGS_USE_ONLY_IF_HASHTREE_DISABLED: The cmdline
27 * will only be applied if hashtree verification is disabled
28 * (cf. AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED).
31 AVB_KERNEL_CMDLINE_FLAGS_USE_ONLY_IF_HASHTREE_NOT_DISABLED = (1 << 0),
32 AVB_KERNEL_CMDLINE_FLAGS_USE_ONLY_IF_HASHTREE_DISABLED = (1 << 1)
33 } AvbKernelCmdlineFlags;
35 /* A descriptor containing information to be appended to the kernel
38 * The |flags| field contains flags from the AvbKernelCmdlineFlags
41 * Following this struct are |kernel_cmdline_len| bytes with the
42 * kernel command-line (UTF-8 encoded).
44 typedef struct AvbKernelCmdlineDescriptor {
45 AvbDescriptor parent_descriptor;
47 uint32_t kernel_cmdline_length;
48 } AVB_ATTR_PACKED AvbKernelCmdlineDescriptor;
50 /* Copies |src| to |dest| and validates, byte-swapping fields in the
51 * process if needed. Returns true if valid, false if invalid.
53 * Data following the struct is not validated nor copied.
55 bool avb_kernel_cmdline_descriptor_validate_and_byteswap(
56 const AvbKernelCmdlineDescriptor* src,
57 AvbKernelCmdlineDescriptor* dest) AVB_ATTR_WARN_UNUSED_RESULT;
63 #endif /* AVB_KERNEL_CMDLINE_DESCRIPTOR_H_ */