summaryrefslogtreecommitdiff
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
...
* Makefile: Explicitly signal success at the end of 'make runtests'Julius Werner2020-03-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | If you run 'make runtests' with -j (as you should because it takes forever), it can be hard to see if it passed successfully. A 'make: *** [Makefile:XXX: ...] Error 255' line might hide somewhere in the middle with a lot of successful output from other tests running in parallel hiding it. It's hard (I think?) to have make output something at the end (after joining all processes) when it has encountered an error, but at least it is easy to output something when the 'runtests' target finishes successfully. This patch adds such a highly visible success message, so that its absence will make it clear that there was an error further up. BRANCH=None BUG=None TEST='make runtests', both passing and failing Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: If979a7635f5c05c44a92daca12d31e344563794c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2116750 Reviewed-by: Joel Kitching <kitching@chromium.org>
* Makefile: Pull ebuild special cases into install targetsJulius Werner2020-03-271-14/+17
| | | | | | | | | | | | | | | | | | | | | | The install targets in the vboot Makefile are currently missing a few things that get manually fixed up by the ebuild (e.g. 'make install' installs the package-config files for hostlib but not the hostlib itself, which makes absolutely no sense). This isn't great because we have to update both sides every time we make changes there. This patch cleans up the install targets to handle those cases directly so they can be removed from the ebuild. BRANCH=None BUG=None TEST=Compared output of 'equery f vboot_reference' before and after, for both SDK and board builds. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: Ibacec8f5fd3983fc3e9040da01dcedb5d4d1a61b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2113712 Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: Introduce menu UIHsuan Ting Chen2020-03-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | According to crbug.com/1033815, add files for MENU_UI: - 2ui.{c,h} for entry point functions called by kernel selection. - vb2_ui_tests.c for tests (normal boot included). There are three entry points: vb2_developer_menu(), vb2_broken_recovery_menu(), and vb2_manual_recovery_menu(). Only infinite loop for this CL, others will be added in separate CLs. BRANCH=none BUG=b:146399181,chromium:1033815 TEST=USE="legacy_clamshell_ui" emerge-nami vboot_reference depthcharge TEST=USE="legacy_menu_ui" emerge-nami vboot_reference depthcharge TEST=USE="menu_ui" emerge-nami vboot_reference depthcharge TEST=make runtests Cq-Depend: chromium:2043102 Change-Id: I5a23eb006754b5ff08eb42bcd5021374995eab40 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2087557 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* host: add host library for accessing chromeos-configrelease-R82-12974.BJack Rosenthal2020-03-131-0/+3
| | | | | | | | | | | | | | | | | | | | Host side library for accessing chromeos-config. Initially, this will be used by futility to access the /firmware:image-name property during a firmware update. More background: go/mosys-firmware-name (note: despite the name "mosys" in the design doc, this is an effort to *not* rely on mosys during the firmware update) BUG=chromium:1061192 BRANCH=none TEST=provided unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ib8e5f8f836a93695e3b30731ae227501f37c4633 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2099449 Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: create 2kernel.c for kernel-related functionsJoel Kitching2020-03-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | Create 2kernel.c for kernel-related functions (including both internal and API-facing). Relocate functions which are currently in active use from lib20/api_kernel.c to 2lib/2kernel.c. Create vb2_kernel_tests.c and move appropriate tests there. Tests for vb2_normal_boot (previously VbBootNormal) will be added in a subsequent CL. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I153ea318ba238b7b30bf871105388437f63075d1 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2091126 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: Rename legacy UIsHsuan Ting Chen2020-02-121-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to crbug.com/1033815, rename files and entry point functions for two legacy UIs. Ideally, these UIs will be deprecated after the detachable UI revamp (b:146399181) is done. common: - rename vboot_ui_common.{c,h} to vboot_ui_legacy_common.{c,h} LEGACY_CLAMSHELL_UI: - rename vboot_ui.c to vboot_ui_legacy_clamshell.c - rename vboot_ui_wilco.c to vboot_ui_legacy_wilco.c - rename VbBootRecovery() to VbBootRecoveryLegacyClamshell() - rename VbBootDiagnostic() to VbBootDiagnosticLegacyClamshell() - rename VbBootDeveloper() to VbBootDeveloperLegacyClamshell() LEGACY_MENU_UI: - rename vboot_ui_menu.c to vboot_ui_legacy_menu.c - rename vboot_ui_menu_private.h to vboot_ui_legacy_menu_private.h - rename VbBootRecoveryMenu() to VbBootRecoveryLegacyMenu() - rename VbBootDeveloperMenu() to VbBootDeveloperLegacyMenu() BRANCH=none BUG=b:146399181,chromium:1033815 TEST=USE="legacy_clamshell_ui" emerge-nami vboot_reference TEST=USE="legacy_menu_ui" emerge-nami vboot_reference Change-Id: I70dafbab0070b19ed963d2a4ba63a95f4a0f3224 Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2008980 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: move dumpRSAPublicKey from SDK into BOARD installJoel Kitching2020-02-111-1/+1
| | | | | | | | | | | | | | | | | This utility is used for firmware_UpdateFirmwareDataKeyVersion and firmware_UpdateKernelDataKeyVersion tests, and needs to be available on the DUT. BUG=b:149102664 TEST=None BRANCH=none Change-Id: I5e7d554356d891c165990a5cdda6ba47d5a3918f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2050423 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Mathew King <mathewk@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Greg Edelston <gredelston@google.com>
* vboot: merge different FWLIB_SRC versions into oneJoel Kitching2020-02-111-27/+18
| | | | | | | | | | | | | | | | Since we are only building one fwlib library now, merge FWLIB_SRCS, FWLIB2X_SRCS, and FWLIB_20_SRCS into one. Remove the corresponding OBJS variables appropriately. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I190f3ca99ca67063fe0013dd490ef8869cd8f57c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1969258 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: move vboot 2.1 functions and structs into host codeJoel Kitching2020-02-111-17/+10
| | | | | | | | | | | | | | | | | | 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-111-12/+0
| | | | | | | | | | | | | | 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: remove fwlib2x, fwlib20, fwlib21 targetsJoel Kitching2020-02-081-45/+6
| | | | | | | | | | | | | | | All vboot "versions" are being coalesced into one, accessible via the vboot_fw.a library, which is built by the fwlib target. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I9ea7f067c9ac732eff7e63aa49e5303b340ede8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1961714 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: enable futility tests by defaultJoel Kitching2020-02-081-3/+1
| | | | | | | | | | | | | | | | | | Since CL:2039946, flakiness with test_update.sh should be fixed. Thus, we should enable futility tests. BUG=b:124141368, chromium:605348 TEST=make clean && make runtests TEST=attempt running on CQ BRANCH=none Change-Id: Ie97ca89fa9e4c792363c2a9cd467d8cbe7f373d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2043023 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: Deprecate VBSD_BOOT_REC_SWITCH_VIRTUALYu-Ping Wu2020-02-061-0/+7
| | | | | | | | | | | | | | | | | | 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-051-1/+2
| | | | | | | | | | | | | | | | | | 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: unify common.sh for testing scriptsstabilize-12881.BJoel Kitching2020-02-031-1/+1
| | | | | | | | | | | | | | | | Use tests/common.sh instead of tests/futility/common.sh. Correct SCRIPT_DIR value to allow running run_test_scripts.sh standalone without using Makefile. BUG=b:124141368, chromium:605348 TEST=make clean && make runfutiltests BRANCH=none Change-Id: I107952826ea9a3a3816d9c13206aa48bee63ac6c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2014236 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: get rid of MINIMAL in MakefileJoel Kitching2020-02-031-113/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Clean up install paths. The ebuild was adding /usr in the MINIMAL=1 case, making it look virtually exactly the same as the non-MINIMAL case. Just unify the two. - Introduce SDK_BUILD variable to take over part of the functionality previously implemented by MINIMAL. - One may now use rununittests for quick test runs instead of setting MINIMAL=1. - runtestscripts is added to the default test set under "runtests". runfutiltests is not yet enabled due to flakiness (see chromium:1048048). - Remove unused LZMA_LIBS and YAML_LIBS. - Stop installing dev-mode-only scripts into /usr/bin for an SDK build (VB_DIR). Presumably this was meant for board builds, but since everyone is used to these scripts living in /usr/share/vboot/bin, we may as well keep them there. - Stop installing crossystem for an SDK build. - Group SIGNING_SCRIPTS into UTIL_SCRIPTS_BOARD. - Have install_for_test depend on test_setup instead of vice versa. Targets which run tests should depend on install_for_test. BUG=b:124141368, chromium:605348, chromium:1048048 TEST=make clean && make runtests TEST=make clean && make rununittests TEST=sudo emerge vboot_reference, check installed files TEST=emerge-eve vboot_reference, check installed files TEST=USE=fuzzer emerge-eve vboot_reference TEST=FEATURES=test USE=fuzzer emerge-eve vboot_reference BRANCH=none Change-Id: I203e69143e40ee42729488bf0ab59f5120649bd1 Cq-Depend: chromium:2012183 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2012182 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* Enable format string warnings for vb2ex_printf()stabilize-12859.BJulius Werner2020-01-251-1/+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: remove secdata TPM backend codeJoel Kitching2020-01-221-19/+7
| | | | | | | | | | | | | | | | | | | | 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>
* 2sha: Add a vb2_hash type to make it easier to work with hashesJulius Werner2020-01-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | 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: apply UNROLL_LOOPS globally rather than to fwlibsJoel Kitching2020-01-101-4/+1
| | | | | | | | | | | | | | Unrolled loops for everyone! BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I22f0950be2aebcee7a988618f7b6a5ee3796de14 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1973673 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-091-0/+7
| | | | | | | | | | | | | | | 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-091-0/+7
| | | | | | | | | | | | | | | 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-071-0/+9
| | | | | | | | | | | | | | | | 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-251-4/+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-241-11/+9
| | | | | | | | | | | | | | | 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-241-0/+7
| | | | | | | | | | | | | | | | | | | | | 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: remove some vboot1 SharedData-related functionsJoel Kitching2019-12-171-1/+0
| | | | | | | | | | | | | | | | | | | | 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 support for _s suffixed binaries in MakefileJoel Kitching2019-12-111-4/+0
| | | | | | | | | | | | | | | | | | | This suffix was used for static files, e.g. futility_s and crossystem_s. Since there's no longer any need to statically link any binaries built by vboot_reference, remove this support from the Makefile. BUG=b:124141368, chromium:765499 TEST=make clean && make runtests BRANCH=none Change-Id: Ia333c86e3466311b96bb111bb7e9a92789379792 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1960185 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>
* crossystem: change mosys calls to use the subprocess libraryJack Rosenthal2019-12-101-0/+1
| | | | | | | | | | | | | | | The new subprocess_run library function provides a unit-tested way to call subprocesses and collect output. BUG=chromium:1030473 BRANCH=none TEST=On drallion and druwl, crossystem works for both reading and writing Change-Id: I072d91cf68ee91c663652d2c0433ef8bbedad7d7 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1955806 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: remove static linking support from MakefileJoel Kitching2019-12-091-12/+3
| | | | | | | | | | | | | | | | | | Previously, futility and crossystem needed to be statically linked. (futility had both futility and futility_s.) Since there's no longer any need to statically link any binaries built by vboot_reference, remove this support from the Makefile. BUG=b:124141368, chromium:765499 TEST=make clean && make runtests BRANCH=none Change-Id: I8c2b5c5b5aa86bbecb0c264f688dfdac4b19ca7e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1954976 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* host/lib: add a subprocess libraryJack Rosenthal2019-12-071-0/+3
| | | | | | | | | | | | | | | | | | | This is a powerful library for interacting with processes. We'll be able to clean up much of the code which manually sets up the pipes and calls exec* with this well-tested and expressive abstraction. This code will initially be used in crossystem for calling out to flashrom instead of relying on mosys. BUG=chromium:1030473 BRANCH=none TEST=provided unit tests Change-Id: I56f28419406d0b1299bb91058dd4500079b2435e Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1955805 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* Makefile: Make loop unrolling fully controllable by the callerJulius Werner2019-12-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | We recently reactivated the -DUNROLL_LOOPS code for x86 devices. Unfortunatley, this seems to lead to code size problems for early firmware stages on certain x86 boards (CB:37475). The biggest speedup with unrolled loops was observed during kernel verification anyway (which hashes orders of magnitude more data than firmware verification), so let's make this fully configurable by the calling firmware and only enable it from depthcharge. Pre-RAM coreboot changes are probably better served with the smaller implementation anyway (and this will only become more important as we move to CBFS per-file hashing and need hash algorithms in every stage). BRANCH=None BUG=None TEST=None Cq-Depend: chromium:1951413 Change-Id: I87eaa14299cae0ee0d0b4a098d638b6bccdaf75b Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1951782 Reviewed-by: Aaron Durbin <adurbin@google.com> Reviewed-by: Subrata Banik <subrata.banik@intel.com>
* vboot/secdata: rewrite rollback_index and centralize reads/writesJoel Kitching2019-11-281-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In current kernel verification code, secdata reads and writes are spread throughout the code. vboot2's design is to use vb2_context.secdata_* for storing the state of secdata spaces, and have the caller (depthcharge) read/save this field when necessary. Centralize secdata reads/writes into the functions of secdata_tpm.c, previously known as rollback_index.c. Functions which directly read/write to the TPM space are modified to use vb2_secdata_*_get and vb2_secdata_*_set. The secure spaces get read/flushed by functions in vboot_api_kernel.c. These calls and the underlying functions from secdata_tpm.c will eventually be relocated to depthcharge. Create a new external function vb2ex_commit_data, which commits any modified nvdata/secdata. Currently the depthcharge implementation of this function only writes nvdata, but once secdata TPM drivers have been migrated from vboot_reference to depthcharge, it will also commit these data spaces. This CL also removes the VbExNvStorageRead call from vb2_kernel_setup, and the data is instead read in depthcharge CL:1819379, right before calling VbSelectAndLoadKernel. As such, both the VbExNvStorageRead and VbExNvStorageWrite functions may be removed. Finally, create a vb2_secdata_kernel_lock function, which should be used right before attempting to leave vboot (by booting an OS or chainloading to another firmware). This should eventually be exposed as a vb2ex_ API function and relocated to depthcharge. BUG=b:124141368, chromium:972956, chromium:1006689 TEST=make clean && make runtests BRANCH=none Change-Id: Ifbfb21122af0bf85e22a6d3a0d48a1db7f7c25b7 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1819380, chromium:1939168 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1728298 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* futility: updater: move system-related utility functions to updater_utilsHung-Te Lin2019-11-221-0/+1
| | | | | | | | | | | | | | | | | | | | | The firmware updater (updater.c) is bloated so we should move functions that are not really related to 'updating logic' to a new file, updater_utils.c. Refactor only by moving functions (and renamed few functions), no changes in updater logic. BRANCH=none BUG=chromium:1024401 TEST=make clean && make runtests Change-Id: I98339c5c4a81845b36daf842c79625fa2389c7f0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1926009 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Auto-Submit: Hung-Te Lin <hungte@chromium.org>
* Makefile: Define UNROLL_LOOPS to save ~50ms of boot timefactory-hatch-12692.BSubrata Banik2019-11-191-1/+1
| | | | | | | | | | | | | | | | | | TEST=Able to save ~50ms of bootime with this CL Without this CL 1100:finished vboot kernel verification 802,443 (148,108) With this CL 1100:finished vboot kernel verification 775,914 (102,601) Signed-off-by: Subrata Banik <subrata.banik@intel.com> Change-Id: I96bea22667ebf45b446a26d84de96e52f3d28aa0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1919094 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org>
* Makefile: Fix typo for MOCK_TPMJulius Werner2019-11-191-1/+1
| | | | | | | | | | | | | | | CL:1900560 broke MOCK_TPM due to a typo in the Makefile. This patch fixes it. BRANCH=None BUG=None TEST=None Change-Id: Ifd23ad764029b72af3fb03cf9dd52faefa586a80 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1922491 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* Split TLCL functionality out into a new libraryTim Wawrzynczak2019-11-181-7/+20
| | | | | | | | | | | | | | | | This patch splits out the TPM functionality into a separate library called TLCL (TPM lightweight command library). This is to avoid linking in TLCL code two times and causing duplicate references. BUG=none BRANCH=none TEST=make clean && make runtests Cq-Depend: chromium:1901882 Change-Id: I56e961c066b2df1d1e19f632b834b11625454f59 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1900560 Reviewed-by: Julius Werner <jwerner@chromium.org>
* Auxfw sync: Move auxfw specific tests to a new fileTim Wawrzynczak2019-11-151-0/+2
| | | | | | | | | | | BUG=b:143094352 BRANCH=none TEST=make clean && make runtests Change-Id: I3665bfb10c66e2fbe3906e99cc72346748123cfb Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1873879 Reviewed-by: Julius Werner <jwerner@chromium.org>
* crossystem: Add a fake workbuffer for the fake contextJulius Werner2019-11-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | crossystem functions just make up a fake vb2_context for calling into things like vb2_nv_init(), but that function actually accesses vb2_shared_data as well. This used to work because vb2_get_sd() would return NULL in that case and vb2_nv_init() actually checks for that, but with the persistent context model this is no longer possible and making up directly allocated contexts is always illegal. This patch adds a small fake workbuffer to the fake context so we can have real backing storage for shared data. (This might not be the final way we want to fix it but should work as a quick band-aid over the crashes.) Also remove the now pointless (sd == NULL) checks from vb2_nv_init(). BRANCH=None BUG=chromium:1024732 TEST=make runtests Change-Id: I91247013f092bbfc41cf1974b82cf70a29fa4734 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1917486 Tested-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Brian Norris <briannorris@chromium.org>
* 2lib: Move context-related functions from 2misc.c into 2context.cJulius Werner2019-11-141-0/+1
| | | | | | | | | | | | | | | | | | | | This patch separates out some code into an extra file so that it's easier to link into hostlib without pulling in all additional dependencies from the random 2misc.c crap. The functions are copied wholesale with no changes. BRANCH=None BUG=chromium:1024732 TEST=make runtests Change-Id: Ia00d1da277e5fc0956c8a1ae608d842224016c91 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1917819 Tested-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org> Commit-Queue: Brian Norris <briannorris@chromium.org>
* EC software sync: Split up EC and auxfw syncTim Wawrzynczak2019-11-141-0/+1
| | | | | | | | | | | | | | | | | | | Currently, the logic for updating auxfw is entangled with the logic for performing EC software sync. This patch attempts to split them apart, so that they can be used separately. VbSelectAndLoadKernel() currently still performs both, EC first and then auxfw. The intended use-case for this functionality is to perform EC software sync only in coreboot's romstage. Unit tests were updated to ensure functionality is effectively unchanged. BUG=b:143094352, chromium:1016688 BRANCH=none TEST=make clean && make runtests Change-Id: I7bdf38694cfed83b18dd8189b8516780184ecc8e Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1867314 Reviewed-by: Julius Werner <jwerner@chromium.org>
* EC sync: Drop support for "PD" software sync.Tim Wawrzynczak2019-11-131-4/+0
| | | | | | | | | | | | | | | | All devices which have a PD chip running CrOS EC code have already shipped, and there is no intention to go back to using an "EC" for a TCPC anymore. BUG=b:143762298,chromium:1017093 BRANCH=none TEST=make runtests Change-Id: I177c00581089de59e4f35608b97ef5432e8b492b Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1895712 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: keep const and non-const signature and key accessorsJoel Kitching2019-10-291-1/+0
| | | | | | | | | | | | | | | | | | | | | Keep const (default) and non-const (_mutable suffix) versions of `data` field accessors for vb2_signature and vb2_packed_key. No need for separate 2packed_key.c file -- just static inline the functions. vb2_verify_packed_key_inside should return type vb2_error_t. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I96722a746f26abbb6e19a365ce74f0bfda0da381 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1786386 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* Always pass "-g" when building.Manoj Gupta2019-10-281-1/+1
| | | | | | | | | | | | | | | | Always build vboot_reference with "-g" irrespective of debug mode. Building with "-g" will allow much better stack traces and debug information when debugging. Portage will strip the debug binaries so the size of final files installed on DUT will stay unchanged. BUG=chromium:1017793 TEST="-g" is passed to builds. Change-Id: Id6a718bc31afe4a12243ddbb1c45d411ab9791f0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1884690 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: move ec_sync to vboot2 namespaceJoel Kitching2019-10-251-3/+3
| | | | | | | | | | | | | | | | | Move ec_sync.c to vboot2 namespace. Keep its API in vboot_api.h for the time being. BUG=b:124141368, chromium:1016688, b:112198832, b:143094352 TEST=make clean && make runtests BRANCH=none Change-Id: Ia925e93ecdcdb1a2a2724336774f48dbe0439743 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1872254 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Sean Abraham <seanabraham@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* vboot: merge ec_sync and ec_sync_allJoel Kitching2019-10-251-1/+0
| | | | | | | | | | | | | | | | | | | Merge ec_sync and ec_sync_all in preparation for EC and auxfw refactoring. This CL just moves code around without actually making any modifications. BUG=b:124141368, chromium:1016688, b:112198832, b:143094352 TEST=make clean && make runtests BRANCH=none Change-Id: I833c429e36a8f75e9b6d8f21aeb4c8c92c860256 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1872253 Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Sean Abraham <seanabraham@chromium.org>
* vboot: fold lib20/api.c into 2lib/2api.cJoel Kitching2019-10-231-3/+0
| | | | | | | | | | | | | | | | | All of the functions in lib20/api.c are actively used in coreboot verstage firmware verification. Fold the functions and their test suite into 2lib. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I2dbad2715246a8a16ee85dac553a751ae1590afa Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1659991 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: make BROKEN screen code for saving nvdata more consistentJoel Kitching2019-10-231-6/+0
| | | | | | | | | | | | | | | | | | | | Remove SAVE_LOCALE_IMMEDIATELY. Check for VB2_CONTEXT_RECOVERY_MODE and !vb2_allow_recovery() before committing nvdata. Ensure comments are consistent. BUG=b:124141368, chromium:1006689 TEST=make clean && make runtests BRANCH=none Change-Id: I6919fb858f999c6d8b81a090dc1f271756bc7dc4 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1840192 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* tests: Add fuzzers for payload and preamble parsingJulius Werner2019-10-221-1/+3
| | | | | | | | | | | | | | | This patch adds fuzzers for vb2_load_fw_keyblock() and vb2_load_fw_preamble(). I'm new at fuzzing so please let me know if I did something dumb. BRANCH=None BUG=None TEST=Ran them manually with cros_fuzz. Change-Id: Ica39fcf4a3d250e69c51214afcee9e9815667ff8 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1867969 Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* tests: Add cgpt fuzzer.stabilize-12607.6.Bstabilize-12607.5.Bstabilize-12607.3.Bstabilize-12607.15.BMattias Nissler2019-10-171-0/+22
| | | | | | | | | | | | | | This adds a fuzzer binary to exercise GPT parsing. BUG=chromium:1014101 TEST=Build and run fuzzer. BRANCH=none Change-Id: Idecc0ddf491e976d4e01f5778e51a01ac317d961 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1859595 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>