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_KERNEL_CMDLINE_DESCRIPTOR_H_
11 #define AVB_KERNEL_CMDLINE_DESCRIPTOR_H_
13 #include "avb_descriptor.h"
19 /* Flags for kernel command-line descriptors.
21 * AVB_KERNEL_CMDLINE_FLAGS_USE_ONLY_IF_HASHTREE_NOT_DISABLED: The
22 * cmdline will only be applied if hashtree verification is not
23 * disabled (cf. AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED).
25 * AVB_KERNEL_CMDLINE_FLAGS_USE_ONLY_IF_HASHTREE_DISABLED: The cmdline
26 * will only be applied if hashtree verification is disabled
27 * (cf. AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED).
30 AVB_KERNEL_CMDLINE_FLAGS_USE_ONLY_IF_HASHTREE_NOT_DISABLED = (1 << 0),
31 AVB_KERNEL_CMDLINE_FLAGS_USE_ONLY_IF_HASHTREE_DISABLED = (1 << 1)
32 } AvbKernelCmdlineFlags;
34 /* A descriptor containing information to be appended to the kernel
37 * The |flags| field contains flags from the AvbKernelCmdlineFlags
40 * Following this struct are |kernel_cmdline_len| bytes with the
41 * kernel command-line (UTF-8 encoded).
43 typedef struct AvbKernelCmdlineDescriptor {
44 AvbDescriptor parent_descriptor;
46 uint32_t kernel_cmdline_length;
47 } AVB_ATTR_PACKED AvbKernelCmdlineDescriptor;
49 /* Copies |src| to |dest| and validates, byte-swapping fields in the
50 * process if needed. Returns true if valid, false if invalid.
52 * Data following the struct is not validated nor copied.
54 bool avb_kernel_cmdline_descriptor_validate_and_byteswap(
55 const AvbKernelCmdlineDescriptor* src,
56 AvbKernelCmdlineDescriptor* dest) AVB_ATTR_WARN_UNUSED_RESULT;
62 #endif /* AVB_KERNEL_CMDLINE_DESCRIPTOR_H_ */