summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* vboot: unify common.sh for testing scriptsstabilize-12881.BJoel Kitching2020-02-0314-166/+104
| | | | | | | | | | | | | | | | 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-032-114/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* 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-017-29/+8
| | | | | | | | | | | | | | | | 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-283-17/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-257-18/+19
| | | | | | | | | | | | | | | | | | | 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
* keygeneration: add helper for generating update payload keysMike Frysinger2020-01-241-0/+8
| | | | | | | | | | | | | | We don't use this anywhere as we've only ever generated one key so far. But we never wrote this down, so this is more documentation. BUG=None TEST=ran the code manually BRANCH=None Change-Id: Ia9a318c686b1ad7ab1de31899b49ce73a4d5ad9f Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1947554 Reviewed-by: George Engelbrecht <engeg@google.com>
* vb2_sha_api_tests: Silence UBSAN warning for zero length array accessJulius Werner2020-01-241-1/+4
| | | | | | | | | | | | | | | | Looks like UBSAN doesn't like zero-length arrays. We use those all the time in firmware, but I guess that's the reason we don't even try to run UBSAN on the real firmware repos. For this particular case in vboot's tests, it's easy enough to work around. BRANCH=None BUG=chromium:1043405 TEST=make runtests Change-Id: Ia799fdc57ee17dc46b55920dd1d2601adf98d3f7 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2008766 Reviewed-by: Joel Kitching <kitching@chromium.org>
* 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-2223-1078/+89
| | | | | | | | | | | | | | | | | | | | 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>
* crossystem: Add support for JSL gpiochipUsha P2020-01-221-0/+1
| | | | | | | | | | | | | | On JSL platform, the pinctrl (gpiochip) driver label is "INT34C8:00", hence declare it properly. Change-Id: I401f095f262739dcb872b7fe9d64f52ee9ff17ce Signed-off-by: Usha P <usha.p@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1966885 Reviewed-by: Subrata Banik <subrata.banik@intel.com> Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Kirtika Ruchandani <kirtika@chromium.org> Commit-Queue: Kirtika Ruchandani <kirtika@chromium.org> Tested-by: Kirtika Ruchandani <kirtika@chromium.org>
* vboot: translate recovery reason info from vboot 2->1Joel Kitching2020-01-213-13/+18
| | | | | | | | | | | | | | | | | | | 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>
* futility: updater: Add '--servo' for updating via Servo-V2 and ServoMicroHung-Te Lin2020-01-203-0/+69
| | | | | | | | | | | | | | | | | | | | | Flashing via Servo V2 and Servo Micro was known to be a complicated. With the new virtual control 'cpu_fw_spi' we have a better way to prepare servo in an unified way. The new '--servo' will detect servo type and pick up the right params (for servo v2, servo micro, servo v4 with ccd, or servo v4 + micro) for programming. BRANCH=None BUG=None TEST=make runtest; sudo futility update --servo -i image.bin Cq-Depend: chromium:1966176 Change-Id: Ia14288b1bd5f24acfc4fb85ba64c2c445152a3a7 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1966872 Reviewed-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* vboot: Set VBSD_EC_SOFTWARE_SYNC flag in vbootYu-Ping Wu2020-01-202-6/+6
| | | | | | | | | | | | | | | | 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-174-47/+40
| | | | | | | | | | | | | | | | | 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-162-8/+4
| | | | | | | | | | | | | | | | 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>
* tests/vb2_firmware_tests: Improve workbuffer usage testJulius Werner2020-01-163-36/+89
| | | | | | | | | | | | | | | | | | | | | | | This patch changes vb2_firmware_tests to run multiple times with different combinations of signature and hash algorithms. The goal is to have more confidence that our recommended work buffer size is still big enough even if we changed algorithm combinations in an RW update. It also changes the underlying vb20_verify_fw to not just print the amount of work buffer used at the end, but to detect the actual high water mark of work buffer used during the test. Also add some fallback definitions for undefined environment variables to tests/common.sh which helps running individual test scripts without the Makefile harness. BRANCH=None BUG=None TEST=make runtests Change-Id: I14519cd7c76a9886bd11ebf5312458ab658e6f75 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1967976 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: rename FAFT_KEY_OVERIDE and clarify its useJoel Kitching2020-01-162-3/+9
| | | | | | | | | | | | | | | 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-165-4/+199
| | | | | | | | | | | | | | | | | | | | | | 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 kernel tests: Refactored vendor-data-specific testsPranay Shoroff2020-01-141-50/+56
| | | | | | | | | | | | | | | No additional features added, simply moved tests relating to setting vendor data to a separate function BUG=b:138812835 BRANCH=none TEST=Run 'FEATURES=test emerge-drallion vboot_reference' and verify tests run Change-Id: Ib9c1d32a4cd149c0e5eb464b7f9b4b17839c42d3 Signed-off-by: Pranay Shoroff <pshoroff@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1999043 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: remove VBSD from tests that don't need itJoel Kitching2020-01-117-32/+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-107-42/+39
| | | | | | | | | | | | | | | | | | 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: 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-093-3/+11
| | | | | | | | | | | | | | | 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-093-3/+11
| | | | | | | | | | | | | | | 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>
* futility: updater: override signature id for phaser360Paul Ma2020-01-085-1/+86
| | | | | | | | | | | | | | | | | | | | | | Because of lacking CL:1501614 in octopus factory branch, dopefish root key is written to some phaser360 devices. That will lead to firmware updater not be able to verify RW vblock and AU will fail. This CL will fix that by using root key info and model name to make firmware updater get a proper sig_id so that in-field machines can be updated by AU. BUG=b:146876241, b:133901651, b:146482979 BRANCH=none TEST=using a DUT of phaser360 (without whitelabel_tag = dopefish) which is flashed dopefish rootkey and hwid, using command 'chromeos-firmwareupdate -m autoupdate --wp=1' to flash firmware, RW firmware can be updated and DUT can boot normally. Change-Id: I163c16189c28a996ed08bf2a7b162e6ee3b13be6 Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1981650 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* vboot: Deprecate VB2_CONTEXT_DETACHABLE_UIYu-Ping Wu2020-01-073-4/+17
| | | | | | | | | | | | | | | | 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>
* crossystem: Fix error message when passing invalid parameterYu-Ping Wu2020-01-061-7/+25
| | | | | | | | | | | | | | | When setting crossystem parameters with various errors, the error message was always "Parameter dev_default_boot is read-only". Display various error messages based on the types of errors. BRANCH=none BUG=chromium:965799 TEST=emerge-nami vboot_reference Change-Id: I185ce5f9c142da538f86b6c6c298f5a76377e395 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1982431 Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: fix up some host key functions for host_key2.cfactory-excelsior-12812.BJoel Kitching2019-12-2519-157/+61
| | | | | | | | | | | | | | | | | | | | | | | | | 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-248-344/+300
| | | | | | | | | | | | | | | 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-245-12/+12
| | | | | | | | | | | | | | | | | | | | | 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-213-26/+5
| | | | | | | | | | | | | | | | 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-1716-215/+46
| | | | | | | | | | | | | | | | | | | | 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-135-27/+50
| | | | | | | | | | | | | | | | | | | 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-135-28/+41
| | | | | | | | | | | | | | 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>
* lib/subprocess: add callback feature to the subprocess libraryJack Rosenthal2019-12-113-34/+251
| | | | | | | | | | | | | | | | | | For the libflashrom-compatible interface I'm working on, I needed the ability to process data from the flashrom subprocess in a callback function. This adds a new type of subprocess_target, TARGET_CALLBACK, which can read and write to/from a callback function. BUG=chromium:478356 BRANCH=none TEST=provided unit tests Change-Id: I20b71000fc2b6b297a8617d2b03d0e91813007d1 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1959944 Reviewed-by: Julius Werner <jwerner@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>
* 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-1016-305/+199
| | | | | | | | | | | | | | | 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>
* lib/subprocess: style updatesstabilize-12748.BJack Rosenthal2019-12-103-22/+25
| | | | | | | | | | | | | | | Just resolving some style comments left on CL:1955805. The CL merged by CQ before I noticed the comments. BUG=none BRANCH=none TEST=compiles Change-Id: I286343e3ee2ecb4cb6092ca99fa46c4a80442e03 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1957760 Tested-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* crossystem: change mosys calls to use the subprocess libraryJack Rosenthal2019-12-102-70/+18
| | | | | | | | | | | | | | | 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>