summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tests: futility: Fix build failure due to missing libzipfactory-reef-8811.BHung-Te Lin2019-04-231-2/+3
| | | | | | | | | | | | | | The test programs do need libzip. BUG=chromium:953993 TEST=emerge vboot_reference BRANCH=None Change-Id: I7347a0d192874b9eddeef4448e2d7b2d1e317fec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1577348 Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org>
* futility: updater: Add more legacy optionsHung-Te Lin2019-04-221-0/+12
| | | | | | | | | | | | | | | | | | | To simplify the migration plan, we want to support the legacy arguments used by FAFT and factory test "UpdateFirmware": --noupdate_ec => --host_only --noupdate_pd => --host_only --nocheck_keys => --force --update_{main,ec,pd} => ignore BUG=chromium:882445,b:118509893,b:130401936,chromium:953993,b:130115628 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I31652806085937fe5ca2f2facc7321021977cbb7 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1310253 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1577346
* futility: updater: Correct HWID digest when preserving HWIDHung-Te Lin2019-01-164-13/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | Starting from GBB 1.2, a digest is stored in GBB and must be updated whenever the HWID string is changed. In shell script version of updater, the digest is automatically updated when we do "futility gbb -s --hwid=XXX", but in native updater implementation we only updated the HWID string and left digest unchanged, this leaves devices generating wrong PCR1 values. `cmd_gbb_utility` updates the digest by calling `update_hwid_digest` using vboot1 structure, so we should introduce a new vboot2 friendly function, `vb2_change_hwid`, which changes both HWID string and digest at same time. Note this has no impact for end user's devices with write protection enabled. Only changes dogfood units AU results. BUG=b:122248649 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=none Change-Id: I6ad2754e6df3c9dd66d71c560a2afc26d14eae33 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1411950
* futility: updater: Hacks to allow building futility on ReefHung-Te Lin2018-11-235-1/+15
| | | | | | | | | | | | | | | | In Reef factory branch the compiler, dependency libraries and default CFLAGS settings were different so we have to hack for FTW. Also disable __USE_FILE_OFFSET64 for build breakage by fts. BUG=b:119292628 TEST=make futil; Change-Id: I93094d580bb8d28e7f6f8aee5e607a9857da06aa Reviewed-on: https://chromium-review.googlesource.com/c/1348511 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Trybot-Ready: Hung-Te Lin <hungte@chromium.org>
* futility: Add firmware updater as 'futility update'Hung-Te Lin2018-11-2313-2/+4426
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The factory branches may need to run firmware updater extracted from newer release images which relies on 'futility update' to run. This change collects all related changes: 85974d01 futility: Add 'Error' utility macro eee33827 futility: Add 'update' command for updating firmware 22266d1f futility: cmd_update: Support loading image files by -i, -e, --pd_image 6d30a78a futility: cmd_update: Process FMAP and parse image version 035f0da2 futility: cmd_update: Access system firmware using external flashrom 039ad74d futility: cmd_update: Add '--emulate' option e04be109 futility: cmd_update: Implement updater logic "FULL UPDATE". 0a368cac futility: cmd_update: Add "system property" and '--sys_props' to override 8017381e futility: cmd_update: Implement updater logic "RW UPDATE". b77e2548 futility: cmd_update: Add 'mainfw_act' system property 6b1ead30 futility: cmd_update: Implement updater logic "TRY-RW" (--try) eb0c9caf futility: cmd_update: Preserve image sections before update 9f27a900 futility: cmd_update: Check contents before starting to update e25ffef4 futility: cmd_update: Use real system write protection status f7b99d00 futility: cmd_update: Add vboot1 updater logic b0f5a8f9 futility: cmd_update: Check platform compatibility before updating c13d39fa futility: cmd_update: Check TPM key versions before updating ede6a006 futility: cmd_update: Check RO and RW signing compatibility before updating 8b86ee5d futility: cmd_update: Add more legacy updater options 6a867bc4 futility: cmd_update: Correct updating logic for RW_LEGACY 27fc2478 futility: cmd_update: Preserve sections blocked by management engine 35c99021 futility: cmd_update: Revise debug and error message macro b5a4e47c futility: cmd_update: Correctly handle error counter 50cf198c futility: cmd_update: Add new 'legacy' mode da4e823f futility: cmd_update: Create and remove temporary files properly 1bb66a0c futility: cmd_update: Add --quirks for device-specific hacks b4243c6b futility: cmd_update: Add quirk 'enlarge_image' c3c9ae6a futility: cmd_update: Add quirk 'unlock_me_for_update' 382375b3 futility: cmd_update: Add quirk 'min_platform_version' cabd2f8c futility: update: Fix update failure in factory mode due to wrong WP logic ac8cb8dd futility: update: Add legacy option '--factory' d6f7c16b futility: update: Skip TPM check if tpm_fwver is not valid. f6198074 futility: update: Preserve new sections: RO_PRESERVE and RW_PRESERVE f67b991a futility: update: Preserve RO_FSG ee96e741 futility: update: Preserve RW_ELOG b07165b5 futility: update: Allow tpm_fwver=0 and allow --force to waive TPM check 5a5be0c7 futility: update: Revise error messages ba73f35e futility: update: Refactor 'emulation' (--emulate). eb166257 futility: update: Add --programmer to override flashrom programmer for servo 5fa5e3b9 futility: update: Refactor: move updater logic to 'updater.c' 243e2115 futility: updater: Refactor: move command line processing to cmd_update.c e7bcda54 futility: updater: Refactor: localize temp files management 8810b089 futility: updater: Refactor: move quirks to 'updater_quirks.c' a1bfb650 futility: updater: Add default quirks a2b9e356 futility: updater: Add quirk 'daisy_snow_dual_model' for daisy_snow ba30c93b futility: updater: Preserve SMMSTORE and add quirk 'eve_smm_store' 38d06701 futility: updater: Support reading main image from stdin f1609b8c futility: updater: Revise verbosity and error messages fabf760f futility: updater: Add ASPRINTF macro 7aa34302 futility: updater: Refactor function names 077026fd futility: updater: Add '--archive' to read from an archive or directory f7c44a32 futility: updater: Refactor how arguments were configured 1847ba4f futility: updater: Add --manifest to scan and print archive info a71e0ccd futility: updater: Allow patching rootkey and vblock files 2ae23df7 futility: updater: Change default model name to FWID platform name 3d615c91 futility: updater: Do not preserve GBB flags in --factory mode. 10b3d4ed futility: updater: Add '--model' and select images by system model 622c35aa futility: updater: Support white label from VPD and --signature_id c6781206 futility: updater: Support --mode=output and --output_dir fb947ae0 futility: update: Add `--host_only` argument 67d66f18 futility: updater: Support --repack and --unpack 1f489393 futility: updater: Fix model detection error BUG=chromium:882445 TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility BRANCH=None Change-Id: I6c14133f59561a422a190b17fa8ff7e79c45d953 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1348510
* futility/cmd_validate_rec_mrc: Update futility to use new MRC structFurquan Shaikh2016-12-251-19/+76
| | | | | | | | | | | | | | | | | | | 1. Use mrc_metadata structure with new fields for header checksum and data checksum. 2. Use region file metadata to ensure there is only one metadata block present and only one slot in recovery MRC cache. Use the offset and size based on values in metadata block. BUG=chrome-os-partner:61306 BRANCH=None TEST=Verified that recovery MRC cache is verified using futility. Change-Id: I68b2d75ea70fdaef6c87cdaa6ce97656e8a8bddc Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/424213 Reviewed-by: Aaron Durbin <adurbin@chromium.org> (cherry picked from commit 2a84553d44fb0274c9b7744217481bfc833dc5c2) Reviewed-on: https://chromium-review.googlesource.com/424233
* set_gbb_flags: add '-p host' to flashrom commandTing Shen2016-12-211-1/+2
| | | | | | | | | | | | | | | | BRANCH=none BUG=chrome-os-partner:60894 TEST=set_gbb_flags 0 Change-Id: I22f372590bfe7705d4312588f971ad37f229a216 Reviewed-on: https://chromium-review.googlesource.com/418519 Commit-Ready: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> (cherry picked from commit e5500a319bd34abfd8b13851a4e758fad154f5d4) Reviewed-on: https://chromium-review.googlesource.com/422672 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* crossystem: add phase_enforcement fieldAaron Durbin2016-12-162-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide 'phase_enforcement' field that indicates if a system should have its full security features enabled while in the factory. The backend implementation currently is only for x86 using chromeos_acpi. On reef: $ grep ^ /sys/devices/platform/chromeos_acpi/GPIO.*/* /sys/devices/platform/chromeos_acpi/GPIO.2/GPIO.0:4 /sys/devices/platform/chromeos_acpi/GPIO.2/GPIO.1:1 /sys/devices/platform/chromeos_acpi/GPIO.2/GPIO.2:10 /sys/devices/platform/chromeos_acpi/GPIO.2/GPIO.3:INT3452:00 BUG=chrome-os-partner:59951 BRANCH=None TEST=Tested on reef with accompanying coreboot patches and flipping internal pulls to see the correct setting. Original-Reviewed-on: https://chromium-review.googlesource.com/418899 Original-Reviewed-by: Hung-Te Lin <hungte@chromium.org> Change-Id: Id5401d795cff8874a038f2456121549713a11237 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/421367 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org>
* futility: Add support for verifying recovery MRC cacheFurquan Shaikh2016-11-292-0/+183
| | | | | | | | | | | | | | | | | | 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> (cherry picked from commit 6d3cb5d9eac572b878ac8e6c9da902d11af8d7c5) Reviewed-on: https://chromium-review.googlesource.com/413156
* utility: Allow chromeos-tpm-recovery to return failure.Hung-Te Lin2016-11-241-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When some of the space re-creation procedure failed, chromeos-tpm-recovery should exit with non-zero value and not saying TPM is successfully recovered. However, there are few known issues: - 0x1009 is not needed in TPM2. - The space is not created in TPM2. - tlcl does not support define spaces with policies yet (crosbug.com/p/59594). As a result, we want to return failure only if writing any of the two spaces (0x1007, 0x1008) fails. This change also revised chromeos-tpm-recovery so it won't exit with unbound variable error due to early exit without having daemon_was_running variable. BRANCH=None BUG=chrome-os-partner:60099 TEST=For boards with TPM and TPM2, do: build_image --board $BOARD factory_install; Boot factory install shim, select 'I' and get TPM recovered. Change-Id: I3f79b02cdf77ac61cf1361033c489604dcd603f2 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/412543 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit c66cbc3440b03440d591274b188ea62b2de7af80) Reviewed-on: https://chromium-review.googlesource.com/414787
* update chromeos-tpm-recovery to work for both TPM 1.x and 2.xVadim Bendebury2016-11-241-30/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This script runs when the target is booted in recovery mode. It reinitializes the TPM and sets the predefined NVRAM spaces to the default values. The precence of the /etc/init/trunksd.init file is used to derermine if the target is runnig TPM 1.x or 2.x. The major difference between TPM 1.2 and TPM 2.0 modes is that the TPM 2.0 supporting routines do not yet allow to define NVRAM spaces. This capability will be added later. BRANCH=none BUG=chrome-os-partner:59361, chrome-os-partner:55210 TEST=verified that running chromeos-TPM-recovery on a device booted in recovery mode properly reinitializes TPM on both reef (TPM2.0) and kevin (TPM1.2). The previously failing on reef autotest firmware_UpdateFirmwareDataKeyVersion is now passing. Change-Id: I58e4ceeb1ba27544b7ebfb045d2d2fc5477ecf43 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/407796 Reviewed-by: Andrey Pronin <apronin@chromium.org> (cherry picked from commit dcbd8103376589dac48f896f3654a93b6943584c) Reviewed-on: https://chromium-review.googlesource.com/414786 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Trybot-Ready: Hung-Te Lin <hungte@chromium.org>
* Fix test failures when TPM2_MODE is definedBill Richardson2016-11-241-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> (cherry picked from commit 0ea5e1ec4a15994a23d732988f46e74e52d8dadd) Reviewed-on: https://chromium-review.googlesource.com/414785 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Trybot-Ready: Hung-Te Lin <hungte@chromium.org>
* tests: Fix coverity warningsRandall Spangler2016-09-1515-50/+102
| | | | | | | | | | | | | | Assorted minor code issues, which we should fix so any new errors stand out more. BUG=chromium:643769 BRANCH=none TEST=make runtests Change-Id: I927571f8a30794c70228506afe4da3eda86f765b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/383953 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Fix more coverity warnings in utilitiesRandall Spangler2016-09-156-13/+38
| | | | | | | | | | | | | | Assorted minor code issues, which we should fix so any new errors stand out more. BUG=chromium:643769 BRANCH=none TEST=make runtests Change-Id: I8fcf0c51e33d5dc49f650f4069f1579091cf188d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/383713 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* utilities: Fix coverity warningsRandall Spangler2016-09-143-4/+12
| | | | | | | | | | | | | | Assorted minor code issues, which we should fix so any new errors stand out more. BUG=chromium:643769 BRANCH=none TEST=make runtests Change-Id: Ifcb50b3dfcc3d376bf6803e9c06f8e68dafd51a0 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/382611 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* futility/host lib: Fix coverity warningsRandall Spangler2016-09-1415-89/+140
| | | | | | | | | | | | | | Assorted minor code issues, which we should fix so any new errors stand out more. BUG=chromium:643769 BRANCH=none TEST=make runtests Change-Id: Ib37b45dea54bd506b519b0304300b8d192e34339 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/382319 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* make_dev_firmware.sh should use key.versions filestabilize-8798.BBill Richardson2016-09-122-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'key.versions' file is used by the image signing scripts to ensure that newly generated keys and re-signed buildbot images have the correct version numbers to avoid rollback in officially-signed Chrome OS images. If a skilled user is re-keying her Chromebook to use personal keys in normal mode (which requires disabling WP and changing the GBB and VBLOCK_A/B), she can avoid clearing the TPM rollback counters if make_dev_firmware.sh will obtain the firmware_version from the key.versions file in her personal key directory. BUG=none BRANCH=none TEST=make runtests, manual tests Extract an MP-signed BIOS from a Chromebook Peppy. flashrom -p host -r peppy.bin Resign it without this CL: make_dev_firmware.sh -f peppy.bin -k tests/devkeys -t dev_peppy.bin Resign it with this CL: make_dev_firmware.sh -f peppy.bin -k tests/devkeys -t dev_peppy_new.bin Confirm no difference: cmp dev_peppy.bin dev_peppy_new.bin Temporarily edit tests/devkeys/key.versions to contain firmware_key_version=2 firmware_version=3 kernel_key_version=4 kernel_version=5 Resign again: make_dev_firmware.sh -f peppy.bin -k tests/devkeys -t dev_peppy_new2.bin Confirm that the only difference is the firmware version in VBLOCK_A/B: futility show dev_peppy_new*.bin Change-Id: I133f1b58fb969eaeb239a44a4800750c4eee1d5f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/383887 Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Change debug key signaturesVictor Hsieh2016-09-091-5/+11
| | | | | | | | | | | | | | We switched to different debug keys so the signature needs to be updated. TEST=sign_official_image with the new recovery image, failed before this change bug succeeded after. BUG=chromium:645628 Change-Id: I58236222c26f90268de80dc99f22d84650e67bb7 Reviewed-on: https://chromium-review.googlesource.com/383900 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Victor Hsieh <victorhsieh@chromium.org>
* cgpt: add support for managing the legacy boot gpt bitstabilize-kevin-8785.94.BMike Frysinger2016-09-0812-14/+107
| | | | | | | | | | | | | | | | | | | | | | | Bit 2 in the GPT partition attributes has been allocated as the legacy bios boot (equivalent to the "active" or "boot" flag in MBR). If we try to boot images on newer x86 systems, syslinux dies because it can't find any GPT partition marked bootable. Update the various parts of cgpt add & show to manage this bit. Now we can run: cgpt add -i 12 -B 1 chromiumos_image.bin And the EFI partition will be marked bootable. BUG=chromium:644845 TEST=vboot_reference unittests pass TEST=booted an amd64-generic disk image via USB on a generic laptop BRANCH=None Change-Id: I78e17b8df5b0c61e9e2d8a3c703e6d5ad230fe92 Reviewed-on: https://chromium-review.googlesource.com/382411 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cgpt: fix -A documentation to match realityMike Frysinger2016-09-082-2/+2
| | | | | | | | | | | | | | | | The documentation claims the -A option shows the raw 64-bit attributes field when in reality it only shows the high reserved 16-bits. Change the docs to match the code. BUG=chromium:644845 TEST=vboot_reference unittests pass BRANCH=None Change-Id: If163896ddbca0dc27ac8205db313031e73a68fd7 Reviewed-on: https://chromium-review.googlesource.com/382431 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* cgpt: unify cli int parsing error checkingMike Frysinger2016-09-0810-121/+43
| | | | | | | | | | | | | | | | Most of the cmd funcs had the same logic copied & pasted multiple times over. Unify them into a common header. BUG=chromium:644845 TEST=precq passes TEST=passing invalid args to some funcs is caught BRANCH=None Change-Id: Ib7212bcbb17da1135b2508a52910aac37ee8e6cd Reviewed-on: https://chromium-review.googlesource.com/382691 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* tests: Prevent testing dev_firmware* if the keys do not exist.Hung-Te Lin2016-09-071-7/+14
| | | | | | | | | | | | | | | | | | | | In CL:378661 we removed dev_firmware* from tests/devkey but that also makes futility unit tests to fail. This changes signing test scripts to first check if dev_firmware* keys exist, and only use it (and test ZGB signing results) if available. BRANCH=none BUG=chrome-os-partner:52568,chrome-os-partner:56917 TEST=make runfutiltests; make runtests; add dev_firmware* back; run tests again and success. Change-Id: If42c8404baf183edf5c8dbeadf537efa8ad571ec Reviewed-on: https://chromium-review.googlesource.com/381151 Commit-Ready: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: use vboot2 functions for kernel preambleRandall Spangler2016-09-069-191/+194
| | | | | | | | | | | | | | | Another in a long series of refactoring changes to replace old vboot1 code with its vboot2 equivalent. Futility changes only; no change to firmware. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: I7be813b82820674e975db13d5e540e49bdea028d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/366057 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: Remove vboot1 host signature functionsRandall Spangler2016-09-065-191/+170
| | | | | | | | | | | | | | These have been superseded by their vboot2 equivalents. No firmware changes; host-only. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: I36b5d3357767f32489efb7e480049620dcc0fce4 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/363970 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* vboot: replace CreateKernelPreamble() with vboot2 equivalentRandall Spangler2016-09-068-150/+129
| | | | | | | | | | | | | 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: Fix lookup of invalid algorithm namesRandall Spangler2016-09-065-34/+24
| | | | | | | | | | | | | | If given a malformed file with an invalid algorithm, futility could dereference null when looking up the algorithm names. BUG=chromium:643769 BRANCH=none TEST=make runtests Change-Id: I26d1312b8bf2eec8d806664708676daa9f36fa58 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/380522 Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* cgpt: Fix coverity warningsRandall Spangler2016-09-062-1/+6
| | | | | | | | | | | | | | Assorted minor code issues, which we should fix so any new errors stand out more. BUG=chromium:643769 BRANCH=none TEST=make runtests Change-Id: I9e7ce2ba226993fc53d1745c98381cb7cfcb7712 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/380448 Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* Fix coverity warnings in firmwareRandall Spangler2016-09-066-26/+37
| | | | | | | | | | | | | | Assorted minor code issues, which we should fix so any new errors stand out more. BUG=chromium:643769 BRANCH=none TEST=make runtests Change-Id: I84182df0d0e222f4f60206c621ec62e1ee283adb Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/380697 Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* futility: Use vboot 2.0 APIs for public keysRandall Spangler2016-09-0225-253/+296
| | | | | | | | | | | | | | This replaces calls to the old vboot 1 APIs with their vboot 2.0 equivalents. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: Ieb1a127577c6428c47ac088c3aaa0d0dad6275a8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356541 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* tests: Remove dev_firmware.* keyblock and keys from devkey set.Hung-Te Lin2016-09-013-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dev_firmware* was created for legacy devices having different RW firmware - A for devmode and B for normal, like Alex and ZGB. All other Chromebooks, including the CR48, were not doing that. Signer scripts relied on checking if RW A/B are equivalent to decide if they should select <dev_firmware* for A, firmware* for B> or <firmware* (normal) for both A and B>. This worked for a long time until Skylake family joined. Skylake FSP has some limitation that we have to execute code in-place, which leads to making RW A != B (due to addresses and offsets), and triggers signer to incorrectly use dev_firmware*. The production images are using keyset folders on signerbot, which only Alex/ZGB keyset folders have dev_firmware*; so the images for Skylake boards are signed correctly. But for people running firmware related tests using tests/devkey keyset, for example platform/dev/fm_and_key_version_test_prep.sh, having dev_firmware* in devkey may produce incorrect output. There is currently no easy way for signer scripts to figure out if the image should use dev_firmware or not except looking into keyset folder. Since Alex and ZGB are pretty old and no one plans to run key change tests anymore on them, the recommended solution is to remove dev_firmware.* from devkeys folder. BRANCH=none BUG=chrome-os-partner:52568 TEST=platform/dev/fm_and_key_version_test_prep.sh -b sentry -i \ /tmp/chromiumos_test_image.bin -f 8530.69.0 -s /tmp/image.bin -v \ Google_Sentry.7820.156.0 Change-Id: Ief37dd482875efc8e808460f3ad00041b5f3b3a2 Reviewed-on: https://chromium-review.googlesource.com/378661 Commit-Ready: Hung-Te Lin <hungte@chromium.org> Tested-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* Remove Android signing restriction of M54+Victor Hsieh2016-08-291-9/+0
| | | | | | | | | | | | | | Effectively, this will sign Android platform apks in M53, the first ARC release. TEST=Haven't heard problem from the latest Dev release 8737.1.0 BUG=b:29915721 Change-Id: Ic71f04e7fddbe3d020c57f9933e09b5537ee7370 Reviewed-on: https://chromium-review.googlesource.com/376799 Tested-by: Victor Hsieh <victorhsieh@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
* image_signing: drop board hacking for lsb appid checksstabilize-8743.69.Bstabilize-8743.60.Bstabilize-8743.58.Bstabilize-8743.25.Brelease-R54-8743.BMike Frysinger2016-08-251-4/+2
| | | | | | | | | | | | BUG=chromium:605595 TEST=None BRANCH=None Change-Id: I8104d80d151440bdd8f419c88bd98592d9f44612 Reviewed-on: https://chromium-review.googlesource.com/371678 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
* Skip Android signing if executables are not foundstabilize-8737.BVictor Hsieh2016-08-231-0/+7
| | | | | | | | | | | TEST=./fm_and_key_version_test_prep ... in chroot BUG=chrome-os-partner:56279 Change-Id: I0c76aed757ae30245e07873180dbc9b609a8ec13 Reviewed-on: https://chromium-review.googlesource.com/374078 Tested-by: Victor Hsieh <victorhsieh@chromium.org> Reviewed-by: danny chan <dchan@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* tlcl: add implementations for GetOwnership and Read/WriteLockStephen Barber2016-08-213-3/+58
| | | | | | | | | | | | | | | | mount-encrypted needs to be aware of TPM ownership status, and will also want to issue a read lock for the early access NVRAM index. BRANCH=none BUG=chromium:625037 TEST=mount-encrypted shows ownership at boot with kevin Change-Id: I42f43f91d892137e1c46c7cacd88e3b749ce7f04 Reviewed-on: https://chromium-review.googlesource.com/366443 Commit-Ready: Andrey Pronin <apronin@chromium.org> Tested-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* Refer keytool using relative pathVictor Hsieh2016-08-191-3/+1
| | | | | | | | | | | | | We will assume JDK bin/ is in the PATH, instead of using an absolute path. TEST=sign_official_image.sh BUG=b:29915721,chrome-os-partner:56279 Change-Id: I55379a8409b7d81f213d4d7418133691fa8152cf Reviewed-on: https://chromium-review.googlesource.com/373558 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Victor Hsieh <victorhsieh@chromium.org>
* Fix file ownership during Android apk signingVictor Hsieh2016-08-181-17/+30
| | | | | | | | | | | | | | Several files were changed to own by root instead of the original owner in the squashfs image. This has caused problem to boot Android. TEST=./sign_official_image with local keys, extract system.raw.img and override device copy. Able to launch ARC. BUG=b:29915721,b:30919855 Change-Id: Ic2595c99cbb7f7c2a2c543612a368681220cb3d9 Reviewed-on: https://chromium-review.googlesource.com/372312 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Victor Hsieh <victorhsieh@chromium.org>
* Only re-sign ARC apks when lsb-release looks legitstabilize-8714.BVictor Hsieh2016-08-161-3/+4
| | | | | | | | | | | TEST=sign_official_build.sh with veyron_minnie image # works TEST=sign_official_build.sh with veyron_shark image # skipped BUG=chromium:638289 Change-Id: Ic00b5c73fc094ad1146ffb1f29d2dcc5cfdb839d Reviewed-on: https://chromium-review.googlesource.com/371458 Tested-by: Victor Hsieh <victorhsieh@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* image_signing: avoid leaking rootfs mount in android codeMike Frysinger2016-08-161-0/+1
| | | | | | | | | | | | | | When we return early from the release check, we leaked the mount point. This could in turn cause issues with data syncing and hash calculation. BUG=b:30891460 TEST=None BRANCH=None Change-Id: I7a40007e371b8e64ca7e8210ad9121dc1a4bcf9f Reviewed-on: https://chromium-review.googlesource.com/370739 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
* Add script to sign Android imageVictor Hsieh2016-08-1511-0/+408
| | | | | | | | | | | | | | | | | | | | sign_android_image.sh is the main script that signs the image. It makes similar changes to an image like the Android official signing tool (sign_target_files_apks.py) does, but more Chrome OS specific. TEST=./sign_official_build.sh recovery recovery_image.bin \ ../../tests/devkeys/ out_img TEST=Same above but with a recovery image without Android image. Android signing was skipping. TEST=Same above but with a M53 image. Android signing was skipped. TEST=Unpack the image and diff the before and after. Looks correct. BUG=b:29915721 Change-Id: I0ae5f0ad8d2b05e485d60262558517ea563bf527 Reviewed-on: https://chromium-review.googlesource.com/366794 Commit-Ready: Victor Hsieh <victorhsieh@chromium.org> Tested-by: Victor Hsieh <victorhsieh@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* crossystem: refactor VM detection to share across architecturesNicolas Norvez2016-08-154-22/+15
| | | | | | | | | | | | | | | | | If there is no HWID and mainfw_type is "nonchrome", report that the host is a VM. If HWID is present, it's not a VM. Make the detection architecture-independent. BUG=chromium:632303 TEST=emerge-cyan vboot_reference and test binary on QEMU and HW TEST=emerge-veyron_minnie vboot_reference and test binary on HW BRANCH=none Change-Id: I076eb9838a3b724ded0cfded9fb8d8a5392631c8 Reviewed-on: https://chromium-review.googlesource.com/368650 Commit-Ready: Nicolas Norvez <norvez@chromium.org> Tested-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Detect and report VM environment in crossystemNicolas Norvez2016-08-104-2/+26
| | | | | | | | | | | | | | | | | | Add "inside_vm" command to crossystem. x86: If there is no HWID and mainfw_type is "nonchrome", report that the host is a VM. If HWID is present, it's not a VM. ARM: Detection not implemented and so far no ARM VMs exist, always report that the system is not a VM BUG=chromium:632303 TEST=emerge-cyan vboot_reference and test binary on cyan QEMU and HW BRANCH=none Change-Id: I18f5cb24b68e51f3097d9aafd9f0db0e610d322a Reviewed-on: https://chromium-review.googlesource.com/367240 Commit-Ready: Nicolas Norvez <norvez@chromium.org> Tested-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Use vboot 2.0 APIs for private keysRandall Spangler2016-08-1021-369/+238
| | | | | | | | | | | | | | This replaces calls to the vboot 1 host library with their vboot 2.0 equivalents. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: Id061554fd82ea3efe35d0fe1485693b47599a863 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356540 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* futility: Use only vboot 2.0 APIs for keyblocksRandall Spangler2016-08-1020-332/+468
| | | | | | | | | | | | | | This refactors futility and the host library to use only vboot 2.0 APIs to create and verify keyblocks. BUG=chromium:611535 BRANCH=none TEST=make runtests Change-Id: Ia3cc1e24971b94f01bcb4890c8666a3af6f84841 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356129 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* futility: Create signatures using vboot 2.0 APIsstabilize-8688.BRandall Spangler2016-08-0327-319/+505
| | | | | | | | | | | | | 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-0311-87/+151
| | | | | | | | | | | | | 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>
* cgptlib: cast 32bit to 64bit before multiplicationPatrick Georgi2016-08-031-3/+6
| | | | | | | | | | | | | | | | | Coverity noted that multiplying two 32bit values happens in 32bit, while the result is to be stored in an uint64_t. BUG=none BRANCH=none TEST=none Found-by: Coverity Scan #1353032, #1353033, 1353034 Change-Id: I8d0c5fe4feee066a81e8904c525dc836dd7a4fc6 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/365391 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* tlcl: implement clear, startup, shutdown, self teststabilize-8647.BAndrey Pronin2016-07-263-6/+133
| | | | | | | | | | | | | | | | | Implement TlclStartup, TlclSaveState, TlclResume, TlclSelfTestFull, TlclContinueSelfTest, TlclForceClear. BRANCH=none BUG=chrome-os-partner:55210 BUG=chrome-os-partner:55250 TEST=boot on kevin in recovery mode, verify that 'tpmc ctest', 'tpmc startup', 'tpmc clear' work. Change-Id: I00839eae1984e24c0138ec5bdab8299379e1bcb6 Reviewed-on: https://chromium-review.googlesource.com/362996 Commit-Ready: Andrey Pronin <apronin@chromium.org> Tested-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* tlcl: support sending raw commandsAndrey Pronin2016-07-263-4/+43
| | | | | | | | | | | | | | | Implement TlclSendReceive and TlclPacketSize required for sending raw commands. BRANCH=none BUG=chrome-os-partner:55210 TEST=boot on kevin, verify that 'tpmc raw' works Change-Id: Iba41b95dd7790a6b7a3a7af6cf5f897f45dce1e5 Reviewed-on: https://chromium-review.googlesource.com/363033 Commit-Ready: Andrey Pronin <apronin@chromium.org> Tested-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* tpmc: define actions for all commands for tpm2Andrey Pronin2016-07-261-29/+67
| | | | | | | | | | | | | | | | | | | | | Implement macros to handle differences between TPM1.2 and TPM2.0. For all original tpmc commands define if they are to (1) be implemented, (2) do nothing, or (3) return a "not implemented" error. Print TPM mode (1.2 or 2.0) for tpmc in 'tpmc help' output. BRANCH=none BUG=chrome-os-partner:55210 BUG=chrome-os-partner:55250 TEST=boot on kevin; verify that the following tpmc commands do nothing and return success: ppon, enable, activate; verify that 'help' prnts the right mode and command descriptions. Change-Id: Ifec4e8e5bd4afb45f76f9c2b3249c844ea1b670a Reviewed-on: https://chromium-review.googlesource.com/363000 Commit-Ready: Andrey Pronin <apronin@chromium.org> Tested-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>