Commit Graph

332 Commits

Author SHA1 Message Date
Randall Spangler
8409b37498 Add typecast to fix compiling in MSVC
BUG=none
TEST=make && make runtests

Change-Id: I774645c1059df70cd25ea6a3f78161eb916d7293
Reviewed-on: http://gerrit.chromium.org/gerrit/4192
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-15 13:06:31 -07:00
Che-Liang Chiou
7d1c22b75a Fix compiler error
BUG=chromium-os:17304
TEST=make successfully

Change-Id: Icebd25069a445960eb4e1e92f10dec195ea3fbf1
Reviewed-on: http://gerrit.chromium.org/gerrit/4152
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
2011-07-14 21:41:57 -07:00
Randall Spangler
8bf0d5ff0f Add vboot support for RO-normal code path.
BUG=chromium-os:17304
TEST=make && make runtests

Change-Id: I4d0f8afd516649fba67119845ec1c4479ba54c43
Reviewed-on: http://gerrit.chromium.org/gerrit/4065
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-14 17:07:10 -07:00
Randall Spangler
a712e01ae7 Add support for flags in the firmware preamble.
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>
2011-07-13 10:13:12 -07:00
Randall Spangler
64ca788195 Add support for merged normal+dev firmware
BUG=chromium-os:17457
TEST=make && make runtests

When this is merged into an actual firmware build, can test it:
* dev switch off -> no dev screen, won't boot self-signed kernel
* dev switch on --> dev warning screen, will boot self-signed kernel
(e.g., it acts like the Cr-48)

Change-Id: I985428256e48b7e05dd4d8fe582a0c0103bf5fb2
Reviewed-on: http://gerrit.chromium.org/gerrit/3901
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-11 18:16:56 -07:00
Randall Spangler
daa807c51e Add support for dev_boot_usb flag
BUG=chromium-os:17433
TEST=make && make runtests.  Additional manual tests:

0. Insert a valid dev-signed USB key.

1. Boot with dev switch off.
`crossystem dev_boot_usb` should print 0.

2. Flip dev switch on.
`crossystem dev_boot_usb` should print 0.
Ctrl+U at dev screen should beep, but not boot USB.

3. Type `crossystem dev_boot_usb=1`.  Should succeed.
`crossystem dev_boot_usb` should print 1.

4. Reboot system.
At the dev mode warning, press Ctrl+U
System should boot from USB key
`crossystem dev_boot_usb` should print 0.

5. Flip dev switch off.
`crossystem dev_boot_usb` should print 0.

6. Flip dev switch on.
`crossystem dev_boot_usb` should print 0.

Note that this does not apply to Cr-48, Alex, or ZGB.

Change-Id: Idf85fdd642f38f531c89e5fa5b1679e84936d4da
Reviewed-on: http://gerrit.chromium.org/gerrit/3875
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-11 18:16:03 -07:00
Randall Spangler
9619112a57 Vboot wrapper - add recovery reason, refactor timing
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>
2011-07-08 16:19:07 -07:00
Randall Spangler
1b1998dff0 Vboot wrapper initial implementation
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>
2011-07-08 13:31:36 -07:00
Randall Spangler
e49e8af65f Port vboot_reference to use new wrapper API utility functions
Third time's the charm.  Now that we've moved to u-boot-next, this
won't break the ARM build.

BUG=chromium-os:17006
TEST=make && make runtests; emerge vboot_reference; emerge-tegra2_seaboard chromeos-bootimage

Change-Id: Ib4fa26c7a23868dd2ffd2b321ee8dc08c66ea322
Original-Change-Id: I771085dcdf79d9592de64f35e3b758111a80dd9f
Original-Reviewed-on: http://gerrit.chromium.org/gerrit/3263
Original-Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/3803
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2011-07-08 13:13:15 -07:00
Randall Spangler
bebe53c919 Add string utility functions.
These are used by the coming-soon vboot wrapper (vboot_api_kernel) to
display debug information when Tab is pressed at a BIOS screen.

BUG=chromium-os:17035
TEST=make && make runtests (runs new test!)

