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

Function fv_parse

util/smmstoretool/fv.c:157–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157bool fv_parse(struct mem_range_t fv, struct mem_range_t *var_store,
158 bool *is_auth_var_store)
159{
160 const EFI_FIRMWARE_VOLUME_HEADER *vol_hdr = (void *)fv.start;
161 if (!check_fw_vol_hdr(vol_hdr, fv.length)) {
162 fprintf(stderr, "No valid firmware volume was found\n");
163 return false;
164 }
165
166 uint8_t *fw_vol_data = fv.start + vol_hdr->HeaderLength;
167 size_t volume_size = fv.length - vol_hdr->HeaderLength;
168 const VARIABLE_STORE_HEADER *var_store_hdr = (void *)fw_vol_data;
169 if (!check_var_store_hdr(var_store_hdr, volume_size, is_auth_var_store)) {
170 fprintf(stderr, "No valid variable store was found");
171 return false;
172 }
173
174 var_store->start = fw_vol_data + sizeof(*var_store_hdr);
175 var_store->length = volume_size - sizeof(*var_store_hdr);
176 return true;
177}

Callers 1

storage_openFunction · 0.85

Calls 3

check_fw_vol_hdrFunction · 0.85
fprintfFunction · 0.85
check_var_store_hdrFunction · 0.85

Tested by

no test coverage detected