Test valid and corrupted FVH header */
| 106 | |
| 107 | /* Test valid and corrupted FVH header */ |
| 108 | static 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 */ |
| 138 | static void efi_test_noop_existing_write(void **state) |
nothing calls this directly
no test coverage detected