Commit Graph

332 Commits

Author SHA1 Message Date
Randall Spangler
640fb51d86 Reapply patch from http://codereview.chromium.org/6594092/
(somehow that never got committed)

Change-Id: I304e594066c5dd72fc7cf37d31e27b1096ae1a38

BUG=12282
TEST=make && make runtests

Review URL: http://codereview.chromium.org/6610019
2011-03-03 10:11:17 -08:00
Randall Spangler
b416714a10 Add crossystem support for nvram_cleared and kern_nv
Fix try_b processing

And move key block flags check up in LoadFirmware(), which speeds up
boot when the dev switch is off because it doesn't do a signature
check and then throw it out.

BUG=12282
TEST=build firmware, try by hand

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

Change-Id: I10474e9e0ae324906dfe02a351347d04ce847f67
2011-03-01 13:04:22 -08:00
Randall Spangler
c4d21025bb Add LoadFirmware() support for NvStorage API
Change-Id: I19f402904978581eb5ca990ffbdf2f762b48c217

BUG=12282
TEST=make H2C firmware and verify using crossystem utility

(set fwb_tries, reboot, verify that mainfw_act is B)

Review URL: http://codereview.chromium.org/6597018
2011-02-25 14:57:39 -08:00
Randall Spangler
92e378e453 rename tried_fwb constants
Change-Id: Ib8018bfe29eed50766c699d832efe4f1afcabb1a

BUG=none
TEST=make && make runtests

Review URL: http://codereview.chromium.org/6597015
2011-02-25 13:56:53 -08:00
Randall Spangler
172602829d Add NV storage fields for firmware flags
1) Did firmware attempt RW slot B before slot A?

2) Did firmware check the kernel keyblock signature, or just its hash?

Added crossystem support as well.

BUG=chrome-os-partner:1657
TEST=make && make runtests

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

Change-Id: I0d743ae87cedd938ba988170793717d3fdbd8ce9
2011-02-25 12:06:26 -08:00
Rong Chang
baa3bbe7a5 Move tpm lite API to common include path
In order to run test cases in both Linux user mode and u-boot command
mode. The API header tlcl.h must be accessed by both ebuilds.

Change-Id: Ic027dc118f26666b88bf54c511e2455a55e4eb8f

BUG=chromium-os:10497
TEST=emerge vboot_reference-firmware successfully

Review URL: http://codereview.chromium.org/6469089
2011-02-23 10:41:38 +08:00
Randall Spangler
9e162cdaa7 VbNvStorage cleanup and comments
BUG=12282
TEST=make && make runtests

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

Change-Id: I912b53ae33d65305353a747cc0bdd2b1ea62a04f
2011-02-22 13:06:53 -08:00
Randall Spangler
b944534edd Add NV storage API to vboot reference
BUG=chromium-os:12282
TEST=make && make runtests

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

Change-Id: I57099de54ed56aa722f1944568bbb58b71b14379
2011-02-17 15:57:39 -08:00
Randall Spangler
a8e0f94b94 Support dev vs consumer firmware in vboot_reference
Change-Id: I5a42ba017974b3d591abc574ef7b9b7c9ac579e8

BUG=chrome-os-partner:1824
TEST=make && make runtests

Review URL: http://codereview.chromium.org/6462010
2011-02-14 11:12:09 -08:00
Che-Liang Chiou
f7bdfbbb98 Expose vboot_struct.h to u-boot
BUG=chromium-os:1302
TEST=cat <<EOF | sh
	sudo emerge vboot_reference &&
	emerge-tegra2_seaboard vboot_reference-firmware &&
	[ -f /build/tegra2_seaboard/usr/include/vboot/vboot_struct.h ] &&
	echo 'Succeed!'
EOF

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

Change-Id: I363daa7ed49c49fee3b3ed0fae06857142fe5cb4
2011-01-12 17:19:07 +08:00
Che-Liang Chiou
5d9509cbde vboot TPM stub functions return error codes
TlclStubInit, TlclCloseDevice, and TlclOpenDevice were void functions but
should return error codes.

