summaryrefslogtreecommitdiff
path: root/firmware
Commit message (Collapse)AuthorAgeFilesLines
* firmware: Add VB2_REC_OR_DIE() helper macroJulius Werner2020-02-115-32/+23
| | | | | | | | | | | | | | | | | After introducing VB2_DIE() recently, practical use has shown that we pretty much always want to check for recovery mode first, and avoid a hard abort in that case. This patch introduces a very similar macro that includes that extra check so we don't have to open-code it all over the place. BRANCH=None BUG=None TEST=make runtests Change-Id: I16e744859ba7a5c68269e06c7e7d071f3bfae67e Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2038244 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: move vboot 2.1 functions and structs into host codeJoel Kitching2020-02-115-793/+0
| | | | | | | | | | | | | | | | | | These structs and functions need to stick around for futility to use, but they are no longer supported in firmware code. Rename host/lib21/include/* files to end in 21 instead of 2. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I01e181e2f03553d60724fbdc826f5ada63777303 Cq-Depend: chromium:1969172 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1963621 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: purge unused vboot 2.1 codeJoel Kitching2020-02-117-719/+1
| | | | | | | | | | | | | | Only keep vboot 2.1 code that futility uses. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: Iee45d7a0f7c6a6d4b27997b2eff3117a12a48dcf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1961715 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: modify control flow for vendor data configPranay Shoroff2020-02-103-82/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | Modify logic for new vendor data configuration workflow. Current workflow contains little to no instruction for navigating vendor data workflow. UI is generally very scarce. New workflow aims to provide more instruction on how to proceed to next steps, escape from the workflow and boot normally, and a new YES/NO selection screen during the final confirmation phase of the workflow. BUG=b:138812835 BRANCH=none TEST=emerge-sarien depthcharge, chromeos-bootimage, flash firmware image on Sarien and test workflow Cq-Depend: chromium:1925665, chrome-internal:2180149 Change-Id: I3d7081f348a7dd68d10d1eba4879a359ccbdd6e5 Signed-off-by: Pranay Shoroff <pshoroff@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1926508 Commit-Queue: Mathew King <mathewk@chromium.org> Tested-by: Mathew King <mathewk@chromium.org> Reviewed-by: Mathew King <mathewk@chromium.org>
* vboot: Reduce unnecessary redraw of error messageYu-Ping Wu2020-02-101-4/+3
| | | | | | | | | | | | | | | | | | | When developer mode is disabled by the VB2_SECDATA_FWMP_DEV_DISABLE_BOOT flag, the error message will be redrawn per 20 ms even if no key is pressed. This patch reduces unnecessary redraw by moving the drawing inside enter_to_norm_menu(), which will be called only when changing screens. BRANCH=kukui BUG=chromium:1048094,chromium:1049029 TEST=emerge-nami vboot_reference Cq-Depend: chromium:2040844 Change-Id: I0e892086b25fc94800534c5a37bcab8b70a5fcd9 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2035056 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: update vb2api_kernel_phase1 to use GBB interfaceJoel Kitching2020-02-094-108/+51
| | | | | | | | | | | | | | | | | | | | vb2api_kernel_phase1 was previously written to read the GBB headers, locate the recovery key, and then load it. GBB headers are now saved directly on workbuf in firmware phase. Simply use the vb2_gbb_read_recovery_key function to retrieve the key. Update LoadKernel to read kernel subkey from vboot2 workbuf. Update tests/verify_kernel.c to write subkey to vboot2 workbuf. BUG=b:124141368, chromium:954774, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: Ia85013da34bdab68bf486014a3401d48c95b3472 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1651221 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: only clear recovery requests at kernel verificationJoel Kitching2020-02-082-13/+22
| | | | | | | | | | | | | | | | | | | | | | | | Instead of clearing recovery requests early on in firmware verification, defer this task until kernel verification has begun. If the system is rebooted for any non-vboot-related reason when entering recovery mode (e.g. FSP initialization), the recovery request will still be available in nvdata. Additionally, relocate the reboot triggered by memory training into VbSelectAndLoadKernel. BUG=b:124141368, b:35576380 TEST=make clean && make runtests BRANCH=none Change-Id: I787e45c7ed4f2bebf570bb9c1a8e9e371f2a040b Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1940398 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Add a semicolon in commentYu-Ping Wu2020-02-061-1/+1
| | | | | | | | | | | BRANCH=none BUG=none TEST=none Change-Id: I04e0151655a9331750f5f5becfae2638c8e3ed17 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2037146 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Deprecate VBSD_BOOT_REC_SWITCH_VIRTUALYu-Ping Wu2020-02-062-15/+17
| | | | | | | | | | | | | | | | | | With the compile time constant PHYSICAL_PRESENCE_KEYBOARD passed (CL:2004267), replace the usage of the flag VBSD_BOOT_REC_SWITCH_VIRTUAL with PHYSICAL_PRESENCE_KEYBOARD. Also deprecate VBSD_BOOT_REC_SWITCH_VIRTUAL because it is no longer needed. BRANCH=none BUG=chromium:1038259, chromium:943150 TEST=make runtests Cq-Depend: chromium:2004267 Change-Id: I091825cf1367571bb50dec84dda6e44ed4d2bb19 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2037269 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot_ui: refactor vendor data codePranay Shoroff2020-02-056-338/+369
| | | | | | | | | | | | | | | | | | Refactored wilco-specific functions related to setting serial numbers to their own file and diagnostic UI feature BUG=b:138812835 BRANCH=None TEST=emerge-drallion vboot_reference, flashed drallion and tested vendor data setting Related to chromium:1983248, chromium:1926508, chrome-internal:2180149 Change-Id: I02b2a62943ea60af007b6fc084b74e990062f3c3 Signed-off-by: Pranay Shoroff <pshoroff@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1999050 Reviewed-by: Mathew King <mathewk@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Mathew King <mathewk@chromium.org>
* vboot: Convert UI errors to vboot2-styleYu-Ping Wu2020-02-031-4/+15
| | | | | | | | | | | | | | | | | | | | | | Error codes are renamed as follows: VBERROR_INVALID_SCREEN_INDEX --> VB2_ERROR_UI_INVALID_SCREEN VBERROR_SCREEN_DRAW --> VB2_ERROR_UI_DRAW_FAILURE In addition, add new error code VB2_ERROR_UI_DISPLAY_INIT. BRANCH=none BUG=none TEST=emerge-nami depthcharge Cq-Depend: chromium:2002310 Change-Id: I1381762fbe1a9bb0c76e7e7d64a0732799c3bf0f Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2002309 Reviewed-by: Joel Kitching <kitching@chromium.org>
* Reland: Clean up implicit fall through.Manoj Gupta2020-02-014-25/+4
| | | | | | | | | | | | | | | | Directly use the __attribute__ ((fallthrough)) instead of a macro. This was suggested in CL:1772474. BUG=chromium:997709 TEST=CQ BRANCH=None Change-Id: Ifcdcd3822eddea41aeb88f4a55bd09aa483f6054 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2031766 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* 2lib: Fix struct vb2_hash the way it was meant to bestabilize-quickfix-12871.27.Bstabilize-12871.91.Bstabilize-12871.65.Bstabilize-12871.57.Bstabilize-12871.253.Bstabilize-12871.24.Bstabilize-12871.103.Bstabilize-12871.102.Brelease-R81-12871.BJulius Werner2020-01-282-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | My goal in CL:1963614 was to write struct vb2_hash such that it can match the exisiting binary representation of the CBFS hash attribute, but no longer be dependent on endianness. Unfortunately I screwed up... if you want to match the binary representation of a big-endian integer for small numbers, the important byte you're interested in is the *last* one, not the first. Thankfully we still have time to fix the issue before this struct is really used anywhere, so this patch does that and adds a test to double check I got it right this time. Also clarify comments about how vboot is allowed to use this struct a bit to match the indended usage I'm planning in coreboot. In doing that I realized that you actually don't want to make it easy to sizeof() the |bytes| portion of the struct (because functions shouldn't rely on that size anyway, they should only touch what's valid for a given hash algorithm), so taking that out which also makes it a little more comfortable to work with the struct. BRANCH=none BUG=none TEST=make runtests Change-Id: I7e1a19f36d75acb69e5d1bfa79700c9d878f9703 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2019952
* Enable format string warnings for vb2ex_printf()stabilize-12859.BJulius Werner2020-01-251-0/+1
| | | | | | | | | | | | | | | | | | | This patch enables the -Wformat warning and tags vb2ex_printf() with the appropriate attribute so the compiler recognizes it as a printf variant. This shows a bunch of (sometimes pretty bad) issues in existing code that are hereby fixed. Cannot enable -Wformat-security yet since a lot of code still uses non-constant format strings and it's unclear whether we can/want to change that in all circumstances (e.g. stuff like DoError()). BRANCH=None BUG=None TEST=make runtests Change-Id: I917a4982a97a668a5c0f793f7c771573f2bd3949 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2013857
* vboot: convert several vboot1 flags to vboot2Joel Kitching2020-01-223-16/+14
| | | | | | | | | | | | | | | | | | | | | Use vboot2 flag as source of truth for NVDATA_V2, DEV_MODE_ENABLED, and NOFAIL_BOOT. Mark vboot1 flags LF_DEV_SWITCH_ON and NOFAIL_BOOT as deprecated. Fix up spacing of vboot1 flags in vboot_struct.h. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: I6af8cd97ade8284e198f966d1b86f57101fcd070 Cq-Depend: chromium:2011415 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2011416 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove secdata TPM backend codeJoel Kitching2020-01-2211-391/+32
| | | | | | | | | | | | | | | | | | | | In vboot 2 design, secdata spaces are read/written by the vboot caller, and not by vboot itself. We still need to maintain a vb2ex_commit_data callback for edge cases, such as when the vboot UI prompts the user to reboot. BUG=b:124141368, chromium:972956 TEST=Build locally, flash and boot eve, check logs for secdata writes and locks TEST=make clean && make runtests BRANCH=none Change-Id: Ib3b628549185749a290dd65e297f2e19adecbc66 Cq-Depend: chromium:1958012 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1958070 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: translate recovery reason info from vboot 2->1Joel Kitching2020-01-212-9/+14
| | | | | | | | | | | | | | | | | | | Recovery reason should be passed into vboot kernel verification API using vboot 2 data structures. Upon arrival, translate to vboot 1 data structures for legacy purposes. Also switch to using vboot 2 recovery_reason field in other parts of vboot code. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: Ic590db46d57ffbd8829f8f3ad784ea46184ceabc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2008534 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* vboot: Set VBSD_EC_SOFTWARE_SYNC flag in vbootYu-Ping Wu2020-01-201-2/+2
| | | | | | | | | | | | | | | | With CL:1988245, vb2_context flag VB2_CONTEXT_EC_SYNC_SUPPORTED is set in depthcharge. Set VBSD_EC_SOFTWARE_SYNC in shared data based on the presence of VB2_CONTEXT_EC_SYNC_SUPPORTED. BRANCH=none BUG=chromium:1038259, chromium:1042135 TEST=FEATURES=test emerge-nami vboot_reference Cq-Depend: chromium:1988245 Change-Id: Ia1dd57858234bbc43f25517f416b7506c1b7919a Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1988246 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: deprecate EC_EFS and EC_SYNC_SLOW flagsJoel Kitching2020-01-173-15/+8
| | | | | | | | | | | | | | | | | The vboot 1 flags are not used in userspace, so they may be deprecated. The vboot 2 flags are converted to use compile-time options instead. BUG=b:124141368, chromium:1038259 TEST=make clean && make runtests BRANCH=none Change-Id: I0bd63a6f4dd0f29d416beacb966c99b16b5efabd Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2004256 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* Auxfw sync: Remove dependency on EC syncTim Wawrzynczak2020-01-161-4/+0
| | | | | | | | | | | | | | | | Auxfw sync used to be guarded by both VB2_GBB_FLAG_DISABLE_EC_SOFTWARE_SYNC and VB2_CONTEXT_EC_SYNC_SUPPORTED. Now that the EC and AUXFW sync are fully decoupled, there are scenarios where it may make sense to do auxfw sync independent of EC sync, such as early bringup. BUG=chromium:1041879 BRANCH=none TEST=make runtests Change-Id: I07948b0317119231ec0287d663a3d8b92259fd6b Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2004942 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: rename FAFT_KEY_OVERIDE and clarify its useJoel Kitching2020-01-161-2/+8
| | | | | | | | | | | | | | | Rename GBB flag FAFT_KEY_OVERRIDE to RUNNING_FAFT. Add a comment to clarify its use. BUG=b:124141368, chromium:965914 TEST=make clean && make runtests BRANCH=none Change-Id: Ib90de7a0d22b39898fc84be8c16ff34ea1d3b504 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1977902 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* 2sha: Add a vb2_hash type to make it easier to work with hashesJulius Werner2020-01-163-4/+82
| | | | | | | | | | | | | | | | | | | | | | I'm prototyping some coreboot code to closer integrate vboot with CBFS (per-file hashing and that stuff). While doing that, I noticed that it would be neat to have a standardized serializable representation for any kind of vboot hash. We already have something like that in CBFS attributes, but if we want to use it more generally it makes more sense to put it in vboot. This patch adds a suitable structure defintion to 2sha.h and two utility functions that can be used to work with it. Also add alloca() because I need it and fix the return types of vb2_..._size(), because those are just plain wrong. BRANCH=None BUG=None TEST=make runtests Change-Id: I4b535ad43704693463fb114d6a81d2b5689a87b9 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1963614 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: remove VBSD from tests that don't need itJoel Kitching2020-01-111-7/+9
| | | | | | | | | | | | | | | Also clean up a few lines setting unneeded flags and fields in tests, and add conditionals to check for VBSD in vboot_display.c. BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: I84438d00777516354529b1e6ee4d04f7947ff971 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1992856 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot_reference: add owners for TlclAndrey Pronin2020-01-114-0/+8
| | | | | | | | | | | | | | This CL adds owners for TPM Lightweight Communications Library (TLCL) inside vboot_reference. BUG=none TEST=none Change-Id: Ife7af0fad31d5f7811a5fc80d34baccf3a4f8c35 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1654006 Tested-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Andrey Pronin <apronin@chromium.org>
* vboot: use vboot 2 flags for checking rec/dev modeJoel Kitching2020-01-104-11/+8
| | | | | | | | | | | | | | | | | | Use vboot 2 flags for checking whether dev mode is enabled, and whether manual recovery was requested. VBSD_BOOT_DEV_SWITCH_ON --> VB2_SD_FLAG_DEV_MODE_ENABLED VBSD_BOOT_REC_SWITCH_ON --> VB2_SD_FLAG_MANUAL_RECOVERY BUG=b:124141368, chromium:1038260 TEST=make clean && make runtests BRANCH=none Change-Id: Idb439f658391f46170704a0fd614853054e1c64d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1992852 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Deprecate VBSD_EC_EFSYu-Ping Wu2020-01-092-3/+4
| | | | | | | | | | | | | | | Replace VbSharedDataHeader flag VBSD_EC_EFS with compile-time macro EC_EFS. BRANCH=none BUG=chromium:1038259 TEST=FEATURES=test emerge-nami vboot_reference Cq-Depend: chromium:1985550 Change-Id: I0c4dc9b096daf3343881df5bd4181b410979eb0d Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1985548 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Deprecate VBSD_EC_SLOW_UPDATEYu-Ping Wu2020-01-092-3/+4
| | | | | | | | | | | | | | | Replace VbSharedDataHeader flag VBSD_EC_SLOW_UPDATE with compile-time macro EC_SLOW_UPDATE. BRANCH=none BUG=chromium:1038259 TEST=FEATURES=test emerge-nami vboot_reference Cq-Depend: chromium:1985549 Change-Id: I0f5e04f2b6cf088ab8373ade580bc294ba18e290 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1985547 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Deprecate VB2_CONTEXT_DETACHABLE_UIYu-Ping Wu2020-01-072-4/+8
| | | | | | | | | | | | | | | | With CL:1975390, utilize the environment variable LEGACY_MENU_UI to define a macro with the same name in compile time. Deprecate VB2_CONTEXT_DETACHABLE_UI since it is no longer needed. BRANCH=none BUG=chromium:953656,chromium:1033815 TEST=USE="legacy_menu_ui" emerge-nami depthcharge Cq-Depend: chromium:1975336, chromium:1975390 Change-Id: I47deaf62fd3e9ea499b7d899f00f36caf7702c3a Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1980543 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: fix up some host key functions for host_key2.cfactory-excelsior-12812.BJoel Kitching2019-12-254-69/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Deprecate: PublicKeyInit --> vb2_init_packed_key PublicKeyCopy --> vb2_copy_packed_key Rename: packed_key_looks_ok --> vb2_packed_key_looks_ok Move vb2_packed_key_looks_ok from host_key.c to host_key2.c. Move tests/vboot_common_tests.c to tests/vb2_host_key_tests.c. Remove firmware/lib/vboot_common.c. Remove host/lib/host_key.c. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I627b2af0416ac69460f9860614a69cad8bdb76a7 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844597 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: fold lib20/common.c into 2lib/2common.cJoel Kitching2019-12-244-304/+291
| | | | | | | | | | | | | | | Also rename tests. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: Ic79e7bc233ab93283d2be78ca9a08322b317d11d Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844600 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: change USB_BOOT_ON_DEV to use build flagJoel Kitching2019-12-243-12/+3
| | | | | | | | | | | | | | | | | | | | | Instead of calling VbExGetSwitches to essentially retrieve a compile-time config value from depthcharge, send this config value to vboot_reference as a build flag. Add a test based on the value of USB_BOOT_ON_DEV. BUG=b:124141368, chromium:1035761 TEST=make clean && make runtests TEST=Add CONFIG_USB_BOOT_ON_DEV to defconfig and flash to device Switch to dev mode and confirm dev_boot_usb with crossystem BRANCH=none Change-Id: I70a2e3fcd8c5cc252ca3d0eed81490a08503d7b3 Cq-Depend: chromium:1975346 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1975450 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: Add screen types for upcoming UI revampYu-Ping Wu2019-12-241-0/+22
| | | | | | | | | | | | | Add more screen types to enum VbScreenType_t for depthcharge to display. BRANCH=none BUG=b:146399181 TEST=emerge-nami depthcharge Change-Id: I85783e6de8aff8045caa5d9b32a0e570aab326ec Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1968268 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: remove VerifyVmlinuzInsideKBlob functionJoel Kitching2019-12-212-22/+0
| | | | | | | | | | | | | | | | Replace the use of VerifyVmlinuzInsideKBlob with vboot2-style vb2_verify_member_inside. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I2ffb52a4e7d7b93b2512923145db5f6ff4f3dfd5 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844599 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: relocate EC and auxfw sync API to 2api.hJoel Kitching2019-12-192-154/+156
| | | | | | | | | | | | | | | | Now that EC and auxfw software sync have been updated to vboot2-style code, relocate function headers to 2api.h. BUG=b:124141368, chromium:1016688 TEST=make clean && make runtests BRANCH=none Change-Id: Iad66b52452a90b13d3ff0ba8b4bced88fa1eb6e1 Cq-Depend: chromium:1973248 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1965925 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: remove unused 2nvstorage_fields.h from vb2_api.hfirmware-servo-12768.BJoel Kitching2019-12-171-3/+2
| | | | | | | | | | | | | | | | | | | | | 2nvstorage_fields.h is no longer needed for NEED_VB20_INTERNALS users. Remove it. The only headers left are 2misc.h (for vb2_get_sd() in coreboot) and 2struct.h (for VBSD->vb2_shared_data conversion in depthcharge). BUG=b:124141368, chromium:956474 TEST=make clean && make runtests TEST=Check that coreboot and depthcharge compile BRANCH=none Change-Id: I389b4f2828dca2934c5036df9dbfca03dc651bfa Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1971112 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: remove some vboot1 SharedData-related functionsJoel Kitching2019-12-174-112/+7
| | | | | | | | | | | | | | | | | | | | Remove VbSharedDataInit, VbSharedDataReserve, VbSharedDataSetKernelKey, along with their corresponding tests. In tests/verify_kernel and utility/load_kernel_test, just copy the kernel subkey manually for now, until we update LoadKernel to retrieve the key from vboot2 workbuf instead. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I7055be10f0d7a38502fd8108f0bc93c5b78f06c9 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844598 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: remove leftover legacy secdata symbolsJoel Kitching2019-12-132-14/+0
| | | | | | | | | | | | | | | | Remove leftover secdata and secdatak symbols. secdata_firmware and secdata_kernel should be used instead. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I89518242c447253c5a7c332257e126d31d76239c Cq-Depend: chromium:1967151 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1952562 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* 2lib: Move firmware body size reporting to separate functionJulius Werner2019-12-133-9/+24
| | | | | | | | | | | | | | | | | | | We used to return the firmware body size as part of vb2api_init_hash(). With persistent context and other recent developments, coreboot is caching less data itself and relying more on vboot's data structures, so it may now need this information at more points than just during the hashing process. So let's create a custom function to return this. BRANCH=hatch BUG=b:143994765 TEST=make runtests Cq-Depend: chromium:1965837 Change-Id: I2bc968cd163016fd0130416c2679724caad895a2 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1965920 Reviewed-by: Mathew King <mathewk@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Make 2nvstorage.h private to vboot_referenceYu-Ping Wu2019-12-131-1/+0
| | | | | | | | | | | | | | | | | Since 2nvstorage.h is no longer used in both coreboot and depthcharge (CL:1957766), remove the include of it from vb2_api.h. BRANCH=none BUG=chromium:789276 TEST=1. emerge-nami vboot_reference coreboot depthcharge 2. FEATURES=test emerge-nami vboot_reference Cq-Depend: chromium:1957766 Change-Id: I53ad0967abd440167547bcbf710c49787d011e15 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1957732 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: Publicize check_reboot_for_display()Yu-Ping Wu2019-12-134-28/+22
| | | | | | | | | | | | | | Publicize check_reboot_for_display() and rename it to vb2api_need_reboot_for_display() for depthcharge to use. BRANCH=none BUG=chromium:1030608 TEST=FEATURES=test emerge-nami vboot_reference Change-Id: Ie6c734850b67b29c8a098c3f232888f3ab47fddf Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1957726 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot/tpm2_lite: add FIRMWARE_NV_INDEX definitionJoel Kitching2019-12-121-1/+9
| | | | | | | | | | | | | | | | | | | | | | Add a FIRMWARE_NV_INDEX definition, and stop including the secdata_tpm.h header, which will soon be embarking on a new journey in depthcharge. It would be nice if we could avoid our TPM library knowing about specific space indices used by vboot. Leaving that as something to worry about in the future: chromium:1032930. BUG=b:124141368, chromium:972956, chromium:1032930 TEST=make clean && make runtests BRANCH=none Change-Id: I99bb04bbc2f4eef28cbe51ecf506078583238074 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1958068 Tested-by: Joel Kitching <kitching@chromium.org> Auto-Submit: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/tlcl: add stddef.h includeJoel Kitching2019-12-111-0/+1
| | | | | | | | | | | | | | Needed for size_t type. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Ia17b55178853768a065f9f49ea16e41b33ef1559 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1958069 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: Append periods to function descriptions in 2api.hYu-Ping Wu2019-12-101-2/+2
| | | | | | | | | | | BRANCH=none BUG=none TEST=FEATURES=test emerge-nami vboot_reference Change-Id: Id02f4a20a95c3653c4327b9cd7620b24bafb50a0 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1957999 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: merge vb2_struct.h into 2struct.hJoel Kitching2019-12-107-289/+194
| | | | | | | | | | | | | | | Also remove unused preamble structs in vboot_struct.h. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I8b41f24b55eba91b1f952415eda1b532732848eb Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844601 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove definition of VB_INIT_OUT flagsJoel Kitching2019-12-101-23/+0
| | | | | | | | | | | | | | | | These flags are no longer used. BUG=b:124141368, chromium:960226 TEST=make clean && make runtests BRANCH=none Change-Id: I0964ea834a190358ae10289c2746304369a79ff8 Cq-Depend: chromium:1957764 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1957725 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: remove VbExOverrideGptEntryPriorityJoel Kitching2019-12-073-24/+0
| | | | | | | | | | | | | | | | | This function was added with the sole intended user being BCB support on the depthcharge side. Now that BCB is deprecated, we can remove it. BUG=b:124141368, chromium:956474 TEST=make clean && make runtests BRANCH=none Change-Id: I4a99c540951b5e160bf50bcb790091d1df6eefc3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1954975 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: move vb2_allow_recovery function to 2miscJoel Kitching2019-12-067-36/+35
| | | | | | | | | | | | | | | | | Previously in vboot_common.c. This function "almost" only reads vboot2 data. As we would like to deprecate and remove the vboot_common.c file, find a new home for it. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Ice980604be3537741293bb9f6d31385c1d915887 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844596 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: remove unnecessary vboot_common.h includesJoel Kitching2019-12-067-4/+5
| | | | | | | | | | | | | BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I7daf97a88c71ff188c5812a30ca71d6c84823ae9 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844595 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: migrate GBB-related error handling to vboot2Joel Kitching2019-12-062-9/+5
| | | | | | | | | | | | | | | | Pass on values returned from vb2_gbb_* functions instead of using VBERROR_INVALID_GBB on error. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I66b99393f0fcc9eabe629d08b35247764cfbcefb Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1728296 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: convert LoadKernel and TryLoadKernel to vboot2-style errorsJoel Kitching2019-12-066-71/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert LoadKernel and TryLoadKernel to use vboot2-style error codes. Error codes are renamed as follows: VBERROR_NO_KERNEL_FOUND --> VB2_ERROR_LK_NO_KERNEL_FOUND VBERROR_INVALID_KERNEL_FOUND --> VB2_ERROR_LK_INVALID_KERNEL_FOUND VBERROR_NO_DISK_FOUND --> VB2_ERROR_LK_NO_DISK_FOUND Remove these error codes: VBERROR_LOAD_KERNEL_RECOVERY Remove VBSD_BOOT_DEV_SWITCH_ON check in vb2_developer_ui to align vboot_ui and vboot_ui_menu functionality. VBERROR_LOAD_KERNEL Unused. BUG=b:124141368, chromium:988410 TEST=make clean && make runtests BRANCH=none Change-Id: I90389c6629cc6055c4a4acbbbdd358bb79b63bf7 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1728297 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>