MCPcopy Create free account
hub / github.com/coreboot/coreboot / efi_test_header

Function efi_test_header

tests/drivers/efivars.c:108–135  ·  view source on GitHub ↗

Test valid and corrupted FVH header */

Source from the content-addressed store, hash-verified

106
107/* Test valid and corrupted FVH header */
108static void efi_test_header(void **state)
109{
110 enum cb_err ret;
111 uint8_t buf[16];
112 uint32_t size;
113 int i;
114
115 mock_rdev(true);
116
117 /* Test variable lookup with intact header */
118 size = sizeof(buf);
119 ret = efi_fv_get_option(&flash_rdev_rw, &EficorebootNvDataGuid, name, buf, &size);
120 assert_int_equal(ret, CB_SUCCESS);
121 assert_int_equal(size, strlen("is great")+1);
122 assert_string_equal((const char *)buf, "is great");
123
124 for (i = 0; i < FVH_CHECKSUMMED_SIZE; i++) {
125 mock_rdev(true);
126
127 /* Flip some bits */
128 flash_buffer[i] ^= 0xff;
129
130 size = sizeof(buf);
131 ret = efi_fv_get_option(&flash_rdev_rw, &EficorebootNvDataGuid, name, buf,
132 &size);
133 assert_int_not_equal(ret, CB_SUCCESS);
134 }
135}
136
137/* Write with the same key and value should not modify the store */
138static void efi_test_noop_existing_write(void **state)

Callers

nothing calls this directly

Calls 3

mock_rdevFunction · 0.85
efi_fv_get_optionFunction · 0.85
strlenFunction · 0.85

Tested by

no test coverage detected