summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* futility: Wipe GBB data before writing new values.factory-samus-6207.BHung-Te Lin2014-09-111-0/+6
| | | | | | | | | | | | | | | | | The previous version of gbb_utility always zeros data before writing new values and we should keep this behavior, to simplify firmware hash calculation and potential security concern. BRANCH=none BUG=chromium:413066 TEST=emerge gbb_utility; factory/bin/gooftool get_firmware_hash bios.bin Original-Change-Id: Ic97a118cefc9698d52d9370b627670ff103d5e23 Change-Id: If38e15f35ee491cc80f96b360c63ee25f71c1854 Reviewed-on: https://chromium-review.googlesource.com/217700 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org>
* Fix include quotes.Alex Deymo2014-08-263-8/+9
| | | | | | | | | | | | | | | System libraries such as string.h and errno.h should be included with <> instead of "" to avoid including them from the local directory. BRANCH=None BUG=None TEST=FEATURES="test" emerge-link vboot_reference Change-Id: I6734e14223fdad9060c6518790f52f1bcfcdf8e0 Reviewed-on: https://chromium-review.googlesource.com/214058 Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* keygeneration: Add a script to sanity check versions for a keysetGaurav Shah2014-08-261-0/+87
| | | | | | | | | | | | | | | | Add a script that runs sanity checks on the versions in a keyset. In particular, tests whether the actual key versions match those in key.versions. Also runs consistency checks (for example: firmware version should match kernel subkey version). BUG=none TEST=run on all of our keysets BRANCH=none Change-Id: I5b509ba33127364f6b63252ad167646eb7dce710 Reviewed-on: https://chromium-review.googlesource.com/190790 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Gaurav Shah <gauravsh@chromium.org>
* vboot2: Move vb2_verify_fw inside of futilityRandall Spangler2014-08-254-23/+17
| | | | | | | | | | | | | | | | | | | | | Update the unit tests which use it to use futility. No functional changes to it, just relocation. Remove the futility test which checks the exact list of supported commands. This doesn't have a good way of handling conditionally-compiled commands, and will be even harder to maintain as we add more commands in the future. Presence of sub-commands is still ensured by the other tests which use them (such as vb2_firmware_tests.sh) BUG=chromium:231547 BRANCH=none TEST=make runtests && VBOOT2=1 make runtests Change-Id: Idddb639276e4c6449d023d40ac7977123113bd28 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213191 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* futility: Reformat to use kernel coding styleBill Richardson2014-08-2512-3271/+3372
| | | | | | | | | | | | | | This just reformats the futility sources to conform to the Linux kernel coding style. No functional changes. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: I82df07dd3f8be2ad2f3df24cebe00a9a378b13f4 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213915 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* make_dev_ssd: Allow chromeos-install to run on a modified image.Hung-Te Lin2014-08-251-3/+4
| | | | | | | | | | | | | | | | | | | | | | chromeos-install always expects DM verity information from install source, because even when --noenable_rootfs_verification is applied, the output image will still include DM verity in kernel command line (just not enabled). To support developers installing a modified image (by --remove_rootfs_verification), we have to change the command line to keep DM verity data, just like how --noenable_rootfs_verification is done. BRANCH=none BUG=none TEST=make_dev_ssd.sh --noenable_rootfs_verification; reboot; chromeos-install # success. Change-Id: I3b2c8cbf1b89086ed91b5549c7147cd940fbda14 Reviewed-on: https://chromium-review.googlesource.com/207321 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Gaurav Shah <gauravsh@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* futility: add --arch=aarch64Benson Leung2014-08-231-1/+2
| | | | | | | | | | | | | | | | | | Add support for the 64bit arm architecture, which update_kernel.sh passes in as "aarch64" Signed-off-by: Benson Leung <bleung@chromium.org> BUG=chrome-os-partner:31525 TEST=run vbutil_kernel --arch=aarch64 Check that it no longer complains about "Unknown architecture string: aarch64" BRANCH=none Change-Id: Iccd925e05baffb1953b229fc4150ca179d1d1e1c Reviewed-on: https://chromium-review.googlesource.com/213706 Reviewed-by: David Riley <davidriley@chromium.org> Tested-by: Benson Leung <bleung@chromium.org> Commit-Queue: Benson Leung <bleung@chromium.org>
* futility: add more static/const markingsMike Frysinger2014-08-209-23/+23
| | | | | | | | | | | | | BUG=chromium:404643 TEST=pre-cq passes (runs unittests) BRANCH=None Change-Id: I3c3a9ee7192305dfa72333c0b6a77653b7188869 Reviewed-on: https://chromium-review.googlesource.com/212877 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org>
* Add GBB flag to disable PD software syncstabilize-6146.Brelease-R38-6158.BDuncan Laurie2014-08-124-4/+12
| | | | | | | | | | | | | | | | | | | | | | In order to disable PD software sync but still do EC software sync it is useful to have a separate GBB flag for it. This will allow me to release a Samus P2B firmware image that will update the EC but not the PD, since the PD FW that comes on P2B devices cannot be updated with software sync. BUG=chrome-os-partner:30079 BRANCH=None TEST=flash BIOS with updated EC+PD: 1) no GBB flags to override behavior updates both EC and PD 2) GBB flag to disable EC software sync disables both EC and PD update 3) GBB flag to disable PD software sync disables only PD update Change-Id: I49ffb59238bee4a2dd66b24f2516e3ce46ea06cd Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/211910 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Call software sync a second time for PD, if necessaryRandall Spangler2014-08-012-1/+13
| | | | | | | | | | | | | | | | | If a device has both an EC and a separate PD chip, call software sync for each chip. BUG=chrome-os-partner:30079 BRANCH=none TEST=Flash image.bin with new AP+EC+PD firmware, reboot. See EC and PD both update and jump to RW. On next cold boot, they jump to RW without again updating. CQ-DEPEND=CL:210520 Change-Id: Ie445336ade46f0009c040afc14b3f40452caf27b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/210536 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Update vbutil_what_keys with more sha1sumsBill Richardson2014-08-011-116/+272
| | | | | | | | | | | | | BUG=none BRANCH=ToT TEST=manual Run vbutil_what_keys on some BIOS and disk images. Change-Id: Ib757b63fa79913920da25c08b1994273fd77e53f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/210692 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Add remaining vboot binary utilitiesBill Richardson2014-07-3117-289/+1010
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds these formerly external utilities into the futility binary: dev_sign_file dump_kernel_config gbb_utility vbutil_firmware vbutil_kernel These target binaries will remain independent of futility, since they are not directly related to verified boot: cgpt crossystem tpm_init_temp_fix tpmc Also, dumpRSAPublicKey is removed from the target, since it is only used on the build host to create new keypairs. This change also add several additional tests. BUG=chromium:224734 BRANCH=ToT CQ-DEPEND=CL:210391,CL:210568,CL:210587 TEST=manual make runtests make clean Also build and test: - normal image - test image - recovery image - firmware shellball Note that this CL depends on simultaneous changes to the chromeos-initramfs ebuild. Change-Id: If791b5e9b5aac218ceafa9f45fc1785f16b91a64 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/210403
* crossystem: Add PCH-LP GPIO typeDuncan Laurie2014-07-301-0/+1
| | | | | | | | | | | | | | Rather than continuing to report different variants of PCH GPIO the same way use the common name of PCH-LP. BUG=chrome-os-partner:28234 BRANCH=None TEST=boot on samus and ensure there are no (error) reported Change-Id: I9321e7bd85b2b3b3ebadc22ac32be6759e85f822 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/210393 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Change VbExEc functions to take a devidx parameterstabilize-6092.Bstabilize-6082.BRandall Spangler2014-07-197-51/+57
| | | | | | | | | | | | | | | | | | | | This will be used in subsequent CLs to support PD software sync. For now, only devidx=0 is used. This changes the external vboot API, so must be checked in at the same time as changes to the u-boot and depthcharge implementations. For now, those implementations should simply check if devidx=0 and fail if it's not. BUG=chrome-os-partner:30079 BRANCH=none TEST=make runtests CQ-DEPEND=CL:208195,CL:208196 Change-Id: Iad3be9d676ac224c4582669bcd67176b39f75c73 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/208210 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* futility: deprecate eficompress and efidecompressBill Richardson2014-07-184-8/+78
| | | | | | | | | | | | | | | | I don't think these utilities are needed any longer, so mark them as deprecated. They will still be built and can be run via futility, but invoking them directly will fail with a warning message. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: Ie704f2cecc3c37c91e4a0ffbcbcf94e2bf3ba05b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/208775 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* resign_firmwarefd: Correct output file name for VBLOCK B.Hung-Te Lin2014-07-171-1/+1
| | | | | | | | | | | | | | | In commit https://chromium-review.googlesource.com/203682 the output file names were always vblock_A, and should be changed to vblock_A and vblock_B. BUG=chrome-os-partner:30611 TEST=Signed a recovery image and checked output. BRANCH=none Change-Id: I91901ba2c24032c6af3e6ab3f731bb7dd384ae2d Reviewed-on: https://chromium-review.googlesource.com/208610 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Gaurav Shah <gauravsh@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* futility: add vbutil_keyblock into the built-in featuresBill Richardson2014-07-173-5/+8
| | | | | | | | | | | BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: Ie9efdcf0b69ab4697f050643b8f2f588e22d20d7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/208368 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: add vbutil_key into the built-in featuresBill Richardson2014-07-173-7/+13
| | | | | | | | | | | BUG=chromium:224734 BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I6757a9c7f70bbe8d1db9bb3f0521778fbbb9632e Reviewed-on: https://chromium-review.googlesource.com/207927 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Install and use futility when running testsBill Richardson2014-07-1712-44/+47
| | | | | | | | | | | | | | As we build features into futility, the standalone executables disappear. Tests that invoke those executables will need to invoke futility instead. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I75230f6901aab8d978fa5d12505c243e1c90c938 Reviewed-on: https://chromium-review.googlesource.com/207926 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Slight tweak to MakefileBill Richardson2014-07-171-28/+7
| | | | | | | | | | | | | Replacing a few duplicated items with a single definition, removing a couple of unnecessary/redundant dependencies. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: I31e78ae1e3810865e26c9c4937eb44222cbfa9d6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207741
* Avoid coredumps if the FMAP is wrong.Bill Richardson2014-07-172-12/+18
| | | | | | | | | | | | | If the FMAP points beyond the boundaries of the image, don't believe it. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Ic35ce71ceac9beb7eb56b50baec938a8e085606c Reviewed-on: https://chromium-review.googlesource.com/207740 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Increase test coverage for dump_fmapBill Richardson2014-07-177-16/+101
| | | | | | | | | | | | This checks some additional cases where the FMAP is a bit messed up. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: Ic2b16bd8afdd1247d1f24c9f976d967764cadb73 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207719
* Cleanup futility test coverage framework a bitBill Richardson2014-07-165-11/+74
| | | | | | | | | | | | | This cleans up the Makfile and test scripts a bit, and adds a new test for the builtin commands. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: Ibf5aa867d4dcabc0e46daac6633036b035c99ac8 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207718
* Simplify the futility linker script a bit.Bill Richardson2014-07-153-50/+32
| | | | | | | | | | | | | | The alignment rules were complicated and not always correct. This change sorts pointers instead of structures, and aligns the pointer table better. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: I16c4e9b777fffe7537127aba15413b54e8e0f0a4 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207717 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Cleanup: remove some noisy output from some utilitiesBill Richardson2014-07-154-8/+0
| | | | | | | | | | | | | | | | | There are a few utilities that print the full path of any file they open. This isn't necessary, and it just has to be ignored when running regression tests from different directories. This just removes that extra noise. BUG=chromium:224734 BRANCH=ToT TEST=make runtests Change-Id: I4291bca7952a0d7371f8682b7d57545361c6341c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207619 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Clean up exported Mtd* functionsBill Richardson2014-07-0912-305/+325
| | | | | | | | | | | | | | | | | | | | A lot of functions were added some time ago, nominally to support keeping the firmware in an MTD device that wasn't formatted with the GPT headers. That work was never completed, so these functions aren't used anywhere. We may want to resurrect this work at some future point. Until then, this CL just moves some of the functions into an "unused" file. BUG=chromium:231567 BRANCH=ToT TEST=manual All tests pass, all firmware and external repos build. Change-Id: I420dd52d1cea0418cedf2f8e834c61145915f20c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207037 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Split libvboot_host.a into external and local libraries.Bill Richardson2014-07-0915-165/+319
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've been creating and linking against a library called "libvboot_host.a" for two different reasons. The main purpose is to build the vboot_reference tools found in the utility/ directory. But there are some external userspace programs that would also like to use some functions in this library. This change establishes libvboot_host.a as the library for use by external userspace programs only, and creates a new libvboot_util.a library that's only used inside this source tree to build the vboot utilities. BUG=chromium:231567 BRANCH=ToT TEST=manual Build and run the local tests: make runalltests make clean Build Link firmware and all the utilities: emerge-link chromeos-base/vboot_reference \ sys-boot/depthcharge \ sys-boot/coreboot \ chromeos-base/chromeos-ec \ chromeos-base/chromeos-firmware-link \ chromeos-base/chromeos-cryptohome \ chromeos-base/update_engine \ chromeos-base/chromeos-installer \ chromeos-base/chromeos-login \ chromeos-base/verity Build Lumpy utilities, which include the 32-bit cros_installer: emerge-lumpy chromeos-base/vboot_reference \ chromeos-base/chromeos-login \ chromeos-base/verity \ chromeos-base/update_engine \ chromeos-base/chromeos-installer \ chromeos-base/chromeos-cryptohome Change-Id: Ie81ff1f74a6356cb8fab7d98471139d7758c4f19 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/207016 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add fPIE flagBertrand SIMONNET2014-07-071-0/+5
| | | | | | | | | | | | | | | | | | | libvboot_host.a is needed by metrics, compiled in platform's gyp/ninja system. All platform executables need to be position independent so we need libvboot_host.a to be position independent too. BRANCH=None BUG=chromium:389742 TEST=Unittests. TEST=Build vboot_reference and metrics, metrics compiles. TEST=Build coreboot on a rambi, the compilation succeeds. TEST=trybot run on daisy, link, duck, rambi and x86-mario. Change-Id: I4b761d9435c35e3d3fcae2efc72fcaed7fc746a6 Reviewed-on: https://chromium-review.googlesource.com/206055 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
* Add nvstorage / crossystem support for new vboot2 fieldsRandall Spangler2014-06-286-11/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows testing vboot2. These fields are ignored by original vboot firmware. BUG=chromium:370082 BRANCH=none TEST=manual crossystem -> fw_tried=A, fw_result=unknown, fw_try_next=A crossystem fw_tried=B echo $? -> 1 crossystem -> fw_tried=A, fw_result=unknown, fw_try_next=A crossystem fw_try_next=B crossystem -> fw_tried=A, fw_result=unknown, fw_try_next=B crossystem fw_try_next=beats_me echo $? -> 1 crossystem -> fw_tried=A, fw_result=unknown, fw_try_next=B crossystem fw_try_next=A crossystem -> fw_tried=A, fw_result=unknown, fw_try_next=A crossystem fw_result=trying crossystem -> fw_tried=A, fw_result=trying, fw_try_next=A crossystem fw_result=bupkis echo $? -> 1 crossystem -> fw_tried=A, fw_result=trying, fw_try_next=A crossystem fw_result=success crossystem -> fw_tried=A, fw_result=success, fw_try_next=A crossystem fw_result=failure crossystem -> fw_tried=A, fw_result=failure, fw_try_next=A crossystem fw_result=unknown crossystem -> fw_tried=A, fw_result=unknown, fw_try_next=A crossystem -> fw_try_count = 0, fwb_tries = 0 crossystem fw_try_count=6 crossystem -> fw_try_count = 6, fwb_tries = 6 crossystem fwb_tries=0 crossystem -> fw_try_count = 0, fwb_tries = 0 Change-Id: I1532f3384f8c05de2a7ff3f35abcc35d18049491 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/205475
* vboot2: add a flag to indicate firmware was selected by vboot2Daisuke Nojiri2014-06-263-12/+20
| | | | | | | | | | | | | | | | | | | | | | TEST=Done manually on Nyan: localhost ~ # sudo /tmp/crossystem fw_vboot2 0 localhost ~ # sudo /tmp/crossystem fw_vboot2=1 localhost ~ # sudo /tmp/crossystem fw_vboot2 0 # reboot with vboot2 firmware localhost ~ # /tmp/crossystem fw_vboot2 1 BUG=none BRANCH=none Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I6ed553c48bdfebf07393f6f5f46832a60971314a Reviewed-on: https://chromium-review.googlesource.com/205664 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* Remove cgpt app-specific symbols from libvboot_host.aBill Richardson2014-06-2615-29/+48
| | | | | | | | | | | | | | | | | | | | | | Three symbols used by the standalone cgpt executable were being referenced in the files used to create the external libvboot_host.a needed by non-vboot userspace applications. This cleans things up so those symbols don't have to be explictly defined by other repos just to link with that library. BUG=chromium:318536 BRANCH=ToT TEST=manual No new functionality, just code cleanup. Tested with make runtests runfutiltests runlongtests Change-Id: Ibc77fb9800c89d7109ebf38d4d6729f52665722f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/205667 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Remove nonexistant functions from tlcl.hBill Richardson2014-06-261-10/+0
| | | | | | | | | | | | | | | | | | The functions TlclLog() and TlclSetLogLevel() are declared in tlcl.h, but do not appear anywhere else in the source. Let's not declare nonexistant functions. BUG=chromium:231567 BRANCH=ToT TEST=make runtests These never existed or did anything. They still don't. Change-Id: Id6f0216d70b7b62d91486aba7d6cd996dc5f7d8d Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/205708 Reviewed-by: Luigi Semenzato <semenzato@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot2: fix overloaded NV bitRandall Spangler2014-06-253-4/+15
| | | | | | | | | | | | | | Bill and I both added meanings for byte 1 bit 0x10. His changed (NV_BOOT_BACKUP_NVRAM) landed first, so move the vboot2 bit to byte 2. BUG=chromium:370082 BRANCH=none TEST=make clean && VBOOT2=1 make runtests Change-Id: Ib7ff8da47d03f91cbeb729ca517c6315dfb4e6ac Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/205408 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* vboot2: Scramble the GBB magic numberDaisuke Nojiri2014-06-253-5/+28
| | | | | | | | | | | | | | | | Compiling in the GBB magic number as is causes any tools that search for the number to fail. This patch allows firmware to embed XOR'ed signature. TEST=Booted Nyan in normal mode. FAFT:firmware_DevMode passes. BUG=none BRANCH=none Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Id18905a9969af3db24151e7c51332d0e94405108 Reviewed-on: https://chromium-review.googlesource.com/205416 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot2: More specific errors for unimplemented external APIsRandall Spangler2014-06-242-2/+8
| | | | | | | | | | | | | | | When porting vboot2 to a platform, it's common to copy 2stub.c and then start implementing APIs. Adding explicit errors makes it clearer when an unimplemented API is called. BUG=chromium:370082 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: I1f412b7ed4b431dbdbdee5e33b27bf7206186918 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/204960 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot2: Allow platform dependent debug loggingDaisuke Nojiri2014-06-232-5/+10
| | | | | | | | | | | | | TEST=Built with VBOOT_DEBUG on/off. Booted Nyan Blaze. Verified debut output. BUG=None BRANCH=none Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Id189231f16ca8719dfff0ef3c9a8d4982b741d5f Reviewed-on: https://chromium-review.googlesource.com/205157 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot2: Check necessity of recovery when firmware body hash fails to matchDaisuke Nojiri2014-06-232-0/+4
| | | | | | | | | | | | | TEST=Booted Nyan Blaze and verified recovery is requested. BUG=None BRANCH=none Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I076e9714de4b853973cadad9a02a35d28431790c Reviewed-on: https://chromium-review.googlesource.com/205156 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot2: Add end-to-end test of firmware verificationstabilize.59781.98.Bstabilize.5978.98.Bstabilize.5978.51.Brelease-R37-5978.BRandall Spangler2014-06-203-4/+62
| | | | | | | | | | | | | | | | This constructs a test firmware using the old vboot signing utilities, and then verifies it using vboot2 libraries. This ensures vboot2 can read files signed by the current signing process. BUG=chromium:370082 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: Icc113c982e5ed99382a4592f9ab688784e853c8e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/204561 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* vboot2: api-level routinesRandall Spangler2014-06-196-7/+1157
| | | | | | | | | | | | | | I'm breaking the last chunk of vboot2 into smaller pieces as I add tests. This has the api-level routines actually called by depthcharge. BUG=chromium:370082 BRANCH=none TEST=make clean && VBOOT2=1 COV=1 make Change-Id: Ic7c082fc5faa0b874b2fa5a15ebda7135dcafe0b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200151 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* vboot2: misc higher-level routines, part 2Randall Spangler2014-06-194-0/+612
| | | | | | | | | | | | | | | I'm breaking the last chunk of vboot2 into smaller pieces as I add tests. This has the higher-level routines for verifying keyblock and preamble. BUG=chromium:370082 BRANCH=none TEST=make clean && VBOOT2=1 COV=1 make Change-Id: I82da9542c8857a3f89a85f206c9f5aecadf94a79 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/203501 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* vboot2: misc higher-level routinesRandall Spangler2014-06-197-41/+970
| | | | | | | | | | | | | | | I'm breaking the last chunk of vboot2 into smaller pieces as I add tests. This has a bunch of misc routines like the dev switch logic and GBB header parsing. BUG=chromium:370082 BRANCH=none TEST=make clean && VBOOT2=1 COV=1 make Change-Id: I0f67400d9b59ec21ed5cc155a9b774fd37eb559b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/203374 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* image_signing: tweak loem firmware signing to have real keysMike Frysinger2014-06-182-25/+38
| | | | | | | | | | | | | | | | | | | | Rather than leave the default set of keys in the firmware untouched (which are dev keys), insert the first loem keyset we find. This is for people who extract the bios.bin by hand and then blindly burn it into their flash. This way they'll still get some valid loem keys. It's not a great solution, but it's better than nothing. BUG=chromium:381862 TEST=signed recovery image by hand w/loemkeys and looked at packed bios.bin TEST=signed recovery image by hand w/devkeys and looked at packed bios.bin TEST=signed recovery image by hand w/custom loemkeys and looked at packed bios.bin BRANCH=none Change-Id: I8db1e34d9f4d85be6edf81fecf79a72031571b01 Reviewed-on: https://chromium-review.googlesource.com/204262 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* create_new_keys: drop redundant settingsMike Frysinger2014-06-172-12/+2
| | | | | | | | | | | | | The common.sh file already defines these variables/funcs, so drop them. BUG=chromium:381862 TEST=`./create_new_keys.sh` created new keys correctly BRANCH=none Change-Id: Ie7f0f683d4971c188d4629b520938b4b65bb0a9f Reviewed-on: https://chromium-review.googlesource.com/203685 Reviewed-by: Gaurav Shah <gauravsh@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* image_signing: support loem keysets with firmware shellballsMike Frysinger2014-06-1639-37/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | With an loem keyset in a recovery shellball, we don't want to write the rootkeys & vblocks to the firmware image directly. Instead, we'll put them into a keyset subdir that the firmware updater will process later. bios.bin keyset/ rootkey.LOEMID vblock_A.LOEMID vblock_B.LOEMID We still write the recovery key to the firmware image though as that is shared between all the keysets. BUG=chromium:381862 TEST=Ran against a recovery image with devkeys & loemkeys and checked shellball TEST=`cbuildbot daisy-release` works BRANCH=none Change-Id: I6fc99c71e6c7dee25f7f9a466a97314ff750fda9 Reviewed-on: https://chromium-review.googlesource.com/203682 Reviewed-by: Gaurav Shah <gauravsh@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* sign_firmware: clean up style to use a main funcMike Frysinger2014-06-131-32/+39
| | | | | | | | | | | | | | | No real functional changes here. Tidying up to make the next CL easier. BUG=chromium:381862 TEST=ran by hand and checked output BRANCH=none Change-Id: I9ffea6eba17560797135f39cf861318b545b9a54 Reviewed-on: https://chromium-review.googlesource.com/203681 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Gaurav Shah <gauravsh@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org>
* vboot_reference: Don't use session_manager_use_flags.txt.Daniel Erat2014-06-121-11/+9
| | | | | | | | | | | | | | | | | | | Make ensure_no_nonrelease_files.sh stop grepping /etc/session_manager_use_flags.txt for USE flags. Instead, look for non-comment lines in /etc/chrome_dev.conf. BUG=chromium:377301 TEST=manual: ran against images both with and without extra config directives BRANCH=none CQ-DEPEND=I86d01f4a551433527bb434dc62c30fb44082f774 CQ-DEPEND=Ic030207840b6be79b51486d1706573241a01c08d Change-Id: Iefeefd936dc7706ed74340edb6521621885bbe25 Reviewed-on: https://chromium-review.googlesource.com/203463 Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Daniel Erat <derat@chromium.org> Tested-by: Daniel Erat <derat@chromium.org>
* vboot2: Use more specific error codes, part 3Randall Spangler2014-06-116-120/+251
| | | | | | | | | | | | | | Error codes reported by 2common.c are now very specific, and tests verify the proper errors are reported. BUG=chromium:370082 BRANCH=none TEST=make clean && VBOOT2=1 COV=1 make Change-Id: I9480bd22b60ae339196c92918a8a984a9f05ac1a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/202938 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot2: Use more specific error codes, part 2Randall Spangler2014-06-114-65/+103
| | | | | | | | | | | | | | | | Error codes reported by the aligment checks in common.c are now very specific, and tests verify the proper errors are reported. Changed args to vb2_member_inside() so I can force wraparounds. BUG=chromium:370082 BRANCH=none TEST=make clean && VBOOT2=1 COV=1 make Change-Id: Ib135674e82005b76bce7a83a1f4a65a9c5296cf4 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/202937 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot2: Use more specific error codesstabilize-5944.Bstabilize-5943.Bstabilize-5942.Bfactory-samus-5939.BRandall Spangler2014-06-0712-97/+222
| | | | | | | | | | | | | | | | | | | | | Error codes reported by the crypto and storage APIs are now very specific, and tests verify the proper errors are reported. More specific error codes coming to other files next, but I don't want this CL to get too long. This also changes test_common.c so TEST_EQ() reports mismatched values in both decimal and hex, and adds TEST_SUCC() to test for a successful return value. BUG=chromium:370082 BRANCH=none TEST=make clean && VBOOT2=1 COV=1 make Change-Id: I255c8e5769284fbc286b9d94631b19677a71cdd0 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/202778 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Use the TPM to back up some of the nvram fieldsBill Richardson2014-06-0512-13/+511
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We use a few bytes of battery-backed nvram to save some flags across reboots. However if the battery discharges completely, these flags are lost. There aren't any security issues with that since they reset to safe values, but some of the flags are used to configure how the system boots in dev-mode. If a dev-mode user has completely replaced ChromeOS with some other OS, then she often needs to set the dev_boot_usb and/or dev_boot_legacy flags as well in order to boot it using Ctrl-U or Ctrl-L. If the battery dies, then those flags are cleared, and the only way to make the Chromebook boot again is by going through recovery, which wipes the disk. This change uses a new NV space in the TPM to back up some of the nvram flags. These nvram fields will be backed up: block_devmode dev_boot_legacy dev_boot_signed_only dev_boot_usb fwupdate_tries loc_idx Because writing to the TPM space is slow and limited to an unspecified but finite number of cycles, we only back up the fields when specifically requested by the new backup_nvram_request flag. This flag will be set by crossystem whenever it is used to change any of the fields listed above. The backup will be attempted at the NEXT boot (because the TPM is locked after booting), and the backup_nvram_request flag will be cleared if the backup was successfull. Note that this CL is for Top of Trunk only. The firmware will create the required TPM spaces on systems that have never been booted, but we don't yet have a secure or reliable method to update existing systems. FYI, on Link, determining that the TPM's backup NV space doesn't exist adds about 6ms to the boot time. If it does exist, the backup_nvram_request flag is cleared automatically so it won't check until it's set again. BUG=chromium:362105 BRANCH=ToT (only!) TEST=manual Testing this is a long and involved process. Read on... First, there are host-side tests for it. In the chroot: cd src/platform/ec make runtests Second, to test on a completely NEW system that was first booted with a BIOS that contains this CL, do this: Enter dev-mode Use crossystem to set values for the fields listed above Confirm that "backup_nvram_request" is set to 1 Reboot Use crossystem to confirm that "backup_nvram_request" is now 0 Remove the battery and the AC Reattach either battery or AC so it will boot again Use crossystem to confirm that the backed up fields are still good, while the others have been reset to default values Switch to normal mode Remove the battery and the AC Reattach either battery or AC so it will boot again Look at the bios info in chrome://system to see what crossystem says Confirm that the dev_boot_* flags are all 0, while the others are restored Third, to set things up to test this on an existing system (I used Link), you have update the BIOS, delete both the Kernel and Firmware NV spaces in the TPM, then reboot so that the BIOS will create the Backup, Kernel, and Firmware spaces. It will only do that if they're all missing. Open it up, disable write-protect, attach a servo, etc. Switch to dev-mode, log in. Run make_dev_firmware.sh Reboot in recovery mode, and insert a USB stick with a test image on it. NOTE: In order to fiddle with the TPM, we'll *always* have to boot in recovery mode, since that's the only time the TPM is left unlocked. That's NOT the same as pressing Ctrl-U at the scary boot screen. The rest of these steps assume you've booted in recovery mode and are running from the test image on the USB stick. Run make_dev_ssd.sh --remove_rootfs_verification --recovery_key Reboot (recovery mode) Run mv /etc/init/tcsd.conf /etc/init/tcsd.conf.disabled Reboot (recovery mode). Run "tpmc getvf". It should say deactivated 0 disableForceClear 0 physicalPresence 1 physicalPresenceLock 0 bGlobalLock 0 Run "tpmc geto". It should say Owned: no Now you'll need to build the "tpm-nvtool" utility. In the chroot: cd src/third_party/tpm/nvtool make Copy that to the DUT, in /usr/local/bin. Now run tcsd tpm-nvtool --list | grep Index You may see a number of spaces, but you should at least see these: # NV Index 0x00001007 # NV Index 0x00001008 Run tpm_takeownership It will prompt you for two passwords (and confirm each one). Respond with something you can remember like "google". Run tpm-nvtool --release --index 0x1007 --owner_password "google" tpm-nvtool --release --index 0x1008 --owner_password "google" Verify that it worked with tpm-nvtool --list | grep Index Power off. Using servo, flash the new BIOS that has this CL in it. Power on, normally this time (not recovery mode). If all goes well, it should create the correct NV spaces and boot into the SSD. Copy tpm-nvtool into this image too, and run tpm-nvtool --list | grep Index You should now see at least these spaces: # NV Index 0x00001007 # NV Index 0x00001008 # NV Index 0x00001009 Now you're ready to test the backup/recover feature. Change-Id: I00031fa0774720147327e2ae0f37e26b34b86341 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/202138 Reviewed-by: Luigi Semenzato <semenzato@chromium.org>