Change-Id: I4893f31e9333f4e9d458a6e347213eef22f770cd
Reviewed-on: http://gerrit.chromium.org/gerrit/3759
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-08 09:17:07 -07:00
Gabe Black
93cf15e9a1 Introduce GUID type for Chrome OS read/write firmware.
This change teaches cgpt a new GUID type to be used for the Chrome OS
read/write firmware. The GUID is CAB6E88E-ABF3-4102-A07A-D4BB9BE3C1D3.

BUG=chrome-os-partner:4843
TEST=Built and installed on my host, used a separate change to repurpose
partition 11 for the R/W firmware using cgpt and the "firmware" type, inspected
the image using cgpt. Built and installed an image and used cgpt on the device
to inspect it's GPT.

Signed-off-by: Gabe Black <gabeblack@google.com>

Change-Id: I3b2801b2e1f71b3275bbddbc45fb63bde5bce5a7
Reviewed-on: http://gerrit.chromium.org/gerrit/3763
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2011-07-07 16:33:47 -07:00
Luigi Semenzato
ebb1eda9bb Reduce race conditions in TPM initialization.
With this change, the firmware creates and initializes the kernel space first,
then the firmware space.  Thus, if the initialization is interrupted (by
cutting power) in between the two spaces, at the next boot the initialization
path will be taken again, since it is triggered by a missing firmware space.
A space creation succeeds when the space already exists (the space is
removed and recreated), so this eliminates two races.  There is still
the possibility that the power is cut between creating the firmware
space and initializing it, but let's assume it's not a problem until
proven otherwise.  (It won't be a security problem anyhow.)

BUG=chromium-os:17049
TEST=none (too hard to reproduce the race)

Change-Id: Iae4c1cc2b9a5056cb5d858e71b680e27a442357e
Reviewed-on: http://gerrit.chromium.org/gerrit/3520
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
2011-07-06 11:02:48 -07:00
Randall Spangler
cfd841d3c2 Revert "Verified boot wrapper - replace utility functions"
This reverts commit 0184886c8cb35e8e01d610622df448a7cb063e06

(This works with uboot-next, but not uboot, which doesn't implement its half of the new wrapper API.  So rolling back to leave uboot working.

Change-Id: I1f9e3c63e5bbdb20b9195cd68787bef89f24afee
Reviewed-on: http://gerrit.chromium.org/gerrit/3588
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-01 15:36:42 -07:00
Randall Spangler
f8c6549159 Verified boot wrapper - replace utility functions
This is part 3 of the vboot wrapper API refactoring.  It replaces the
function calls to utility.c functions with new API calls.  (It also
fixes up some integer type mismatches in cryptolib that were causing
warnings on the H2C build; those had been fixed a while ago in H2C but
hadn't been propagated across.)

This is a re-commit of the original; I've verified it compiles on both
x86-alex and tegra2, for both vboot_reference and
vboot_reference-firmware, now that the patch from
1c1a883bc7 is checked in.

BUG=chromium-os:17006
TEST=make && make runtests, and emerged on both x86-alex and tegra2

Original-Change-Id: I771085dcdf79d9592de64f35e3b758111a80dd9f
Original-Reviewed-on: http://gerrit.chromium.org/gerrit/3263
Original-Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
(cherry picked from commit bd81b3a7d3)

Change-Id: Iefdbfb3d10eb9aa385fb6dfc3bf0896f637cb64b
Reviewed-on: http://gerrit.chromium.org/gerrit/3582
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-07-01 14:33:12 -07:00
mukesh agrawal
a7b9481f34 Revert "Verified boot wrapper - replace utility functions"
This reverts commit bd81b3a7d3.

Change-Id: I2be2c076a37bf0e49569248691fceac417254f0b
Reviewed-on: http://gerrit.chromium.org/gerrit/3295
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
2011-06-27 20:02:36 -07:00
Randall Spangler
bd81b3a7d3 Verified boot wrapper - replace utility functions
This is part 3 of the vboot wrapper API refactoring.  It replaces the
function calls to utility.c functions with new API calls.  (It also
fixes up some integer type mismatches in cryptolib that were causing
warnings on the H2C build; those had been fixed a while ago in H2C but
hadn't been propagated across.)

BUG=chromium-os:17006
TEST=make && make runtests

Change-Id: I771085dcdf79d9592de64f35e3b758111a80dd9f
Reviewed-on: http://gerrit.chromium.org/gerrit/3263
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-06-27 14:57:50 -07:00
Randall Spangler
32a6526d25 Verified boot wrapper - add stub implementations for host
This is part 2 of the wrapper API refactor.  It adds stub
implementations for the host, and changes the host-side utilities to
use them.  Firmware implementation is unchanged in this CL (other than
a few updates to macros).

BUG=chromium_os:16997
TEST=make && make runtests

Change-Id: I63989bd11de1f2239ddae256beaccd31bfb5acef
Reviewed-on: http://gerrit.chromium.org/gerrit/3256
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-06-27 13:30:41 -07:00
Kazuhiro Inaba
53306d984f Fix compilation failure of mocked_tlcl.c
BUG=none
TEST=none

Change-Id: I97d1c95eda62439e4f3ae23bf4f39bb4451acea7
Reviewed-on: http://gerrit.chromium.org/gerrit/2522
Tested-by: Takayoshi Kochi <kochi@chromium.org>
Reviewed-by: Takayoshi Kochi <kochi@chromium.org>
2011-06-12 21:53:22 -07:00
Luigi Semenzato
7b90cf3f00 Tolerate lack of TPM reset in common cases.
This is a temporary workaround for Tegra boards that don't reset the TPM
when the CPU is reset.  It makes the firmware more lenient when execution
starts with an already locked TPM.

BUG=chromeos-partner:3574
TEST=none (yet)

Change-Id: If6a060595c1eb41e95e0935f8467de8bb6256b12
Reviewed-on: http://gerrit.chromium.org/gerrit/1429
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
2011-05-25 17:21:13 -07:00
Randall Spangler
c90e7e8cd9 Fix indentation; no code change.
BUG=none
TEST=none (since nothing changed)

Change-Id: Ifea9a0c0105e70d9cea2b173d0991849770dc14b
Reviewed-on: http://gerrit.chromium.org/gerrit/1067
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-05-17 15:29:58 -07:00
Randall Spangler
4dd03035c2 Fix build break
BUG=none
TEST=emerge-x86-generic vboot_reference

Change-Id: Ic34f0aedbb6522e2ac4bbea3cb33f303435a0d33
Reviewed-on: http://gerrit.chromium.org/gerrit/608
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-05-10 12:56:01 -07:00
Randall Spangler
9243e616d7 Add more specific recovery reasons for RW firmware invalid
BUG=chrome-os-partner:3698
TEST=manual

1. Run the firmware key/version autoupdate test; this rolls forward your stored TPM version numbers.
2. Put back the original firmware.
3. Reboot.
4. Press TAB at recovery screen.
5. Should see Recovery Reason 0x14.

Change-Id: I7791f594dbd8919e74d1e6b97b99775cf1e73d1d
Reviewed-on: http://gerrit.chromium.org/gerrit/567
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2011-05-10 12:23:56 -07:00
Vadim Bendebury
c3574086a8 Introduce arm support in crossystem.
This CL builds upon earlier firmware and kernel changes (see CLs
related to the same bug, chromium-os:12522).

ARM firmware now simulates both Nvram storage and VDAT buffer, the
structures the x86 version uses extensively to communicate back and
forth between firmware/kernel/userland.

So, to make crossystem work on arm, all what's needed is to provide
architecture specific interface to Nvram and VDAT simulation, and
architecture specific processing for variables which are accessed on
ARM platforms in a different way.

The few discrepancies and platform specifics which had to be addressed
for ARM specifically are as follows:

- the Nvram contents are cached in the shared memory and available for
  reading as part of /sys/kernel/debug/chromeos_arm. When writing
  Nvram, the same file needs to be written, but only the 16 bytes
  (representing the Nvram contents) are aacepted.

- the VDAT buffer also comes from the shared memory (as part of the
  same sysfs file)

- when crossystem starts, it needs to read in this shared memory
  contents, a` weak' function VbArchInit() is being added such that it
  is provided on ARM platforms only, on x86 an empty stub is called.

- current developer/recovery request/ro firmware switch states are
  retrieved through GPIO drivers. The GPIO numbers are defined in the
  file, the GPIO driver is supposed to be configured before
  crsossystem can operate.

- the BINF values are supplied through an array within shared memory,
  it would be easy to refactor both x86 and ARM use the same code to
  process BINF values, but with this submission the code is duplicated
  to minimize x86 impact.

- the following crossystem variables do not have ARM equivalents,
  thier values are reported as '(error)':

   recoverysw_ec_boot
   savedmem_base
   savedmem_size

BUG=chromium-os:12522
TEST=manual:

. bring up a kaen system
. execute the following script to enable the appropriate GPIOSs:

 for gpio in 56 59 168; do echo $gpio > /sys/class/gpio/export; done

. run `crossystem' and observe reasonable output values

. to verify that it reads GPIOs properly, try

  echo $(./crossystem recoverysw_cur)

  with the miniservo 'GOOG_REC' button pressed and released, observe
  different readings (note that the state of the button is reversed,
  the released button is reported as '1')

. to verify the write capabilities, note that the nvram contents can
  be accessed using the following shell commands

     echo 3 > /proc/sys/vm/drop_caches
     2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && \
       od -t x1 /tmp/blk | head -1

 (the first command cause the device cache dropped, and the second
 command accesses the device contents.

   vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
   localhost var # echo $(./crossystem fwb_tries)
   10
   localhost var # echo 3 > /proc/sys/vm/drop_caches
   localhost var # 2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && od -t x1 /tmp/blk | head -1
   0000000 60 0a 00 be 00 00 00 00 00 00 00 02 00 00 00 a2
   localhost var # ./crossystem fwb_tries=9
   localhost var # echo $(./crossystem fwb_tries)
   9
   localhost var # echo 3 > /proc/sys/vm/drop_caches
   localhost var # 2>/dev/null dd if=/dev/mmcblk0 of=/tmp/blk bs=16 count=1 && od -t x1 /tmp/blk | head -1
   0000000 60 09 00 be 00 00 00 00 00 00 00 02 00 00 00 8a
   localhost var #
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Change-Id: Ie4c6ff44441d98a42b1057953208fdb90c08f46d
Reviewed-on: http://gerrit.chromium.org/gerrit/113
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
2011-05-05 14:42:09 -07:00
Che-Liang Chiou
8511f7891b Add option to use mocked TPM driver
Some ARM boards, such as Seaboard, have buggy TPM chip that bricks the borad.
This commit adds a option to use mocked TPM driver.

R=rongchang@chromium.org,rspangler@chromium.org,wad@chromium.org
BUG=chromium-os:14239
TEST=Run verified boot on Seaboard

Review URL: http://codereview.chromium.org/6883040

Change-Id: Iae6133f081c2e3d9daa4e14bb711550e2658e9df
2011-04-22 16:01:38 +08:00
Randall Spangler
700fc49a7e Do not advance kernel version in TPM if we are in firmware B trying a new firmware
Change-Id: If5b6390d011d743689cf96e49202358397663651

R=bleung@chromium.org,dlaurie@chromium.org,sumit@chromium.org
BUG=chrome-os-partner:3367
TEST=make && make runtests

Review URL: http://codereview.chromium.org/6871044
2011-04-17 10:48:10 -07:00
Gaurav Shah
e7f5c905fc Make SHA256 and SHA512 handle >UINT32_MAX data correctly (now with fix for ARM compilation)
Change-Id: Iaa0c5675c07e9b54b2a389c53ed503e7a21ba731

BUG=chrome-os-partner:2912
TEST=
1) emerge-x86-generic vboot_reference
2) emerge-arm-generic vboot_reference
3) emerge-arm-generic vboot_reference-firmware
4) emerge-tegra2 vboot_reference-firmware
5) make && make runtests