BUG=chromium-os:6695
TEST=RUNTESTS=1 make && emerge successfully

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

Change-Id: I8ddbf8b1f080d98ff6ed42c4a675fbda5b17eef1
2010-12-16 14:11:17 +08:00
Bill Richardson
3430b32667 Add 'prioritize' command to cgpt tool.
This lets us reorder the priority of all the kernel partitions with a single
command, instead of a bunch of complicated and error-prone shell script
logic.

Change-Id: I21d39763ec5a748488d5319a987bcfe7c34ce4d0

BUG=chromium-os:9167
TEST=manual

In the chroot, do this:

cd ~/trunk/src/platform/vboot_reference
make
make runtests
make clean

Everything should pass.

Review URL: http://codereview.chromium.org/5352005
2010-11-29 14:24:51 -08:00
Randall Spangler
44f34b5195 Port over ContinueSelfTest() fix from firmware
Change-Id: Ib12405f968af11ad75a6429ae9ebe502dde5bf92

BUG=chrome-os-partner:1591
TEST=make && make runtests

(This is already in the firmware; I'm just copying it back into vboot reference)

Review URL: http://codereview.chromium.org/5312003
2010-11-23 14:17:21 -08:00
Louis Yung-Chieh Lo
2b23c021f3 Fixing the bug of CGPT when primary entry table is invalid.
http://code.google.com/p/chromium-os/issues/detail?id=9279
This issue disclosed a bug of cgpt. The bug comes from the 'show' command always
reads the primary entry table when '-i partition' is specified. I added an
ANY_VALID constant for GetEntry to automatically select valid entry table.

Also fixed the bugs in cmd_boot.c and cmd_find.c. In cmd_add.c, stop user to
continue if any header/entry table is invalid.

Also fixed the bug that untrusted header size could cause segmentation failure.

Hungte, this is FYI. But welcome to do review.

BUG=chromium-os:9279
TEST=RUNTESTS=1 emerge-x86-generic vboot_reference
     Manually tested:
       cgpt show /tmp/test -i 1 -b
       cgpt show /tmp/test
       cgpt add /tmp/test -i 1 -l TEST
       cgpt find /tmp/test -l STATE
       cgpt boot /tmp/test -i 1

Change-Id: Iaba9c635754096a82b3ec74634af184362d4e264
Change-Id: I6f3e87e3998457676e3388d2a6ed36c0564796d8

Review URL: http://codereview.chromium.org/5115002
2010-11-18 09:53:10 +08:00
Che-Liang Chiou
89678602e6 Fix integration bugs (vboot side)
BUG=chromium-os:8621
TEST=See below

1. Build and run tests of vboot (including linktest)
$ make && make runtests

2. Check if *_stub.o are not in vboot_fw.a
$ nm /build/<board>/usr/lib/vboot_fw.a | grep _stub.o

3. Build and boot x86-generic image
$ ./build_packages --board=x86-generic && ./build_image --board=x86-generic
(Then successfully boot the image you just built)

See CL=4372001 for u-boot side changes

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

Change-Id: Icc2bcc551c998f370e4b737fbe442ebf029cd81c
2010-11-09 08:33:36 +08:00
Gaurav Shah
82602d7909 Change PCR extend call to capture the state of both recovery and dev modes
Change-Id: I3f18081bda888a0fa6f56a67d0cef17268014706

BUG=chromium-os:6714
TEST=manual by enabling ROLLBACK_TPM in firmware/Makefile (did not test by compiling under MSVC)

Review URL: http://codereview.chromium.org/3973001
2010-10-21 14:40:38 -07:00
Randall Spangler
3e2c742be4 This enables a normal recovery mode image to fix problems with the TPM.
Change-Id: I8260d9596640e79af24c02ca1da5b47eb2caeaa7

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

Review URL: http://codereview.chromium.org/3847005
2010-10-18 16:43:19 -07:00
Randall Spangler
6078ca3398 Add profile macro calls
This matches the calls in firmware version 0037.

BUG=none
TEST=manual

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

Change-Id: I3b45051dec3f4f45414802b39122c8d52c4d62f1
2010-10-18 15:49:28 -07:00
Luigi Semenzato
26718cad62 Move initialization of g_recovery_mode.
Change-Id: I876b1f366eeb5d73eb3b3998a76ee5e1d386c7f5

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

Review URL: http://codereview.chromium.org/3470013
2010-09-24 12:50:45 -07:00
Luigi Semenzato
5be730cbf1 Fix (unfiled, I think) TPM initialization bug.
Change-Id: Id083f73680dbb1edd9ba036659b57f77b16325ec

BUG=none
TEST=none
TBR=rspangler@chromium.org
2010-09-23 17:05:12 -07:00
Luigi Semenzato
a7e19cffbe Add new files: two tests, one common file, one program to set things up.
Change-Id: I4c9b7a937103f3978cbed6629ee4057018b80eae

More cleanup.  Also allow some tests to run even when TPM is already started.

Change-Id: I23558b96a1de55bbeca42dbf2e44f6802a0ec85b

Reorganize and standardize behavior of tests.

Change-Id: Id32fd09211a72deaa66a3dd0f973d35506ff96f2

BUG=433
TEST=ran all the tests I could run without TPM-free BIOS

Review URL: http://codereview.chromium.org/3389004
2010-09-15 17:20:36 -07:00
Randall Spangler
6eee220fcd Fix one-time init
Change-Id: Ie8b4f5b1b7493b16b69eb41531ec3362d4b3679f

BUG=chrome-os-partner:1101
TEST=manual testing of affected TPM on CRB

Review URL: http://codereview.chromium.org/3388008
2010-09-15 15:57:58 -07:00
Randall Spangler
77ae389799 fix clearing kernel attributes
Change-Id: Id353323d268835cbcc1fb13c8669cee420c8fb6a

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

Make sure your chromeos install on the hard drive has 2 good kernel
partitions. Do:

sudo cgpt show /dev/sda

If partition 2 has success=1, do:

sudo dd if=/dev/sda2 of=/dev/sda4 bs=1M
sudo dd if=/dev/sda3 of=/dev/sda5 bs=1M
cgpt add -i 4 -S 1 -P 2

(if instead partition 4 has success=1, do:)

sudo dd if=/dev/sda4 of=/dev/sda2 bs=1M
sudo dd if=/dev/sda5 of=/dev/sda3 bs=1M
cgpt add -i 2 -S 1 -P 2

Reboot and do the following:

sudo cgpt show /dev/sda

If the partition you just marked active still has success=1
priority=2, the bug is fixed.  If it has success=0 priority=0, the bug
is still there.

Review URL: http://codereview.chromium.org/3324014
2010-09-09 17:37:51 -07:00
Randall Spangler
7c88d4c31d use continue self test
Change-Id: I4785a6326017c63d83a8eb153d6b90ee82e5f839

BUG=chromeos-partner:222
TEST=manual (build FW, make sure system boots and tpmc prints good values)

Review URL: http://codereview.chromium.org/3367020
2010-09-09 11:14:59 -07:00
Randall Spangler
528f6a20db fix missing constant
Change-Id: I26d7d725cb429394e24be40a2f362b7ff160f4ee

BUG=none
TEST=make && make runtests (and build into test BIOS)

Review URL: http://codereview.chromium.org/3337017
2010-09-08 16:40:14 -07:00
Randall Spangler
2c21fe6693 Successful partitions are never marked bad by cgptlib.
Change-Id: I70e54f59b540e9115bb6bd77ae51f49a1f4ab671

BUG=chromeos-partner:1029
TEST=make && make runtests

Review URL: http://codereview.chromium.org/3315014
2010-09-07 10:30:50 -07:00
Luigi Semenzato
9828594eaa Bail out from S3Resume if TPM was not power-cycled.
Change-Id: I80027a5a935e13ba37e24978dd4b0c6040d66728

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/3298010
2010-09-07 09:56:19 -07:00
Randall Spangler
1fe1607679 TBR: reviewed in person with semenzato 2010-09-02 11:37:51 -07:00
Luigi Semenzato
89a02c194f Make TPM datagrams const, since they cannot be modified in the RO firmware.
Change-Id: I7f135584536c7437824ae65f74a8f7ef27c28665

BUG=
TEST=

Review URL: http://codereview.chromium.org/3271006
2010-08-31 15:49:56 -07:00
Luigi Semenzato
3da063e3f7 Add resume command (TPM_Startup(ST_STATE))
Change-Id: Ia85c3cdbcb74c6cd8e7bd53c51eaccc98b13677e

BUG=
TEST=

Review URL: http://codereview.chromium.org/3232006
2010-08-31 14:31:30 -07:00
Luigi Semenzato
377557fcb2 Add physical presence initialization and locking to one-time initializations.
Change-Id: If2b6041fe93bc97885e45bbb0cf7e1b81cb06c18

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/3229011
2010-08-31 13:20:53 -07:00
Bill Richardson
60563ee0af Always treat invalid images as nonexistant now.
This makes the sequence of pictures shown to the user slightly less
confusing, but the whole process needs a bit more cleanup. Some of the work
has to be done in the BIOS code, not just here. This is better, but it's not
complete.

Change-Id: If0b3ecc92716020a06031866849d83411d7f0db8

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

Review URL: http://codereview.chromium.org/3249009
2010-08-30 15:15:38 -07:00
Gaurav Shah
2447dd256f Add a PCR extend call for measuring the dev mode boot flag.
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
2010-08-30 11:43:57 -07:00
Gaurav Shah
9379a7d759 Use SafeMemcmp() in RSAVerify() just to be safe.
BUG=chrome-os-partner:832
TEST=make && make runtests

Change-Id: I370021071b2b219c0db89cfaa015f4ff315c9204

Review URL: http://codereview.chromium.org/3216010
2010-08-30 11:41:01 -07:00
Luigi Semenzato
1d83dd1ba5 Add a command to enable the physical presence command.
Change-Id: Id8b6ac3c75d1ee34237cde8adde55cea33b25889

Review URL: http://codereview.chromium.org/3163045
2010-08-30 10:23:43 -07:00
Bill Richardson
aa8eda4f97 More cgptlib tests
Add some extra cases to SanityCheckTest() to test both header and entries
being garbled at either end of the disk.

Add DuplicateUniqueGuidTest() to check that GPTs having duplicate
UniqueGuids in the entries are rejected. We can only check this per-disk, of
course.

Made some changes to the library to enforce the UniqueGuid requirement that
I just started testing for.

BUG=chromium-os:4854

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

Change-Id: I86458faf9cc99aa3f29aac0d5b144dbd05067181
2010-08-27 09:31:26 -07:00
Luigi Semenzato
5896b9664d Added new commands and reactivated full rebuild after fixing for ARM ebuild.
Review URL: http://codereview.chromium.org/3116025

Change-Id: Ideb82562f6b1c3ce5cd9e0b79de250d0a7bd976e
2010-08-25 07:16:03 -07:00
Randall Spangler
41656c082d Fix utility.c to compile on MSVC.
BUG=none
TEST=make && make runtests

Review URL: http://codereview.chromium.org/3186024
2010-08-23 13:20:07 -07:00
Randall Spangler
741d2b2f8d Fix LoadKernel() failing to update GPT flags.
BUG=5654

TEST=manual

Case 1: Trying a new kernel which works
  sudo cgpt add -P10 -T10 -S0 -i4 /dev/sda
Then reboot and
  sudo cgpt show /dev/sda
See that tries is now 9 for /dev/sda4 (since the current ChromeOS
doesn't set the successful bit)

Case 2: Trying a new kernel which is bad
  sudo dd if=/dev/zero of=/dev/sda4 count=1 conv=notrunc
Then reboot and
  sudo cgpt show /dev/sda4
See that success=prio=tries=0 for /dev/sda4.

Review URL: http://codereview.chromium.org/3130040
2010-08-20 16:37:12 -07:00
Gaurav Shah
37dff84dbb Make sure that our version of certain utility function implementations gets used in the firmware.
Reference code drop-in to firmware should make our implementations of Memset() and SafeMemcmp() get used now.

BUG=chrome-os-partner:820
TEST=make && make runtests

Change-Id: If0c06dfad85b67398a118985cdb751d20b2b65a4

Review URL: http://codereview.chromium.org/3173035
2010-08-20 14:30:03 -07:00
Randall Spangler
dfeb025750 Add explicit typecasts so it compiles using MSVC.
BUG=none
TEST=make && make runtests

Review URL: http://codereview.chromium.org/3184014
2010-08-19 13:17:48 -07:00
Randall Spangler
4bb5e4bad4 Security fixes for LoadKernel()
1) kernel_subkey is one of the input parameters; not read off disk.  KeyBlockVerify() now verifies it's not NULL unless we're only using the hash.

2) Added a check for kernel size vs. buffer size.

