summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* fuzzers: Fix builds with new clangstabilize-rust-13795.Bstabilize-rust-13776.Bstabilize-quickfix-13816.67.Bstabilize-LTS-13816.60.Bstabilize-13816.82.Bstabilize-13816.80.Bstabilize-13816.64.Bstabilize-13816.63.Bstabilize-13816.55.Bstabilize-13816.53.Bstabilize-13816.51.Bstabilize-13816.40.Bstabilize-13799.Bstabilize-13768.Brelease-R90-13816.Bfactory-puff-13813.BManoj Gupta2021-01-302-0/+2
| | | | | | | | | | | | | | | | | | | | Clang is complaining about missing prototypes e.g. tests/vb2_preamble_fuzzer.c:43:13: error: no previous prototype for function 'vb2_check_padding' [-Werror,-Wmissing-prototypes] Add the header "2rsa_private.h" to fix fuzzer builders. BUG=chromium:1172055 TEST=tryjob Signed-off-by: Manoj Gupta <manojgupta@google.com> Change-Id: I9593e1f747939a38c33226f98570fa5423570362 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2658033 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Auto-Submit: Manoj Gupta <manojgupta@chromium.org>
* vboot: relocate private RSA function headersJoel Kitching2021-01-281-0/+1
| | | | | | | | | | | | | | | | | Previously, functions that need to be tested but not exposed to vboot API were placed in vboot_test.h. Now, the approach of placing them in a xyz_private.h header file is preferred. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I8be50d95c533b277b509aabb503ae05f69662a33 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2641344 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: remove vboot_audio.c and friendsJoel Kitching2021-01-283-3/+0
| | | | | | | | | | | | | | | | No longer used with new vboot UI; remove. (Missed this in the prior removal of legacy UI code.) BUG=b:167643628, chromium:968464 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I01383071dee6257921547302fe4a2977b3521195 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2641342 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: move lib20/packed_key.c into 2lib namespaceJoel Kitching2021-01-206-6/+2
| | | | | | | | | | | | | | | | | | | lib20/packed_key.c functions are currently called throughout 2lib namespace, so move to 2lib/2packed_key.c. Move function declarations from vb2_common.h to 2packed_key.h, and include 2packed_key.h from 2common.h. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I151b2d41cbbfa1bfd03de301bd4ee69c49e81f3b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2635220 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: move lib20/misc.c into 2lib namespaceJoel Kitching2021-01-201-1/+1
| | | | | | | | | | | | | | | | | | | lib20/misc.c contains only functions related to firmware verification, which are currently called from 2lib/2api.c, so move this to 2lib/2firmware.c. Move its unit test file accordingly. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Ibaeea168ed5055d47d4be86f5b3bb0f803f97dad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2635219 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* Minidiag: Enable minidiag by defaultstabilize-quickfix-13729.84.Bstabilize-quickfix-13729.73.Bstabilize-quickfix-13729.60.Bstabilize-13729.72.Bstabilize-13729.57.Bstabilize-13729.56.Bstabilize-13729.49.Bstabilize-13729.45.Bstabilize-13729.16.Brelease-R89-13729.BMeng-Huan Yu2021-01-141-3/+3
| | | | | | | | | | | | | | | This CL enabled the pre-boot diagolostic tools entry in recovery mode. BRANCH=none BUG=b:176947486 TEST=CQ TEST=FEATURES=test P2_TEST_FILTER='*' emerge-zork vboot_reference TEST=manually build, flash FW to device, and confirm minidiag works Signed-off-by: Meng-Huan Yu <menghuan@chromium.org> Change-Id: I8500cbaaa4e8d0f1aa668d56d38095ecdcf50aaf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2617391 Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* futility: update: add new quirk 'no_check_platform'Hung-Te Lin2020-12-091-0/+10
| | | | | | | | | | | | | | | | | | | | | | Some devices may have flashed firmware with different platform name in their early stage (especially in the first build of leading devices), so we do want to provide an explicit way (not just --force) to skip checking platform name. The change CL:2059621 does not help because the loaded system firmware looks good. This is implemented as a quirk so we can enable it using a CBFS quirk file, making it easier to be deployed by auto update. BRANCH=None BUG=None TEST=make runtests Change-Id: I888d5848921d31c9b7cba1b96c42d38fda71927e Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2573999 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot2: Use TPM for hash acceleration allowanceKangheui Won2020-12-091-24/+26
| | | | | | | | | | | | | | | | | | | | Previously we used a flag in preamble to prevent HW acceleration for SHA hashing. However we started to use kernel TPM flag for RSA part since we can use the flag in preamble only after we verified preamble. No need to keep both for same objective, so deprecate old flag and change code to use TPM flag. BUG=b:166038345 BRANCH=zork TEST=CC=x86_64-pc-linux-gnu-clang make runtests TEST=boot Ezkinil, check HW acceleration is used for SHA Signed-off-by: Kangheui Won <khwon@chromium.org> Change-Id: I81b174dbe285fa3f68a22667b6af14a52b06b112 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2566866 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: deprecate and remove legacy UI codeJoel Kitching2020-12-047-4442/+0
| | | | | | | | | | | | | | | BUG=b:146399181, b:167643628 TEST=make clean && make runtests TEST=Build and flash to device BRANCH=none Cq-Depend: chromium:2512739 Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Ia8d95451d55142fbe9acaa6e49de9b5abe134083 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2512740 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Pass screen and locale_id to vb2ex_prepare_log_screen()Yu-Ping Wu2020-11-191-1/+2
| | | | | | | | | | | | | | | | | | To support multi-line title for log screens, we need to support different size of log box in each screen. Therefore, pass the screen and locale information to vb2ex_prepare_log_screen() so that the number of lines per page can be determined. BUG=b:165187866 TEST=emerge-asurada depthcharge BRANCH=none Cq-Depend: chromium:2522156 Change-Id: I652d6261ed559a948e7bd578da3ec81d54374039 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2522416 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Remove extra delay for long iteration timeHsuan Ting Chen2020-11-121-0/+85
| | | | | | | | | | | | | If an iteration takes longer than KEY_DELAY_MS, no extra delay. Otherwise, delay until the iteration time reaches KEY_DELAY_MS. BUG=b:168776970 BRANCH=none TEST=Build locally Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ia78dbe1cc87d08c02f99f4fc9269929c12c18b77 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2424373
* vboot/ui/tests: Remove unnecessary aborting delay checkHsuan Ting Chen2020-11-121-39/+27
| | | | | | | | | | | | | | | | | | | - Do not check if delay is aborted every time since we already have an individual test item. - Do not save the last return value of vb2ex_mtime() to allow us to use vb2ex_mtime() elsewhere. - Use fuzzy match for `delay finished` test items. BUG=b:156448738 BRANCH=none TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ic211955637c67dc35ffd4c12194a8ccb77e1bf9c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2508104 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui/tests: Add time-related constants in 2ui_private.hstabilize-13591.BHsuan Ting Chen2020-11-041-16/+16
| | | | | | | | | | | | | | | | | | | | Add several constants in 2ui_private.h for testing: - KEY_DELAY_MS - DEV_DELAY_SHORT_MS - DEV_DELAY_NORMAL_MS - DEV_DELAY_BEEP1_MS - DEV_DELAY_BEEP2_MS BUG=b:156448738 BRANCH=none TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I7349d5214a90699fda67135329d7a6b93022bb27 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2513418 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Suffix "_ms" to time-related variablesHsuan Ting Chen2020-11-041-22/+22
| | | | | | | | | | | | | | | | | | | | For test/vb2_ui_tests.c: - Rename mock_get_timer_last to mock_get_timer_last_ms. - Rename mock_time to mock_time_ms. - Rename mock_time_start to mock_time_start_ms. For 2lib/2ui.c and 2lib/2ui_screen.c: - Rename start_time to start_time_ms in struct vb2_ui_context. - Rename elapsed to elapsed_ms in developer_mode_action(). BUG=b:156448738 BRANCH=none TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Icabe04003f0dc95f41c9ed8b8e2292f1f64e86bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2513417
* futility: update: load quirks from firmware image CBFS filestabilize-rust-13555.BHung-Te Lin2020-10-161-0/+12
| | | | | | | | | | | | | | | | | | | | 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>
* futility: update: support multi-line quirksHung-Te Lin2020-10-151-0/+5
| | | | | | | | | | | | | | | 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>
* vboot/ui: Split disabled_item_mask into two masks for log screenHsuan Ting Chen2020-10-143-147/+294
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add three macros in 2api.h for bitmask operations: - VB2_SET_BIT(mask, index) - VB2_CLR_BIT(mask, index) - VB2_GET_BIT(mask, index) These macros will be used in corresponding depthcharge CLs. Split disabled_item_mask into: - disabled_item_mask: Disabled style, but still visible and selectable. - hidden_item_mask: Not visible. Ignore selecting on disabled menu items. Set appropriate disabled_item_mask for page up/down buttons in log screen. Revise tests of hidden_item_mask and add unit tests of disabled_item_mask. BUG=b:163301076, b:146399181 BRANCH=none TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; DETACHABLE=1; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; PHYSICAL_PRESENCE_KEYBOARD=1; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; DIAGNOSTIC_UI=1; make clean && make runtests TEST=Build locally, navigate to debug info screen with <TAB>, select page up or page down, and observe that nothing happens. Cq-Depend: chromium:2432168 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I1607af53f6e2b5c1cde568cb24606314051d2380 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2426154 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui/tests: Fix ignoring vb2ex_display_ui calls in unit testsstabilize-13532.BHsuan Ting Chen2020-10-122-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | Save parameters `timer_disabled` and `error_code` in mocked vb2ex_displayed_ui calls to check whether the consecutive calls are duplicate or not. The unit tests of these parameters will be added in following CLs. BRANCH=none BUG=b:146399181, b:156448738 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; DETACHABLE=1; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; PHYSICAL_PRESENCE_KEYBOARD=1; make clean && make runtests TEST=FEATURES=test PKGDIR=/build/puff/test-packages /mnt/host/source/chromite/bin/parallel_emerge --sysroot=/build/puff --jobs=32 vboot_reference Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I2b7c9b6b05d2427e938394ff9d0769fbde81f773 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2449310 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui/tests: Fix struct compare error in unit testsHsuan Ting Chen2020-10-122-2/+2
| | | | | | | | | | | | | | | | | Use packed structures to avoid unexpected error about padding. BUG=b:156448738, b:170186754 BRANCH=none TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=FEATURES=test PKGDIR=/build/puff/test-packages /mnt/host/source/chromite/bin/parallel_emerge --sysroot=/build/puff --jobs=32 vboot_reference Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ibdcffe81d92db2880c53282a313ffa678af7d43d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2454911 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot2: Add support for modexp accelerationKangheui Won2020-10-031-0/+22
| | | | | | | | | | | | | | | | | Add vb2ex_hwcrypto_modexp support to accelerate only calculation part of RSA and we can handle the rest. Instead of relying on opaque hardware accleration for all RSA verification process, this will enable us to maintain our security level while enhancing overall speed of verification. BRANCH=zork BUG=b:169157796 TEST=make runtests Signed-off-by: Kangheui Won <khwon@chromium.org> Change-Id: I6f9fc919c4215964158815a58a9f1b338c2a76a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2444809 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/ui: Force to reacquire log on initializationstabilize-13482.BHsuan Ting Chen2020-09-171-3/+87
| | | | | | | | | | | | | | | | | | | | 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>
* COIL: Change sane to inclusive wordsDaisuke Nojiri2020-09-112-2/+2
| | | | | | | | | | | | 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-112-4/+141
| | | | | | | | | | | | | | | | | | | | 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>
* crossystem: allow last nvdata entry to be filledJack Rosenthal2020-09-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* minidiag: Add storage and memory diagnostic screensMeng-Huan Yu2020-09-101-6/+23
| | | | | | | | | | | | | | | | | 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>
* vboot/ui: Always show page up/down buttons in log screenHsuan Ting Chen2020-09-091-5/+12
| | | | | | | | | | | | | | | | | | | 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-052-4/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: Implement firmware log screenHsuan Ting Chen2020-09-031-10/+45
| | | | | | | | | | | | | | | | | | | | | | | 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>
* futility: update: Add '--gbb_flags FLAGS' to override GBB flagsHung-Te Lin2020-08-291-1/+7
| | | | | | | | | | | | | | | 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>
* vboot2: use hwcrypto for RSA when allowedKangheui Won2020-08-263-0/+127
| | | | | | | | | | | | | | | | | | | 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>
* vboot: adjust VB2_SECDATA_KERNEL_FLAGS in non-recovery pathChun-Ta Lin2020-08-241-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* inclusive: change usage of sanityDaisuke Nojiri2020-08-194-42/+42
| | | | | | | | | | | | | | | | 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/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-091-8/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-093-11/+33
| | | | | | | | | | | | | | | | | | | 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>
* vboot/ui: Implement debug info screen navigationHsuan Ting Chen2020-07-311-10/+40
| | | | | | | | | | | | | | | | | | | | 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-312-72/+198
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Reset EC when transitioning to dev modestabilize-13360.BDaisuke Nojiri2020-07-141-1/+1
| | | | | | | | | | | | | | | | | Currently, we reboot the AP (a.k.a. warm-reboot) to transition to dev mode in legacy_menu_ui; and reboot the EC (a.k.a. cold-reboot) in menu_ui and legacy_clamshell_ui. This patch makes legacy_menu_ui also reboot the EC. BUG=b:154228771 BRANCH=none TEST=make runtests Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ie48c8ef5e8744102c8dbafb7929523c54b14d81d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2293050 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: move TPM callbacks to vboot2 namespaceJoel Kitching2020-07-101-7/+7
| | | | | | | | | | | | | | | | Move TPM callback definitions from vboot_api.h to 2api.h. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Cq-Depend: chromium:2282023 Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Iad9da9fd3b6786609148d08b88f2e62ac3dee627 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2282322 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/ui: pass timer_disabled to vb2ex_display_ui()factory-puff-13329.BYu-Ping Wu2020-07-022-0/+2
| | | | | | | | | | | | | | | | | Add an argument 'timer_disabled' to vb2ex_display_ui(), which will be used when drawing dev mode screen to show the appropriate screen descriptions. BRANCH=none BUG=b:146399181, b:157871585 TEST=make runtests TEST=emerge-puff depthcharge Cq-Depend: chromium:2236550 Change-Id: I48b46838f482bce612106b840476f5f941cc1166 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2241492 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: add screen stack functionalityJoel Kitching2020-06-303-134/+139
| | | | | | | | | | | | | | | | | | | | | | | | Add a stack storing previous screen states. When the user clicks "Back" or presses ESC, revert to the previous state. In order to deal with the possibility of a UI cycle (repeatedly selecting the same sequence of screens) which would eventually use up all available memory, re-use existing target screen states within the stack. In other words, when switching to a specific screen which already exists in the stack, pop until that screen is reached, rather than creating a duplicate stack entry. BUG=b:146399181, b:158256196 TEST=make clean && make runtests BRANCH=none Change-Id: I6fbebc2abb11b26d95d4fcf841eb195b3d589396 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2214617 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* firmware/2lib: Add visual/audio error handlingShelley Chen2020-06-272-2/+4
| | | | | | | | | | | | | | | | | | | | | | Adding an enum parameter to vb2ex_display_ui to facilitate printing errors to the screen. Currently, errors are only printed to the serial console. Also adding in beep if an error is displayed. BUG=b:144969091,b:158635317,b:158639298,b:146399181 BRANCH=None TEST=Boot into dev warning screen and try to hit ctrl-u when no USB is plugged in. Ensure error beep occurs. Ensure in dev mode. Boot into recovery and press ctrl-d. Ensure that error message is printed to the screen and beep occurs. make runtests Cq-Depend: chromium:2243513 Change-Id: I548d624532ad8816497c37a726275b33171e28dc Signed-off-by: Shelley Chen <shchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2243196 Tested-by: Shelley Chen <shchen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Shelley Chen <shchen@chromium.org>
* vboot: add vb2api_phone_recovery_ui_enabled()stabilize-quickfix-13310.91.Bstabilize-quickfix-13310.76.Bstabilize-quickfix-13310.73.Bstabilize-13310.99.Bstabilize-13310.94.Bstabilize-13310.83.Bstabilize-13310.74.Bstabilize-13310.72.Brelease-R85-13310.BYu-Ping Wu2020-06-252-1/+19
| | | | | | | | | | | | | | | | | | Add a new flag VB2_SECDATA_KERNEL_FLAG_PHONE_RECOVERY_UI_DISABLED to vb2_secdata_kernel_flags to separate phone recovery functionality from UI instructions. Also add vb2api_phone_recovery_ui_enabled() to control the UI behavior. BRANCH=none BUG=b:156532222 TEST=make runtests Cq-Depend: chromium:2260155 Change-Id: Ib91a206e680ba2cb47762d8a5c0c0ce146918b7d Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2259632 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: add power off optionsYu-Ping Wu2020-06-231-6/+11
| | | | | | | | | | | | | | | Add power off options to screens. BRANCH=none BUG=b:146399181, b:145098577 TEST=make runtests TEST=USE="menu_ui" emerge-nami depthcharge Cq-Depend: chromium:2237367 Change-Id: I356c56361a4282b456c3a4661e518a84944e983b Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2237366 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: Add beep testsHsuan Ting Chen2020-06-181-23/+63
| | | | | | | | | | | | | | | | | | | | Add beep tests for testing the beep duration and frequency. BUG=b:146399181, b:156448738 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; DETACHABLE=1; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; PHYSICAL_PRESENCE_KEYBOARD=1; make clean && make runtests BRANCH=none Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ifb3231a43195e51900139a98ab2696cee244a009 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2249261 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Add tests for developer screensHsuan Ting Chen2020-06-181-23/+314
| | | | | | | | | | | | | | | | | | Unit tests paired with CL:2192863. BUG=b:146399181, b:156448738 TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; DETACHABLE=1; make clean && make runtests TEST=CC=x86_64-pc-linux-gnu-clang; PHYSICAL_PRESENCE_KEYBOARD=1; make clean && make runtests BRANCH=none Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I40bb9fbe111a1ab6e6123bc18af0753100bfb08b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2228255 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: rename USB_BOOT_ON_DEV to BOOT_EXTERNAL_ON_DEVfactory-endeavour-13295.BYu-Ping Wu2020-06-172-2/+2
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=make runtests TEST=emerge-puff depthcharge Cq-Depend: chromium:2241263 Change-Id: I4ebfadda3a41c09662f241f04c251784716784e3 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2241418 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/ui: use trusted keypress in cancel TO_DEV testJoel Kitching2020-06-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | In order to ensure that the TO_DEV action function does not trigger TO_DEV confirmation for the PHYSICAL_PRESENCE_KEYBOARD=1 case, use trusted DOWN and ENTER keys to navigate and press the "Cancel" button. If this is erroneously picked up by the TO_DEV action function, then a transition to developer mode will occur. This hole in test coverage was discovered by CL:2234678. BUG=b:146399181 TEST=PHYSICAL_PRESENCE_KEYBOARD=0 make runtests TEST=PHYSICAL_PRESENCE_KEYBOARD=1 make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Id8db074e4e9398a2f7fbfe348059c2c195bc8d90 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2237088 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* host/lib/flashrom: enable --fast-verify for write operationsJack Rosenthal2020-06-161-1/+30
| | | | | | | | | | | | | | | | | | | We caused a boot-speed regression as we are currently verifying the entire flash chip after any write. Flashrom has an option --fast-verify which verifies only the region written, which is significantly faster. It also looks like this is the way mosys used to handle flashrom writes, so we can align with the old behavior this way. BUG=chromium:1091903 BRANCH=none TEST=unit tests, and boot speed regression went away (on octopus) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: If8d2288cb0c08e8644b6e05f7b174c3c21542f94 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2242738 Reviewed-by: Joel Kitching <kitching@chromium.org>