Commit Graph

35 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Randall Spangler
63dffcb52b Enable TPM in developer mode again.
Also fix a few comments, and make extra debugging work when compiled
in firmware.

BUG=none
TEST=make && make runtests; all pass

Review URL: http://codereview.chromium.org/3007036
2010-08-05 15:13:14 -07:00
Bill Richardson
5deb67f225 Make LoadKernel() pass back the kernel partition's UniqueGuid.
LoadKernel already returns the partition number for the selected kernel.
This change makes it also return the GPT Entry's UniqueGuid, which will
eventually be passed to the kernel itself, so the kernel can determine which
of several possible devices it has booted from. It doesn't know for certain
because the BIOS and the kernel may enumerate the devices in a different
order.

BUG=chromium-os:4984

Review URL: http://codereview.chromium.org/3056014
2010-07-23 17:22:25 -07:00
Bill Richardson
e272940ec5 Fix load_kernel_test, add check to LoadKernel to detect bad args.
load_kernel_test was failing because it wasn't setting
params->kernel_buffer_size before calling LoadKernel(). This fixes that,
plus adds some checks to LoadKernel so that it will notice bad params if it
happens again.

Review URL: http://codereview.chromium.org/3060004
2010-07-22 12:23:47 -07:00
Randall Spangler
ae029d9109 Fix checking boot flags in developer mode.
Should only check in recovery or normal modes.

BUG=http://code.google.com/p/chrome-os-partner/issues/detail?id=497

Review URL: http://codereview.chromium.org/2806058
2010-07-19 18:26:35 -07:00
Randall Spangler
87c13d806b Added size param to VerifyData()
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
2010-07-19 10:35:40 -07:00
Randall Spangler
3e1081fb71 Add lots of debugging to TPM library.
Temporarily disable TPM in developer mode.

Review URL: http://codereview.chromium.org/3041005
2010-07-19 10:04:21 -07:00
Randall Spangler
7a786b73e7 added reboot return codes to load kernel and firmware
Review URL: http://codereview.chromium.org/2844044
2010-07-08 13:29:42 -07:00
Randall Spangler
c4a011a725 TBR: wfrichar
Fix LoadKernel() checking key block flags

BUG=none
TEST=none
2010-06-29 19:08:43 -07:00
vbendeb
3ecaf776d8 Make vboot_reference build in MSVC command line environment.
This is a mostly NOOP change which modifies the source code
to compile cleanly in the MSVC command line build
environment.

A new makefile is introduced (msc/nmakefile) along with a
README.txt in the same directory explaining how to build
the code in the DOS window. As of this submission the build
is running in a 32 bit environment, the intention is to use
the same makefile for 64 bit builds in the future.

Enabling high compilation warnings level allowed to
identify a couple of bugs in the code which are being fixed.

Not all sources are being compiled in the MSVC environment,
only those in firmware/ and most of those in test/
subdirectories. The benchmark calculations require porting
of the timer facilities and are being postponed.

TEST

Built in DOS and linux environments. Ran unit tests in
linux environment.

Review URL: http://codereview.chromium.org/2809037
2010-06-24 16:19:53 -07:00
Randall Spangler
d6aad3a088 Ignore TPM return codes in recovery mode
Review URL: http://codereview.chromium.org/2844024
2010-06-24 14:01:34 -07:00
Randall Spangler
e2ec98412e Add VBDEBUG macro for debug output.
Replaced in firmware/ lib; not replaced in host-side utils/tests.

Review URL: http://codereview.chromium.org/2810026
2010-06-23 21:17:07 -07:00
Randall Spangler
1078838fff Refactor rollback interface for LoadKernel(), LoadFirmware().
Review URL: http://codereview.chromium.org/2861020
2010-06-23 15:35:31 -07:00
Randall Spangler
b9d60a52b7 Even more integration fixes.
Review URL: http://codereview.chromium.org/2849021
2010-06-23 12:43:01 -07:00
Randall Spangler
81d0996901 Assorted integration fixes.
MSVC does not like bitfields with extra bits in them, so it made the GptEntry struct too big.

Fixed a missing return value in LoadFirmware().

Added some debug output.

Fixed calls to SetupTPM().

Tested with 'make && make runtests'.  No errors.

Review URL: http://codereview.chromium.org/2865014
2010-06-23 10:15:38 -07:00
Randall Spangler
beb5bae09f Fixes to compiler warnings in MSVC
Review URL: http://codereview.chromium.org/2851015
2010-06-21 16:33:26 -07:00
Randall Spangler
620c38cf34 Remove unused files, and tidy the directory structure of the remaining ones.
Review URL: http://codereview.chromium.org/2815011
2010-06-17 14:45:22 -07:00