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

Function maybe_update_fmap_hash

util/cbfstool/cbfstool.c:309–328  ·  view source on GitHub ↗

This should be called after every time the FMAP or the bootblock itself might have changed, and will write the new FMAP hash into the metadata hash anchor in the bootblock if required (usually when the bootblock is first added). */

Source from the content-addressed store, hash-verified

307 have changed, and will write the new FMAP hash into the metadata hash anchor
308 in the bootblock if required (usually when the bootblock is first added). */
309static int maybe_update_fmap_hash(void)
310{
311 if (strcmp(param.region_name, SECTION_NAME_BOOTBLOCK) &&
312 strcmp(param.region_name, SECTION_NAME_BOOTBLOCK_B) &&
313 strcmp(param.region_name, SECTION_NAME_FMAP) &&
314 param.type != CBFS_TYPE_BOOTBLOCK &&
315 param.type != CBFS_TYPE_AMDFW)
316 return 0; /* FMAP and bootblock didn't change. */
317
318 struct mh_cache *mhc = get_mh_cache();
319 if (mhc->cbfs_hash.algo == VB2_HASH_INVALID)
320 return 0;
321
322 struct vb2_hash fmap_hash;
323 const struct fmap *fmap = partitioned_file_get_fmap(param.image_file);
324 if (!fmap || vb2_hash_calculate(false, fmap, fmap_size(fmap),
325 mhc->cbfs_hash.algo, &fmap_hash))
326 return -1;
327 return update_anchor(mhc, fmap_hash.raw);
328}
329
330static bool verification_exclude(enum cbfs_type type)
331{

Callers 2

cbfs_add_componentFunction · 0.85
cbfs_writeFunction · 0.85

Calls 5

get_mh_cacheFunction · 0.85
fmap_sizeFunction · 0.85
update_anchorFunction · 0.85
strcmpFunction · 0.50

Tested by

no test coverage detected