summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* futility/: Drop dup host programmer defineHEADmainEdward O'Callaghan2023-05-183-7/+6
| | | | | | | | | | | | | | BUG=b:282585789 BRANCH=none TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: I263ea5a68da3be4fdb07bfd0197645180d32ed3f Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4542040 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org>
* futility/updater_utils.c: Inline {read,write}_flash()Edward O'Callaghan2023-05-171-22/+11
| | | | | | | | | | | | | | | Avoid indirection. BUG=b:282585789 BRANCH=none TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: I2ad99a61b801b856f53743c0ed4e00289ede5deb Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4541780 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
* futility/updater.c: Inline write_ec_firmware()Edward O'Callaghan2023-05-171-28/+22
| | | | | | | | | | | | | | | | Avoid indirection. BUG=b:282585789 BRANCH=none TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: I5391c349ff60569e4dcc6c1c4605ccb9901c290b Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4532320 Commit-Queue: Nikolai Artemiev <nartemiev@google.com> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org>
* futility/updater_utils.c: Drop useless func operandEdward O'Callaghan2023-05-161-6/+4
| | | | | | | | | | | | | | | Unused param. BUG=b:282585789 BRANCH=none TEST=none Change-Id: I57f4a2f30965b078ab1482dd8eb31ddc29a1a5f4 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4532322 Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* futility/updater.c: Dedup update_legacy_firmware() logicEdward O'Callaghan2023-05-161-21/+19
| | | | | | | | | | | | | BUG=b:282585789 BRANCH=none TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: I8fdc14236a478cc1ad0f39e091b19223cb3d9470 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4532321 Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* futility/: Inline write_firmware() as write_system_firmware()Edward O'Callaghan2023-05-163-25/+14
| | | | | | | | | | | | | | | Avoid confusing indirections. BUG=b:282585789 BRANCH=none TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: I5fdc01affcce2399955b594abf98c7550815b56b Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4532319 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* futility/updater.c: Rename write_optional_firmware()Edward O'Callaghan2023-05-161-6/+5
| | | | | | | | | | | | | | | The function relates to the EC path. BUG=b:282585789 BRANCH=none TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: I0da0df25f659404bd639a863a68a2b717d593d1d Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4532318 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
* futility/updater.c: Drop redundant params to write_optional_firmware()Edward O'Callaghan2023-05-161-8/+5
| | | | | | | | | | | | | BUG=b:282585789 BRANCH=none TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: I3da2da752cc45a34b25616fea225654abe60a214 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4532317 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
* futility/updater.c: Drop redundant has_valid_update() in EC pathEdward O'Callaghan2023-05-161-2/+0
| | | | | | | | | | | | | BUG=b:282585789 BRANCH=none TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: Ic3ba500b45cdc9098808aca69eb852ec317d094b Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4532316 Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* futility/cmd_dump_fmap.c: Rewrite with scoped logicEdward O'Callaghan2023-05-151-4/+4
| | | | | | | | | | | | | | | | Scope fmap header to loop construct. Also do not exit(1) on error branches, return error codes. BUG=b:268397597 TEST=`emerge-nissa vboot_reference`. Change-Id: I0190cb55740a21cbf9a74929fa6dd612f398d350 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4313543 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Sam McNally <sammc@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org>
* futility/cmd_create.c: Drop dead commentEdward O'Callaghan2023-05-151-1/+0
| | | | | | | | | | | | | | BUG=b:268397597 BRANCH=none TEST=`emerge-nissa vboot_reference`. TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: I21935ef6733d345949ffd1d8964aa9805318109a Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4531328 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org>
* futility/misc.c: Check mmap() ret with std valueEdward O'Callaghan2023-05-151-1/+1
| | | | | | | | | | | | | | | BUG=b:268397597 BRANCH=none TEST=`emerge-nissa vboot_reference`. TEST=`$ cros_run_unit_tests --host --packages="vboot_reference flashrom"`. TEST=`$ cros_run_unit_tests --board=nissa --packages="vboot_reference flashrom"`. Change-Id: I0033d52fb14ece7397451ba6283592c726833a94 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4531327 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* futility/misc.c: Use ERROR() macro consistentlyEdward O'Callaghan2023-05-151-22/+16
| | | | | | | | | | | | | | | BUG=b:268397597 BRANCH=none TEST=`emerge-nissa vboot_reference`. TEST=`$ cros_run_unit_tests --host --packages="vboot_reference flashrom"`. TEST=`$ cros_run_unit_tests --board=nissa --packages="vboot_reference flashrom"`. Change-Id: I86035534ba6318bad29c8cb43c3b72e2f984e953 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4531326 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org>
* futility/file_type_bios.c: Improve branch readabilityEdward O'Callaghan2023-05-151-12/+10
| | | | | | | | | | | | | | | | BUG=b:268397597 BRANCH=none TEST=`emerge-nissa vboot_reference`. TEST=`$ cros_run_unit_tests --host --packages="vboot_reference flashrom"`. TEST=`$ cros_run_unit_tests --board=nissa --packages="vboot_reference flashrom"`. Change-Id: I3eb8810a7c5efd7042f422bb772567daf87e803c Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4531325 Reviewed-by: Sam McNally <sammc@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* futility/cmd_dump_fmap.c: Rewrite to se proper arg identifiersEdward O'Callaghan2023-05-151-15/+15
| | | | | | | | | | | | | The previous function parameter names were cryptic at best. BUG=b:268397597 TEST=`emerge-nissa vboot_reference`. Change-Id: I6f384db9fcfc855caf229fef338117f47b46cea3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4313542 Reviewed-by: Sam McNally <sammc@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* futility/cmd_create.c: Drop globalsEdward O'Callaghan2023-05-151-38/+41
| | | | | | | | | | | | | | | | | | | Write proper functions that consume and return values. Allow code to be maintainable and extensible. Fix types where required while here as well. BUG=b:268397597 BRANCH=none TEST=`emerge-nissa vboot_reference`. TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: I9a615506685b45d0c05936aa83ee3c5b08f8c04a Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4313545 Reviewed-by: Sam McNally <sammc@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* futility/cmd_dump_fmap.c: Rewrite without globalsEdward O'Callaghan2023-05-151-36/+36
| | | | | | | | | | | | | | | | | | | Write proper functions that consume and return values. Allow code to be maintainable and extensible. Fix types required while here as well. Deal with odd func recursion with const opt param. BUG=b:268397597 TEST=`emerge-nissa vboot_reference`. TEST=`$ cros_run_unit_tests --host --packages="vboot_reference flashrom"`. TEST=`$ cros_run_unit_tests --board=nissa --packages="vboot_reference flashrom"`. Change-Id: I09245ce703054369b8fad960927f68fb5c386cf1 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4313541 Commit-Queue: Sam McNally <sammc@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* Add checks for a few minor overflow risksJulius Werner2023-05-133-6/+6
| | | | | | | | | | | | | | | | This patch fixes a few locations where specific maliciously crafted input could cause an arithmetic overflow to bypass a size check. In none of those instances is the data being parsed actually untrusted for our use case, so there was no real security risk here. This is just extra hardening. BUG=chromium:1441030,b:280378929 TEST=Booted CoachZ Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I65f2d483f1e67686b7a22f0f7eb3ce5c3eabfdfa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4505019 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* futility/cmd_flash_util.c: Print fw expected wp sr conf valuesEdward O'Callaghan2023-05-121-30/+37
| | | | | | | | | | | | | | | | | | | | | AP RO verification in the case of non-factory flows wishes to determine the WP configuration values needed to calculate the SR configuration data as defined by the firmware image. Since we already do this to configure WP correctly on the DUT using FW derived values parsed from the WP_RO region within the FMAP we can simply print the offset and length. BUG=b:281888335 TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: Iafa0cc4193453cc67952aa4ff1f1554ac1861882 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4520486 Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org>
* Revert "vboot: update get system properties"Edward O'Callaghan2023-05-081-16/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8ef4f7a9a9a68bad49e8417d5ed346dc927e1d2c. Reason for revert: Installer supposedly misuses API with `VbGetSystemPropertyString("fw_try_next", NULL, 0);` by passing a `NULL` ptr as dest and so not sized. The call sites need checking. BUG=b:280417931 TEST=none Original change's description: > vboot: update get system properties > > `VbGetSystemPropertyString` header promises that the property string > will be read into the passed in dest buffer, however for some system > properties the values are not placed in buffer but returned directly. > this patch fixes that error > > Before, running `VbGetSystemPropertyString("minios_priority", buf, > size):` > ``` > buf: return value: B > ``` > After, same command: > ``` > buf: B return value: B > ``` > > BRANCH=none > BUG=none > TEST=Tested with an executable on brya > > Signed-off-by: Saketh Pothireddy <spothire@chromium.org> > > Change-Id: I87a0aa8638e719bc5bbea579ecaca4754a38c02e > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4468208 > Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> > Reviewed-by: Julius Werner <jwerner@chromium.org> > Commit-Queue: Saketh Pothireddy <spothire@google.com> > Tested-by: Saketh Pothireddy <spothire@google.com> Bug: none Change-Id: Ie07363424db92832b485c9efae21edbf0d24fba5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4508974 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org>
* futility/: EOL PD firmware updating supportEdward O'Callaghan2023-05-059-48/+15
| | | | | | | | | | | | | | | | | | | The kunimitsu/glados family uses a PD MCU. These include lars, sentry, caroline, and chell. The kunimitsu family reaches AUE 2023-Jun-01. As part of removing cros_ec out of flashrom drop which support for this subtype so then EOL it from futility too. BUG=b:262782150,b:280268486 BRANCH=none TEST=`cros_run_unit_tests --board=nissa --packages="vboot_reference flashrom"`. Cq-Depend: chromium:4453124, chromium:4486860 Change-Id: I111492c7386dec012419cb0581e302e7e1f1719e Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4486657 Reviewed-by: Sam McNally <sammc@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* vboot: update get system propertiesstabilize-15446.BSaketh Pothireddy2023-04-271-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `VbGetSystemPropertyString` header promises that the property string will be read into the passed in dest buffer, however for some system properties the values are not placed in buffer but returned directly. this patch fixes that error Before, running `VbGetSystemPropertyString("minios_priority", buf, size):` ``` buf: return value: B ``` After, same command: ``` buf: B return value: B ``` BRANCH=none BUG=none TEST=Tested with an executable on brya Signed-off-by: Saketh Pothireddy <spothire@chromium.org> Change-Id: I87a0aa8638e719bc5bbea579ecaca4754a38c02e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4468208 Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Saketh Pothireddy <spothire@google.com> Tested-by: Saketh Pothireddy <spothire@google.com>
* scripts: Support compressed about_os_credits.html.stabilize-15439.Brelease-R114-15437.BMiriam Zimmerman2023-04-251-1/+8
| | | | | | | | | | | | | BUG=b:187790036 BRANCH=none TEST=ensure_not_tainted_license.sh /path/to/chromiumos_test_image.bin Signed-off-by: Miriam Zimmerman <mutexlox@google.com> Change-Id: Id3ad6535b1bc9635050d467208614f97e0aeca35 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4467627 Commit-Queue: Miriam Zimmerman <mutexlox@chromium.org> Tested-by: Miriam Zimmerman <mutexlox@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* sign_official_build: Add support for a second miniOS keyReka Norman2023-04-211-7/+33
| | | | | | | | | | | | | | | | | | | | | | For recovery images, if minios_kernel.v1.keyblock exists, sign - MINIOS-A with minios_kernel.v1.keyblock - MINIOS-B with minios_kernel.keyblock Otherwise, sign both with minios_kernel.keyblock. BRANCH=None BUG=b:266502803 TEST=- Run replace_recovery_key.sh in devkeys directory to get test keys - Run sign_official_build.sh on a nissa recovery image - Set recovery_key.v1.vbpubk in GBB and run recovery. After recovery completes, check NBR still works. - Repeat with recovery_key.vbpubk. Change-Id: I2336e5261ef24114c5fee302ed95b4dfa1f67c11 Signed-off-by: Reka Norman <rekanorman@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4452079 Tested-by: Reka Norman <rekanorman@chromium.org> Commit-Queue: Reka Norman <rekanorman@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: make flash --wp-status subcmd check HW statusstabilize-15432.BNikolai Artemiev2023-04-202-9/+25
| | | | | | | | | | | | | | | | Check HW WP status as well as SW WP status by default. A new `--ignore-hw` flag makes it possible to only check SW WP. BUG=b:268574030 BRANCH=none TEST=todo Change-Id: I4a45499ceda52a1e00e7e33742b0bb48d235550b Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4413354 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* Makefile: Respect standard CPPFLAGSstabilize-15429.BYu-Ping Wu2023-04-191-1/+1
| | | | | | | | | | | | | | | | | The Makefile should respect the standard compilation setting CPPFLAGS. For example, the cros-debug-add-NDEBUG function call in the ebuild needs that to work. BUG=none TEST=USE=cros-debug emerge-corsola vboot_reference TEST=USE=-cros-debug emerge-corsola vboot_reference BRANCH=none Change-Id: I9b3a404983b5db81fe401ef243de357c55f478b3 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4426377 Commit-Queue: Julius Werner <jwerner@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* Makefile: Disable NDEBUG by defaultYu-Ping Wu2023-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | We decided in to enable NDEBUG by default because cryptolib would spam the debug output [1]. Now that cryptolib is gone (CL:400903), we should be able to turn it on by default, so that assert() calls will no longer be no-ops. The DISABLE_NDEBUG make variable is replaced with NDEBUG. [1] https://codereview.chromium.org/3004001 BUG=none TEST=make NDEBUG=1 futil -j TEST=emerge-corsola vboot_reference BRANCH=none Change-Id: Ic97d85f0cc14c05a1084d02c6a150e4cc7d3393e Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4413341 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org>
* futility/: host/lib: Add flash chip info subcommand supportEdward O'Callaghan2023-04-133-1/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The AP RO verification tooling requires a understanding of the underlying flashchip information. Provision support in the flash subcommand to report back this data from the flashrom driver. BUG=b:276981092 BRANCH=none TEST=on Nissa ``` localhost ~ # futility flash --flash-i{nfo} Warning: Setting BIOS Control at 0xdc from 0x8b to 0x89 failed. New value is 0x8b. Flash vendor: Winbond Flash name: W25Q256JV_M Flash vid-pid: 0xef00007019 Flash size: 0x02000000 ```. Cq-Depend: chromium:4401775, chromium:4401776 Change-Id: I58e818f06def4904693f61c6967d70b16c62fa37 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4402370 Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Jakub Czapiga <czapiga@google.com> Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
* Fix build error when compiling without -DNDEBUGYu-Ping Wu2023-04-131-5/+5
| | | | | | | | | | | | | | | | | | | | | Currently the host lib is always built with "-DNDEBUG" (added by Makefile). When NDEBUG is undefined, the symbols such as TPM_TAG_RQU_COMMAND will be undeclared, leading to build error. Since the assertion is for TPM1 only, add #ifndef guard for TPM2_MODE. BUG=none TEST=make hostlib TPM2_MODE=0 DISABLE_NDEBUG=0 TEST=make hostlib TPM2_MODE=0 DISABLE_NDEBUG=1 TEST=make hostlib TPM2_MODE=1 DISABLE_NDEBUG=0 TEST=make hostlib TPM2_MODE=1 DISABLE_NDEBUG=1 BRANCH=none Change-Id: Id2cb327e512140ed8fff04f5e54d3090d9e25dbe Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4418006 Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: Allow printing manifest for EC onlyYu-Ping Wu2023-04-122-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently `futility update --manifest` requires either -i/--image or -a/--archive to be passed. There is no way to show the EC manifest without also passing an AP image. Extend the command by allowing `futility update --manifest -e FILE`. Here are a few examples of valid commands: * futility update --manifest --archive PATH * futility update --manifest --image FILE * futility update --manifest --image FILE --ec_image FILE * futility update --manifest --ec_image FILE BUG=none TEST=make DISABLE_NDEBUG=1 futil -j TEST=sudo emerge vboot_reference TEST=futility update --manifest -e FILE BRANCH=none Change-Id: I267b90a3e5ff2891b519702558d173bb2e970052 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4413335 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Yidi Lin <yidilin@chromium.org>
* firmware/2lib: Expose vb2_clear_recovery as vb2apiMichał Żygowski2023-04-125-26/+26
| | | | | | | | | | | | | | | | | | | | | | | | | For ChromeOS platform the recovery reason is cleared in vb2api_kernel_phase2 which is probably not called by any non-ChromeOS system. It results in the platform being stuck in recovery mode, e.g. when RW firmware verification fails. Even if the RW partition is flashed with correctly signed image, the persistent non-zero recovery reason will prevent vboot from attempting the RW partition check. Expose vb2_clear_recovery as vb2api to let non-ChromeOS coreboot platform to clear the recovery reason when needed. TEST=Clear the recovery reason in mainboard_final function right before payload jump when RW partition is corrupted and RW partition is valid. In case it is corrupted, the platform stays in recovery mode, when valid the platform boots from RW partition. Tested on MSI PRO Z690-A DDR4. Change-Id: Ic2946150c404fc8e2d50d07d0746b2e42f7cbcde Signed-off-by: Michał Żygowski <miczyg94@gmail.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4414956 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org> Tested-by: Julius Werner <jwerner@chromium.org>
* sha256_armv8a_ce_a64.S: Reuse vb2_sha256_k[] in 2sha256.cYidi Lin2023-04-121-23/+3
| | | | | | | | | | | | | | Reuse round constants defined in 2sha256.c instead of having them twice. BRANCH=none BUG=none TEST=boot to kernel Change-Id: I6fe12b5d65a7c46078781cb1632eba5bca6797a0 Signed-off-by: Yidi Lin <yidilin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4408854 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility/cmd_update: Describe more details in command helpJakub Czapiga2023-04-101-1/+13
| | | | | | | | | | | | | BRANCH=None BUG=None TEST=make runtests Disallow-Recycled-Builds: test-failures Change-Id: I86f0f4ea383b5fff8390a0510bc5c88bda414f2b Signed-off-by: Jakub Czapiga <czapiga@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4370239 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* tlcl: Add `TlclReadPublic()` supportYi Chou2023-04-104-0/+114
| | | | | | | | | | | | | | | Add support for the TPM2_ReadPublic command to the TLCL. This command is used to read the public area data of an object with the object handle. BUG=b:249552664 BRANCH=None TEST=TlclReadPublic works. Signed-off-by: Yi Chou <yich@google.com> Change-Id: I5d72b8f19e02c6bdcc39f1c20ff7100f5dd0eda1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4218847 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* futility/updater: Fix legacy bios image namingstabilize-15415.BEdward O'Callaghan2023-04-066-10/+10
| | | | | | | | | | | | | | | | | | Clean up many other instances of 'bios.bin' littered everywhere over time. BUG=b:65745723 BRANCH=none TEST=`cros_run_unit_tests --host --packages vboot_reference`. Change-Id: Ie5916d003ba0a5873ce04ec96f48cd45c8253aab Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4402371 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* cgpt: Expose CgptRepair in the host libTed Brandston2023-04-041-1/+2
| | | | | | | | | | | | | | | | | | | Needed by chromeos-installer in postinstall, with the new postinstall_cgpt_repair USE flag. Also fix copyright lint. BUG=b:197219816, b:257478857 BRANCH=None TEST=emerge-reven vboot_reference USE=postinstall_cgpt_repair emerge-reven chromeos-installer Cq-Depend: chromium:4377945, chromium:4377717 Change-Id: I40170da35fac4e302673614c6a8ab99d5384ad5d Signed-off-by: Ted Brandston <tbrandston@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4377068 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Jeffery Miller <jefferymiller@google.com>
* futility/cmd_*: Cleanups for maintainabilityEdward O'Callaghan2023-04-0310-117/+87
| | | | | | | | | | | | | | | | | Fix many mistyping of indexers and other itermediate variables. BUG=b:268397597 TEST=`emerge-nissa vboot_reference`. TEST=`cros_run_unit_tests --host --packages vboot_reference`. TEST=`cros_run_unit_tests --board nissa --packages vboot_reference`. Change-Id: I49cc0e1a3e5d455c7f473e31cba528e8f227dfb6 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4349562 Reviewed-by: Sam McNally <sammc@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Sam McNally <sammc@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org>
* futility/cmd_gbb_utility.c: Remove globalEdward O'Callaghan2023-03-311-14/+2
| | | | | | | | | | | | | | | | BUG=b:268397597 TEST=`emerge-nissa vboot_reference`. TEST=`cros_run_unit_tests --host --packages vboot_reference`. TEST=`cros_run_unit_tests --board nissa --packages vboot_reference`. Change-Id: I3effc8651511a5b51f0948ba213bb5a00c49f55e Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4349561 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* futility/cmd_*.c: Use ERROR() macro consistentlyEdward O'Callaghan2023-03-3113-266/+198
| | | | | | | | | | | | | | | | | | Fix grammatical issues in ERROR() usage and over usage of contractions. Now errors shall now be prefixed with "ERROR:" and the function name. BUG=b:268397597 TEST=`emerge-nissa vboot_reference`. TEST=`cros_run_unit_tests --host --packages vboot_reference`. TEST=`cros_run_unit_tests --board nissa --packages vboot_reference`. Change-Id: Ieac1f312c2e02133228ba4560197d009aed0324c Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4349560 Reviewed-by: Sam McNally <sammc@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* futility: updater: Add --unlock_me optionReka Norman2023-03-297-24/+135
| | | | | | | | | | | | | | | | | | | | Add a --unlock_me option which unlocks the Intel ME before flashing by: - Unlocking the FLMSTR values in the descriptor. - Disabling GPR0 in the descriptor. This will be used in factory to support Flexible EOM. BRANCH=None BUG=b:273168873 TEST=Flash locked yaviks firmware with --unlock_me. Read firmware back and check that FLMSTR values are unlocked and GPR0 is disabled. Change-Id: Ie29f3c997c82a1bc58fe62f568f257e9dc375d94 Signed-off-by: Reka Norman <rekanorman@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4374965 Tested-by: Reka Norman <rekanorman@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org> Commit-Queue: Reka Norman <rekanorman@chromium.org>
* cgpt: Add support for error counter (verity)Jae Hoon Kim2023-03-2810-5/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .. so platform side daemons/process can initiate getting/setting the error counter (verity) attribute from GPT partitions of CrOS kernels. ``` $> cgpt show <IMAGE> 405504 65536 2 Label: "KERN-A" Type: ChromeOS kernel UUID: 0394A807-59A0-A84C-A443-BC3C555C8842 Attr: priority=15 tries=15 successful=1 error_counter=0 ... $> cgpt add -E1 -i2 <IMAGE> $> cgpt show <IMAGE> 405504 65536 2 Label: "KERN-A" Type: ChromeOS kernel UUID: 0394A807-59A0-A84C-A443-BC3C555C8842 Attr: priority=15 tries=15 successful=1 error_counter=1 ... $> cgpt add -E0 -i2 <IMAGE> $> cgpt show <IMAGE> 405504 65536 2 Label: "KERN-A" Type: ChromeOS kernel UUID: 0394A807-59A0-A84C-A443-BC3C555C8842 Attr: priority=15 tries=15 successful=1 error_counter=0 ... ``` BUG=b:274539529 BRANCH=None TEST=emerge vboot_reference TEST=comment above Change-Id: Ib0904378fba8219a3631278c66b7317fd86ea9d8 Signed-off-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4370744 Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: Drop external flashrom quarkEdward O'Callaghan2023-03-263-63/+1
| | | | | | | | | | | | | | | | | This prevents architectural changes required to make futility to make it fast and robust while providing limited to no tangible value. BUG=b:226477133 BRANCH=none TEST=none Signed-off-by: Edward O'Callaghan <quasisec@google.com> Change-Id: Ie0ea715fcf60cfb5b2b25037f4421c2dc70c0e5b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4147407 Reviewed-by: Sam McNally <sammc@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* futility/file_type_*: Use ERROR() macro consistentlyEdward O'Callaghan2023-03-254-47/+40
| | | | | | | | | | | | | | | | | | Fix grammatical issues in ERROR() usage and over usage of contractions. Now errors shall now be prefixed with "ERROR:" and the function name. BUG=b:268397597 TEST=`emerge-nissa vboot_reference`. TEST=`cros_run_unit_tests --host --packages vboot_reference`. TEST=`cros_run_unit_tests --board nissa --packages vboot_reference`. Change-Id: Iba811c4d4714b9af1a3982613b74ca43958d7934 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4349559 Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* futility/file_type*: Minor cleanups for maintainabilityEdward O'Callaghan2023-03-256-129/+87
| | | | | | | | | | | | | | | | | | | | Use C99 features to scope indexer to loop constructs and local itermediates within more constrained lexical scopes. Be canonical in predicates of branch conditions. Use const correctness. Apply clang-format where reasonable BUG=b:268397597 TEST=`emerge-nissa vboot_reference`. TEST=`cros_run_unit_tests --host --packages vboot_reference`. TEST=`cros_run_unit_tests --board nissa --packages vboot_reference`. Change-Id: I8ce232f791a95a668ab5017cff628c199c36e917 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4349558 Tested-by: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* sign_official_build: Fix is-reven checkstabilize-15395.BNicholas Bishop2023-03-231-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | The `get_is_reven` function added in https://crrev.com/c/4206907 was too restrictive. When run by the signer, the board name has been modified from "reven" to "reven-signed-mp-v2keys". Change the condition to accept either `reven` or `reven-signed*` (note the glob). Allowing plain "reven" is not strictly necessary, but useful for local testing. Tested the updated function by building a reven base image, then making variants with different CHROMEOS_RELEASE_BOARD values: "reven", "reven-signed-mp-v2keys", and "revenator". Running `sign_official_build.sh` on them shows that the first two are identified as reven, and the last one is not. This can be seen by checking if boot*.efi is signed or not, since that should not happen for reven. BRANCH=none BUG=b:274648121 TEST=See above TEST=FEATURES=test emerge-reven vboot_reference Change-Id: I099abf372b71ea3e064e91a57c5e8888de298028 Signed-off-by: Nicholas Bishop <nicholasbishop@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4358400 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* futility: Add `flash` subcommandstabilize-15393.48.Brelease-R113-15393.Bfirmware-skyrim-15390.BNikolai Artemiev2023-03-168-1/+408
| | | | | | | | | | | | | | | | | | | | | | | | | Add a new subcommand for getting/setting flash properties such as the flash size and writeprotect configuration. The operations provided by `futility flash` require less information from the user and are less error prone than the equivalents provided by `flashrom`. For example, --wp-enable automatically choses the protection range based on the firmware image and --wp-status gives a warning if the protection range does not match the RO firmware region. BUG=b:268574030 BRANCH=none TEST=`futility flash --{flash-size,wp-enable,wp-disable,wp-status}` Co-authored-by: Edward O'Callaghan <quasisec@google.com> Signed-off-by: Edward O'Callaghan <quasisec@google.com> Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Change-Id: I36d7468616a5bcdf3c4542d48652bd24c3377a61 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4279661 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
* futility/: Replace futil_copy_file_or_die() implfactory-skyrim-15384.BEdward O'Callaghan2023-03-155-52/+39
| | | | | | | | | | | | | | | | | | | | | | | Replace shell-script C with actual library calls to copy file content. Don't die, dying is bad. Use '0660' as the default dest file perm mask over the default system umask inherited form the environment applied to the source file permissions. Add error handling so we have a idea what happened. BUG=b:268397597 TEST=`emerge-nissa vboot_reference`. TEST=`cros_run_unit_tests --host --packages vboot_reference`. TEST=`cros_run_unit_tests --board nissa --packages vboot_reference`. Change-Id: Ibe4745dbad20504a1ff7e39e10cbf18ed1831354 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4313546 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* tpm2_lite: Treat NV_UNINITIALIZED error as BADINDEX for TPM 2.0Julius Werner2023-03-151-0/+5
| | | | | | | | | | | | | | | This patch ports the equivalent of CB:20299 to the vboot version of the TPM library. This should fix a problem that was observed where a created but not written FWMP space gets a device stuck in recovery mode. BRANCH=none BUG=b:272310645 TEST=none Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: If0ef6fdda879b45de0444cdaeb423d01ce109e2c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4327074 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* OWNERS: Add quasisecEdward O'Callaghan2023-03-151-0/+1
| | | | | | | | | | | | | | | Futility is an integral part of CrOS FW Update Team's mission. BUG=none TEST=none Change-Id: Ie6591be479268e854288f07b0825d84b086ea492 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4337534 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org>
* sign_official_build: Don't sign miniOS kernels in factory shimsstabilize-15381.BReka Norman2023-03-091-5/+7
| | | | | | | | | | | | | | | | | Factory shims contain miniOS kernels, but they are not used, so don't sign them. They will remain in the image signed with dev keys. BRANCH=None BUG=None TEST=Run sign_official_build.sh on factory shim. Logs show miniOS kernels are not signed, and shim still boots. Change-Id: I4a1b72726edb7d780a3f2c2fe783f568a012ee77 Signed-off-by: Reka Norman <rekanorman@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4321706 Tested-by: Reka Norman <rekanorman@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Reka Norman <rekanorman@chromium.org>