Review URL: http://codereview.chromium.org/6760017
2011-04-04 11:47:51 -07:00
Randall Spangler
8ae94c2d24 Fix preamble range checks
Change-Id: I0571f4524703566b8840e2b264d868c404f87c80

R=gauravsh@chromium.org,wfrichar@chromium.org
BUG=chrome-os-partner:2910
TEST=make && make runtests

Review URL: http://codereview.chromium.org/6759075
2011-04-01 13:35:46 -07:00
David James
b55193e596 Revert "Make SHA256_update and SHA512_update if the passed in length is greater than UINT32_MAX"
Needed to unbreak the tegra build.

This reverts commit a01a62bf85.

R=gauravsh@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/6731068

Change-Id: I096fde817c0e1cfa0c34f4f1dab986c7844c0714
2011-03-29 15:19:50 -07:00
Gaurav Shah
a01a62bf85 Make SHA256_update and SHA512_update if the passed in length is greater than UINT32_MAX
BUG=chrome-os-partner:2912
TEST=make && make runtests

Change-Id: If415a023d47b78ae2fc5af0b2fe5e410ef37086d

Review URL: http://codereview.chromium.org/6750016
2011-03-29 14:52:30 -07:00
Randall Spangler
cecdcbfe5d Add additional checks for size greater than header size.
Change-Id: Iea64e3df795d1f9299117cbd161b203295211629