3) Added a check to make sure kbuf_sectors is nonzero.

BUG=chrome-os-partner:704
TEST=make && make runtests

Review URL: http://codereview.chromium.org/3186013
2010-08-19 09:05:22 -07:00
Gaurav Shah
47b593d849 Add additional sanity checks to RSA verification code.
Also, make algorithm unsigned int in most places.

BUG=chrome-os-partner:701
TEST=existing RSA verification tests still pass

Review URL: http://codereview.chromium.org/3136017
2010-08-17 15:48:22 -07:00
Randall Spangler
138acfe1ba Fix KeyBlockVerify() to take an explicit param for whether to use hash only.
Fix VerifyMemberInside().

BUG=chrome-os-partner:703
TEST=make && make runtests

Review URL: http://codereview.chromium.org/3126013
2010-08-17 15:45:21 -07:00
Randall Spangler
bb5d9f1286 Remove kernel backup space
BUG=chrome-os-partner:304
TEST=make && make runtests; all pass.  Manual testing on CRB.

Review URL: http://codereview.chromium.org/3132014
2010-08-16 15:36:07 -07:00
Randall Spangler
666802822b Change rollback interface so kernel/firmware version numbers are
packed in the calling code rather than in rollback_index.

Review URL: http://codereview.chromium.org/3114013
2010-08-16 12:33:44 -07:00
Gaurav Shah
45a628251f RSAVerify() - fail on malloc() failure.
BUG=chrome-os-partner:702
TEST=exists RSA verification tests still pass

Review URL: http://codereview.chromium.org/3127013
2010-08-16 11:37:59 -07:00
Randall Spangler
4abede35af Add structs for TPM NV simplification. Now uses only 2 NV spaces, one for 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
2010-08-12 16:40:32 -07:00
Luigi Semenzato
e72291c636 Command-line utility to execute TPM commands bypassing the TSS stack.
Review URL: http://codereview.chromium.org/3149001
2010-08-10 09:46:09 -07:00
Bill Richardson
4f36ef3360 Changes to allow user-signed kernels to be generated.
Make vbutil_keyblock handle unsigned blocks. Also enable --unpack option and
add tests for it.

Modify vbutil_kernel to allow unsigned keyblocks, correct usage message,
and fix the --debug option which was somehow disabled.

Update load_kernel_test to accept /dev/null for the public key, to test
non-signed kernel keyblocks.

Review URL: http://codereview.chromium.org/3124004
2010-08-09 17:50:14 -07:00