summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* lib21: always append '\0' in vb2_readfilestabilize-13505.85.Bstabilize-13505.73.Bstabilize-13505.65.Bstabilize-13505.63.Bstabilize-13505.111.Bstabilize-13505.100.Brelease-R87-13505.BHung-Te Lin2020-11-022-1/+3
| | | | | | | | | | | | | | | | | | | | For utilities reading text file, it is easier to process as ASCIIZ input if vb2_readfile can always return a buffer ends with '\0' so we don't need to pass and check the size. BUG=None TEST=make clean && make runtests BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: Ib6294969fb325b9b7899e6295fb1817ad91a9952 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2426092 Reviewed-by: Joel Kitching <kitching@chromium.org> (cherry picked from commit 7c6bf3080a20077f1da49bc383297ac33bce35f8) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2514762 Reviewed-by: Evan Green <evgreen@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
* futility: update: load quirks from firmware image CBFS fileHung-Te Lin2020-10-204-7/+75
| | | | | | | | | | | | | | | | | | | | | | | | The firmware updater now looks at CBFS 'FW_MAIN_A' (RW A) and if a text file 'updater_quirks' is found, the contents will be fetched to setup default quirks. This helps sharing same customization across multiple firmware images (for different models) shared by same unibuild OS image. Without that, we have to maintain a large list of hard-coded model names in firmware updater source. BRANCH=none BUG=b:169284414 TEST=make runtests Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: I938bffe9f16bc3adee0dc3efb6976efe581c6d8c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2426093 Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2488672 Reviewed-by: Evan Green <evgreen@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
* futility/updater: Add quirk to preserve management engineKarthikeyan Ramasubramanian2020-10-203-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In recent Intel platforms, updating Management Engine (ME) while SoC is in S0 state is an unsupported use-case. To work-around this issue for the devices that are in development, specifically during firmware update, this quirk is added to preserve the ME region. In the subsequent boot, ME region is updated as part of boot firmware update upstart script. BUG=b:165590952 BRANCH=None TEST=With the quirk enabled, ensured that the ME is preserved under the following scenario: chromeos-firmwareupdate --mode=autoupdate chromeos-firmwareupdate --mode=recovery futility update --mode=autoupdate -a /usr/sbin/chromeos-firmwareupdate futility update --mode=recovery -a /usr/sbin/chromeos-firmwareupdate In other scenarios, ME region is not preserved. Change-Id: I81a52d11d1fb363b7e07ef3439b927449456b28a Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2465286 Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2488671 Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Evan Green <evgreen@chromium.org>
* futility: update: support multi-line quirksHung-Te Lin2020-10-202-2/+11
| | | | | | | | | | | | | | | | | | To support loading quirks from external files, we want to skip tab (\t) and new line characters (\n, \r). BRANCH=none BUG=b:169284414 TEST=make runtests Change-Id: If314d6cf36907837ce9c36b73337976ee0c6fad1 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2467305 Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2488670 Reviewed-by: Evan Green <evgreen@chromium.org> Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
* futility: updater: print flashrom execution logs on read failurestabilize-13505.1.BHung-Te Lin2020-09-261-0/+11
| | | | | | | | | | | | | | | | | | To prevent flooding AU logs, we don't want flashrom to print verbose logs especially when reading system SPI flash. However, if anything goes wrong it will be very helpful to have all the messages logged. With this patch, we will try reading system flash again with max verbosity. BUG=chromium:943262,b:169026171 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I5469182f2628855e65546bef3abf8791261aabca Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1545598 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* vboot/ui: Always beep when error dialog is shownHsuan Ting Chen2020-09-242-11/+4
| | | | | | | | | | | | | | | Setting error_code always implies we need to beep. BUG=b:146399181 TEST=Build locally BRANCH=zork Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I65d790a63739f36dc1db8e22321adbff26d70893 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2397017 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* firmware/2lib: Add error message for ctrl-U when usb boot is not enabledShelley Chen2020-09-242-0/+3
| | | | | | | | | | | | | | | | | | | | Currently, we only have a beep when the user presses ctrl-u. Adding an error message to clarify what the error is. BUG=b:164944674 BRANCH=puff, zork TEST=boot into developer mode make sure "boot from external disk" doesn't appear press ctrl+U and make sure dialog box with error appears Cq-Depend: chromium:2359765 Signed-off-by: Shelley Chen <shchen@google.com> Change-Id: Id8fad79802cb61883758e8c7561163cc17fb0f87 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2359768 Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org>
* make_dev_ssd.sh: Correct root partition regular expressionHung-Te Lin2020-09-231-1/+1
| | | | | | | | | | | | | | | | Discovered by CL:2353632, the regular expression for extracting rootfs partition should include non-digit character first otherwise we won't get correct number when the partition number is longer than one digit (e.g., >=10). BUG=None TEST=./make_dev_ssd.sh BRANCH=none Change-Id: I155e04beec47c55df4d09cb78168ab0a7407c697 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2353776 Reviewed-by: Kuang-che Wu <kcwu@chromium.org>
* firmware/2lib: Handle errors in alternate bootHsuan Ting Chen2020-09-212-5/+30
| | | | | | | | | | | | | | | | | | | | Handle three different errors in alternate boot: - VB2_UI_ERROR_ALTERNATE_BOOT_DISABLED - VB2_UI_ERROR_NO_BOOTLOADER - VB2_UI_ERROR_ALTERNATE_BOOT_FAILED BUG=b:146399181, b:161092974 TEST=make clean && make runtests BRANCH=puff, zork Cq-Depend: chromium:2384995 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I1e6572ed4a1c756d6d3727818439de25cad03158 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2382998 Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* vboot/ui: Force to reacquire log on initializationstabilize-13482.BHsuan Ting Chen2020-09-174-9/+95
| | | | | | | | | | | | | | | | | | | | Force to reacquire a newer firmware log snapshot every time when the user enters the firmware log screen. Re-entering (e.g. back from language selection or debug info tab) will still show the cached firmware log string. BUG=b:146399181, b:168442372 TEST=make clean && make runtests TEST=Build locally, navigate to the firmware log screen, go back, and enter the firmware log screen again. BRANCH=none Cq-Depend: chromium:2409742 Change-Id: I8c3eea23446c58603ce698a86f1aca4b264ebb0e Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2411761 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* fuzzers: Initialize secdataJulius Werner2020-09-152-12/+18
| | | | | | | | | | | | | | | | | | CL:2353775 made the functions tested by vb2_keyblock_fuzzer and vb2_preamble_fuzzer look at secdata, which broke the fuzzer because they don't initialize secdata the way a normal boot would. This patch makes the fuzzers initialize both firmware and kernel secdata explicitly (and nvdata as well for good measure, although I think it's technically not needed). BRANCH=None BUG=chromium:1125143,chromium:1124172 TEST=None Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Id9aaa4d44a20455133adc4c2bc524895629edfb9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2402423 Commit-Queue: Joel Kitching <kitching@chromium.org>
* host: Make gpiochip path buffer largerJacob Garber2020-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | The name of a gpiochip can in theory be up to NAME_MAX characters long (usually 255), which exceeds the length of the 30 byte buffer allocated for it. In practice we won't need more than the 30 bytes, but the smaller buffer trips a -Wformat-truncation warning from GCC that makes the build fail. Make the buffer bigger to keep GCC happy. BUG=none BRANCH=none TEST=make utillib compiles on BeagleBone Black Change-Id: I528f395033f58057846e717ff126e7a5dca504e3 Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2393193 Tested-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/ui: Disallow Ctrl-S when GBB forces dev modeYu-Ping Wu2020-09-122-0/+18
| | | | | | | | | | | | | | | | | When GBB forces developer mode (VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON), disallow Ctrl-S shortcut in developer screens. Beep and show an error message when Ctrl-S is pressed. BRANCH=zork BUG=b:146399181, b:164975737 TEST=export CC=x86_64-pc-linux-gnu-clang; make runtests TEST=emerge-nami depthcharge Cq-Depend: chromium:2397556 Change-Id: I62d18575290498b7ae829c2b3a2ff8dda6679636 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2390593 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org>
* COIL: Change denylist to blocklistDaisuke Nojiri2020-09-113-5/+5
| | | | | | | | | | | | | | | The signer uses BLOCKLIST instead of DENYLIST. This patches make the language match. BUG=b:163883397 BRANCH=None TEST=egrep -i -I -r "deny.*list" TEST=make runtests Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I47c913eb2ca89cd3eea4ca3ff5f1accb223ba418 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2401968 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* COIL: Change sane to inclusive wordsDaisuke Nojiri2020-09-118-9/+8
| | | | | | | | | | | | BUG=b:163883397 BRANCH=None TEST=make runtests TEST=egrep -r -i -I '(sane|insane)' Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I109207575e2c00d6aa3b0ed17de7f699087a9658 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2369464 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* vboot: Introduce alternate boot functionalityJoel Kitching2020-09-117-6/+281
| | | | | | | | | | | | | | | | | | | | Introduce alternate boot functionality both via keyboard shortcut ("Ctrl+L") to directly boot into the default alternate bootloader, and via menu ("Alternate bootloader" on dev screen) to show a screen listing available bootloaders. BUG=b:146399181, b:161092974 TEST=make clean && make runtests BRANCH=puff, zork Cq-Depend: chromium:2339040 Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I28f157936017719dc95656db147967f5e61a1407 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2335017 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* portability fixes: support building vboot on FreeBSDIdwer Vollering2020-09-1113-16/+49
| | | | | | | | | | | Built on FreeBSD 12.1-RELEASE, 13-CURRENT, using gcc9 installed from packages. Change-Id: Ifa8bb343c7e916c1b545cf6c1e4bd0a18ea391cd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2382790 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org>
* crossystem: allow last nvdata entry to be filledJack Rosenthal2020-09-102-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mosys used to have code (below), which led me to believe that we always try and leave the last entry unfilled: memset(blank, 0xff, VBNV_BLOCK_SIZE); for (index = 0; index < len / VBNV_BLOCK_SIZE; index++) { unsigned int offset = index * VBNV_BLOCK_SIZE; if (!memcmp(blank, &data[offset], VBNV_BLOCK_SIZE)) break; } if (index == 0) { lprintf(LOG_ERR, "VBNV is uninitialized\n"); return -1; } else if (index >= len) { <---- SEE NOTE lprintf(LOG_ERR, "VBNV is full\n"); <--- unreachable return -1; } else { return index - 1; } The statement at "SEE NOTE" will always be false, so this code fooled me to believe that we consider VBNV without a row of 0xFF*16 to be empty. And so I implemented and wrote unit tests for what I believed the correct behavior to be :/ Anyway, this is causing us issues since AP firmware does not implement it that way. So allow the last row to be filled. BUG=chromium:1112578 BRANCH=none TEST=unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ib3da78eddef69a688d081cdb5391a25000dac9d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2402385 Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* COIL: Add unblocked_terms.txt to block keywordsDaisuke Nojiri2020-09-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | This CL kicks off COIL for vboot_reference. Currently the global unblocked_terms.txt are in effect. Since it's identical to the global blocked_terms.txt, nothing is being blocked. This patch adds unblocked_terms.txt, which overrides the global one. Thus, all changes with a word listed in the global blocked_terms.txt but not in the local unblocked_terms.txt will be blocked. BUG=b:165908442, b:163883397 BRANCH=None TEST=Run repohook. Cq-Depend: chromium:2369239 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I1618db8e46f2b77397e016c1dfb02f20f66bb3aa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2369360 Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
* minidiag: Add storage and memory diagnostic screensMeng-Huan Yu2020-09-105-6/+252
| | | | | | | | | | | | | | | | | BRANCH=none BUG=b:156692539, b:156693348 TEST=emerge-hatch vboot_reference TEST=unittest passed: ( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 MENU_UI=1 DIAGNOSTIC_UI=1 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) Cq-Depend: chromium:2322286, chromium:2328704, chromium:2336239 Cq-Depend: chromium:2361823, chromium:2361582 Signed-off-by: Meng-Huan Yu <menghuan@chromium.org> Change-Id: I8b875b09bd5bcdb65f08c11945b046d2b3c3a113 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2372022 Reviewed-by: Joel Kitching <kitching@chromium.org>
* Add script for signing PSP VerstageMartin Roth2020-09-091-0/+162
| | | | | | | | | | | | | This script will sign the psp_veratage.bin file and modify the fields as required. BUG=b:166095736 TEST=create verstage signed with test key. Change-Id: I234d7902f950a60a816dd5f4d46d3d5afd105489 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2390825 Tested-by: Martin Roth <martinroth@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Martin Roth <martinroth@google.com>
* keygeneration: psp verstagebl: refactor key gen & csr generationMike Frysinger2020-09-091-32/+70
| | | | | | | | | | | | | | | | We want to separate the stages of creating the key & using the key as our HSM tools use different commands for these. This also means we no longer need a passphrase at all. BUG=b:166095736 TEST=ran script before & after and made sure output (largely) looked the same BRANCH=None Change-Id: Id488789f83c21ffb6263489e3c22531878ceb1f2 Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2391219 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* vboot/ui: Always show page up/down buttons in log screenHsuan Ting Chen2020-09-092-74/+34
| | | | | | | | | | | | | | | | | | | Always show page up/down buttons in log screen. Beep if users select the page up button on the first page or the page down button on the last page. BRANCH=puff, zork BUG=b:146399181, b:163301076 TEST=emerge-puff depthcharge TEST=emerge-zork depthcharge TEST=navigate to the debug info screen by <TAB> Cq-Depend: chromium:2361582 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I29a567554f9283ea3fca0f58fb31c7056523c2a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2361823 Commit-Queue: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* minidiag: Add diagnostic menu screenMeng-Huan Yu2020-09-057-13/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | BRANCH=none BUG=b:156692539, b:156693348 TEST=emerge-hatch vboot_reference TEST=unittest passed: ( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 MENU_UI=0 DIAGNOSTIC_UI=0 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) ( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 MENU_UI=1 DIAGNOSTIC_UI=0 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) ( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 MENU_UI=0 DIAGNOSTIC_UI=1 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) ( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 MENU_UI=1 DIAGNOSTIC_UI=1 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) Cq-Depend: chromium:2193314, chromium:2328704 Signed-off-by: Meng-Huan Yu <menghuan@chromium.org> Change-Id: I4f3c64ce53b14437cb14d3c1109e14608d082141 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2318590 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Add refresh flag to support force refresh the screen in actionMeng-Huan Yu2020-09-032-4/+13
| | | | | | | | | | | | | | | | | | | | | | CL:2163088 is working on depthcharge side to support refreshing everything in vboot side, but it is still work in progress. In the meanwhile, we can have a flag to control the refreshing for already support refreshing everytime screen. This flag can be removed after all screens are supported refreshing everytime in vboot. BRANCH=none BUG=b:156692539, b:156693348 TEST=emerge-hatch vboot_reference TEST=verfied in later CL that the screen is refreshed when the action callback set this flag. Signed-off-by: Meng-Huan Yu <menghuan@chromium.org> Change-Id: Ie76e8dce5186d0acfbc176a4cc8079c3df37fd38 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2336239 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* Add CSR generation script for signing PSP VerstageMartin Roth2020-09-031-0/+103
| | | | | | | | | | | | | | This script is based on previous key generation scripts and on the AMD document describing their recommendations. BUG=b:166095736 TEST=Generate keys of different sizes with different passphrases in various directories. Change-Id: I76a31f5d592d233282c145a9a4ce5220a2d597d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2380612 Tested-by: Martin Roth <martinroth@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* vboot/ui: Implement firmware log screenHsuan Ting Chen2020-09-034-10/+166
| | | | | | | | | | | | | | | | | | | | | | | Implement firmware log screen which can be accessed from advanced options menu. The screen displays a snapshot for the firmware log using the same layout of debug info screen. BRANCH=puff, zork BUG=b:146399181, b:146105976 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=USE="menu_ui" emerge-puff depthcharge TEST=USE="menu_ui" emerge-zork depthcharge TEST=select "advanced options", and navigate to firmware log screen Cq-Depend: chromium:2334490 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I3cb5800d71925aa20ca4d5636172885e23fd0099 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2328241 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* 2stub: vb2ex_abort()s on host should abort(), not just exit()Julius Werner2020-09-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Our keyblock and preamble fuzzers have been broken since CL:2353775, because they don't set up secdata in the context which the tested functions now depend upon. Unfortunately, we got no alerting about this... I only just happened to look at ClusterFuzz randomly today and saw an odd break in execution statistics around that date. With the new code as it is right now, all fuzzing attempts of the function end up running vb2ex_abort() from the uninitialized secdata. It would be great if the fuzzer could report every time it ends up in that function, but it doesn't seem to do that right now. Supposedly it reports "crashes", but I guess exit(1) is not a crash, so let's switch the line to abort() and see if that gets me the reporting behavior I want (before actually fixing the fuzzer). BRANCH=None BUG=None TEST=None Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ie65838f30fa33a7602db253860afc8eeadcac4c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2389002 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Add reinit screen hookfactory-trogdor-13443.BHsuan Ting Chen2020-08-303-1/+28
| | | | | | | | | | | | | | | | | | | | | | | Re-initialize the log screen when going back from another screen. BRANCH=puff BUG=b:146399181, b:146105976 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=USE="menu_ui" emerge-puff depthcharge when the firmware log screen is implemented, select "advanced options", navigate to firmware log screen, press <TAB> to debug info, and select back to firmware log screen Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ie44805e3bfb14a4a8b660a18a123a184a4c5ea45 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2329224 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> (cherry picked from commit 2cb872fa3056158c35f82a9412e667b69ccf5a49) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2332200 Reviewed-by: Joel Kitching <kitching@chromium.org>
* futility: update: Add '--gbb_flags FLAGS' to override GBB flagsHung-Te Lin2020-08-294-7/+47
| | | | | | | | | | | | | | | Developers may want to use the new GBB flags when flashing a firmware image. That can be done by --factory, but it's also more convenient to have a new parameter for overriding the flags with a new value. BRANCH=none BUG=b:166569397 TEST=make runtests Change-Id: If9dce9b1f2fbb27655ad2a111ba75ab83375fb7a Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2382991 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/ui: Fix handling error beep request without screen state changeHsuan Ting Chen2020-08-291-1/+3
| | | | | | | | | | | | | | | | | Check the variable error_beep to handle the error beep request without screen state change. BRANCH=zork BUG=b:146399181 TEST=USE="menu_ui" emerge-zork depthcharge chromeos-bootimage TEST=Enter the debug info screen by <TAB>, select <Page up>, and notice a beep Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Id31fb06c37e2fee9b2eec1030cec06f22e7de854 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2379585 Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot2: use hwcrypto for RSA when allowedKangheui Won2020-08-2613-27/+224
| | | | | | | | | | | | | | | | | | | Add vb2ex_hwcrypto_rsa_verify support for RSA verification. If firmware implements the function it will used instead of SW implementation in vboot. Also separate hwcrypto stubs to 2stub_hwcrypto.c for depthcharge and coreboot. Depthcharge needs stubs but fails to compile 2stub.c BRANCH=none BUG=b:163710320, b:161205813 TEST=make runtests TEST=check hwcrypto is allowed/disallowed depending on nvmem flag Change-Id: I85573e7cff31f32043db4b0a6b24b642856024e3 Signed-off-by: Kangheui Won <khwon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2353775 Reviewed-by: Julius Werner <jwerner@chromium.org>
* futility: Work around clang/GCC problem with libzip headersJulius Werner2020-08-251-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | I don't even want to get into why this is needed. I'm so tired of having to deal with new clang-specific toolchain bullshit 2-3 times a year. libzip did this https://github.com/nih-at/libzip/commit/1d949dd77339fb59605dc8f3a30f76604d693795 and then we upreved to it in CL:2245845 and now building upstream coreboot in a Chrome OS chroot is broken. I have to get back to wasting time on the other three random things that broke when I ran repo sync, so someone please just approve... BRANCH=None BUG=None TEST=None Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ic578e8f8e47f7fafd98d8c3148cbe24d9156886b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2366053 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* vboot: adjust VB2_SECDATA_KERNEL_FLAGS in non-recovery pathChun-Ta Lin2020-08-242-7/+35
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, VB2_SECDATA_KERNEL_FLAGS controls experimental features like phone recovery (and its UI), diagnostics entry. All of those are under recovery screen. In order to allow later update pushes to enable specific features in write-protected RO, we should not set those flags in recovery path. Otherwise, it will always toggle back and forth when booting RO recovery path vs. normal boot path. BRANCH=puff BUG=b:165181118 TEST=MENU_UI=0 DIAGNOSTIC_UI=0 make runtests TEST=MENU_UI=0 DIAGNOSTIC_UI=1 make runtests TEST=MENU_UI=1 DIAGNOSTIC_UI=0 make runtests TEST=MENU_UI=1 DIAGNOSTIC_UI=1 make runtests TEST=Cherry-pick locally to ToT of firmware-puff-13324.B with chromium:2360066 to manually check flags on Kaisa device. Change-Id: I7ec45b4ecfa6d50781cec2690dbc88894c734073 Signed-off-by: Chun-Ta Lin <itspeter@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2361983 Tested-by: Chun-ta Lin <itspeter@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Chun-ta Lin <itspeter@chromium.org>
* vboot2: Add prototype for hwcrypto RSAfactory-zork-13427.BKangheui Won2020-08-203-1/+21
| | | | | | | | | | | | | | Introduce new prototype for HW RSA accleration. This is not used on anywhere yet but will unblock coreboot work to support HW RSA. BRANCH=none BUG=b:163710320, b:161205813 TEST=make runtests; emerge-zork coreboot depthcharge Change-Id: Ic4b93f32410efdd06bd012efe58749b6ef0692c6 Signed-off-by: Kangheui Won <khwon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2364338 Reviewed-by: Julius Werner <jwerner@chromium.org>
* inclusive: change usage of blacklist/whitelistDaisuke Nojiri2020-08-193-4/+4
| | | | | | | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the term "blacklist" & "whitelist" with inclusive alternatives. chrome-internal:3214766, chrome-internal:3214767, chrome-internal:3214831 will be checked in separately. They refer to a pinned vboot_reference. So, this patch won't affect the signer until the pin is moved. BUG=b:163883397 BRANCH=None TEST=grep -ir "white*list" TEST=grep -ir "black*list" TEST=make runtests Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Iff98b55713b3c7381ba092ff14b50141b8422cf2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2353421 Reviewed-by: Julius Werner <jwerner@chromium.org>
* inclusive: change usage of sanityDaisuke Nojiri2020-08-1940-122/+123
| | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the term "sanity" with inclusive alternatives. BUG=b:163883397 BRANCH=None TEST=grep -ir sanity TEST=make runtests Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I708a044d89050c442f14fb11a8ae5e98490d56af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2353420 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/ui: Display error for untrusted confirmationHsuan Ting Chen2020-08-182-0/+9
| | | | | | | | | | | | | | | Display a error dialog box while user confirms with untrusted keyboard. BUG=b:144969091, b:161866932 BRANCH=puff TEST=PHYSICAL_PRESENCE_KEYBOARD=1; emerge-puff depthcharge Cq-Depend: chromium:2345837 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I2b0fdc217bbaa23ac71a41bf400c412be634ec0c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2346455 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* futility: Allow --force to override min_platform_version quirkBob Moragues2020-08-181-3/+6
| | | | | | | | | | | | | | BUG=b:162747154 BRANCH=none TEST=verify that update runs for rev1, but not rev0 without --force TEST=verify that update runs for both rev1 and rev0 with --force Signed-off-by: Bob Moragues <moragues@chromium.org> Change-Id: I1594d6a4c83d8a0c13494f8f108225618612db8e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2360590 Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* vboot/tests: Fix unit tests with MENU_UI=1Yu-Ping Wu2020-08-121-7/+32
| | | | | | | | | | | | | | | | | Fix vboot_api_kernel4_tests with MENU_UI=1 by mocking UI functions for menu UI. BRANCH=none BUG=b:146399181, b:156448738 TEST=MENU_UI=0 DIAGNOSTIC_UI=0 make runtests TEST=MENU_UI=0 DIAGNOSTIC_UI=1 make runtests TEST=MENU_UI=1 DIAGNOSTIC_UI=0 make runtests TEST=MENU_UI=1 DIAGNOSTIC_UI=1 make runtests Change-Id: Ie1bf4296a757bd1a65c7d0e17f954db4a0dafc3f Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2336206 Reviewed-by: Joel Kitching <kitching@chromium.org>
* minidiag: add entryChun-Ta Lin2020-08-092-8/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The entry `Launch diagnostics` in recovery screen will set VB2_NV_DIAG_REQUEST and reboot. BRANCH=none BUG=b:155848434 TEST=( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DIAGNOSTIC_UI=0 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) TEST=( export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DIAGNOSTIC_UI=1 MINIMAL=1 TPM2_MODE= MOCK_TPM=; make clean && make -j32 test_setup && make runtests; echo $? ) TEST=LOCALES="en" USE="menu_ui minidiag" emerge-nami chromeos-bmpblk vboot_reference depthcharge chromeos-bootimage TEST=Unset by &= ~VB2_SECDATA_KERNEL_FLAG_DIAGNOSTIC_UI_DISABLED manually; trigger recovery mode on device; visually confirmed `Launch diagnostics` is shown; select, reboot and confirm behavior from serial output: "Unset diagnostic request (undo display init)". Cq-Depend: chromium:2282643, chromium:2282664, chromium:2289814 Change-Id: I34af282edee66c5b9943e2d11fb514bac9ccddd8 Signed-off-by: Chun-Ta Lin <itspeter@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2282867 Tested-by: Chun-ta Lin <itspeter@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: create secdata_kernel flag to disable diagnostic UIJoel Kitching2020-08-098-12/+57
| | | | | | | | | | | | | | | | | | | Diagnostic UI is currently not ready to ship. Disable the UI (including both entry point and the UI itself) until it is ready. Also remove unused mock_presence from vboot_api_kernel4_tests. BUG=b:155848434, b:162486211 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I5cad7d40b2f52015f17f930a4d061c9cdf976a49 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2328985 Tested-by: Chun-ta Lin <itspeter@chromium.org> Commit-Queue: Chun-ta Lin <itspeter@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* futility: updater: always set new boot/try cookiesHung-Te Lin2020-08-081-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | If the update target is same as the active image, the firmware updater will do nothing on vboot2. However, if the system already have fw_try_next set to other slot (for example after multiple updates applied without rebooting) then the next boot will not pick the right firmware. So we have to ensure fw_try_next is set to right value. In the meantime, if fw_try_count and fw_result are not configured at the same time, the system may start "trying" again and increase the chance to fail. To fix that, we should clear trial cookies when there is no update, just like chromeos-setgoodfirmware. BUG=b:162866548 TEST=make runtests BRANCH=None Signed-off-by: Hung-Te Lin <hungte@chromium.org> Change-Id: I41ecac445000a850d050d77f0f694ee431926424 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2340172 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* futility: Add version quirk for trogdorBob Moragues2020-08-061-0/+1
| | | | | | | | | | | | | | BUG=b:162747154 BRANCH=none TEST=verify that update runs for rev1, but not rev0 Signed-off-by: Bob Moragues <moragues@chromium.org> Change-Id: I19e88a3046c6e98968650b6d7b1296a1a47c1470 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2334360 Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Douglas Anderson <dianders@chromium.org>
* vboot/ui: Implement debug info screen navigationHsuan Ting Chen2020-07-312-14/+47
| | | | | | | | | | | | | | | | | | | | The debug info screen can be accessed from advanced option screen. BRANCH=none BUG=b:146399181, b:144969088 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=USE="menu_ui" emerge-nami depthcharge select "advanced options", observe its layout, and navigate to debug info screen Cq-Depend: chromium:2301571 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I1fed968770a2681c28d49869676fb9b4f1d46494 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2301629 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Implement debug info screenHsuan Ting Chen2020-07-319-80/+520
| | | | | | | | | | | | | | | | | | | | | | | | Implement debug info screen with multiple pages. The debug info screen can be accessed using TAB as keyboard shortcut. The menu navigation will be added in a separate CL. The screen has one textbox for displaying one page of debug info, and three buttons: page up, page down, and back. BRANCH=puff BUG=b:146399181, b:144969088 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=USE="menu_ui" emerge-nami depthcharge press tab, observe the debug info on the screen Cq-Depend: chromium:2251685 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I6bc0a49c4d69817825f35435b643b006823b5c03 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2251868 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: disallow DIAGNOSTIC_UI with MENU_UIJoel Kitching2020-07-291-1/+2
| | | | | | | | | | | | | | | | DIAGNOSTIC_UI is incompatible with the new menu_ui ("Groot"). Disallow diagnostic UI under the condition of using MENU_UI. BUG=b:146399181, b:160748354 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Idc09e37a72d355baf7fa42ade7cdfecb3d41eabb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2319415 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* sign_android_image: use ARCVM file context if neededVictor Hsieh2020-07-291-3/+10
| | | | | | | | | | | | | | Apparently the file android_file_contexts has a different name for ARCVM with _vm suffix. Choose _vm if the container one is not found. BUG=b:161828692 TEST=sign_official_build.sh base recovery_image.bin mykey signed.bin BRANCH=none Signed-off-by: Victor Hsieh <victorhsieh@chromium.org> Change-Id: I8a93d8e1dd5b824f319d7de804f8f74825166a97 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2323647 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* vboot/ui: decouple error beep from error messageYu-Ping Wu2020-07-284-16/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Some error such as VB2_UI_ERROR_DEV_EXTERNAL_BOOT_FAILED only requires a beep sound to notify the user. No dialog box will be shown for these errors. Instead of defining them in the vb2_ui_error enum and ignore them in vb2ex_display_ui() in depthcharge, add a new field 'error_beep' to vb2_ui_context and use it for playing error beep sound in the UI loop. Then these beep-only errors can be removed from the enum. Also remove VB2_UI_ERROR_DEV_INTERNAL_NOT_ALLOWED because it is not used everywhere. BRANCH=puff BUG=b:146399181, b:161375587 TEST=emerge-puff depthcharge TEST=b/161375587 is not reproducible Cq-Depend: chromium:2299925 Change-Id: Ia90d1c8a164334d4cfec84281722eb6f2623b111 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2299968 Reviewed-by: Joel Kitching <kitching@chromium.org>
* host/lib/include/subprocess.h: Add `extern` to globalsAngel Pons2020-07-281-4/+4
| | | | | | | | | | | This prevents linker errors regarding multiple definitions. Change-Id: I62d6132c20ca2b9620a9f3b1539a1a0109c5aa26 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2318026 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>