summaryrefslogtreecommitdiff
path: root/firmware/linktest/main.c
Commit message (Collapse)AuthorAgeFilesLines
* vboot: replace sysincludes.h with 2sysincludes.hJoel Kitching2019-08-221-2/+1
| | | | | | | | | | | | | | | | | | | | | sysincludes.h and 2sysincludes.h are almost identical except for one extra header (ctype.h) in the vboot1 variant. Add this to 2sysincludes.h, and nuke sysincludes.h. Depends on: https://review.coreboot.org/c/coreboot/+/33525 BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Iaba21a9b8bb2ae0c081184019576663898317bd1 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1680325 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1659990 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Auto-Submit: Joel Kitching <kitching@chromium.org>
* vboot: remove VerifyMemberInside functionstabilize-12301.BJoel Kitching2019-06-261-1/+0
| | | | | | | | | | | | | | | | | | Use vboot2-style vb2_verify_member_inside instead. Correct some strings in vboot2 tests to refer to new vboot2 functions instead. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Idb3bcf1657c9d955acc6f93983c7b0c7f06427e3 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1675870 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: remove OffsetOf functionJoel Kitching2019-06-261-1/+0
| | | | | | | | | | | | | | | Should use vboot2 equivalent instead: vb2_offset_of BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I64afc88477cbb615a661833f45761030c55fcdf6 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1675868 Tested-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
* vboot: do not use cparams for VBSDJoel Kitching2019-05-281-0/+1
| | | | | | | | | | | | | | | | | | | | | Pass VbSharedDataHeader struct directly as an argument for the functions VbVerifyMemoryBootImage and VbSelectAndLoadKernel, instead of retrieving from cparams. After any remaining references are removed from depthcharge, the VbCommonParams struct may be deprecated and removed. BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: I4dceb539516b62b5817987359705bb8e27ddb6f3 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1585505 Reviewed-on: https://chromium-review.googlesource.com/1584489 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* vboot: pull vb2_context up to higher level in call stackJoel Kitching2019-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | The original purpose of vb2_context is to provide one shared state object through the entirety of one particular application. Pull the creation of vb2_context up to a higher level in order to work towards this goal. BUG=b:124141368 TEST=/work/vboot/src/repohooks/pre-upload.py TEST=make clean && make runtests TEST=make clean && COV=1 make coverage && make coverage_html CQ-DEPEND=CL:1517179 BRANCH=none Change-Id: I7c454afddb2b525895d9945b081b14b29100892c Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/1517061 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* tpmc: Add TlclUndefineSpace/Ex for TPM 1.2/2.0Meng-Huan Yu2018-11-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | For TPM 1.2, to undefine the space is just define a size 0 space. And all operation should be done under physical presence is set if NvLocked is set. Iirc, NvLocked is usually set before boot. For TPM 2.0, support to undefine space regardless platform hierarchy state. We will use platform authorization when TPMA_NV_PLATFORMCREATE of that space is set. Otherwise, we will try to use owner authorization with NULL password. For owner authorization with customized password is still not supported in UndefineSpace since it is also not support in DefineSpaceEx. BUG=chromium:895549 BRANCH=None TEST=vboot_reference unit test passed and added new link test for TPM 1.2. For TPM 2.0, there is no unit test, but passed manually test with tpmc in the following commit. Also passed depthcharge unit test for TPM 2.0 and TPM 1.2 board. Change-Id: I06dcc70c63a88a04d19f3b248666ff2492a1d2b0 Reviewed-on: https://chromium-review.googlesource.com/1291131 Commit-Ready: Meng-Huan Yu <menghuan@chromium.org> Tested-by: Meng-Huan Yu <menghuan@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* firmware: Stop using vboot1 cparams internallyRandall Spangler2018-01-091-1/+1
| | | | | | | | | | | | | | | | | | Now that vb2_shared_data / vb2_context provides all the same data to lower-level kernel verification code that cparams did, stop passing cparams down to those functions. No change in functionality. BUG=chromium:611535 BRANCH=none TEST=make -j runtests; build bob firmware and boot it Change-Id: I86eb1801ee96d8b56404b74843a8d09e3122567f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/852814 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
* vboot: Use 2nvstorage instead of vboot_nvstorageRandall Spangler2017-12-111-6/+0
| | | | | | | | | | | | | | | | | | Remove the old vboot1 vboot_nvstorage library (VbNv*() functions) and use the vboot2 library (vb2_nv_*()) instead. This is needed in preparation for moving to 64-byte records; no sense in implementing that change twice... Should be (better be) no change in system behavior. BUG=chromium:789276 BRANCH=none TEST=make runtests compare output of crossystem before/after change (should be identical) Change-Id: I10f9975b0824263064b9a74a3c6daadcecc085d3 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/794732
* vboot: Pass vb2 context and use vboot2 NV routinesRandall Spangler2016-12-221-1/+1
| | | | | | | | | | | | | | | Passing the vb2 context around allows using more of the vb2 functions in future changes, and prepares for a future where we directly use the context as it was set up in firmware verification. BUG=chromium:611535 BRANCH=none TEST=make runtests; emerge-kevin coreboot depthcharge Change-Id: I8efa606dbdec5d195b66eb899e76fdc84337ad36 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/404997 Reviewed-by: Shelley Chen <shchen@chromium.org>
* vboot: use vb2 verification functions for kernel verificationRandall Spangler2016-10-291-5/+0
| | | | | | | | | | | | | 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>
* Modify 'tpmc block' to lock only the FW indexAndrey Pronin2016-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in https://chromium-review.googlesource.com/#/c/361381/, instead of being a synonym to 'tpmc pplock', the 'tpmc block' command should protect just the FW index using WriteLock. Additionally, both TlclSetGlobalLock and TlclLockPhysicalPresence in tlcl (which are used by 'tpmc block' and 'tpmc pplock') are updated to first check if the platform hierarchy is already disabled and return success, if so. That's needed to prevent command failures when rollback protection is already on. BRANCH=none BUG=chrome-os-partner:55210 BUG=chrome-os-partner:55250 TEST=boot on kevin, verify that 'tpmc block' and 'tpmc pplock' work as expected: - pplock is possible after block - pplock and block succeed both for enabled and disabled PH - block locks FW index - pplock disables PH Change-Id: I32bff2b590a51315b11da361b97c684dcce8ab36 Reviewed-on: https://chromium-review.googlesource.com/362772 Commit-Ready: Andrey Pronin <apronin@chromium.org> Tested-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* vboot: Upgrade VerifyFirmwarePreamble() to vboot2.0Randall Spangler2016-07-261-2/+0
| | | | | | | | | | | | | | | 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-15/+0
| | | | | | | | | | | | | | | | | | 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
* Stub tlcl implementation for tpm2 caseAndrey Pronin2016-07-151-4/+6
| | | | | | | | | | | | | | | | | | | 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>
* Extend HWID digest into PCR1 (GBB v1.2 only)Bill Richardson2014-10-311-70/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GBB header v1.2 adds a digest of the HWID string to the blob (and maintains it when updated with the current futility/gbb_utility). This CL causes VbSelectFirmware() to extend PCR1 with that HWID digest (only for GBB header v1.2 and later, of course). Tests are updated. This also adds a "pcr" command to futility to help determine that the change is working on the hardware (adds 4K bytes or fewer to the size of the executable). BUG=chromium:415714 BRANCH=ToT (and maybe others?) TEST=make runtests, manual install on HW To test on hardware, build and update a system with this change (both the disk image and the RO firmware). NOTE: The BIOS image must be built in a chroot that is using the current version of futility. You may need to update your chroot if your BIOS image still produces v1.1 GBB headers. Check with: futility show <firmware_image.bin> | grep -B1 'digest:' Boot the new system with a new test image, then follow these steps: Read the BIOS: # flashrom -r /tmp/bios.bin Make sure the GBB has a valid digest for the HWID. # futility show /tmp/bios.bin | grep -B1 'digest:' HWID: SAMUS TEST 8028 digest: 4172d24f40bf72cc0ab8... <valid> # Extract only the sha1sum-sized part of the HWID digest: # futility show /tmp/bios.bin | awk '/digest:/ {print $2}' | colrm 41 4172d24f40bf72cc0ab878b4c589b8fe9cf4405e # Simulate extending that value in a PCR using the futility "pcr" command: # futility pcr 4172d24f40bf72cc0ab878b4c589b8fe9cf4405e PCR: 0000000000000000000000000000000000000000 + 4172d24f40bf72cc0ab878b4c589b8fe9cf4405e PCR: b6e5ffd2d898a7b15236ad22ca25f53ac1f40776 # Finally, look at the value of PCR1. It should match the last line of the futility pcr output: # head /sys/class/misc/tpm0/device/pcrs | grep PCR-01 PCR-01: B6 E5 FF D2 D8 98 A7 B1 52 36 AD 22 CA 25 F5 3A C1 F4 07 76 # Change-Id: I09cf855f1a24616cc1a9ddb676670edbc76827d2 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226408 Reviewed-by: Darren Krahn <dkrahn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Implementation of Region APIstabilize-4636.BSimon Glass2013-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present reading data from storage in Vboot is a little fragmented. For the firmware image, we expect the boot loader to handle this. For the disk we have a block-level API. For the GBB (which also sits in the firmware image) we expect the entire thing to be read before Vboot is called. Add the concept of a region, and an API to read from a region. At present, and most pressing, is reading from a GBB region. In the future this could be extended to other parts of the firmware or even the disk. Move all access to the GBB into this API so that the boot loader can provide either a GBB region in one large contiguous chunk, or a function to deal with read requests from vboot. The call to VbExRegionRead() is behind a flag since not all boot loaders support it yet. The main change for boot loaders which don't support this new API is that vboot will do more behind the scenes. For example, it will allocate memory for chunks of data that it reads from the GBB, rather than just accessing it directly. This approach is considerably simpler than trying to pass char ** everywhere and have vboot decide whether something needs to be allocated or not. The tests are updated, mainly to include setting up a GBB structure accessible from VbCommonParams, which is now required by the firmware and kernel functions. In normal operation this is set up at the start of VbLoadFIrmware() and VbSelectAndLoadKernel() but for tests which call children of these functions directly, the GBB structure must be set up manually by the test. BUG=chrome-os-partner:21115 BRANCH=none TEST=manual FEATURES=test sudo -E emerge vboot_reference Change-Id: If2b8bbe467fdbd643239d8d9b5d7aa98df4d286f Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/63336 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/167361
* Revert "Implementation of Region API"Yoshiki Iguchi2013-08-291-1/+1
| | | | | | | | | | | | | This reverts commit 1d3c804b6b9d2ffb6953a7ee98fabfd548915ad7. This patch breaks cbuildbot on internal paladins bots. Change-Id: Icf7f9d9bbb56b092035888eaa3e249ffd23fac16 (cherry picked from commit 3a60335ebb1530e5fd9d5da3bc6214949bc59caf) Reviewed-on: https://chromium-review.googlesource.com/167451 Reviewed-by: Yoshiki Iguchi <yoshiki@chromium.org> Commit-Queue: Yoshiki Iguchi <yoshiki@chromium.org> Tested-by: Yoshiki Iguchi <yoshiki@chromium.org>
* Implementation of Region APISimon Glass2013-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present reading data from storage in Vboot is a little fragmented. For the firmware image, we expect the boot loader to handle this. For the disk we have a block-level API. For the GBB (which also sits in the firmware image) we expect the entire thing to be read before Vboot is called. Add the concept of a region, and an API to read from a region. At present, and most pressing, is reading from a GBB region. In the future this could be extended to other parts of the firmware or even the disk. Move all access to the GBB into this API so that the boot loader can provide either a GBB region in one large contiguous chunk, or a function to deal with read requests from vboot. The call to VbExRegionRead() is behind a flag since not all boot loaders support it yet. The main change for boot loaders which don't support this new API is that vboot will do more behind the scenes. For example, it will allocate memory for chunks of data that it reads from the GBB, rather than just accessing it directly. This approach is considerably simpler than trying to pass char ** everywhere and have vboot decide whether something needs to be allocated or not. The tests are updated, mainly to include setting up a GBB structure accessible from VbCommonParams, which is now required by the firmware and kernel functions. In normal operation this is set up at the start of VbLoadFIrmware() and VbSelectAndLoadKernel() but for tests which call children of these functions directly, the GBB structure must be set up manually by the test. BUG=chrome-os-partner:21115 BRANCH=none TEST=manual FEATURES=test sudo -E emerge vboot_reference Change-Id: I2c19e9dc2ed602d0642bbf4f7d27f79fe9fad873 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/63336 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* rollback_index: Remove recovery_mode parameter to SetupTPM.Shawn Nematbakhsh2013-07-231-1/+1
| | | | | | | | | | | | | | | | | | SetupTPM no longer uses recovery_mode parameter for anything other than a debug print. This change moves the debug print to a caller function, then removes recovery_mode from SetupTPM and some caller functions that no longer have a use for it. BUG=chrome-os-partner:20913. TEST=Manual. Boot factory install shim in recovery mode and verify TPM clear operations succeed. Boot in dev mode and verify "Lock physical presence" print on UART. BRANCH=None. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I2f671f6680a6e67cf722855e659e99752bc0783c Reviewed-on: https://gerrit.chromium.org/gerrit/62916 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* rollback_index: Add recovery parameter to RollbackKernelLock.stabilize-4443.BShawn Nematbakhsh2013-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | RollbackKernelLock previously checked a global to determine recovery mode state. Since we have two copies of vboot_reference in firmware (in coreboot and depthcharge), this creates a problem with synchronization. Remove the global entirely and instead pass the recovery state to RollbackKernelLock. BUG=chrome-os-partner:20913. TEST=Manual. Boot factory install shim in recovery mode and verify TPM clear operations succeed. Boot in dev mode and verify "Lock physical presence" print on UART. BRANCH=FalcoPeppy. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I4e751d4a9ca60cd57c5c662ce86eba595fb22ba2 Reviewed-on: https://gerrit.chromium.org/gerrit/62874 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Massive refactoring of external header files.Bill Richardson2013-04-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This reduces the number of exported header files to the minimum needed by the existing userspace utilities and firmware implementations. BUG=chromium:221544 BRANCH=none TEST=manual, trybots CQ-DEPEND=CL:47019,CL:47022,CL:47023 sudo FEATURES=test emerge vboot_reference FEATURES=test emerge-$BOARD \ vboot_reference \ chromeos-cryptohome \ chromeos-installer \ chromeos-u-boot \ peach-u-boot \ depthcharge Change-Id: I2946cc2dbaf5459a6c5eca92ca57d546498e6d85 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47021 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add clear TPM owner requestRandall Spangler2012-08-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds two new flags to crossystem: clear_tpm_owner_request clear_tpm_owner_done The first one requests that the firmware clear the TPM owner on the next boot. When the firmware does this, it will set clear_tpm_owner_request=0, and set clear_tpm_owner_done=1. The OS can use the done-flag as a hint that trusted things guarded by the TPM are no longer trustable. BUG=chromium-os:31974 TEST=manual crossystem // both flags initially 0 crossystem clear_tpm_owner_request=1 crossystem clear_tpm_owner_done=1 // request=1, done=0; done can be cleared but not set by crossystem reboot tpmc getownership // owned=no crossystem // request=0, done=1 crossystem clear_tpm_owner_done=0 crossystem // both flags 0 again Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: I49f83f3c39c3efc3945116c51a241d255c2e42cd Reviewed-on: https://gerrit.chromium.org/gerrit/25646
* Support virtual dev-switch (keyboard-based dev-mode)Bill Richardson2012-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BUG=chrome-os-partner:9706 TEST=manual Currently, Link is the only platform that enables this feature. To enter dev-mode: Boot into recovery mode using the magic key chord. At the Insert screen, press Ctrl-D. You'll be asked if you want to enter developer mode. If you then press ENTER, it will reboot with dev-mode enabled. If you press SPACE or ESC, it will return to the Insert screen. If you enter recovery mode through any other means, or if dev-mode is already enabled, pressing Ctrl-D at the Insert screen will have no effect. To return to normal mode: Reboot. At the Dev screen, press ENTER or SPACE. It will reboot to recovery mode and ask you if you want to return to normal mode. If you press ESC or power off, you'll still be in dev-mode. Press ENTER or SPACE, and it will reboot into normal mode (of course, if you've messed up your images while in dev-mode, you'll just come right back to recovery mode again). You can also request a direct return to normal mode by running crossystem disable_dev_request=1 and rebooting. Change-Id: I435905855a6c39932ee466cc046bdc4c4c860f98 Reviewed-on: https://gerrit.chromium.org/gerrit/24160 Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Ready: Bill Richardson <wfrichar@chromium.org>
* Use virtual dev-mode switch when told to.factory-2338.BBill Richardson2012-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | If VbInit() is instructed to look at a virtual dev-mode switch, then it will use value contained in the TPM's firmware space instead of a hardware GPIO to determine if developer mode is enabled. This change just makes it look. It doesn't provide a way to actually set the value in the TPM. VbInit() isn't being told to look yet, either. Those changes are coming. BUG=chrome-os-partner:9706 TEST=none The usual sanity-check applies: make make runtests But to actually test that this stuff is working IRL requires special tweaks to other components and monitoring the serial debug output from both EC and CPU. We'll save the hands-on tests for when it's all done. Change-Id: Ie485ad2180224e192238bf2a5dbf95bbcb9130f9 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/23067 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Clean up calling LoadFirmware() from VbSelectFirmware()Randall Spangler2011-07-291-2/+1
| | | | | | | | | | | BUG=chromium-os:18383 TEST=compiles for both x86 and ARM; boots on my test system Change-Id: I6c7dc1dd086fb06e4ad8daa053bccdf61a463240 Reviewed-on: http://gerrit.chromium.org/gerrit/4977 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@google.com> Tested-by: Randall Spangler <rspangler@chromium.org>
* Refactor TPM calls into vboot wrapperRandall Spangler2011-07-251-3/+1
| | | | | | | | | | | | | | | | | | | | | | Try #2, now that ARM has the fix from http://gerrit.chromium.org/gerrit/4667 This cleans up the TPM calls inside vboot_reference. * TPM calls share mode code between boot modes. * Better handling for TPM_E_MUST_REBOOT, particularly in recovery mode. * TAB screen shows current TPM versions. No changes required to the wrapper API; these changes are internal to vboot. BUG=chromium-os:18084 TEST=make && make runtests; built for both alex and tegra2-seaboard Original-Change-Id: I2a52066f2889210af83409872b10f9d6380470af (cherry picked from commit da55560cddcf7a1aa8a881cdf52792a21a01e766) Change-Id: I120797145772116f09b8125b9e56fdbb11dc16b3 Reviewed-on: http://gerrit.chromium.org/gerrit/4671 Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Revert "Refactor TPM calls into vboot wrapper"Elly Jones2011-07-251-1/+3
| | | | | | | | | This reverts commit da55560cddcf7a1aa8a881cdf52792a21a01e766. This commit caused http://build.chromium.org/p/chromiumos/builders/arm%20tegra2%20binary/builds/6301 to fail. Change-Id: Ie132c1e600ab28f97337ecfe0e7cff053987717d Reviewed-on: http://gerrit.chromium.org/gerrit/4661 Reviewed-by: Elly Jones <ellyjones@chromium.org> Tested-by: Elly Jones <ellyjones@chromium.org>
* Refactor TPM calls into vboot wrapperRandall Spangler2011-07-251-3/+1
| | | | | | | | | | | | | | | | | | This cleans up the TPM calls inside vboot_reference. * TPM calls share mode code between boot modes. * Better handling for TPM_E_MUST_REBOOT, particularly in recovery mode. * TAB screen shows current TPM versions. No changes required to the wrapper API; these changes are internal to vboot. BUG=chromium-os:18084 TEST=make && make runtests; built for both alex and tegra2-seaboard Change-Id: I2a52066f2889210af83409872b10f9d6380470af Reviewed-on: http://gerrit.chromium.org/gerrit/4611 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Gaurav Shah <gauravsh@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Add support for flags in the firmware preamble.Randall Spangler2011-07-131-0/+1
| | | | | | | | | | | | | | | | | | The old (v2.0) parser is compatible with new (v2.1) structs. That is, this won't break existing firmware or vbutil_firmware. A new (v2.1) parser parsing an old (v2.0) struct will return 0 for the flags. This will be used to support the RO-normal code path in a subsequent CL. BUG=chromium-os:17304 TEST=added unit tests; make && make runtests Change-Id: I73bcd8acd3330b0d7d143061b5ef838e6d79cf1a Reviewed-on: http://gerrit.chromium.org/gerrit/4030 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Vboot wrapper - add recovery reason, refactor timingRandall Spangler2011-07-081-2/+1
| | | | | | | | | | | | | | | | | | | | | Pressing Tab at a firmware screen now displays real data, including the recovery reason, HWID, and contents of VbNvStorage. Entry point start/end time tracking in VbSharedData now refers to the new wrapper APIs. Added capability for calling firmware to request recovery mode (for example, if it's unable to initialize RAM, can't find the SSD, etc.). Previously, calling firmware had no (good) way to do this other than faking the recovery button being pressed. BUG=chromium-os:17018 TEST=emerge on x86 and tegra2_seaboard Change-Id: I7d377f279842b30a10d945d13571c41c464633f1 Reviewed-on: http://gerrit.chromium.org/gerrit/3814 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Vboot wrapper initial implementationRandall Spangler2011-07-081-3/+7
| | | | | | | | | | | | | | | | | | Patch 1: Initial change Patch 2: Fix comment in vboot_struct.h Patch 3: Revert files unintentionally reverted Patch 4: (rebase) Patch 5: (rebase) Patch 6: Revert files unintentionally reverted (again) Patch 7: Fix mocked tlcl for ARM build BUG=chromium-os:17010 TEST=make && make runtests; works on H2C; emerge-tegra2_seaboard chromeos-bootimage compiles Change-Id: I6e5ce72d41b9297c07a3f330a881eba68cfabee2 Reviewed-on: http://gerrit.chromium.org/gerrit/3593 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Add TPM version checkingRandall Spangler2011-03-171-0/+1
| | | | | | | | | | | | | Change-Id: Ic32b7bcf0bc5501e21dc84e79419a256d9b0d095 R=semenzato@chromium.org,reinauer@chromium.org BUG=chrome-os-partner:2832 TEST=manual crossystem tpm_fwver tpm_kernver On a debug system, this will return 0x00010001 0x00010001 Review URL: http://codereview.chromium.org/6685075
* Update PCR state with the state of the firmware keyblock flags too.Gaurav Shah2011-03-151-0/+4
| | | | | | | | | | | | I re-factored the extend call into its own module, since it doesn't necessarily need to be couple with rollbackfirmwaresetup. BUG=chrome-os-partner:2372 TEST=Tried emerge-x86-generic and emerge-arm-generic vboot_reference. Change-Id: I0d3115b10b686133e63e304570325ebdbd50ae3a Review URL: http://codereview.chromium.org/6696006
* This is necessary to pass additional information about whether firmware A or ↵Randall Spangler2011-03-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | B is being run. This change also passes the GBB directly into LoadFirmware() and LoadKernel(). Change-Id: I976c11c82c3d665a4feb88226e919f16c2440f60 BUG=chrome-os-partner:1657 TEST=manual - see below make && make runtests Then test verifying a test image in both dev mode (-b1, no key specified) and recovery mode (key specified) build/utility/load_kernel_test -b1 ~/b/USB_images/0.11.224.0-alex/chromiumos_test_image.bin build/utility/load_kernel_test ~/b/USB_images/0.11.224.0-alex/chromiumos_test_image.bin tests/devkeys/recovery_key.vbpubk And make sure the firmware with this change actually boots to USB and SSD. NOTE: u-boot-next needs to change to work with this change. will attempt a follow-up CL with that change Review URL: http://codereview.chromium.org/6626045
* VbNvStorage cleanup and commentsRandall Spangler2011-02-221-0/+6
| | | | | | | | | BUG=12282 TEST=make && make runtests Review URL: http://codereview.chromium.org/6469059 Change-Id: I912b53ae33d65305353a747cc0bdd2b1ea62a04f
* TBR: reviewed in person with semenzatoRandall Spangler2010-09-021-0/+2
|
* Add a PCR extend call for measuring the dev mode boot flag.Gaurav Shah2010-08-301-0/+3
| | | | | | | | | | | BUG=2083 TEST=manual Compiled with DISABLE_ROLLBACK unset. I need help testing this change - in particular, if the PCR 0 value is actually different in dev mode off vs. dev mode on. This can be done by invoking 'tpm_pcrread -p 0' at the shell. tpm_pcrread is part of the tpm_tools package. Change-Id: I0728fb776a0c9cb90d885e7a1c76ff6a1a41a17b Review URL: http://codereview.chromium.org/3195018
* Fix KeyBlockVerify() to take an explicit param for whether to use hash only.Randall Spangler2010-08-171-1/+1
| | | | | | | | | Fix VerifyMemberInside(). BUG=chrome-os-partner:703 TEST=make && make runtests Review URL: http://codereview.chromium.org/3126013
* Change rollback interface so kernel/firmware version numbers areRandall Spangler2010-08-161-6/+4
| | | | | | packed in the calling code rather than in rollback_index. Review URL: http://codereview.chromium.org/3114013
* Add structs for TPM NV simplification. Now uses only 2 NV spaces, one for ↵Randall Spangler2010-08-121-2/+1
| | | | | | | | | | | | | | | firmware and one for kernel. Changed TlclRead / TlclWrite to take void* / const void* to reduce typecasts. Much restructuring of rollback_index.c. Fixed a version-packing bug in rollback_index.c (& --> |) BUG:chrome-os-partner:304 TEST:manual testing of all code flows on CRB Review URL: http://codereview.chromium.org/3084030
* Add license headersRandall Spangler2010-08-051-0/+4
| | | | Review URL: http://codereview.chromium.org/3094003
* Added size param to VerifyData()Randall Spangler2010-07-191-3/+3
| | | | | | | | | | | Also renamed verify preamble functions, now that they do not need the '2' at the end to differentiate them from the now-deleted original implementation. BUG=4501 TEST=Ran make runtests; all pass. Review URL: http://codereview.chromium.org/3027009
* Add lots of debugging to TPM library.Randall Spangler2010-07-191-2/+2
| | | | | | Temporarily disable TPM in developer mode. Review URL: http://codereview.chromium.org/3041005
* Add tpm lite to vboot referenceRandall Spangler2010-07-141-0/+1
| | | | Review URL: http://codereview.chromium.org/2919010
* This test sets the TPM to a each of a large amount of "interesting" initial ↵Luigi Semenzato2010-07-081-0/+3
| | | | | | | | states, and runs the firmware code at user level. This code compiles and installs using a modified ebuild (which needs to be committed after this change). Review URL: http://codereview.chromium.org/2857030
* New rollback_index API.Luigi Semenzato2010-06-281-1/+2
| | | | Review URL: http://codereview.chromium.org/2869022
* Refactor rollback interface for LoadKernel(), LoadFirmware().Randall Spangler2010-06-231-5/+7
| | | | Review URL: http://codereview.chromium.org/2861020
* Remove unused files, and tidy the directory structure of the remaining ones.Randall Spangler2010-06-171-0/+70
Review URL: http://codereview.chromium.org/2815011