summaryrefslogtreecommitdiff
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
...
* firmware: Add developer menu support for detachablesShelley Chen2017-01-181-0/+1
| | | | | | | | | | | | | | | | | Adding in basic menu support (using arrow keys) for detachables, which do not have keyboards. Thus, we can only do menu scrolling rather than the old ctrl+D/U/L way. This is specifically for the developer warning menu. BUG=chrome-os-partner:61275 BRANCH=None TEST=reboot system and try scrolling through menu Change-Id: I39f56f5ca2fedd47df53ab246ec357d07c9c4af0 Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/424353 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot: fix compiling with DEBUG=1Randall Spangler2017-01-181-0/+1
| | | | | | | | | | | | | | | | | | If FOR_TEST is defined, 2common.h defines VB2_DEBUG() to be printf(); it should include stdio.h as well. The HOSTLIB extern linktest links against the vboot1 stub functions, but not the vboot2 stub functions, so it couldn't find vb2ex_printf(). BUG=chromium:682058 BRANCH=none TEST=DEBUG=1 make runtests; DEBUG=1 emerge-reef vboot_reference depthcharge Change-Id: Ibf981a70ca4087ce3d86b02d76e03063b2cfc9e5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/429310 Commit-Ready: Shelley Chen <shchen@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* firmware: Split out kernel UIRandall Spangler2017-01-121-0/+1
| | | | | | | | | | | | | | | This moves the UI loops out of vboot_api_kernel.c into vboot_ui.c, so that it'll be easier to support different UIs for different form factors. BUG=chromium:611535 BRANCH=none TEST=make runtests; build_packages --board=reef chromeos-firmware; boot reef Change-Id: I451b15f65aceb427ffdd94b19f44e91ebc10a860 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/414289 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Shelley Chen <shchen@chromium.org>
* firmware: Refactor and clean up ec_syncChromeOS Developer2017-01-121-0/+1
| | | | | | | | | | | | | | | | | | | | Previously, the EC software sync process called VbDisplayScreen() from several function calls deep. Refactor software sync so that the UI decisions are at a higher level (in ec_sync_all.c) and isolated from the low-level EC software sync functionality (in ec_sync.c). This is one in a series of changes which are more clearly separating out the UI, to make it easier to support multiple UI across a range of devices. BUG=chromium:611535 BRANCH=none TEST=make runtests; build_packages --board=reef chromeos-firmware; boot reef Change-Id: I40597abeb5b0cc8f5d8fc2098e4acbed4bf59bf6 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/411921 Reviewed-by: Shelley Chen <shchen@chromium.org>
* vboot: Split ec software sync to its own fileRandall Spangler2016-12-201-2/+3
| | | | | | | | | | | | | | | | This was previously done inside vboot_api_kernel. But it has nothing to do with kernel verification; that's just the only place where we could easily put it given that vboot (currently) owns the firmware UI. No outwardly-visible functionality changes. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: I8a434eb4449a5a86b129ecac61ad81d0ad55549c Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/404920
* futility: Add support for verifying recovery MRC cacheFurquan Shaikh2016-11-111-0/+1
| | | | | | | | | | | | | | | | This functionality allows factory to ensure that the recovery MRC cache trained during finalization has the right signature and the checksum on the data can be verified. BUG=chrome-os-partner:59661 BRANCH=None TEST=Verified checksum on recovery mrc cache. Change-Id: Ic5bd9910b4542037ad86f6fb7a7d83b97be5c792 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409680 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot: use malloc and free directlyRandall Spangler2016-11-061-9/+0
| | | | | | | | | | | | | | | | Originally, vboot1 code used VbExMalloc() and VbExFree() since it needed to talk to EFI firmware that didn't have standard malloc() and free(). Now, coreboot and depthcharge implement them as wrappers around those standard calls. vboot2 code already calls them directly, so let vboot1 code do that too. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: I49ad0e32e38d278dc3589bfaf494bcf0e4b0a4bd Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/400905
* vboot: remove unused stateful_utilRandall Spangler2016-11-061-3/+0
| | | | | | | | | | | | | | Now that the vboot1 cryptolib code is gone, nothing uses stateful_util. Remove it and its unit tests. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: I75b6014be00c5266545db10e87c1d9485fd1444b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/400904 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: Remove vboot1 cryptolib padding sourceRandall Spangler2016-11-061-1/+0
| | | | | | | | | | | | | | | | | The old vboot1 cryptolib hard-coded many of its padding arrays in a padding.c file. Use the equivalent vboot2 apis instead. This change is almost exclusively on the host and test side; the only firmware impact is on a single line of debug output. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: If689ffd92f0255847bea2424950da4547b2c0df3 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/400902 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* host,test: Remove unneeded vb1 rsa functionsRandall Spangler2016-10-291-7/+2
| | | | | | | | | | | | | | | Another in a continued stream of refactoring. This change removes more of the vb1 rsa library code and associated tests, in favor of their vb2 equivalents. This change touches only host-side code and its tests, not firmware. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: I1973bc2f03c60da62232e30bab0fa5fe791b6b34 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/400901
* vboot: use vb2 verification functions for kernel verificationRandall Spangler2016-10-291-9/+1
| | | | | | | | | | | | | This removes old vboot1 functions in favor of the new vboot2 functions. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: Idc64f7714bbd9d4fa82d14b6b5d73d71c61de854 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/400900 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: use vb2_safe_memcmp instead of SafeMemcmpRandall Spangler2016-10-291-1/+0
| | | | | | | | | | | | | No need to have two implementations of this now. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: I18bac928eb09971c37f3e1d7cbfd2009999b1f31 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/400899 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: use vb2_crc8 instead of Crc8Randall Spangler2016-10-231-2/+2
| | | | | | | | | | | | | No need to have two implementations of this now. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: Id3348eae80c5d85451981a44729164ff59f88648 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/399121 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: use standard memcmp, memcpy, memsetRandall Spangler2016-10-231-3/+0
| | | | | | | | | | | | | | Originally, we didn't trust the firmware to provide these functions from a standard library. Now, with coreboot, we do. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: I4e624c40085f2b665275a38624340b2f6aabcf11 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/399120 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* bdb: Make 'futility show' support BDBDaisuke Nojiri2016-10-041-1/+2
| | | | | | | | | | | | | | This patch makes futility show command support boot block descriptor (BDB) of the common boot flow. BUG=chromium:649554 BRANCH=none TEST=make runtests. Ran futility show bdb.bin. Change-Id: I5f199a32ab1c268351e822e37ed39e41ae19bc7a Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/388631 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Add 'bdb --resign' to futilityDaisuke Nojiri2016-10-041-0/+4
| | | | | | | | | | | | | | | | | 'resign' sub-command signs a BDB using keys provided. It can resign only the data key, the hashes, or both. Required keys vary depending on what part of BDB is invalid and on what public key is specified in the command line. It then detects what key is needed based on the verification result and fails if the required key is not provided. BUG=chromium:649554 BRANCH=none TEST=make runtests. Ran futility bdb --create, --add, --resign, --verify Change-Id: I589a5972f1d7e5066eb56e1c5efb4ee7089d41cd Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/387118 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Add 'bdb --add' to futilityDaisuke Nojiri2016-10-041-1/+1
| | | | | | | | | | | | | | | | futility bdb --add appends a new hash entry to the given BDB. The resulting BDB does not have a valid signature and is expected to be resigned by 'resign' sub-command after all hashes are added. BUG=chromium:649554 BRANCH=none TEST=make runtest. Ran futility bdb --add, then --resign, then --verify (to be implemented) Change-Id: Icdf185f8ac268a23bb3954f5e78df6f80e749e18 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/387117 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: add bdb --create command to futilityDaisuke Nojiri2016-10-041-4/+6
| | | | | | | | | | | | | | | | bdb command manipulates BDBs. '--create' sub-command creates a BDB. Other sub-commands will follow in the successive patches. BUG=chromium:649554 BRANCH=none TEST=make runtests. Ran futility bdb --create using test keys and verify it with bdb --verify (to be implemented). Change-Id: Ib0a6165ac93efc7478b9d999d3c837d47cf81ddd Reviewed-on: https://chromium-review.googlesource.com/386794 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Add bdb_extendDaisuke Nojiri2016-10-011-0/+7
| | | | | | | | | | | | | bdb_extend prints out secrets derived from the given BDS based on the given BDB. BUG=chromium:649555 BRANCH=none TEST=make runtests. Ran bdb_extend -s bds.bin -b bdb.bin (with/without -m) Change-Id: I8d9f73468992dad4cb93a422c0eae0977be9a16f Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/385539
* bdb: Define RSA symbols non-weaklyDaisuke Nojiri2016-09-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Defining these symbols weakly causes the output executable to hit segmentation fault because ld chooses *UND* symbols over the definition when they appear in *.a archive: $ objdump -t build/libvboot_utilbdb.a bdb.o: 0000000000000000 w *UND* 0000000000000000 bdb_rsa4096_verify ... rsa.o 000000000000061f w F .text 0000000000000111 bdb_rsa4096_verify ... This happens regardless whether the symbol is referenced or not; or whether the object defining the symbol appears earlier than the reference or not. BUG=none BRANCH=none TEST=make runtests Change-Id: Ib53a9010f2afdc2ba59369fb145aef4381db30d3 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/387905 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix test failures when TPM2_MODE is definedBill Richardson2016-09-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An earlier commit had added this: ifeq (${TPM2_MODE},) # TODO(apronin): tests for TPM2 case? TEST_NAMES += \ tests/tlcl_tests \ tests/rollback_index2_tests endif but left this: .PHONY: runmisctests runmisctests: test_setup ${RUNTEST} ${BUILD_RUN}/tests/rollback_index2_tests [...] ${RUNTEST} ${BUILD_RUN}/tests/tlcl_tests So if TPM2_MODE is not null, those two test targets won't be built. This CL puts those two into the same guard, so that they won't be attempted if they're not built. BUG=chrome-os-partner:57727 BRANCH=all TEST=manual Before, this fails: FEATURES=test emerge-reef vboot_reference Now, it passes. Change-Id: Ic00f9f867d3d9c719d797907f00fda8bc5044504 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/388711 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* vboot: replace CreateKernelPreamble() with vboot2 equivalentRandall Spangler2016-09-061-1/+0
| | | | | | | | | | | | | Continued refactoring of host library to kernel style / vboot2 structs. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: Ifed376812ed7690eea1ec0dfab958e836f7724a0 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/363951 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* futility: Create signatures using vboot 2.0 APIsstabilize-8688.BRandall Spangler2016-08-031-0/+3
| | | | | | | | | | | | | Refactor futility to use only vboot 2.0 APIs to create signatures. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: I176e7f424fa556d34d8fe691df5681f1e43210ce Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356128 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: Always compile vb2.1 stuff into utillibRandall Spangler2016-08-031-30/+10
| | | | | | | | | | | | | | | Some of the vboot 2.0 and 2.1 functions call common code that currently lives inside the vb2.1 host library. To be able to use vboot 2.0 code in futility, we always need to include the 2.1 sources. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: Ib01622fa462d0bceda1e6041b5e3395ee7c2f94f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356127 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* futility: cmd_show uses only vboot 2.0 APIsRandall Spangler2016-08-031-2/+2
| | | | | | | | | | | | | This removes the remaining vboot 1.0 API calls from cmd_show. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: I03c4260aa034100efbbea1005367cd85dfff273d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/350173 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: Upgrade VerifyFirmwarePreamble() to vboot2.0Randall Spangler2016-07-261-6/+5
| | | | | | | | | | | | | | | This replaces all calls to vboot1 VerifyFirmwarePreamble() with equivalent vb2.0 functions. No effect on ToT firmware, which already uses the vboot2.0 functions. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: I5c84e9ed0e0c75e2ea8dbd9bfcde0597bc457f24 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/349322 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: Remove vboot1 init and select-firmware APIsRandall Spangler2016-07-261-28/+1
| | | | | | | | | | | | | | | | | | And nuke all the underlying code that is unused once those APIs are gone. These APIs are not used by any project in ToT, having been superseded last year by the vboot2 APIs. No functional changes to live code, just lots of deletes. CQ-DEPEND=CL:347414 BUG=chromium:611535 BRANCH=none TEST=make runtests; build samus Change-Id: I05ac752d74d1343dd03600b1c5e6ed22822e2802 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/347257
* Fix yaml pkg-config warningsBrian Norris2016-07-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | I see warnings like this when building with USE=minimal (the default): Package yaml-0.1 was not found in the pkg-config search path. Perhaps you should add the directory containing `yaml-0.1.pc' to the PKG_CONFIG_PATH environment variable No package 'yaml-0.1' found That's because we don't have a yaml dependency for the USE=minimal build, yet we still unconditionally call `pkg-config --libs yaml-0.1`. Let's move the pkg-config calls into 'ifeq' block where they're actually used. BRANCH=none BUG=none TEST=`emerge-${BOARD} vboot_reference` both with and without USE=minimal Change-Id: I96a59848ee970abacbe4cc3c56bb35c7cf552f63 Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/362620 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot: Convert vboot1 SHA calls to use vboot2Randall Spangler2016-07-221-10/+4
| | | | | | | | | | | | | | | | | | This change replaces all calls to the old vboot1 SHA library with their vboot2 equivalents. This is the first in a long series of changes to move the core vboot kernel verification into vb2, and the control/display loop out to depthcharge. BUG=chromium:611535 BRANCH=none TEST=make runtests; build samus firmware and boot it Change-Id: I31986eb766176c0e39a192c5ce15730471c3cf94 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/344342 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Proper armv7l host arch detectionPaul Kocialkowski2016-07-181-0/+4
| | | | | | | | | | | | | | | This allows properly detecting an armv7l host architecture and setting the right ARCH value so that e.g. crossystem can build fine. BRANCH=none BUG=none TEST=Build host_stuff on an armv7l machine Change-Id: I6a6ac74477eff41e73eca671d9dac229888c4e77 Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-on: https://chromium-review.googlesource.com/360160 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* Stub tlcl implementation for tpm2 caseAndrey Pronin2016-07-151-13/+36
| | | | | | | | | | | | | | | | | | | Build a special version of TPM Lightweight Command Library in libvboot_host for TPM2. Create the framework for implementation, stub functions for now. libvboot_host is used by tpmc and other user-space utilities that talk directly to tpm bypassing trunks/trousers. BRANCH=none BUG=chrome-os-partner:54981 BUG=chrome-os-partner:55210 TEST=Boot on kevin, verify that 'tpmc read' works. Change-Id: I4cc41028041193041defc319687697eb9edb1f3e Reviewed-on: https://chromium-review.googlesource.com/358623 Commit-Ready: Andrey Pronin <apronin@chromium.org> Tested-by: Stephen Barber <smbarber@chromium.org> Tested-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org>
* bdb: Add nvmrw_get and nvmrw_setDaisuke Nojiri2016-07-111-0/+2
| | | | | | | | | | | | | These internal APIs are used to get and set values in NVM-RW variables. BUG=chrome-os-partner:51907 BRANCH=tot TEST=make runtests Change-Id: Ibae1836cb569fe89dd2c8249f76c66b78b1c2cf4 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356691 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add ability to build vboot firmware for TPM2 supportVadim Bendebury2016-07-011-1/+12
| | | | | | | | | | | | | | | TPM2 will have to use a different tlcl layer, the configuration option will be provided by depthcharge at build time. BRANCH=none BUG=chrome-os-partner:50645 TEST=with the rest of the patches applied kevin/gru boards boot into chrome OS with rollback counters read from/written to TPM2 Change-Id: I0694741f5317da2c3268ee9edfdf29caff2fc26c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356750 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Add secrets librarystabilize-8530.Bstabilize-8530.96.Bstabilize-8530.93.Bstabilize-8530.89.Bstabilize-8530.80.Bstabilize-8530.77.Bstabilize-8530.71.Bstabilize-8530.35.Bstabilize-8516.Brelease-R53-8530.BDaisuke Nojiri2016-06-231-0/+1
| | | | | | | | | | | | | | The secrets library clears, extends, and derives secrets which are used by vboot SoC. BUG=chrome-os-partner:51907 BRANCH=tot TEST=make runtests Change-Id: I38c93fd450364792cebc942694f848e10d0e9502 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/349252 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Add NVM libraryDaisuke Nojiri2016-05-201-2/+3
| | | | | | | | | | | | | | This patch adds NVM library, which verifies, updates, and syncs NVM-RW of vboot SoC. BUG=chrome-os-partner:51907 BRANCH=tot TEST=make runtests Change-Id: I5adc399f9e582bd9ea7d9ee73482ed9a924837e0 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/343121 Reviewed-by: Daisuke Nojiri <dnojiri@google.com>
* hmac: Add HMAC to 2lib libraryDaisuke Nojiri2016-05-101-2/+6
| | | | | | | | | | | | | | | This patch adds HMAC. HMAC will be used to sign/verify NVM structures. Hash algorithms can be selected from those supported by enum vb2_hash_algorithm (i.e. SHA1, SHA256, or SHA512). BUG=chrome-os-partner:51907 BRANCH=tot TEST=make runtests Change-Id: I6d349bc807874fe2a5512aabcd7fbf67a4eaa40a Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342880 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Add vba_bdb_initDaisuke Nojiri2016-05-071-2/+7
| | | | | | | | | | | | | | | | | | | vba_bdb_init initializes the vboot context and decides what to do next based on the vboot register content. Possible actions are: 1. proceed to verify the current slot 2. reset to try the other slot 3. reset to recovery mode bdb_sprw_test demonstrates these actions. BUG=chrome-os-partner:51907 BRANCH=tot TEST=make runtests Change-Id: If72cdd575d09b9162a871f088064ca853b7fd74d Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342604 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Replace sha functions with vb2 libraryDaisuke Nojiri2016-05-041-4/+3
| | | | | | | | | | | | | | BDB has its own implementation of SHA256. This patch replaces it with the one implemented in vb2 library. BUG=chrome-os-partner:51908 BRANCH=tot TEST=build runtests Change-Id: Ida19dd49153a038fc2b2ce481cedf828818aaeaa Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342121 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* bdb: Integrate bdb_testDaisuke Nojiri2016-05-041-3/+48
| | | | | | | | | | | | | This patch integrate bdb_test with the root Makefile. BUG=chrome-os-partner:51908 BRANCH=tot TEST=make runtests Change-Id: I6266199d8f3068d2e9349110e8351f20d027ab35 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342091 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Pipe the custom_music use flag to the defineAlexandru M Stan2016-01-261-0/+4
| | | | | | | | | | | | | | | | | This will allow the definition of CUSTOM_MUSIC from the individual board ebuilds. TEST=Define use flag and extra functions on a board, enjoy the custom tunes BUG=chrome-os-partner:48657 BRANCH=master Change-Id: I974f9cc51f9b25fb3dff063926e6ea01cf1e031b Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/323833 Commit-Ready: Alexandru Stan <amstan@chromium.org> Tested-by: Alexandru Stan <amstan@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* Port to musl: musl doesn't have execinfo.h.Doug Evans2016-01-071-0/+5
| | | | | | | | Change-Id: Idc2f18880581d3a2e67185becee8b77cfa5cdf04 Reviewed-on: https://chromium-review.googlesource.com/313388 Commit-Ready: Doug Evans <dje@google.com> Tested-by: Doug Evans <dje@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Use ${WERROR} consistently.Doug Evans2016-01-061-1/+1
| | | | | | | | Change-Id: I37b414b030cc69fab2b4feec70b55297dcd5fdb7 Reviewed-on: https://chromium-review.googlesource.com/313198 Commit-Ready: Doug Evans <dje@google.com> Tested-by: Doug Evans <dje@google.com> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move default target up so it's really the default.stabilize-smaug-7800.Bstabilize-7797.BDoug Evans2015-12-161-7/+10
| | | | | | | | | | | | The line ${FUTIL_BIN}: ${UTILLIB21} was changing the default. Change-Id: I7988af498c9a9a1981cf2485e4f9d3496412f133 Reviewed-on: https://chromium-review.googlesource.com/313245 Commit-Ready: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* futility: Support for signing RO+RW firmwarestabilize-smaug-7547.BBill Richardson2015-10-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the "rwsig" type, with initial support for RO+RW firmware images that need to verify themselves instead of using software sync. This uses our vb2 structs instead of raw binary blobs. That will help us locate, identify, and verify the keys and signatures in the signed firmware images. BUG=chrome-os-partner:46254 BRANCH=smaug,ToT TEST=make runtests I also hacked up a test board with the EC-side signature verification routines from a preliminary CL and tested this signing scheme with that. It works. Additional work is needed to make this seamless, but you can try it out like so: futility create ./tests/testkeys/key_rsa2048.pem foo futility sign --type rwsig --prikey foo.vbprik2 --pubkey foo.vbpubk2 ec.bin Change-Id: I876ab312a2b0b36411c5f739fe3252529728d034 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/305394 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Compute / verify root key hashRandall Spangler2015-07-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ryu will store a hash of the GBB root key in a struct inside its boot block. Add a vb2_ryu_root_key_hash struct for that. If 'futility gbb_utility' is used to set the root key, also look for a root key hash struct and fill it in. No error if not found, because this needs to work on other platforms where the struct is not present. This way, we don't need to change the signing scripts. Added a --roothash option which can be used to check if the root key hash is found, and if so, whether it's empty, valid, or invalid. BUG=chromium:511405 BRANCH=ryu TEST=manual Take any existing image.bin. cp image.bin image.orig gbb_utility --roothash image.bin - ryu root hash not found Extract the root key gbb_utility -k rootkey.bin image.bin - exported root_key to file: rootkey.bin Now, append a blank ryu root hash struct to it echo '0000000: 5274 4b79 4861 7368 0100 0000 3000 0000' | xxd -r >> image.bin echo '0000000: 0000 0000 0000 0000 0000 0000 0000 0000' | xxd -r >> image.bin echo '0000000: 0000 0000 0000 0000 0000 0000 0000 0000' | xxd -r >> image.bin Nothing is set yet gbb_utility --roothash image.bin - ryu root hash is unset Setting the root key also sets the root hash gbb_utility -s -k rootkey.bin image.bin - import root_key from rootkey.bin: success - calculate ryu root hash: success successfully saved new image to: image.bin See, it verifies gbb_utility --roothash image.bin - ryu root hash verified Now, append a bad ryu root hash struct to it cp image.orig image.bin echo '0000000: 5274 4b79 4861 7368 0100 0000 3000 0000' | xxd -r >> image.bin echo '0000000: 0001 0000 0000 0000 0000 0000 0000 0000' | xxd -r >> image.bin echo '0000000: 0000 0000 0000 0000 0000 0000 0000 0000' | xxd -r >> image.bin See, it fails gbb_utility --roothash image.bin - ryu root hash does not verify Make sure the library doesn't contain the magic string strings `which futility` | grep RtKyHash (should be no output) Change-Id: Ib46f93cac0f2b532bada4b187ae48efcf4926702 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/286237 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* vboot2: Add 2.0 api layer to verify kernel partitionRandall Spangler2015-06-091-0/+3
| | | | | | | | | | | | | | | | | | | This allows the caller to load the kernel partition and then pass it to vboot for verification, rather than having vboot assume the kernel partitions are all on a block storage device. Next up, APIs for the caller to parse partition information from a GPT (yes, that's cgptlib, but we'll make it more easily callable by depthcharge). BUG=chromium:487699 BRANCH=none TEST=make -j runtests Change-Id: I388085c7023f4c76d416f37df0607019bea844ac Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/275646 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* cgpt: Add a callback to allow override of GPT entry priorityFurquan Shaikh2015-06-041-0/+2
| | | | | | | | | | | | | | | | | | | | This can be used by implementations that want to request vboot to favor a particular kernel entry for booting without affecting the checks for rollback protection and image verification. CQ-DEPEND=CL:274716, CL:274932, CL:275171 BUG=None BRANCH=None TEST=Compiles successfully. make -j runtests successful. Change-Id: I6a4600020354f5d4118c17f083c353c2585c4181 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/274558 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Nicolas Boichat <drinkcat@chromium.org> Trybot-Ready: Nicolas Boichat <drinkcat@chromium.org>
* fastboot: Add routines for unlock and lock devicestabilize-7131.BFurquan Shaikh2015-05-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Add support for functions to request unlock and lock of devices in response to fastboot oem unlock/lock commands. Unlock operation is equivalent to enabling dev mode and lock operation is equivalent to leaving dev mode. It is the responsibility of the caller to ensure that user confirmation is obtained before unlock/lock operations. BUG=chrome-os-partner:40196 BRANCH=None TEST=Compiles successfully and fastboot lock/unlock operations work as expected on smaug. Added tests to ensure lock/unlock operations are covered. Verified using make -j runtests. Change-Id: Ibafe75abdd1202473009208a414f3996d537db4f Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/273182 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> Trybot-Ready: Furquan Shaikh <furquan@chromium.org>
* fastboot: Add routine for verifying kernel image loaded in memoryFurquan Shaikh2015-05-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This API allows fastboot boot from memory command to verify that the image loaded in memory is signed properly using recovery keys. Thus, only officially signed recovery images can be booted using fastboot boot command in recovery mode. However, if GBB_FLAG_FORCE_DEV_BOOT_FASTBOOT_FULL_CAP is set, then this routine will not perform any check and return okay for any image sent by fastboot boot. BUG=chrome-os-partner:40196 BRANCH=None TEST=Compiles successfully. With GBB override for FASTBOOT_FULL_CAP set any signed image is allowed to boot. With FASTBOOT_FULL_CAP not set, then only officially signed image is allowed to boot. (make -j runtests successful) Change-Id: I78028853bd1ad09d3c610a687f327560557d5681 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/272696 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> Trybot-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org>
* vboot2: Add routines to load and verify kernel keyblockRandall Spangler2015-05-221-0/+2
| | | | | | | | | | | | | | These are slightly more complex than the firmware versions, because they need to deal with developer-signed keyblocks and keyblock flags. BUG=chromium:487699 BRANCH=none TEST=make -j runtests Change-Id: I682c14ddfe729984f2629dfbe66750e5cd5ab75e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/272541 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>