summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* cgpt: Change stateful partition type GUID to TYPE_LINUX_FSstabilize-12593.Bfactory-kukui-12587.BHung-Te Lin2019-10-093-3/+5
| | | | | | | | | | | | | | | | | | | | | The TYPE_BASIC_DATA (called TYPE_LINUX_DATA before) is used by both Windows and Linux systems, and has caused problems when dual-booting. Modern Linux systems have been changed to TYPE_LINUX_FS. In Chrome OS, we usually find the stateful partition by number (1) instead of searching by type, so it should be fine simply replacing default mapping in the cgpt tool. BUG=chromium:944389 TEST=sudo emerge vboot_reference; make runtests BRANCH=None Change-Id: If18ff5180cbae5cdea8104f36203cffcf34db934 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1535456 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Matt Delco <delco@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Make vboot_version extern in headerLeonard Chan2019-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | When enabling `-fno-common` in Fuchsia, we get a bunch of linker errors when linking futility: ``` ld.lld: error: duplicate symbol: vboot_version >>> defined at futility.h:43 (../../third_party/vboot_reference/futility/futility.h:43) >>> host_x63-asan_no_detect_leaks/obj/third_party/vboot_reference/futility/futility.cmd_bdb.c.o:(vboot_version) >>> defined at futility.h:43 (../../third_party/vboot_reference/futility/futility.h:43) >>> host_x64-asan_no_detect_leaks/obj/third_party/vboot_reference/futility/futility.cmd_create.c.o:(.bss.vboot_version+0x0) ``` and think this is because -fno-common places vboot_version for unitialized global variables in the BSS section of each object file. Making it extern instead resolves each reference to its definition in futility/misc.c. Change-Id: I591f07abd1f975a8a9d078bb4366e2e0861390b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1839207 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org> Tested-by: Julius Werner <jwerner@chromium.org>
* vboot: remove VbVerifyMemoryBootImage functionJoel Kitching2019-10-024-490/+0
| | | | | | | | | | | | | | | Previously used for fastboot. BUG=b:124141368, chromium:995172 TEST=make clean && make runtests BRANCH=none Change-Id: I960932526bbd4482707125700cfa63e94c9f356b Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1776290 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: remove linktest filesJoel Kitching2019-10-024-180/+4
| | | | | | | | | | | | | | | | Remove linktest files, which were previously used to ensure that firmware lib doesn't rely on outside libraries. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I694ca51007b05213d4b105f183bb34ad25e2ddbd Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1813123 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: join vb2_fail and vb2api_failJoel Kitching2019-10-0211-69/+58
| | | | | | | | | | | | | | | | As previously discussed with jwerner@, API functions should not distinguish between "internal" and "external" versions. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Iea4fb430dbd56110639f52bdb7d8d3aaae7ee293 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1830240 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: fix compile error with MOCK_TPMstabilize-12560.BJoel Kitching2019-10-011-1/+1
| | | | | | | | | | | | | | | | | | | | In CL:1773088, we jumped the gun on an update to using the context object in RollbackFwmpRead, before actually updating the function to take vb2_context as an argument (which will occur in CL:1728298). BUG=b:124141368, chromium:972956 TEST=make clean && MOCK_TPM=1 make runtests BRANCH=none Change-Id: I0e1db6eafea169e73a806094ec6f385254fa563f Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1830238 Tested-by: Joel Kitching <kitching@chromium.org> Tested-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Ronak Kanabar <ronak.kanabar@intel.corp-partner.google.com> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Julius Werner <jwerner@chromium.org>
* x86/crossystem_arch: Free file descriptor if we fail to use itPatrick Georgi2019-09-271-2/+6
| | | | | | | | | | | | | | | Found by Coverity Scan #204275 BUG=none BRANCH=none TEST=Coverity run after this merged marks #204275 fixed Change-Id: I50e6300eabaf6bd0c1230b0cbd2d375ab1daf5d2 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1827293 Reviewed-by: Duncan Laurie <dlaurie@google.com> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org>
* firmware/lib20: Annotate sanitizing function for CoverityPatrick Georgi2019-09-261-0/+4
| | | | | | | | | | | | | | | | | | Coverity identifies a couple of issues with data read and then parsed, but it can't identify that the code checks it. Help coverity with an annotation. BUG=none BRANCH=none TEST=Should clear a couple of coverity errors, but it's hard to test offline. Change-Id: Icab3c6bdfeb4cc36b3c183ac2207c4a41c9cfaf1 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1815242 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* crossystem: avoid TOCTOU issuePatrick Georgi2019-09-261-2/+7
| | | | | | | | | | | | | | | Found by Coverity Scan #57203 BUG=none BRANCH=none TEST=none Change-Id: Ic04d1c7c3299ee5f779e7a8cf0359a8a1a751b5b Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1815240 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* futility: also clamp to natural valuesPatrick Georgi2019-09-231-1/+3
| | | | | | | | | | | | | | | Found by Coverity Scan #242 BUG=none BRANCH=none TEST=none Change-Id: I384044d36ee5e2e9d344c7af40d61c5e27fd75b4 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1815239 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* futility/cmd_update.c: free cfg before leaving contextPatrick Georgi2019-09-231-0/+1
| | | | | | | | | | | | | | | Found by Coverity Scan #198897 BUG=none BRANCH=none TEST=none Change-Id: Ib7e049c912a77fa5ad15a0f4638befd5596b7df4 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1815238 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* vboot: fix up some more includesJoel Kitching2019-09-23128-273/+203
| | | | | | | | | | | | | | | | Should have no extra line breaks in between local includes, and should be sorted alphabetically. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I83c25d30d7376712857314965a7d93f57190aa3f Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1776281 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/secdata: move struct definitions into 2secdata_struct.hJoel Kitching2019-09-238-121/+136
| | | | | | | | | | | | | | | | Makes it easier to prevent different parts of vboot from reading secdata structs without using accessor functions. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I407e1409409c6aab0c1f311f7715ce159497961b Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1776280 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/secdata: implement vboot2 FWMP supportJoel Kitching2019-09-2319-141/+692
| | | | | | | | | | | | | | | | | | | | | | Implement FWMP support in vboot2. Currently, the data structure is just accessed directly, checking to see whether its `flags` member contains particular flags. We'd like to change this to follow the same scheme as secdata_firmware and secdata_kernel. This CL also updates some functions, comments, and tests related to secdata_firmware and secdata_kernel to ensure consistency between code for the secdata spaces. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: Ia0d67532cc6e077e170ffb25d0bc587b1d53edf3 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1773088 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: add VB2_ASSERT and VB2_DIE macrosJoel Kitching2019-09-2314-34/+140
| | | | | | | | | | | | | | | | | | | | | | | | Sometimes vboot needs to make assertions to work sanely without always having to return VB2_ERROR_* values. Add VB2_ASSERT and VB2_DIE macros to deal with these cases. Convert existing VbAssert macro to use either VB2_ASSERT or TEST_* macros depending on the case. Implement testing infrastructure to check that aborts are being triggered correctly. The TEST_ASSERT macro should be used. BUG=b:124141368, chromium:1005700 TEST=make clean && make runtests BRANCH=none Change-Id: I298384ba50842a94a311df7f868f807bf2109cff Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1813277 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1800112 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* futility/cmd_update.c: free cfg before leaving contextPatrick Georgi2019-09-201-0/+1
| | | | | | | | | | | | | | | Found by Coverity Scan #198897 BUG=none BRANCH=none TEST=none Change-Id: I171571afe2492d15256df8388fa4a05bd8b10bf2 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1789711 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* futility/updater: clamp revision numberPatrick Georgi2019-09-201-2/+10
| | | | | | | | | | | | | | | Found by Coverity Scan #198901 BUG=none BRANCH=none TEST=none Change-Id: I6ebf5caa286bd64cddaa589a9e14f93185afbf90 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1789710 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* futility/updater: verify that data copied from stdin is completePatrick Georgi2019-09-201-1/+4
| | | | | | | | | | | | | | | Found by Coverity Scan #198910 BUG=none BRANCH=none TEST=none Change-Id: I609a3a1fe4d38b5c417608ef8574df6286dfbfda Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1789709 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* image_signing: drop set_chronos_password.shMike Frysinger2019-09-201-56/+0
| | | | | | | | | | | | | | | We're dropping this from the signer, so drop it from here too. Nothing else has referred to it. BUG=None TEST=CQ passes BRANCH=None Change-Id: I855ef036b620082ec98af7aac8ea330ae472435a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1814697 Reviewed-by: George Engelbrecht <engeg@google.com> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* Revert "Use bfd as the linker to build vboot_reference."Manoj Gupta2019-09-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4856877a76a90ab1851c0e24593ec67e6375a60a. Reason for revert: Root cause fixed by CL:1790955. Original change's description: > Use bfd as the linker to build vboot_reference. > > Coreboot uses vboot_reference to build futility as a host binary. > However, it passes a target path for linking which causes LLD to > error out. > e.g. x86_64-pc-linux-clang -L/build/veyron_minnie/usr/lib > where -L/build/veyron_minnie/usr/lib should not be passed > as futility is being linked as a host binary. > > Use bfd as the linker temporarily as it only produces a warning > and does not error out. > > BUG=chromium:999217 > TEST=coreboot builds > BRANCH=None > > Change-Id: I8716ff3a0b4cc8afc54a3cc95ca5c1bfdcba6c9f > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1789676 > Tested-by: Manoj Gupta <manojgupta@chromium.org> > Reviewed-by: Julius Werner <jwerner@chromium.org> > Commit-Queue: Manoj Gupta <manojgupta@chromium.org> Bug: chromium:999217 Change-Id: Ibf69ca06e3ae2e681176499b23c673eda8d77b6c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1790956 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* futility/updater: Check that image exists before digging into itstabilize-12515.Bstabilize-12499.18.Brelease-R78-12499.BPatrick Georgi2019-09-091-0/+5
| | | | | | | | | | | | | | | | Found by Coverity Scan BUG=none BRANCH=none TEST=none Change-Id: I2544a4e84ecadc262e08aaa4e6f056d710d807f5 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1771972 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* sign_cr50_firmware.sh: allow signing MP images.LaMont Jones2019-09-081-8/+9
| | | | | | | | | | | | | | | Allow MP images to be signed. Also, the manifest file name changed. BRANCH=none BUG=b:74100307 TEST=manual Change-Id: Ia6b4724ceea2b7a18a2caecea7142d1b6ebfaa13 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1791816 Reviewed-by: LaMont Jones <lamontjones@chromium.org> Commit-Queue: LaMont Jones <lamontjones@chromium.org> Tested-by: LaMont Jones <lamontjones@chromium.org> Auto-Submit: LaMont Jones <lamontjones@chromium.org>
* Use bfd as the linker to build vboot_reference.Manoj Gupta2019-09-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | Coreboot uses vboot_reference to build futility as a host binary. However, it passes a target path for linking which causes LLD to error out. e.g. x86_64-pc-linux-clang -L/build/veyron_minnie/usr/lib where -L/build/veyron_minnie/usr/lib should not be passed as futility is being linked as a host binary. Use bfd as the linker temporarily as it only produces a warning and does not error out. BUG=chromium:999217 TEST=coreboot builds BRANCH=None Change-Id: I8716ff3a0b4cc8afc54a3cc95ca5c1bfdcba6c9f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1789676 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* vboot/secdata: rename rollback_index to secdata_tpmJoel Kitching2019-09-0522-69/+35
| | | | | | | | | | | | | | | | | | | | | | | | | These secure spaces are now used for more than just rollback versions and should be renamed thus. Note: Originally this rename operation was batched into the CL which rewrites the functions in rollback_index/secdata_tpm, but it made reviewing in Gerrit a pain, since it couldn't pick up on the file renames, and instead showed them as deletes/adds. Doing the rename separately helps ensure all references to rollback_index are updated, and gives us a better review experience in Gerrit. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I51e5c731e0d7a071d384c28da56e7adce64ba943 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1776279 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/secdata: remove TPMClearAndReenable function mockJoel Kitching2019-09-051-6/+0
| | | | | | | | | | | | | | | | | | | This function is only used internally in rollback_index.c and thus does not need a mock. (It does need to be listed in rollback_index.h since it must be accessible by tests.) BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: Ib7ce907da82608de7e5c6c2be11c57bf353ca0b3 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1780088 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/secdata: fix up macros in rollback_index.cJoel Kitching2019-09-051-10/+6
| | | | | | | | | | | | | | | | Remove the unnecessary offsetof declaration in rollback_index.c, and fix some macro formatting. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I156a0561070e03f978fff307d3dbfafde09e0adf Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1773093 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: no need to compile C++ files in MakefileJoel Kitching2019-09-051-5/+0
| | | | | | | | | | | | | | | | | The last remaining C++ files were removed in CL:367882. vboot_reference does not have any C++ files anymore, and thus does not need this rule in its Makefile. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Id59b2e593b1748293f045e5f7152ec2647ba7342 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1780082 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: various Makefile cleanupsJoel Kitching2019-09-051-66/+25
| | | | | | | | | | | | | | | | | | - Lists should be alphabetically sorted - No need for CHROMEOS_ENVIRONMENT variable - Remove some defunct sections - Merge VBINIT and VBSLK into FWLIB BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Id05508a8be6273f11c1886fd9a35d30be4bb778f Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1773087 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* tests: Ensure string is null-terminatedJacob Garber2019-09-051-2/+6
| | | | | | | | | | | | | | | | It is possible that set_vendor_data will not be null terminated if strlen(vendor_data_value) >= sizeof(set_vendor_data). Leave an extra byte at the end to prevent this. BUG=none TEST=make clean && make runtests BRANCH=none Change-Id: Ic21d74e9f3f36557ab1083001ab8af8ee42426e4 Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Found-by: Coverity CID 198908 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1752933 Reviewed-by: Joel Kitching <kitching@chromium.org>
* crossystem: Add TGL GPIO Chip IDSrinidhi N Kaushik2019-09-051-0/+1
| | | | | | | | | | | | BUG=none TEST= emerge vboot_reference BRANCH=none Change-Id: I1e486ce46d56539e23ec2b93e7eee971366c31f4 Signed-off-by: Srinidhi N Kaushik <srinidhi.n.kaushik@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1775273 Reviewed-by: Duncan Laurie <dlaurie@google.com> Reviewed-by: Wonkyu Kim <wonkyu.kim@intel.corp-partner.google.com>
* cgpt: show: dump drive details in verbose/debug modeMike Frysinger2019-09-011-1/+18
| | | | | | | | | | | | | | | | The drive details are the only place where block sizes are tracked, so make sure we display them so the user knows the bytes-per-block. Might as well dump all the other drive details while we're here. BUG=None TEST=CQ passes BRANCH=None Change-Id: I2f2546feec2d58a295ce69c2bfe89a5ecf392f46 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1773966 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org>
* vboot: prevent some tests from running when MOCK_TPM=1Joel Kitching2019-08-311-2/+5
| | | | | | | | | | | | | | | | tlcl_tests and rollback_index2_tests only work when MOCK_TPM is disabled. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I3d09e2b02c72e2ee1b1b89769e433cc5cd513163 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1776278 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: add mocked TlclDefineSpaceEx functionJoel Kitching2019-08-311-0/+11
| | | | | | | | | | | | | | | | | | | Allows the case of FIRMWARE_ARCH= TPM2_MODE= MOCK_TPM=1 to compile. Also wrap TlclUndefineSpace in #ifdef CHROMEOS_ENVIRONMENT to match its non-mocked definition. BUG=b:124141368, chromium:997132 TEST=make clean && TPM2_MODE= MOCK_TPM=1 make runtests BRANCH=none Change-Id: I681dcb239c0bff9530df84a0a4f848e73384c798 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1773095 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/secdata: fix 2secdata.h includesJoel Kitching2019-08-318-4/+7
| | | | | | | | | | | | | | | | | | | | Get rid of vb2_context forward declaration and vb2_error_t redefinition from 2secdata.h, and properly include 2api.h instead. Remove 2secdata.h from 2api.h (should not be publicly accessible), and add 2secdata.h include to appropriate files. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I15570488fdabfcd9a178a0cedc7868b8c23720e9 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1776285 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot/secdata: rename secdata and secdatakJoel Kitching2019-08-3133-779/+869
| | | | | | | | | | | | | | | | | | | | | | | For clarity's sake, rename: secdata -> secdata_firmware secdatak -> secdata_kernel secdata is now the general term to refer to any secure data spaces: firmware, kernel, and FWMP. Once coreboot code has been updated, the sections in 2api.h and 2constants.h may be removed. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I376acee552e8be37c75c340626a95462f81e198b Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1773079 Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
* vboot: deprecate fastboot supportJoel Kitching2019-08-3013-131/+22
| | | | | | | | | | | | | BUG=b:124141368, chromium:995172 TEST=make clean && make runtests BRANCH=none Change-Id: I42e4ac8a21ac3be416d315a8a8cc914f997bab79 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1758148 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* cgpt: improve help textMike Frysinger2019-08-299-25/+28
| | | | | | | | | | | | | | | | | | | | Standardize on the term "blocks" rather than "sectors" as this matches our disk layout configuration files. For cgpt show, split the specific field options out from the -i option. The current text makes it seem like they're always required when using the -i option, and it's not super clear that they only matter when the -i flag is used. BUG=None TEST=CQ passes BRANCH=None Change-Id: Idfd939cfe9501da78e323bc1ce8c1fbf772fbaa9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1773965 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* cgpt: show: add some sanity checking to -i flagsstabilize-12464.BMike Frysinger2019-08-291-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | If people use -i0, the code runs as if the flag wasn't specified. Since valid partition numbers are [1,128], and the lower layers already reject values outside that range (except for 0), add an explicit check to the CLI for -i0. Trying to display specific fields w/out -i makes no sense, and the lower layers just ignore it. Add an explicit check for it so users don't try to do `cgpt show /dev/sda -s` and wonder why the output is unchanged. Passing more than one specific field selector like -s -b doesn't work -- whatever flag was specified last wins. This isn't that obvious to users, so throw an explicit error when it happens. BUG=None TEST=CQ passes BRANCH=None Change-Id: I7c98822b79b389824b544b128ede93458b678342 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1773964 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* Fix fall through warning reported by ToT clang.Manoj Gupta2019-08-286-6/+28
| | | | | | | | | | | | | | | | | | | | Clang is diagnosing implicit fallthrough in C code past https://reviews.llvm.org/rL369414. Detect the support for the fallthrough attributes in gcc/clang and enable it as VBOOT_FALLTHROUGH (copied from boringssl). This is needed to fix ToT clang builds. Note: GCC apparently does not diagnose fallthrough to another case with break but clang does (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91432). And clang does not detect the fallthrough based on code comments. Bug: chromium:997709 Test: CQ Change-Id: Id8b4be4deabca2d0f1b2efd80efa72a485a5dc8c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1772474 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* vboot: remove more Alt OS codeJoel Kitching2019-08-285-15/+2
| | | | | | | | | | | | | | | BUG=b:124141368, b:131663912, b:139392536 TEST=make clean && make runtests BRANCH=none Change-Id: I91eab08130786188b0a7c514b35574c611863b03 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1758147 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* futility: avoid leak in eve's smmstore quirkPatrick Georgi2019-08-281-1/+1
| | | | | | | | | | | | | | | | Minor but Coverity Scan noticed it. BUG=none BRANCH=none TEST=none Change-Id: I08e889f8515681e4065b0c93180aec4d083c5012 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1771971 Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org>
* host/lib/crossystem: free SharedData when leaving contextPatrick Georgi2019-08-281-3/+17
| | | | | | | | | | | | | | | Minor leak avoidance as identified by Coverity Scan. BUG=none BRANCH=none TEST=none Change-Id: I4e1d0f8c7eeaf12c5cf52fb94bdcf4ed7fef3224 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1771970 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org>
* vboot/secdata: remove DISABLE_ROLLBACK_TPM constantJoel Kitching2019-08-287-60/+46
| | | | | | | | | | | | | | | | | | | | | | | | | This constant triggered different implementations of the two functions RollbackFwmpRead and RollbackKernelLock, whose overridden implementation would then be relied on in various tests. Instead, directly override these functions within the tests where they are required. The overridden implementations were also used in utilities/load_kernel_test.c, but this utility is currently broken and not in active use. If we would like to get it working again, simply override these two functions directly in the C file, just as is done for unit tests. (See b:139839429.) BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I0a4d24ea4ae4182b7f4f258860de6f712dae1555 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1765169 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/secdata: remove rollback_index3_testsJoel Kitching2019-08-282-29/+0
| | | | | | | | | | | | | BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I37d2d76aa08f42853fa9785a5b941f080f2f6243 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1765168 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: fix up some headers, includes, comments, spacingJoel Kitching2019-08-28116-327/+334
| | | | | | | | | | | | | BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Id97f544da845f7070555e5e8cc6e782b2d45c300 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1758151 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/secdata: remove VbUnlockDevice functionJoel Kitching2019-08-285-80/+4
| | | | | | | | | | | | | | | | VbUnlockDevice is only used in fastboot. Currently fastboot "unlocking" is disabled (see CL:1757973). BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: I0de44c2bb8d8150dafb0b73e7a0be6e63564a26b Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1758150 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot/secdata: fix up 2secdata{,k} and testsJoel Kitching2019-08-287-90/+110
| | | | | | | | | | | | | | | | These are not yet used in production and need some fixing up first. BUG=b:124141368, chromium:972956 TEST=make clean && make runtests BRANCH=none Change-Id: Ifbd0e761cc5bc05437bfed774fb15d5e8ef1b8e7 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1758149 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: remove 9-year old tpm_init_temp_fix workaroundJoel Kitching2019-08-272-85/+0
| | | | | | | | | | | | | | | | | | From the original CL:3077016: "Small program to temporarily fix TPM state until we can do this in the BIOS." BUG=b:124141368 TEST=emerge with USE=cros_host and USE=-cros_host BRANCH=none Change-Id: Icc90bc2b3ee76b66b803af4059dafbe5e1d52daf Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1763969 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1763970 Reviewed-by: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove obsolete COPY_BMP_DATAJoel Kitching2019-08-271-5/+0
| | | | | | | | | | | | | | | No longer relevant with GBB refactor. BUG=b:124141368, chromium:954774 TEST=make clean && make runtests BRANCH=none Change-Id: I84479ae3bd8a936728d83d7937f4981ef6a37247 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1763972 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: bring load_kernel_test up to coding style standardsJoel Kitching2019-08-271-240/+243
| | | | | | | | | | | | | | | | In case we want to keep it around. See b:139839429. BUG=b:124141368, b:139839429 TEST=None BRANCH=none Change-Id: Ib49a8c7a1acf2e643fcda0a68bf39d756506e3a2 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1763971 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>