Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/30811 )
Change subject: lib/prog_loaders.c: Add prog_locate_hook() for measured and verified boot. ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/#/c/30811/1/src/include/program_loading.h File src/include/program_loading.h:
https://review.coreboot.org/#/c/30811/1/src/include/program_loading.h@140 PS1, Line 140: int prog_locate_hook(struct prog *prog); I think you should just call this vboot_crtm_measure_prog() or something, put it in vboot_crtm.h, and implement it as an empty inline function there if VBOOT_MEASURED_BOOT isn't set (similar to how things like timestamp_add_now() work). Calling this prog_locate_hook() implies that other features could make use of this hook as well, but they can't really, because then they couldn't be used at the same time as measured boot. These sort of hook-by-function-name hooks only really work if they're meant to be implemented by a range of code components where only one of them can ever be used at the same time (like mainboards or SoCs). They don't work well for optional, platform-independent features, like timestamps or this.
https://review.coreboot.org/#/c/30811/1/src/lib/prog_loaders.c File src/lib/prog_loaders.c:
https://review.coreboot.org/#/c/30811/1/src/lib/prog_loaders.c@43 PS1, Line 43: if (prog_locate_hook(prog)) I don't think this works? prog->rdev is still uninitialized here. You'll have to put it at the end of this function, after cbfs_file_data(), to do what you want.