R=wfrichar@chromium.org,gauravsh@chromium.org
BUG=chrome-os-partner:2908
TEST=make && make runtests

Review URL: http://codereview.chromium.org/6745027
2011-03-25 15:49:10 -07:00
Randall Spangler
ac7c2d9e30 Fix not checking hashed data size
R=wfrichar@chromium.org,gauravsh@chromium.org
BUG=chrome-os-partner:2909
TEST=make && make runtests

Review URL: http://codereview.chromium.org/6748009

Change-Id: I3251aa6e6dd62ff4351fdf33ca9182b19a29cbbf
2011-03-25 15:20:58 -07:00
Gaurav Shah
d583a30a7c Use uint64_t and avoid down casting as much as possible.
Change-Id: I231d1b3a059907c3806feced7e1b8f1c06575ba5

BUG=chromeos-partner:2912
TEST=make clean all && make runtests

Review URL: http://codereview.chromium.org/6733018
2011-03-25 14:02:13 -07:00
Randall Spangler
cabe6b3514 Use VbSharedData instead of VbNvStorage for fwb_tries and kernkey_vfy
Change-Id: I5ed3509a9d4e578cd2e98f493dab59bc2fbd5827

R=dlaurie@chromium.org
BUG=chrome-os-partner:2748
TEST=manual

