summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* 2lib: Deprecate vb2api_allow_recovery() and VB2_SD_FLAG_MANUAL_RECOVERYHsuan Ting Chen2021-12-303-24/+21
| | | | | | | | | | | | | | | | | | | | | | | | 2lib used vb2_api_allow_recovery() to differentiate between manual and non-manual recovery in 2kernel and UI related areas. With introducing the ctx->boot_mode, we could decide if it is a manual recovery or a broken screen (a.k.a non-manual recovery in the original design) once in vb2api_fw_phase1 and use this boot mode instead for further justifications. Also deprecate the sd flag VB2_SD_FLAG_MANUAL_RECOVERY and use the boot mode instead to determine if it is a manual recovery boot. BUG=b:181931817 BRANCH=none TEST=make clean && make runtests TEST=emerge coreboot vboot_reference depthcharge Cq-Depend: chromium:3282875 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: Ief4ff6cf82285c5857f0051c1f348ad0f269b4a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3121926 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* tests/vb2_auxfw_sync_tests: Match the test behavior with the deviceKarthikeyan Ramasubramanian2021-12-231-3/+4
| | | | | | | | | | | | | | | | | | | | | | In depthcharge, display availability is checked as part of performing AUX FW update. In vboot tests, display availability is checked as part of checking for the AUX FW update. Match the test behavior with the implementation in depthcharge. BUG=b:210127173 BRANCH=None TEST=Ensure that all the tests passed successfully using the following command: cros_workon_make --board=dedede vboot_reference --test Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Change-Id: Ifc58f94bd64c3a90f80e40d97de8938a04dcba6f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3346284 Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Bob Moragues <moragues@chromium.org>
* Reland "2api: Add vb2_boot_mode in vb2_context denoted the current boot mode"stabilize-14396.Bstabilize-14395.BHsuan Ting Chen2021-12-123-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f0ba3fe277fdc623565eab0725aed743e24a1a44. Reason for revert: We can try another reland after the coreboot CL https://review.coreboot.org/c/coreboot/+/58253 is downstreamed and the guybrush psp_verstage.bin is signed again. Original change's description: > Revert "2api: Add vb2_boot_mode in vb2_context denoted the current boot mode" > > This reverts commit 2cf76574dbf57c70da3a835f2a45d5619dc058f5. > > Reason for revert: b:202258389 > > Original change's description: > > 2api: Add vb2_boot_mode in vb2_context denoted the current boot mode > > > > Add enum vb2_boot_mode which denotes the most relevant boot mode between > > normal, manual recovery, broken recovery, diagnostic, and developer. > > > > The boot mode constant stores in vb2_context, is exposed externally, and > > decided in vb2api_fw_phase1. > > > > Split out the logic of manual recovery and broken screen. (The broken > > recovery is a recovery boot with !vb2api_allow_recovery) > > > > Add the fifth boot mode, diagnostic boot mode > > > > A boot could match more the one boot mode, this api will pick the most > > relevant boot mode based on the following order: > > 1. Manual recovery boot > > 2. Broken recovery boot > > 3. Diagnostics boot > > 4. Developer boot > > 5. Normal boot > > > > This constant is used in: > > * lib/vboot_api_kernel.c: VbSelectAndLoadKernel() > > * lib/vboot_kernel.c: replace the original vb2_boot_mode > > * coreboot/bootmode for adding elogs > > > > Also bump the vb2sd minor version from 0 to 1. > > > > BUG=b:185551931, b:177196147, b:181931817 > > BRANCH=none > > TEST=CC=x86_64-pc-linux-gnu-clang; > > make clean && make runtests > > TEST=emerge coreboot vboot_reference depthcharge > > > > Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> > > Change-Id: I421e4d51c261ba2bdec996a5fb2ebccb33513fa4 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2944250 > > Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> > > Bug: b:185551931, b:177196147, b:181931817 > Change-Id: Ic184a24f5b580bcaf40d75045476ae77c674dd3d > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3209725 > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com> Bug: b:185551931, b:177196147, b:181931817 Change-Id: Ie480bf76eb0164f6e498b72e0533cd5c5762d6f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3274699 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Tested-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Hsuan Ting Chen <roccochen@chromium.org>
* Reland "2lib/2api: Deprecate vb2ex_ec_trusted()"Hsuan Ting Chen2021-12-101-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit b9644352d7717d4f564be90aac6c41bef583d930. Reason for revert: We can try another reland after the coreboot CL https://review.coreboot.org/c/coreboot/+/58253 is downstreamed and the guybrush psp_verstage.bin is signed again. Original change's description: > Revert "2lib/2api: Deprecate vb2ex_ec_trusted()" > > This reverts commit 7c73bb07fd3ca45ce650b993a9c6a5850ddb2707. > > Reason for revert: b:202258389 > > Original change's description: > > 2lib/2api: Deprecate vb2ex_ec_trusted() > > > > coreboot will support check the EC_IN_RW during verstage_main(), which > > performs the equivalent tasks as vb2ex_ec_trusted(). > > > > In the previous CL, we remove the check of vb2ex_ec_trusted(), so the > > whole implementation of this function among vboot_reference and > > depthcharge could be deprecated and removed. > > > > BUG=b:181931817 > > BRANCH=none > > TEST=CC=x86_64-pc-linux-gnu-clang; > > make clean && make runtests > > TEST=emerge coreboot vboot_reference depthcharge > > > > Cq-Depend: chromium:3139956 > > Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> > > Change-Id: I4f592d7dec2480475762e1336791cbb34fa143ba > > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139539 > > Reviewed-by: Julius Werner <jwerner@chromium.org> > > Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> > > Bug: b:181931817 > Change-Id: Ia127ce89b7f9413db9fd6ca4561ad06efb36d7e1 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3211006 > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com> Bug: b:181931817 Cq-Depend: chromium:3275254 Change-Id: I2c4db28b5800e5756f6f12b8bf69924f373a5c58 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3274698 Tested-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Hsuan Ting Chen <roccochen@chromium.org>
* gscvd: add dedicated test keysVadim Bendebury2021-12-034-0/+0
| | | | | | | | | | | | | | | | | | | | | | | This patch extends create_new_keys.sh to generate two additional key pairs to use for AP RO verification signing. Both new pairs are RSA4096/SHA256. The script was ran to generate a new set of keys and the produced AP RO verification key pairs were copied into tests/devkeys. BRANCH=none BUG=b:141191727 TEST=re-signed guybrush AP firmware image following the process described in cmd_gscvd.c comments, created a Cr50 image incorporating the new root public key hash, updated the DUT AP and Cr50 firmware and observed successful AP RO validation. Change-Id: I03cba1446fc5ffdfef662c5ce1ea3e61950477d4 Signed-off-by: Vadim Bendebury <vbendeb@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3297447 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* firmware: VB2_REC_OR_DIE() should not abort before vb2_check_recovery()Julius Werner2021-12-036-4/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, CL:3168437 introduced a new problem when booting with a broken TPM: secdata accessors no longer return failure but instead just abort when booting in normal mode and continue when we're in recovery mode. The problem is that when accessing secdata very early in vb2api_fw_phase1(), we have not decided whether we're booting in recovery mode yet. If vb2_secdata_firmware_init() fails, we will call vb2api_fail() and then continue knowing that vb2_check_recovery() will later see the recovery reason in NVRAM and decide to boot directly into recovery from here. But if the code in-between accesses secdata, the VB2_CONTEXT_RECOVERY_MODE flag is technically not yet set, so our secdata accessor thinks we are booting in normal mode and something terrible happened (because it shouldn't be possible to boot in normal mode when secdata_init failed), so it aborts. In order to try to solve this problem in a more general way, introduce a new VB2_SD_STATUS_RECOVERY_DECIDED status flag that gets set once we reach the point where we have conclusively decided whether we are booting into recovery mode and set the appropriate context flags. Any code using VB2_REC_OR_DIE() before that point will play it safe and assume that we may still go into recovery mode, so we shouldn't abort. BRANCH=none BUG=none TEST=none Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ic3daa8dac932286257cbceebfff8712d25c3a97a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3301540 Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* firmware/2lib: Remove BOOT_EXTERNAL_ON_DEVJakub Czapiga2021-11-251-2/+0
| | | | | | | | | | | | | | | | | | BOOT_EXTERNAL_ON_DEV was not used anymore, so it was removed from the Makefile and source code. BUG=b:206031372 BRANCH=none TEST=make runtests TEST=emerge-guybrush depthcharge Signed-off-by: Jakub Czapiga <jacz@semihalf.com> Change-Id: I463a77f2de8f59954704495708025321ca1571d8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3289345 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Jakub Czapiga <czapiga@google.com> Commit-Queue: Jakub Czapiga <czapiga@google.com>
* vboot: Remove VbExIsShutdownRequestededisonhello2021-11-071-10/+0
| | | | | | | | | | | | | | | | | | Remove function VbExIsShutdownRequested, since this function is not used in vboot anymore after UI code is centralized. Remove VB_SHUTDOWN_* macros since they are not used in vboot now. These macros will be added in depthcharge in the dependent CL. BUG=b:172339016 TEST=DEBUG=1 make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3142698 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I024b34212a5c9e42b880d51d21c7a90a6170b3c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3143814 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Support booting from non-active miniOS partitionYu-Ping Wu2021-10-152-21/+42
| | | | | | | | | | | | | | | | | | To support booting from the non-active miniOS partition in recovery UI, add minios_flags argument to VbTryLoadMiniOsKernel. Currently there is only one flag: VB_MINIOS_FLAG_NON_ACTIVE. When it is set, we will attempt to boot from the non-active partition only. BUG=b:200750322 TEST=make runtests BRANCH=none Cq-Depend: chromium:3219727 Change-Id: I6221f10c09de2487e89e6113981bc9e9755d67f4 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3219901 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
* Revert "2lib/2api: Deprecate vb2ex_ec_trusted()"Hsuan Ting Chen2021-10-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 7c73bb07fd3ca45ce650b993a9c6a5850ddb2707. Reason for revert: b:202258389 Original change's description: > 2lib/2api: Deprecate vb2ex_ec_trusted() > > coreboot will support check the EC_IN_RW during verstage_main(), which > performs the equivalent tasks as vb2ex_ec_trusted(). > > In the previous CL, we remove the check of vb2ex_ec_trusted(), so the > whole implementation of this function among vboot_reference and > depthcharge could be deprecated and removed. > > BUG=b:181931817 > BRANCH=none > TEST=CC=x86_64-pc-linux-gnu-clang; > make clean && make runtests > TEST=emerge coreboot vboot_reference depthcharge > > Cq-Depend: chromium:3139956 > Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> > Change-Id: I4f592d7dec2480475762e1336791cbb34fa143ba > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139539 > Reviewed-by: Julius Werner <jwerner@chromium.org> > Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Bug: b:181931817 Change-Id: Ia127ce89b7f9413db9fd6ca4561ad06efb36d7e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3211006 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com>
* Revert "2api: Add vb2_boot_mode in vb2_context denoted the current boot mode"Hsuan Ting Chen2021-10-073-32/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2cf76574dbf57c70da3a835f2a45d5619dc058f5. Reason for revert: b:202258389 Original change's description: > 2api: Add vb2_boot_mode in vb2_context denoted the current boot mode > > Add enum vb2_boot_mode which denotes the most relevant boot mode between > normal, manual recovery, broken recovery, diagnostic, and developer. > > The boot mode constant stores in vb2_context, is exposed externally, and > decided in vb2api_fw_phase1. > > Split out the logic of manual recovery and broken screen. (The broken > recovery is a recovery boot with !vb2api_allow_recovery) > > Add the fifth boot mode, diagnostic boot mode > > A boot could match more the one boot mode, this api will pick the most > relevant boot mode based on the following order: > 1. Manual recovery boot > 2. Broken recovery boot > 3. Diagnostics boot > 4. Developer boot > 5. Normal boot > > This constant is used in: > * lib/vboot_api_kernel.c: VbSelectAndLoadKernel() > * lib/vboot_kernel.c: replace the original vb2_boot_mode > * coreboot/bootmode for adding elogs > > Also bump the vb2sd minor version from 0 to 1. > > BUG=b:185551931, b:177196147, b:181931817 > BRANCH=none > TEST=CC=x86_64-pc-linux-gnu-clang; > make clean && make runtests > TEST=emerge coreboot vboot_reference depthcharge > > Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> > Change-Id: I421e4d51c261ba2bdec996a5fb2ebccb33513fa4 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2944250 > Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Bug: b:185551931, b:177196147, b:181931817 Change-Id: Ic184a24f5b580bcaf40d75045476ae77c674dd3d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3209725 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Bhanu Prakash Maiya <bhanumaiya@google.com>
* 2api: Add vb2_boot_mode in vb2_context denoted the current boot modestabilize-14267.Bfactory-ambassador-14265.BHsuan Ting Chen2021-10-013-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add enum vb2_boot_mode which denotes the most relevant boot mode between normal, manual recovery, broken recovery, diagnostic, and developer. The boot mode constant stores in vb2_context, is exposed externally, and decided in vb2api_fw_phase1. Split out the logic of manual recovery and broken screen. (The broken recovery is a recovery boot with !vb2api_allow_recovery) Add the fifth boot mode, diagnostic boot mode A boot could match more the one boot mode, this api will pick the most relevant boot mode based on the following order: 1. Manual recovery boot 2. Broken recovery boot 3. Diagnostics boot 4. Developer boot 5. Normal boot This constant is used in: * lib/vboot_api_kernel.c: VbSelectAndLoadKernel() * lib/vboot_kernel.c: replace the original vb2_boot_mode * coreboot/bootmode for adding elogs Also bump the vb2sd minor version from 0 to 1. BUG=b:185551931, b:177196147, b:181931817 BRANCH=none TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=emerge coreboot vboot_reference depthcharge Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I421e4d51c261ba2bdec996a5fb2ebccb33513fa4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2944250 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* 2lib/2api: Deprecate vb2ex_ec_trusted()Hsuan Ting Chen2021-09-281-5/+0
| | | | | | | | | | | | | | | | | | | | | | coreboot will support check the EC_IN_RW during verstage_main(), which performs the equivalent tasks as vb2ex_ec_trusted(). In the previous CL, we remove the check of vb2ex_ec_trusted(), so the whole implementation of this function among vboot_reference and depthcharge could be deprecated and removed. BUG=b:181931817 BRANCH=none TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=emerge coreboot vboot_reference depthcharge Cq-Depend: chromium:3139956 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I4f592d7dec2480475762e1336791cbb34fa143ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139539 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: boot from miniOS recovery kernels on diskstabilize-14249.BJoel Kitching2021-09-243-23/+588
| | | | | | | | | | | | | | | | | | | Add VbTryLoadMiniOsKernel() to vboot API, which boots from a miniOS recovery kernel located on internal disk. In this boot path, an attempt is made to verify and boot this kernel. Recovery proceeds from within the miniOS kernel by downloading a recovery image over the network. No USB disk is used in the process. For more information, see go/nbr-firmware. BUG=b:188121855, b:186682292 TEST=make clean && make runtests BRANCH=none Change-Id: Ic4d1fe5642a2bf71c51c78fd7830ad2b6e9eebeb Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2856364 Reviewed-by: Julius Werner <jwerner@chromium.org>
* 2api: Adjust the order of checking dev switch in vb2api_fw_phase1stabilize-14238.BHsuan Ting Chen2021-09-231-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL is a revert to CL:300621. In that CL, we adjusted the order of checking dev switch (vb2_check_dev_switch) and move it after the check for recovery step (vb2_check_recovery). The reason of that adjustment was because vb2_check_dev_switch might return very early if the TPM is broken and it failed to retrieve the secdata. However, retrieving the secdata becomes a function which cannot fail nowadays and it is not necessary to handle that scenario of the early return in vb2_check_dev_switch. So we adjust them back to the original order. We also remove the related outdated unit tests in vb2_api_tests.c BUG=none 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: Iada8092e73ed9282242b1d67d101c836860e13c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3168437 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vb2_sha256_x86_test: check sha-ni support by cpuidKangheui Won2021-09-221-0/+9
| | | | | | | | | | | | | | The test uses sha-ni extension, so it crashes on platforms without sha-ni. Add cpuid checks to avoid that. BUG=b:162551138 BRANCH=none TEST=run test on Haswell, which doesn't have sha-ni Signed-off-by: Kangheui Won <khwon@chromium.org> Change-Id: I6e18843a723d022c67832ef970d4dc470c1aadce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3140849 Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* vboot/ui: Remove 2ui, 2ui_screens, and vb2_ui*_testsstabilize-rust-14225.Bstabilize-rust-14224.Bstabilize-rust-14220.Bedisonhello2021-09-142-1312/+0
| | | | | | | | | | | | | | | | Since all the screens and tests are already moved to depthcharge in previous CLs, remove all internal UI functions and tests from vboot. BUG=b:172339016 TEST=DEBUG=1 make -j test_setup && make -j runtests BRANCH=none Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: Ifbd005a5761e5c354e010fc70487a63cd17cf4b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139540 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Remove diagnostics menu and related testsedisonhello2021-09-142-657/+1
| | | | | | | | | | | | | | | | | | | | | | This CL is a part of centralizing ui codes. The removed screens and unit tests will be added in depthcharge. Remove diagnostics menu, diagnostics storage and memory checking screens. Remove unit tests for above screens and menu. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j test_setup && make -j runtests TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3138687 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I5eb1bee6a5f1aedb77298acbddab20156c1c086e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139537 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Remove developer menu and related testsedisonhello2021-09-143-567/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This CL is a part of centralizing ui codes. The removed screens and unit tests will be added in depthcharge. Remove developer menu and its action function. Remove developer mode, developer to norm, developer boot external, developer invalid disk, developer select altfw screens. Remove unit tests for above screens and menu. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j test_setup && make -j runtests TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3132550 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I45332f8e059eba612231362cc56a70da1336c7c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3132504 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/ui: Remove manual recovery and related screenedisonhello2021-09-143-653/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL is a part of centralizing ui codes. The removed screens and unit tests will be added in depthcharge. Remove manual recovery menu and its action function. Remove recovery select, recovery phone step *, recovery disk step *, recovery invalid screens. Add vb2ex_manual_recovery_ui declaration. Remove unit tests of above screens, menu and actions. BUG=b:172339016 TEST=Hayato booted into developer mode TEST=Hayato showed manual recovery screen TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j test_setup && make -j runtests TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3099529 Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I330098200d45d094d4faab90b96355b5b19e3fea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3116108 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Remove broken recovery screenedisonhello2021-09-142-155/+1
| | | | | | | | | | | | | | | | | | | | | Remove broken recovery screen in vboot, and migrate to depthcharge. Remove broken recovery related tests in vboot. BUG=b:172339016 TEST=Hayato booted into developer mode TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j test_setup && make -j runtests TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j test_setup && make -j runtests BRANCH=none Cq-Depend: chromium:3116129 Change-Id: I7d830e992d9ae1703befba570dfbe3061319b9fe Signed-off-by: edisonhello <edisonhello@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3060559 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/ui: Rename UI functionsedisonhello2021-09-143-43/+45
| | | | | | | | | | | | | | | | | | | | | Prepare for copying UI functions to depthcharge. Rename UI functions which will be copied to depthcharge in vboot in order to avoid linking time error after copying the functions. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j test_setup && make -j runtests TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j test_setup && make -j runtests TEST=Hayato booted into developer mode BRANCH=none Change-Id: I840de3121dc2ccd8f6d05ec8a1538c3761f806da Signed-off-by: edisonhello <edisonhello@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3060558 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* 2lib/2ec_sync: Clear VB2_CONTEXT_EC_TRUSTED before jumping to RWHsuan Ting Chen2021-09-041-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | Currently the EC is trusted if any of the conditions are met: * The ctx flag VB2_CONTEXT_EC_TRUSTED is set. * vb2ex_ec_trusted() returns trusted. With introducing the boot mode area in ctx, the vb2ex_ec_trusted will be deprecated and the VB2_CONTEXT_EC_TRUSTED will become the only condition to decide if EC is trusted. This CL clears the flag while EC jumps to RW, which is the prerequisite before landing the coreboot changes. Also update the tests of ec_sync() BRANCH=none BUG=b:181931817 TEST=emerge-trogdor coreboot vboot_reference depthcharge Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I4711093353f5a92157c4c00c859c01f08fc3607f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3139538 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* run2tests: fix more compilation problemsVadim Bendebury2021-09-021-2/+6
| | | | | | | | | | | | | | | | | | | | | | The compiler is too zealous when deciding which addresses are allowed to be accessed. While it is correct in principal, in some controlled cases the code indeed needs to calculate addresses which are beyond the structures boundaries. This patch modifies the code to placate the compiler. BRANCH=none BUG=none TEST='make run2tests' inside chroot does not fail to compile and passes. Change-Id: Iba99714da569a5f28ae95939e93ee1d09da20caa Signed-off-by: Vadim Bendebury <vbendeb@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3133544 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
* vboot/ui: Show error box on internal boot failureYu-Ping Wu2021-08-311-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | CL:2917623 changes the behavior when failing to boot from internal disk in developer UI. However, it causes the device to potentially enter a reboot loop (b/197216832). Instead of either triggering recovery or returning an error from the UI loop, change the behavior to showing an error message in a dialog box and staying in the UI. This is similar to the behavior when booting from an invalid external disk, where an error screen will be shown to the user. Add VB2_UI_ERROR_INTERNAL_BOOT_FAILED to vb2_ui_error enum. BUG=b:197216832, b:197911901 TEST=make runtests BRANCH=none Cq-Depend: chromium:3123160 Change-Id: Ic5ace55fc8b93ba0836e5722b7c5011fd490c35e Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3124395 Reviewed-by: Julius Werner <jwerner@chromium.org>
* tests: fix compilation failuresVadim Bendebury2021-08-263-20/+34
| | | | | | | | | | | | | | | | | | | | | | Attempts to access array of fixed size beyond the boundary now trigger compilation warnings, even though there is room beyond the array boundary in due to data layout. Let's modify the code to declare the array size explicitly to calm the compiler. Also needed to add en explicit return value in a function where all returns happened inside a case statement. BRANCH=none BUG=none TEST='make run2tests' does not fail to compile any more and succeeds running tests. Change-Id: Ib2158145233a0e8641c5b9b95499928f18390a8d Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3120000 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: Remove unnecessary flag unset operationsstabilize-14150.882.Bstabilize-14150.881.Bstabilize-14150.74.Bstabilize-14150.734.Bstabilize-14150.64.Bstabilize-14150.43.Bstabilize-14150.376.Brelease-R94-14150.Brelease-R94-14150.49.Bedisonhello2021-08-122-2/+0
| | | | | | | | | | | | | | | | | | Since all flags are initialized as 0 in vb2api_init(), some flag unset operations are not needed. Edit few comments to make it more accurate. BUG=none TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1; \ make -j32 test_setup && make -j32 runtests; BRANCH=none Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: I0129f43342598195800ff671b965100d3d568564 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3066803 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/misc: Add validity check in vb2api_enable_developer_modeedisonhello2021-08-122-6/+18
| | | | | | | | | | | | | | | | | | | | | | | Check vb2api_allow_recovery before actual changes in vb2api_enable_developer_mode. Add new API error type VB2_ERROR_API_ENABLE_DEV_NOT_ALLOWED in vb2_error_t. Add spaces in the output message of vb2_misc_tests for indentation. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j32 test_setup && make -j32 runtests; TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j32 test_setup && make -j32 runtests; TEST=Hayato booted into developer mode BRANCH=none Change-Id: Ifebdd01ca87cf944c394907eca73a09fc3bf5457 Signed-off-by: edisonhello <edisonhello@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3056240 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/tests: Add test_fail function and TEST_FAIL macroedisonhello2021-08-042-0/+25
| | | | | | | | | | | | | | | | | | | Add test_fail function that will check whether the result value is not 0. Add TEST_FAIL macro that will call test_fail. BUG=none TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1; \ make -j32 test_setup && make -j32 runtests; BRANCH=none Change-Id: I4dfe6a887780f70fbcb753828cfb5500ed810b72 Signed-off-by: edisonhello <edisonhello@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3060562 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Publicize and create functions for UI migrationedisonhello2021-07-309-12/+9
| | | | | | | | | | | | | | | | | | | | | | Publicize vb2api_enable_developer_mode, vb2api_allow_recovery and VbTryLoadKernel, and modify corresponding parts in tests. Create vb2api_disable_dev_request, vb2api_request_diagnostics for wrapping vb2_nv_set(ctx, VB2_NV_DISABLE_DEV_REQUEST, 1) and vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 1). BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j32 test_setup && make -j32 runtests; TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j32 test_setup && make -j32 runtests; TEST=Hayato booted into developer mode BRANCH=none Change-Id: I0211a63ed58ce862ee3e17b4835c675544f773a4 Signed-off-by: edisonhello <edisonhello@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3053541 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Add DEV_BOOT_*ALLOWED in ctx->flagsedisonhello2021-07-303-103/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | Add DEV_BOOT_ALLOWED, DEV_BOOT_ALTFW_ALLOWED, DEV_BOOT_EXTERNAL_ALLOWED in ctx->flags, which can be used by external functions. These flags will be filled in VbSelectAndLoadKernel, before calling any menu function. In 2ui.c and 2ui_screen.c, all function calls to vb2_dev_boot_*allowed are replaced with corresponding flags in ctx->flags. Remove the parts of mocking these functions in unit tests, and set ctx->flags instead in reset_common_data. BUG=b:172339016 TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=0; \ make -j32 test_setup && make -j32 runtests; TEST=export CC=x86_64-pc-linux-gnu-clang DEBUG=1 DETACHABLE=1; \ make -j32 test_setup && make -j32 runtests; TEST=Hayato booted into developer mode BRANCH=none Signed-off-by: edisonhello <edisonhello@google.com> Change-Id: Ida9f03557a92a1522d631fc04b281ce85f5049c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3041498 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/vboot_kernel: split gpt tests out of vboot_kernel_testsJoel Kitching2021-07-212-332/+390
| | | | | | | | | | | | | | | | | | | These don't really belong together. We can get two cleaner test files by splitting them apart. This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551, b:172337800, b:124141368 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Idaa4c36214cc98bffdc50bdb5c071673829250ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3039164 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* Makefile: deprecate config DIAGNOSTIC_UIHsuan Ting Chen2021-07-162-52/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DIAGNOSTIC_UI is indirectly decided by the diag_payload and minidiag use flag from depthcharge. But with introducing the diagnostic boot mode, coreboot also needs to build minidiag utility functions and enable this building flag. Therefore we consider to deprecate DIAGNOSTIC_UI and always build them. For diag_payload: It is for a diagnostic tool which based on legacy UI and deprecated For minidiag: Mini-diag is set default enabled for newer devices, and we could still use kernel secdata in runtime if we decide to disable it on certain platforms. In conclusion, deprecating DIAGNOSTIC_UI will not affect newer devices. BUG=b:190796342, b:181931817 BRANCH=none TEST=emerge-volteer depthcharge TEST=emerge-volteer coreboot TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests Cq-Depend: chromium:3004223 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I0d804bcd9d31d3952c744a1926ac59cde7b7f841 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3006114 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: introduce minios_kernel.keyblockJoel Kitching2021-07-0513-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | miniOS requires a distinct kernel data key, whose dev key pair is added in this CL as minios_kernel_data_key.vb{pub,priv}k. A distinct keyblock is also required. The keyblock should set the kernel keyblock flag MINIOS_1. Other keyblocks are modified appropriately to set MINIOS_0. Keyblocks were generated using the following commands: $ futility vbutil_keyblock --flags 23 --datapubkey tests/devkeys/ec_data_key.vbpubk --signprivate tests/devkeys/ec_root_key.vbprivk --pack tests/devkeys/ec.keyblock Keyblock file: tests/devkeys/ec.keyblock Signature valid Flags: 23 !DEV DEV !REC !MINIOS Data key algorithm: 7 RSA4096 SHA256 Data key version: 1 Data key sha1sum: 5833470fe934be76753cb6501dbb8fbf88ab272b $ futility vbutil_keyblock --flags 23 --datapubkey tests/devkeys/firmware_data_key.vbpubk --signprivate tests/devkeys/root_key.vbprivk --pack tests/devkeys/firmware.keyblock Keyblock file: tests/devkeys/firmware.keyblock Signature valid Flags: 23 !DEV DEV !REC !MINIOS Data key algorithm: 7 RSA4096 SHA256 Data key version: 1 Data key sha1sum: e2c1c92d7d7aa7dfed5e8375edd30b7ae52b7450 $ futility vbutil_keyblock --flags 27 --datapubkey tests/devkeys/recovery_kernel_data_key.vbpubk --signprivate tests/devkeys/recovery_key.vbprivk --pack tests/devkeys/recovery_kernel.keyblock Keyblock file: tests/devkeys/recovery_kernel.keyblock Signature valid Flags: 27 !DEV DEV REC !MINIOS Data key algorithm: 11 RSA8192 SHA512 Data key version: 1 Data key sha1sum: e78ce746a037837155388a1096212ded04fb86eb $ futility vbutil_keyblock --flags 43 --datapubkey tests/devkeys/minios_kernel_data_key.vbpubk --signprivate tests/devkeys/recovery_key.vbprivk --pack tests/devkeys/minios_kernel.keyblock Keyblock file: tests/devkeys/minios_kernel.keyblock Signature valid Flags: 43 !DEV DEV REC MINIOS Data key algorithm: 8 RSA4096 SHA512 Data key version: 1 Data key sha1sum: 65441886bc54cbfe3a7308b650806f4b61d8d142 $ futility vbutil_keyblock --flags 23 --datapubkey tests/devkeys/kernel_data_key.vbpubk --signprivate tests/devkeys/kernel_subkey.vbprivk --pack tests/devkeys/kernel.keyblock Keyblock file: tests/devkeys/kernel.keyblock Signature valid Flags: 23 !DEV DEV !REC !MINIOS Data key algorithm: 4 RSA2048 SHA256 Data key version: 1 Data key sha1sum: d6170aa480136f1f29cf339a5ab1b960585fa444 $ futility vbutil_keyblock --flags 26 --datapubkey tests/devkeys/installer_kernel_data_key.vbpubk --signprivate tests/devkeys/recovery_key.vbprivk --pack tests/devkeys/installer_kernel.keyblock Keyblock file: tests/devkeys/installer_kernel.keyblock Signature valid Flags: 26 DEV REC !MINIOS Data key algorithm: 11 RSA8192 SHA512 Data key version: 1 Data key sha1sum: e78ce746a037837155388a1096212ded04fb86eb BUG=b:188121855 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I5b3e4def83ff29ca156b3c84dfcb8398f4985e67 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2965485 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/minidiag: add *log assignment in diag_get_storage_test_log mockJoel Kitching2021-07-041-0/+1
| | | | | | | | | | | | | | | | Subsequent code can potentially access the *log variable after being set by vb2ex_diag_get_storage_test_log. BUG=none TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I9c8ed20efecbb4eaff8a8fcdf1f467f7df5147a0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2917624 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot/vboot_kernel: store kparams pointer instead of copying dataJoel Kitching2021-07-031-1/+4
| | | | | | | | | | | | | | | | | | | | Store kparams as a pointer in vboot_api_kernel.c, rather than a full struct passed around as a "buffer copy". This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I7be7280761564c35e928bc947177b3fce61d6215 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2856360 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: add x86 SHA256 ext supportKangheui Won2021-07-011-0/+121
| | | | | | | | | | | | | | | | | | | | | Latest x86 processors have SHA256 extension which can accelerate hash computation in vboot. This is especially helpful on low-end devices where sha256 computation takes 70ms-90ms, with this CL it is reduced to 10ms. BUG=b:162551138 BRANCH=zork TEST=build and boot, check cbmem -t TEST=run vb2_sha256_x86_tests on dirinboz Signed-off-by: Kangheui Won <khwon@chromium.org> Change-Id: I50e123048d54d5061e8d8e0e0ae804a416130948 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2639457 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Raul E Rangel <rrangel@chromium.org>
* vboot/vboot_kernel: change recovery behaviour on kernel failureJoel Kitching2021-06-261-1/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | On load kernel failure, only call vb2api_fail when in normal mode. Previously, the behaviour here was to only call when attempting to load a kernel from a fixed disk. This maps to (1) normal mode, and (2) developer mode when booting from an internal disk. Excluding (2) creates a more consistent experience in developer mode, and also prepares for a world where recovery kernels might exist on disk. This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551, b:188121855 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Ic2c55a073b036be98f4ce9b2e0c7fb3209de74c8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2917623 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/vboot_kernel: break disk check out to separate functionstabilize-14031.BJoel Kitching2021-06-155-14/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move disk validity check to static function is_valid_disk(). If multiple disk types are selected (e.g. REMOVABLE | FIXED), is_valid_disk() will now check that exactly *one* of those flags is selected by VbDiskInfo.flags. Also, split disk flags into two 16-bit sections: - Disk selection in the lower 16 bits (where the disk lives) - Disk attributes in the higher 16 bits (extra information about the disk needed to access it correctly) This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Icf76ab6e92cca40810071def66aed13cdb3a7ec7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2872251 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/vboot_kernel: remove LoadKernelParams structJoel Kitching2021-06-153-4/+5
| | | | | | | | | | | | | | | | | | | | LoadKernelParams struct is identical to VbSelectAndLoadKernelParams. Remove it, and use the public interface internally. This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I8b820d18c1e9a66404a7a091aa3ccc1b050a559d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2846282 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/vboot_kernel: pass VbDiskInfo into LoadKernelJoel Kitching2021-06-153-16/+24
| | | | | | | | | | | | | | | | | | | | Pass VbDiskInfo struct into LoadKernel, rather than copying all of its members into LoadKernelParams. Remove the unused members from LoadKernelParams. This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I60957426388c88b16e570b717addb5eaf65b5e4f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2846281 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/vboot_kernel: move kernel/fw struct functionsJoel Kitching2021-06-153-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Relocate currently-in-use kernel struct functions out of lib20 namespace, and into: * 2struct.c for functions required at runtime * host_common.c for functions required by host Relocate firmware struct functions from 2common.c into 2struct.c vb2_common.h may be deleted as a result. This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Ic162d9633b6112ddc4a819b3e58d313dc484f304 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2825269 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* Revert "vboot/vboot_kernel: update keyblock flag mismatch logic"stabilize-13974.BMartin Roth2021-05-151-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 0902a08d74f090b747f59de616abfdf2131b1ae3. Reason for revert: This causes issues with booting, at least on the guybrush platform. BUG=b:187953058 TEST=See OS boot failures with this patch in place. Remove patch and guybrush boots fine again. Original change's description: > vboot/vboot_kernel: update keyblock flag mismatch logic > > A keyblock flag mismatch should cause keyblock verification to > fail regardless of whether a valid keyblock is required (i.e. > self-signed keyblock case). > > This CL is part of a series to merge vboot1 and vboot2.0 > kernel verification code; see b/181739551. > > BUG=b:181739551 > TEST=make clean && make runtests > BRANCH=none > > Signed-off-by: Joel Kitching <kitching@google.com> > Change-Id: I47096ab7fcf0fbd47a46a9a92a5406e9aa9b3596 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2846251 > Reviewed-by: Julius Werner <jwerner@chromium.org> > Tested-by: Joel Kitching <kitching@chromium.org> > Commit-Queue: Joel Kitching <kitching@chromium.org> Bug: b:181739551 Change-Id: Ie778fd669bc072ba526d2082a3418208d6b28472 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2891607 Auto-Submit: Martin Roth <martinroth@google.com> Tested-by: Martin Roth <martinroth@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Julius Werner <jwerner@chromium.org>
* vboot/vboot_kernel: update keyblock flag mismatch logicfactory-strongbad-13963.BJoel Kitching2021-05-091-1/+9
| | | | | | | | | | | | | | | | | | | | A keyblock flag mismatch should cause keyblock verification to fail regardless of whether a valid keyblock is required (i.e. self-signed keyblock case). This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: I47096ab7fcf0fbd47a46a9a92a5406e9aa9b3596 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2846251 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot_reference: migrate out of flashrom deprecated optionsDaniel Campello2021-04-281-1/+1
| | | | | | | | | | | | | | This change replaces --diff and --fast-verify for the supported equivalent flashrom options BRANCH=none BUG=b:186479007 TEST=tryjobs Change-Id: I614ba71c606dbe4e3a1b4988df845bcbbd61dd01 Signed-off-by: Daniel Campello <campello@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2853623 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* vboot/ui: Refactor ui error handlingstabilize-RUST-13932.Bstabilize-13942.Bstabilize-13935.Bfactory-asurada-13929.Bfactory-13929.BChung-Sheng Wu2021-04-211-5/+15
| | | | | | | | | | | | | | | | | | | | Add helper functions to check and set ui error code. The ui error handling shouldn't catch the requests but only the error. Add vb2_is_error() to 2api.h. This function is for checking if the return value is an error or not. BRANCH=none BUG=b:157625765 TEST=make clean && CC=x86_64-pc-linux-gnu-clang make runtests Signed-off-by: Chung-Sheng Wu <chungsheng@google.com> Change-Id: I5c9a34dadf749f3b5364860a1a034bfefe0a61f5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2780821 Tested-by: Chung-Sheng Wu <chungsheng@chromium.org> Commit-Queue: Chung-Sheng Wu <chungsheng@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* minidiag: Add storage self-test screenChung-Sheng Wu2021-04-211-29/+65
| | | | | | | | | | | | | | | | | | Implement the ui for storage self-test. BUG=b:173364332 TEST=make clean && CC=x86_64-pc-linux-gnu-clang make runtests BRANCH=none Cq-Depend: chromium:2641906 Signed-off-by: Chung-Sheng Wu <chungsheng@google.com> Change-Id: Ieb3a24e0bf19f4e62de41cccd1138719dbc65e7c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2626566 Tested-by: Chung-Sheng Wu <chungsheng@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-by: Meng-Huan Yu <menghuan@chromium.org> Commit-Queue: Chung-Sheng Wu <chungsheng@chromium.org>
* vboot/ui: Remove VB2_SCREEN_BLANKstabilize-glibc-13901.Bstabilize-coil-13902.BYu-Ping Wu2021-04-072-14/+7
| | | | | | | | | | | | | | | Remove the unused VB2_SCREEN_BLANK from vb2_screen enum. BUG=none TEST=emerge-asurada depthcharge TEST=make runtests BRANCH=none Cq-Depend: chromium:2793450 Change-Id: I931f6ad804f6da3b710bef9d800c26960d20c3cb Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2793448 Reviewed-by: Julius Werner <jwerner@chromium.org>
* arc: Add missing keys to support signing ARC images.Yury Khmel2021-04-062-0/+23
| | | | | | | | | | | | | | | | | | | This adds missing networkstack keys required for sign scripts. Keys are generated by: ./create_new_android_keys.sh ${VBOOT_REFERENCE}/tests/devkeys/android git checkout media.pk8 media.x509.pem platform.pk8 \ platform.x509.pem releasekey.pk8 releasekey.x509.pem \ shared.pk8 shared.x509.pem BUG=b:170344735 TEST=build hatch based board with this feature on BRANCH=none Change-Id: I80376b8b07cc111d3ef51cf8a7bbc8dcfe8cfcc8 Signed-off-by: Yury Khmel <khmel@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2803655 Reviewed-by: Victor Hsieh <victorhsieh@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* vboot/vboot_kernel: correct semantics of kernel_version_secdataJoel Kitching2021-04-011-1/+1
| | | | | | | | | | | | | | | | This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Ib61f9bd726d2da9ef0fee3cd3a4039a6aa1063cc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2780222 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>