blob: 2f45d77c0af1c6f71212487e5fdd77b42d8f2bb0 [file] [log] [blame]
Alice Wangbf7fadd2023-01-13 12:18:24 +00001/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Alice Wang2925b0a2023-01-19 10:44:24 +000017mod utils;
Alice Wangbf7fadd2023-01-13 12:18:24 +000018
Alice Wang1f0add02023-01-23 16:22:53 +000019use anyhow::{anyhow, Result};
Alice Wang2925b0a2023-01-19 10:44:24 +000020use avb_bindgen::{AvbFooter, AvbVBMetaImageHeader};
Alice Wangab0d0202023-05-17 08:07:41 +000021use pvmfw_avb::{
22 verify_payload, AvbIOError, AvbSlotVerifyError, Capability, DebugLevel, VerifiedBootData,
23};
Alice Wang2925b0a2023-01-19 10:44:24 +000024use std::{fs, mem::size_of, ptr};
25use utils::*;
26
Alice Wangbf7fadd2023-01-13 12:18:24 +000027const TEST_IMG_WITH_ONE_HASHDESC_PATH: &str = "test_image_with_one_hashdesc.img";
Alice Wang86383df2023-01-11 10:03:56 +000028const TEST_IMG_WITH_PROP_DESC_PATH: &str = "test_image_with_prop_desc.img";
Alice Wangab0d0202023-05-17 08:07:41 +000029const TEST_IMG_WITH_SERVICE_VM_PROP_PATH: &str = "test_image_with_service_vm_prop.img";
30const TEST_IMG_WITH_UNKNOWN_VM_TYPE_PROP_PATH: &str = "test_image_with_unknown_vm_type_prop.img";
31const TEST_IMG_WITH_MULTIPLE_PROPS_PATH: &str = "test_image_with_multiple_props.img";
32const TEST_IMG_WITH_DUPLICATED_CAP_PATH: &str = "test_image_with_duplicated_capability.img";
Alice Wang86383df2023-01-11 10:03:56 +000033const TEST_IMG_WITH_NON_INITRD_HASHDESC_PATH: &str = "test_image_with_non_initrd_hashdesc.img";
Alice Wangf2752862023-01-18 11:51:25 +000034const TEST_IMG_WITH_INITRD_AND_NON_INITRD_DESC_PATH: &str =
35 "test_image_with_initrd_and_non_initrd_desc.img";
Alice Wangbf7fadd2023-01-13 12:18:24 +000036const UNSIGNED_TEST_IMG_PATH: &str = "unsigned_test.img";
37
Alice Wangbf7fadd2023-01-13 12:18:24 +000038const RANDOM_FOOTER_POS: usize = 30;
39
40/// This test uses the Microdroid payload compiled on the fly to check that
41/// the latest payload can be verified successfully.
42#[test]
Alice Wang4e55dd92023-01-11 10:17:01 +000043fn latest_normal_payload_passes_verification() -> Result<()> {
Alice Wang1f0add02023-01-23 16:22:53 +000044 assert_latest_payload_verification_passes(
Alice Wang4e55dd92023-01-11 10:17:01 +000045 &load_latest_initrd_normal()?,
Alice Wang1f0add02023-01-23 16:22:53 +000046 b"initrd_normal",
47 DebugLevel::None,
Alice Wang4e55dd92023-01-11 10:17:01 +000048 )
49}
Alice Wangbf7fadd2023-01-13 12:18:24 +000050
Alice Wang4e55dd92023-01-11 10:17:01 +000051#[test]
52fn latest_debug_payload_passes_verification() -> Result<()> {
Alice Wang1f0add02023-01-23 16:22:53 +000053 assert_latest_payload_verification_passes(
Alice Wang4e55dd92023-01-11 10:17:01 +000054 &load_latest_initrd_debug()?,
Alice Wang1f0add02023-01-23 16:22:53 +000055 b"initrd_debug",
56 DebugLevel::Full,
Alice Wang4e55dd92023-01-11 10:17:01 +000057 )
Alice Wangbf7fadd2023-01-13 12:18:24 +000058}
59
60#[test]
61fn payload_expecting_no_initrd_passes_verification_with_no_initrd() -> Result<()> {
Pierre-Clément Tosif58f3a32023-02-02 16:24:23 +000062 let public_key = load_trusted_public_key()?;
Alice Wang1f0add02023-01-23 16:22:53 +000063 let verified_boot_data = verify_payload(
Alice Wang86383df2023-01-11 10:03:56 +000064 &fs::read(TEST_IMG_WITH_ONE_HASHDESC_PATH)?,
Alice Wang2925b0a2023-01-19 10:44:24 +000065 /*initrd=*/ None,
Pierre-Clément Tosif58f3a32023-02-02 16:24:23 +000066 &public_key,
Alice Wang86383df2023-01-11 10:03:56 +000067 )
Alice Wang1f0add02023-01-23 16:22:53 +000068 .map_err(|e| anyhow!("Verification failed. Error: {}", e))?;
69
Pierre-Clément Tosi81ca0802023-02-14 10:41:38 +000070 let kernel_digest = hash(&[&hex::decode("1111")?, &fs::read(UNSIGNED_TEST_IMG_PATH)?]);
Pierre-Clément Tosif58f3a32023-02-02 16:24:23 +000071 let expected_boot_data = VerifiedBootData {
72 debug_level: DebugLevel::None,
73 kernel_digest,
74 initrd_digest: None,
75 public_key: &public_key,
Alice Wangab0d0202023-05-17 08:07:41 +000076 capabilities: vec![],
Pierre-Clément Tosif58f3a32023-02-02 16:24:23 +000077 };
Pierre-Clément Tosi81ca0802023-02-14 10:41:38 +000078 assert_eq!(expected_boot_data, verified_boot_data);
79
Alice Wang1f0add02023-01-23 16:22:53 +000080 Ok(())
Alice Wangbf7fadd2023-01-13 12:18:24 +000081}
82
Alice Wang86383df2023-01-11 10:03:56 +000083#[test]
Alice Wangf2752862023-01-18 11:51:25 +000084fn payload_with_non_initrd_descriptor_fails_verification_with_no_initrd() -> Result<()> {
Alice Wang1f0add02023-01-23 16:22:53 +000085 assert_payload_verification_fails(
Alice Wang86383df2023-01-11 10:03:56 +000086 &fs::read(TEST_IMG_WITH_NON_INITRD_HASHDESC_PATH)?,
Alice Wang2925b0a2023-01-19 10:44:24 +000087 /*initrd=*/ None,
Alice Wang86383df2023-01-11 10:03:56 +000088 &load_trusted_public_key()?,
Alice Wang14973b22023-05-22 14:54:16 +000089 AvbSlotVerifyError::InvalidDescriptors(AvbIOError::NoSuchPartition),
Alice Wangf2752862023-01-18 11:51:25 +000090 )
91}
92
93#[test]
94fn payload_with_non_initrd_descriptor_fails_verification_with_initrd() -> Result<()> {
Alice Wang1f0add02023-01-23 16:22:53 +000095 assert_payload_verification_with_initrd_fails(
Alice Wangf2752862023-01-18 11:51:25 +000096 &fs::read(TEST_IMG_WITH_INITRD_AND_NON_INITRD_DESC_PATH)?,
97 &load_latest_initrd_normal()?,
98 &load_trusted_public_key()?,
Alice Wang14973b22023-05-22 14:54:16 +000099 AvbSlotVerifyError::InvalidDescriptors(AvbIOError::NoSuchPartition),
Alice Wang86383df2023-01-11 10:03:56 +0000100 )
101}
102
103#[test]
Alice Wangab0d0202023-05-17 08:07:41 +0000104fn payload_expecting_no_initrd_passes_verification_with_service_vm_prop() -> Result<()> {
105 let public_key = load_trusted_public_key()?;
106 let verified_boot_data = verify_payload(
107 &fs::read(TEST_IMG_WITH_SERVICE_VM_PROP_PATH)?,
108 /*initrd=*/ None,
109 &public_key,
110 )
111 .map_err(|e| anyhow!("Verification failed. Error: {}", e))?;
112
113 let kernel_digest = hash(&[&hex::decode("2131")?, &fs::read(UNSIGNED_TEST_IMG_PATH)?]);
114 let expected_boot_data = VerifiedBootData {
115 debug_level: DebugLevel::None,
116 kernel_digest,
117 initrd_digest: None,
118 public_key: &public_key,
119 capabilities: vec![Capability::RemoteAttest],
120 };
121 assert_eq!(expected_boot_data, verified_boot_data);
122
123 Ok(())
124}
125
126#[test]
127fn payload_with_unknown_vm_type_fails_verification_with_no_initrd() -> Result<()> {
128 assert_payload_verification_fails(
129 &fs::read(TEST_IMG_WITH_UNKNOWN_VM_TYPE_PROP_PATH)?,
130 /*initrd=*/ None,
131 &load_trusted_public_key()?,
132 AvbSlotVerifyError::UnknownVbmetaProperty,
133 )
134}
135
136#[test]
137fn payload_with_multiple_props_fails_verification_with_no_initrd() -> Result<()> {
138 assert_payload_verification_fails(
139 &fs::read(TEST_IMG_WITH_MULTIPLE_PROPS_PATH)?,
140 /*initrd=*/ None,
141 &load_trusted_public_key()?,
142 AvbSlotVerifyError::InvalidDescriptors(AvbIOError::Io),
143 )
144}
145
146#[test]
147fn payload_with_duplicated_capability_fails_verification_with_no_initrd() -> Result<()> {
148 assert_payload_verification_fails(
149 &fs::read(TEST_IMG_WITH_DUPLICATED_CAP_PATH)?,
150 /*initrd=*/ None,
151 &load_trusted_public_key()?,
152 AvbSlotVerifyError::InvalidMetadata,
153 )
154}
155
156#[test]
Alice Wang86383df2023-01-11 10:03:56 +0000157fn payload_with_prop_descriptor_fails_verification_with_no_initrd() -> Result<()> {
Alice Wang1f0add02023-01-23 16:22:53 +0000158 assert_payload_verification_fails(
Alice Wang86383df2023-01-11 10:03:56 +0000159 &fs::read(TEST_IMG_WITH_PROP_DESC_PATH)?,
Alice Wang2925b0a2023-01-19 10:44:24 +0000160 /*initrd=*/ None,
Alice Wang86383df2023-01-11 10:03:56 +0000161 &load_trusted_public_key()?,
Alice Wangab0d0202023-05-17 08:07:41 +0000162 AvbSlotVerifyError::UnknownVbmetaProperty,
Alice Wang86383df2023-01-11 10:03:56 +0000163 )
164}
165
166#[test]
167fn payload_expecting_initrd_fails_verification_with_no_initrd() -> Result<()> {
Alice Wang1f0add02023-01-23 16:22:53 +0000168 assert_payload_verification_fails(
Alice Wang86383df2023-01-11 10:03:56 +0000169 &load_latest_signed_kernel()?,
Alice Wang2925b0a2023-01-19 10:44:24 +0000170 /*initrd=*/ None,
Alice Wang86383df2023-01-11 10:03:56 +0000171 &load_trusted_public_key()?,
Alice Wang1f0add02023-01-23 16:22:53 +0000172 AvbSlotVerifyError::InvalidMetadata,
Alice Wang86383df2023-01-11 10:03:56 +0000173 )
174}
Alice Wangbf7fadd2023-01-13 12:18:24 +0000175
176#[test]
177fn payload_with_empty_public_key_fails_verification() -> Result<()> {
Alice Wang1f0add02023-01-23 16:22:53 +0000178 assert_payload_verification_with_initrd_fails(
Alice Wangbf7fadd2023-01-13 12:18:24 +0000179 &load_latest_signed_kernel()?,
180 &load_latest_initrd_normal()?,
181 /*trusted_public_key=*/ &[0u8; 0],
Alice Wang1f0add02023-01-23 16:22:53 +0000182 AvbSlotVerifyError::PublicKeyRejected,
Alice Wangbf7fadd2023-01-13 12:18:24 +0000183 )
184}
185
186#[test]
187fn payload_with_an_invalid_public_key_fails_verification() -> Result<()> {
Alice Wang1f0add02023-01-23 16:22:53 +0000188 assert_payload_verification_with_initrd_fails(
Alice Wangbf7fadd2023-01-13 12:18:24 +0000189 &load_latest_signed_kernel()?,
190 &load_latest_initrd_normal()?,
191 /*trusted_public_key=*/ &[0u8; 512],
Alice Wang1f0add02023-01-23 16:22:53 +0000192 AvbSlotVerifyError::PublicKeyRejected,
Alice Wangbf7fadd2023-01-13 12:18:24 +0000193 )
194}
195
196#[test]
197fn payload_with_a_different_valid_public_key_fails_verification() -> Result<()> {
Alice Wang1f0add02023-01-23 16:22:53 +0000198 assert_payload_verification_with_initrd_fails(
Alice Wangbf7fadd2023-01-13 12:18:24 +0000199 &load_latest_signed_kernel()?,
200 &load_latest_initrd_normal()?,
201 &fs::read(PUBLIC_KEY_RSA2048_PATH)?,
Alice Wang1f0add02023-01-23 16:22:53 +0000202 AvbSlotVerifyError::PublicKeyRejected,
Alice Wangbf7fadd2023-01-13 12:18:24 +0000203 )
204}
205
206#[test]
Alice Wang5c1a7562023-01-13 17:19:57 +0000207fn payload_with_an_invalid_initrd_fails_verification() -> Result<()> {
Alice Wang1f0add02023-01-23 16:22:53 +0000208 assert_payload_verification_with_initrd_fails(
Alice Wang5c1a7562023-01-13 17:19:57 +0000209 &load_latest_signed_kernel()?,
210 /*initrd=*/ &fs::read(UNSIGNED_TEST_IMG_PATH)?,
211 &load_trusted_public_key()?,
Alice Wang1f0add02023-01-23 16:22:53 +0000212 AvbSlotVerifyError::Verification,
Alice Wang5c1a7562023-01-13 17:19:57 +0000213 )
214}
215
216#[test]
Alice Wangbf7fadd2023-01-13 12:18:24 +0000217fn unsigned_kernel_fails_verification() -> Result<()> {
Alice Wang1f0add02023-01-23 16:22:53 +0000218 assert_payload_verification_with_initrd_fails(
Alice Wangbf7fadd2023-01-13 12:18:24 +0000219 &fs::read(UNSIGNED_TEST_IMG_PATH)?,
220 &load_latest_initrd_normal()?,
Alice Wang4e55dd92023-01-11 10:17:01 +0000221 &load_trusted_public_key()?,
Alice Wang1f0add02023-01-23 16:22:53 +0000222 AvbSlotVerifyError::Io,
Alice Wangbf7fadd2023-01-13 12:18:24 +0000223 )
224}
225
226#[test]
227fn tampered_kernel_fails_verification() -> Result<()> {
228 let mut kernel = load_latest_signed_kernel()?;
229 kernel[1] = !kernel[1]; // Flip the bits
230
Alice Wang1f0add02023-01-23 16:22:53 +0000231 assert_payload_verification_with_initrd_fails(
Alice Wangbf7fadd2023-01-13 12:18:24 +0000232 &kernel,
233 &load_latest_initrd_normal()?,
Alice Wang4e55dd92023-01-11 10:17:01 +0000234 &load_trusted_public_key()?,
Alice Wang1f0add02023-01-23 16:22:53 +0000235 AvbSlotVerifyError::Verification,
Alice Wangbf7fadd2023-01-13 12:18:24 +0000236 )
237}
238
239#[test]
Alice Wangfaceff42023-01-19 09:54:38 +0000240fn kernel_footer_with_vbmeta_offset_overwritten_fails_verification() -> Result<()> {
241 // Arrange.
242 let mut kernel = load_latest_signed_kernel()?;
243 let total_len = kernel.len() as u64;
244 let footer = extract_avb_footer(&kernel)?;
245 assert!(footer.vbmeta_offset < total_len);
Alan Stokes196192b2023-07-24 11:44:08 +0100246 // TODO: use core::mem::offset_of once stable.
247 let footer_addr = ptr::addr_of!(footer) as *const u8;
Alice Wangfaceff42023-01-19 09:54:38 +0000248 let vbmeta_offset_addr = ptr::addr_of!(footer.vbmeta_offset) as *const u8;
Alice Wangfaceff42023-01-19 09:54:38 +0000249 let vbmeta_offset_start =
Alan Stokes196192b2023-07-24 11:44:08 +0100250 // SAFETY:
251 // - both raw pointers `vbmeta_offset_addr` and `footer_addr` are not null;
252 // - they are both derived from the `footer` object;
253 // - the offset is known from the struct definition to be a small positive number of bytes.
254 unsafe { vbmeta_offset_addr.offset_from(footer_addr) };
Alice Wangfaceff42023-01-19 09:54:38 +0000255 let footer_start = kernel.len() - size_of::<AvbFooter>();
256 let vbmeta_offset_start = footer_start + usize::try_from(vbmeta_offset_start)?;
257
258 let wrong_offsets = [total_len, u64::MAX];
259 for &wrong_offset in wrong_offsets.iter() {
260 // Act.
261 kernel[vbmeta_offset_start..(vbmeta_offset_start + size_of::<u64>())]
262 .copy_from_slice(&wrong_offset.to_be_bytes());
263
264 // Assert.
Inseob Kim8ebf1da2023-01-27 18:12:57 +0900265 let footer = extract_avb_footer(&kernel)?;
266 // footer is unaligned; copy vbmeta_offset to local variable
267 let vbmeta_offset = footer.vbmeta_offset;
268 assert_eq!(wrong_offset, vbmeta_offset);
Alice Wang1f0add02023-01-23 16:22:53 +0000269 assert_payload_verification_with_initrd_fails(
Alice Wangfaceff42023-01-19 09:54:38 +0000270 &kernel,
271 &load_latest_initrd_normal()?,
272 &load_trusted_public_key()?,
Alice Wang1f0add02023-01-23 16:22:53 +0000273 AvbSlotVerifyError::Io,
Alice Wangfaceff42023-01-19 09:54:38 +0000274 )?;
275 }
276 Ok(())
277}
278
279#[test]
Alice Wangbf7fadd2023-01-13 12:18:24 +0000280fn tampered_kernel_footer_fails_verification() -> Result<()> {
281 let mut kernel = load_latest_signed_kernel()?;
282 let avb_footer_index = kernel.len() - size_of::<AvbFooter>() + RANDOM_FOOTER_POS;
283 kernel[avb_footer_index] = !kernel[avb_footer_index];
284
Alice Wang1f0add02023-01-23 16:22:53 +0000285 assert_payload_verification_with_initrd_fails(
Alice Wangbf7fadd2023-01-13 12:18:24 +0000286 &kernel,
287 &load_latest_initrd_normal()?,
Alice Wang4e55dd92023-01-11 10:17:01 +0000288 &load_trusted_public_key()?,
Alice Wang1f0add02023-01-23 16:22:53 +0000289 AvbSlotVerifyError::InvalidMetadata,
Alice Wangbf7fadd2023-01-13 12:18:24 +0000290 )
291}
292
Alice Wang58dac082023-01-13 13:03:59 +0000293#[test]
Alice Wang75d05632023-01-25 13:31:18 +0000294fn extended_initrd_fails_verification() -> Result<()> {
295 let mut initrd = load_latest_initrd_normal()?;
296 initrd.extend(b"androidboot.vbmeta.digest=1111");
297
Alice Wang1f0add02023-01-23 16:22:53 +0000298 assert_payload_verification_with_initrd_fails(
Alice Wang75d05632023-01-25 13:31:18 +0000299 &load_latest_signed_kernel()?,
300 &initrd,
301 &load_trusted_public_key()?,
Alice Wang1f0add02023-01-23 16:22:53 +0000302 AvbSlotVerifyError::Verification,
Alice Wang75d05632023-01-25 13:31:18 +0000303 )
304}
305
306#[test]
Alice Wang58dac082023-01-13 13:03:59 +0000307fn tampered_vbmeta_fails_verification() -> Result<()> {
308 let mut kernel = load_latest_signed_kernel()?;
309 let footer = extract_avb_footer(&kernel)?;
310 let vbmeta_index: usize = (footer.vbmeta_offset + 1).try_into()?;
311
312 kernel[vbmeta_index] = !kernel[vbmeta_index]; // Flip the bits
313
Alice Wang1f0add02023-01-23 16:22:53 +0000314 assert_payload_verification_with_initrd_fails(
Alice Wang58dac082023-01-13 13:03:59 +0000315 &kernel,
316 &load_latest_initrd_normal()?,
317 &load_trusted_public_key()?,
Alice Wang1f0add02023-01-23 16:22:53 +0000318 AvbSlotVerifyError::InvalidMetadata,
Alice Wang58dac082023-01-13 13:03:59 +0000319 )
320}
321
322#[test]
323fn vbmeta_with_public_key_overwritten_fails_verification() -> Result<()> {
324 let mut kernel = load_latest_signed_kernel()?;
325 let footer = extract_avb_footer(&kernel)?;
326 let vbmeta_header = extract_vbmeta_header(&kernel, &footer)?;
327 let public_key_offset = footer.vbmeta_offset as usize
328 + size_of::<AvbVBMetaImageHeader>()
329 + vbmeta_header.authentication_data_block_size as usize
330 + vbmeta_header.public_key_offset as usize;
331 let public_key_size: usize = vbmeta_header.public_key_size.try_into()?;
332 let empty_public_key = vec![0u8; public_key_size];
333
334 kernel[public_key_offset..(public_key_offset + public_key_size)]
335 .copy_from_slice(&empty_public_key);
336
Alice Wang1f0add02023-01-23 16:22:53 +0000337 assert_payload_verification_with_initrd_fails(
Alice Wang58dac082023-01-13 13:03:59 +0000338 &kernel,
339 &load_latest_initrd_normal()?,
340 &empty_public_key,
Alice Wang1f0add02023-01-23 16:22:53 +0000341 AvbSlotVerifyError::Verification,
Alice Wang58dac082023-01-13 13:03:59 +0000342 )?;
Alice Wang1f0add02023-01-23 16:22:53 +0000343 assert_payload_verification_with_initrd_fails(
Alice Wang58dac082023-01-13 13:03:59 +0000344 &kernel,
345 &load_latest_initrd_normal()?,
346 &load_trusted_public_key()?,
Alice Wang1f0add02023-01-23 16:22:53 +0000347 AvbSlotVerifyError::Verification,
Alice Wang58dac082023-01-13 13:03:59 +0000348 )
349}
350
Alice Wangf06bfd72023-01-19 09:24:21 +0000351#[test]
352fn vbmeta_with_verification_flag_disabled_fails_verification() -> Result<()> {
353 // From external/avb/libavb/avb_vbmeta_image.h
354 const AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED: u32 = 2;
355
356 // Arrange.
357 let mut kernel = load_latest_signed_kernel()?;
358 let footer = extract_avb_footer(&kernel)?;
359 let vbmeta_header = extract_vbmeta_header(&kernel, &footer)?;
Inseob Kim8ebf1da2023-01-27 18:12:57 +0900360
361 // vbmeta_header is unaligned; copy flags to local variable
362 let vbmeta_header_flags = vbmeta_header.flags;
363 assert_eq!(0, vbmeta_header_flags, "The disable flag should not be set in the latest kernel.");
Alice Wangf06bfd72023-01-19 09:24:21 +0000364 let flags_addr = ptr::addr_of!(vbmeta_header.flags) as *const u8;
365 // SAFETY: It is safe as both raw pointers `flags_addr` and `vbmeta_header` are not null.
366 let flags_offset = unsafe { flags_addr.offset_from(ptr::addr_of!(vbmeta_header) as *const u8) };
367 let flags_offset = usize::try_from(footer.vbmeta_offset)? + usize::try_from(flags_offset)?;
368
369 // Act.
370 kernel[flags_offset..(flags_offset + size_of::<u32>())]
371 .copy_from_slice(&AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED.to_be_bytes());
372
373 // Assert.
Inseob Kim8ebf1da2023-01-27 18:12:57 +0900374 let vbmeta_header = extract_vbmeta_header(&kernel, &footer)?;
375 // vbmeta_header is unaligned; copy flags to local variable
376 let vbmeta_header_flags = vbmeta_header.flags;
377 assert_eq!(
378 AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED, vbmeta_header_flags,
379 "VBMeta verification flag should be disabled now."
380 );
Alice Wang1f0add02023-01-23 16:22:53 +0000381 assert_payload_verification_with_initrd_fails(
Alice Wangf06bfd72023-01-19 09:24:21 +0000382 &kernel,
383 &load_latest_initrd_normal()?,
384 &load_trusted_public_key()?,
Alice Wang1f0add02023-01-23 16:22:53 +0000385 AvbSlotVerifyError::Verification,
Alice Wangf06bfd72023-01-19 09:24:21 +0000386 )
387}