crossystem fwb_tries=3
(reboot)
crossystem tried_fwb
(should print 1)

crossystem fwb_tries=0
(reboot)
crossystem tried_fwb
(should print 0)

In dev mode...
Boot a kernel signed with the same key as in the firmware
crossystem kernkey_vfy
(should print sig)
Boot a kernel signed with a different key than the firmware
crossystem kernkey_vfy
(should print hash)

Review URL: http://codereview.chromium.org/6711045
2011-03-18 12:44:27 -07:00
Randall Spangler
17c712672f Add VbSharedData debug output to LoadKernel()
Change-Id: Id2837c83877520067e46e2434460349ef001b7b9

R=dlaurie@chromium.org
BUG=chrome-os-partner:2748
TEST=nmake uefi64; boot in normal and recovery modes

Review URL: http://codereview.chromium.org/6688035
2011-03-18 11:24:27 -07:00
Randall Spangler
5ac39bfff0 Add TPM version checking
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
2011-03-17 17:58:56 -07:00
Randall Spangler
f4ba19d81d Add VbSharedData field parsing
R=reinauer@chromium.org
BUG=chrome-os-partner:2578
TEST=manual

crossystem vdat_timers
should show 'LFS=0,0 LF=number1,number2 LK=number3,number4'
where number1 < number2 < number3 < number4

crossystem vdat_lfdebug
run from a dev mode console, should show
'check=12,0 index=0x00 tpmver=(hex number) lowestver=(hex number)'

crossystem vdat_flags
run from a dev mode console, flags should be 0x04.

Review URL: http://codereview.chromium.org/6685068

Change-Id: Id7b958ae300d10cdcdc1b17a1bb17b7e5069166f
2011-03-17 16:10:21 -07:00
Luigi Semenzato
83c3714ed3 Perform a full self test before one-time initialization.
Change-Id: I2f5232d5133c0725ec21f885a4632e980062be8f

BUG=chrome-os-partner: 1826
TEST=none

Review URL: http://codereview.chromium.org/6688004
2011-03-17 10:33:41 -07:00
Randall Spangler
ad6824ba4f Added timing data to VbSharedData.
Change-Id: I8d52765227fd3355431bebc77dfbe0106c889eca

BUG=chrome-os-partner:2748
TEST=compiles; will be porting to H2C next

Review URL: http://codereview.chromium.org/6672068
2011-03-16 19:07:33 -07:00
Luigi Semenzato
06fbb168ac Move ContinueSelfTest to a later point to save time.
Change-Id: I96b413438359e11315101d408033066e6f0a0981

BUG=chrome-os-partner: 1826
TEST=none

Review URL: http://codereview.chromium.org/6667051
2011-03-16 17:33:23 -07:00
Luigi Semenzato
050785c312 Bump tlcl_structures.h.
Change-Id: I9346c02244246b82cc6fe7c60090173ff650efc1

BUG=chromium-os:433
TEST=none

Review URL: http://codereview.chromium.org/6667050
2011-03-16 11:24:35 -07:00
Luigi Semenzato
54992f9d33 Added TPM_SaveState command.
Change-Id: If7b6ef3cba733b74ba13db0871e6ac554d0d84ef

BUG=chromium-os:433
TEST=none

Review URL: http://codereview.chromium.org/6696043
2011-03-16 10:56:48 -07:00
Randall Spangler
4c6e6dac28 Fix compiler errors on MSVC
Change-Id: I47fd6d0be5542e5f540a34410b3f694ae0f67fd9

R=gauravsh@chromium.org
BUG=none
TEST=make && make runtests

Review URL: http://codereview.chromium.org/6676039
2011-03-16 09:56:15 -07:00
Randall Spangler
0222355d8a Fix LoadKernel() not returning LOAD_KERNEL_RECOVERY
Change-Id: Ib147be7442b93ef429a9796e2b76bee27347e0b3

R=adlr@chromium.org
BUG=13150
TEST=manual

On a current firmware (0052G1+), use 'crossystem vbtest_errfunc=3
vbtest_errno=3' to force a reboot to recovery mode.  Then use
'crossystem recovery_reason' to check the recovery reason.

It should be 71.  It's not.  (You'll get a range of other error reasons
due to a different firmware bug.)

Review URL: http://codereview.chromium.org/6670040
2011-03-15 19:20:25 -07:00
Gaurav Shah
b64faaa7f4 Update PCR state with the state of the firmware keyblock flags too.
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
2011-03-15 16:36:29 -07:00
Stefan Reinauer
55db6a6717 only update tpm if version if not default value
Change-Id: I697de80aa2f0454164cd3651e5a53d06e60a837e

BUG=2782
TEST=in progress

Review URL: http://codereview.chromium.org/6677067
2011-03-15 16:23:41 -07:00
Randall Spangler
99ca3466ba LoadFirmware() and LoadKernel() handling for test errors
Change-Id: Icecfcab8f5cc30e80da7a2d77a1b1729f5094fee

R=wfrichar@chromium.org
BUG=13107
TEST=make && make runtests

Review URL: http://codereview.chromium.org/6673048
2011-03-15 15:28:31 -07:00
Randall Spangler
b17e8d353c Add VB test error func/num
Change-Id: Ibe253963f0424935554fe91f166ef5040a723c6f

BUG=13107
TEST=make && make runtests

Review URL: http://codereview.chromium.org/6698032
2011-03-15 09:50:38 -07:00
Randall Spangler
95c4031ce9 This is necessary to pass additional information about whether firmware A or 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
2011-03-09 15:54:16 -08:00
Randall Spangler
c324fbfb6d Only advance kernel version when the booted partition has a valid key block
Change-Id: I879c18cc139f8a02bcaa6eb80437eaf836a5e851

BUG=chrome-os-partner:2597
TEST=manual

install pvt-signed image
flip dev switch on and boot
install dev-signed firmware
reboot
reboot
sudo bash
stop tcsd
tpmc read 0x1008 0x0d

bytes 6-10 should be 1 0 1 0, not FF FF FF FF

Review URL: http://codereview.chromium.org/6626020
2011-03-04 12:19:25 -08:00
Randall Spangler
8478ece80f Fix missing brackets
Change-Id: I9d4fefdd128c087f9495055dbf3b6aa63ac62fd2

BUG=none
TEST=make && make runtests

Review URL: http://codereview.chromium.org/6610023
2011-03-03 11:00:17 -08:00