Commit Graph

1223 Commits

Author SHA1 Message Date
Randall Spangler
17f8d34109 Rename files and defines to simplify makefile.
BUG=chromium-os:26317
BRANCH=none
TEST=manual

sudo emerge vboot_reference
emerge-link vboot_reference chromeos-u-boot chromeos-installer
emerge-daisy vboot_reference chromeos-u-boot chromeos-installer

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: I8c55ca40f3f0cacf08530ab63c886fe351bcee8e
Reviewed-on: https://gerrit.chromium.org/gerrit/41152
2013-01-11 16:14:24 -08:00
Randall Spangler
5d9bbf2bbd Unify vboot build into a single makefile
This is a necessary precursor to getting coverage working.

BUG=chromium-os:26317
BRANCH=none
TEST=manual

sudo emerge vboot_reference
emerge-link vboot_reference chromeos-u-boot
emerge-daisy vboot_reference chromeos-u-boot

Change-Id: Ibed91c64a5ca5fa486169d64fb01a9e868ce27e5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
(cherry picked from commit 13ed1f4812f810ee0a47b946ad990f1fa93f366c)
Reviewed-on: https://gerrit.chromium.org/gerrit/40906
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-01-11 14:20:53 -08:00
Duncan Laurie
ee327511af Add missing TlclLibClose function for mock TPM interface
BUG=none
BRANCH=none
TEST=manual: MOCK_TPM=1 emerge vboot_reference

Change-Id: I81ae9bb646b1a1186629e1a3ba8317efe8397faf
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41131
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-01-11 12:17:38 -08:00
Luigi Semenzato
d6acfd441d Fix bad free order in tlcl_generator.c.
Fix suggested by the OpenSUSE friends:

https://build.opensuse.org/package/view_file?expand=1&file=fix-tlcl-generator.patch&package=vboot&project=devel%3AFactory%3AARM%3AContrib%3AChromebook

for this bug:

http://paste.opensuse.org/86254908

BUG=chromium-os:37707
TEST=emerge-daisy vboot_reference
BRANCH=none

Change-Id: I61c116152fab7b997a84f44da89c93b89659e852
Reviewed-on: https://gerrit.chromium.org/gerrit/40902
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
2013-01-10 11:38:47 -08:00
Randall Spangler
e8cfa31d54 Move lengthy tests from 'make runtests' to 'make runlongtests'
This reduces 'make runtests' from ~90 sec on a z620 to ~8 sec, which
is short enough we can run it as part of the continuous build.

BUG=chromium-os:26317
BRANCH=none
TEST=make && time make runtests && time make runlongtests

Change-Id: I8165efaf8b8290ca3c8f8da73e3f8a54c2bc19f9
Reviewed-on: https://gerrit.chromium.org/gerrit/40374
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2013-01-03 11:14:51 -08:00
Simon Glass
ef2a02fe7d Use a separate knob for SHA512 unrolling
The SH512 code gets quite large when unrolled, about 20KB larger on x86.
This is a net loss on machines with slow SPI. Split this out into a
separate knob, and don't enable it on any architecture for now.

Also swap the code around so that we do #ifdef...#else...#endif instead
of #ifndef...#else...#endif.

BUG=chrome-os-partner:13961
BRANCH=none
TEST=manual
build and boot to kernel on link

U-Boot image size before this change:
   text	   data	    bss	    dec	    hex	filename
 319403	   8260	  83988	 411651	  64803	u-boot

after:
 293227	   8260	  85492	 386979	  5e7a3	u-boot

This is a saving of about 25KB.

Signed-off-by: Simon Glass <sjg@chromium.org>

Change-Id: I9fa7ea8eba6691d8a06df9374950303e6f2ce2fd
Reviewed-on: https://gerrit.chromium.org/gerrit/40155
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2012-12-26 10:37:43 -08:00
Gabe Black
0aedbe1950 Add support for a V option which selects verbose Makefile output.
When V=1, the full command lines are printed. When V is not 1, then only a
small summary line is printed which shows what commands are being executed.
The command lines themselves are usually quite long and are overwhelming to
see fly by on the console. Abbreviated command lines are easier to read and
don't fill up your console so quickly.

This change is primarily targeted at vboot_fw.a and probably excludes some
things which could also be converted. The indentation between the action
string (OBJCOPY, CC, etc.) and the target is three spaces longer than "normal",
aka what's used in depthcharge, so that when this make is run from the other,
you can tell the difference between the commands run by each.

BUG=chrome-os-partner:8339
TEST=Built with and without V=1 and saw and did not see the full command
lines, respectively.
BRANCH=None

Change-Id: Ibee244c24dc44b8da109b8c23ac7273174836bb9
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/40011
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
2012-12-21 12:42:42 -08:00
Kees Cook
90f78d2261 mount-encrypted: finalize if keyfile missing
If a system key is available (could read TPM NVRAM), but the "finalization
needed" file exists, it means that we are in the situation where either
cryptohome was interrupted, or the TPM was temporarily unavailable at an
earlier boot. In this case, it is up to mount-encrypted to perform the
finalization. Before, we were making the very bad assumption that the
keyfile was valid if a system key was found, meaning we would delete the
"finalization needed" file, leaving us with no way to find the encryption
key leading to an OOBE on the next boot.

BUG=chrome-os-partner:15960
TEST=daisy build, manual testing
BRANCH=None

Change-Id: Ifb6d74d8a38100e00d9a4597c25a71a6c33f806c
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39883
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
2012-12-18 14:51:29 -08:00
Bill Richardson
699ebf398f Add recovery_subcode field to nvstorage and crossystem
This just adds a one-byte field in the nvstorage region for use in debugging
hard-to-catch errors. There's no official meaning or expectation for this
field. It's just a handy place to emit some information.

BUG=chrome-os-partner:11534
BRANCH=parrot
TEST=manual

Just change the value and ensure that it persists across a (working) reboot.
It's only updated at specific points under very exacting error conditions,
so all we really want to test is that it works as a place to store some
extra info.

  crossystem recovery_subcode
  crossystem recovery_subcode=14
  reboot
  crossystem recovery_subcode

The recovery_subcode byte is at index [6] of the VbNv.raw bytes that appear
when you press TAB, so you can find it there too:

  VbNv.raw: 60 20 00 00 00 00 0e 00 00 00 00 00 00 00 00 65

Decimal 14 == 0x0e

Change-Id: I1930b8f81a03ab838dbee99a8d72c35a444efdfd
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39803
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-12-17 17:05:01 -08:00
Mike Frysinger
b55c538fca sign_official_build: add a dump_config helper and clean up argument processing
For debugging purposes, we like to see the kernel command line that a
particular kernel is using.  We have all the tools to do this already,
but not easy to leverage (you have to manually extract/etc...).  So
add a "dump_config" helper to help people out.

Further, the existing argc processing is incomplete and not terribly
friendly.  Add some useful error messages explaining why we quit.

BUG=None
TEST=`./sign_official_build.sh dump_config <bin>` works
TEST=`./sign_official_build.sh verify <bin>` works
TEST=`./sign_official_build.sh` shows usage
TEST=`./sign_official_build.sh recovery <bin>` shows usage
TEST=`./sign_official_build.sh recovery <bin> / /tmp/foo` tries to sign
BRANCH=None

Change-Id: I9f94250b8c299783bdcba704733974c6a5491101
Reviewed-on: https://gerrit.chromium.org/gerrit/39603
Reviewed-by: Paul Taysom <taysom@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-12-12 14:57:17 -08:00
Kees Cook
dd7a774344 tlcl: move open retry into Tlcl
Make sure all Tlcl users benefit from the new retry logic.

BUG=None
TEST=daisy build, manual testing of racing tpmc loops
BRANCH=None

Change-Id: I8e9656a65b5d6b45694c1c8bceb95f54f7c751bb
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39525
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
2012-12-12 13:37:33 -08:00
Bill Richardson
a4090b5a61 Addtional -h args to dump_fmap will ignore overlap errors.
Snow was built with overlapping regions in its FMAP, so when we use
dump_fmap -h to see what the layout is, it complains and dies. This change
lets it keep going if you give it multiple -h args. Nothing else is different.

BUG=none
BRANCH=none
TEST=manual

This complains and quits:

  dump_fmap -h image-snow.bin

This complains and keeps going:

  dump_fmap -hh image-snow.bin

Change-Id: Ia4592b9ba6963b8c5064dd6f51625e9495db2845
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39551
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-12-11 11:13:12 -08:00
Kees Cook
34d515c5c1 mount-encrypted: retry TPM open
If the TPM hits an error other than ENOENT during open(), retry for 5
seconds with 100ms polling delays. Also switch to on-demand opening
of TPM, so umount will not hit delays if tcsd keeps the TPM open at
shutdown time.

BUG=chrome-os-partner:15960
TEST=daisy build, mount ok with kernel patched to return EBUSY for a few
 opens, platform_EncryptedStateful passes.
BRANCH=None

Change-Id: Ia597622bb54ccc4366be2a0c960c518406e6c0b2
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39445
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
2012-12-10 13:56:47 -08:00
Kees Cook
00cc72894f Tlcl: allow OS failures to bubble up to caller
If there were any errors communicating with the TPM at the OS layer
(open, read, write failures), the library would immediately exit, not
allowing the caller to make any decisions about how to handle it. This
introduces a way to initialize the library so that errors will get passed
back up to the caller instead of unceremoniously exiting.

Setting the environment variable "TPM_NO_EXIT=1" enables the feature. To
avoid needing to implement supporting functions in all backends, the
feature is currently limited to just the Tlcl stub implementation.

In the case of mount-encrypted, it can now survive the kernel returning
read/write failures. In the past it had only worked around having open
fail, but that has now been replaced with more sensible logic instead of
the environment variable trickiness.

BUG=chrome-os-partner:15960
TEST=daisy built with an always-failing kernel driver, u-boot builds too
BRANCH=None

Change-Id: Ic7b217017537980f9c239d678067398613045676
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38791
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
2012-11-28 21:35:49 -08:00
Kees Cook
ca44b077a8 mount-encrypted: add error reporting to RNG failures
In the case of the TPM getting into a permanent failure mode
(e.g. crosbug.com/p/15785), the entropy system was not trying harder to
get entropy (i.e. falling back to system RNG), and was just using
whatever happened to be on the stack.

This adds the system RNG to the fallback list:
- try TPM RNG
- try system RNG
- use uninitialized stack contents

The reason for the last one being used is so we can make sure we're
getting a system up. It is extremely unlikely for both the TPM and
the system RNGs to be broken and if they are, it's likely a relatively
permanent failure condition. If we abort in this state, we'll cause an
infinite repair loop which is a very bad user experience. Instead, get
the system up using terrible entropy so the conditions can be examined.

BUG=chrome-os-partner:15960
TEST=daisy build with instrumented kernel tpm driver to always fail
BRANCH=none

Change-Id: I92c454925a78bb0d94262cdb3914c1b72010450e
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38751
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
2012-11-27 14:53:22 -08:00
Paul Taysom
8a42c2718f remove verity regardless of dm device
Changed the pattern substitution to work with dm-[0-9]

BUG=chromium-os:25441
TEST=Turned off verity on stumpy both with and without bootcache
BRANCH=none

Change-Id: I519ad71879f2db847f450b869c8f7a67606f1e20
Reviewed-on: https://gerrit.chromium.org/gerrit/38691
Tested-by: Paul Taysom <taysom@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Paul Taysom <taysom@chromium.org>
2012-11-27 10:02:43 -08:00
Bill Richardson
640b1c4207 Add more recovery_reason codes
There are several places where the same recovery_reason was used to report
slightly different points of failure. Let's create some new codes instead.

Remember that recovery mode is handled by RO firmware, so if an updated RW
firmware uses one of the new error codes, pressing TAB at the recovery
screen will say "We have no idea what this means". That's not a bug. This CL
deprecates the original codes, so the fact that the RO firmware doesn't
recognize it just means it's a new code reported by a new RW BIOS.

BUG=chromium-os:36562
TEST=manual
BRANCH=parrot

Run

  make && make runtests

It should pass. You can test some of the error cases on actual hardware by
using

  crossystem recovery_reason=86
  reboot

and pressing TAB at the recovery screen. For that example you should see the
message

  recovery_reason: 0x56 TPM lock error in rewritable firmare

Change-Id: I123c781e6c6f6fe0284c4fd49f5f5a855eece7df
Reviewed-on: https://gerrit.chromium.org/gerrit/38652
Commit-Ready: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-11-26 12:04:42 -08:00
Kees Cook
b08c46a0da mount-encrypted: report numeric results on TPM failure
To help identify the specific failure conditions encountered when the
TPM goes weird, report them any time they are encountered.

BUG=chrome-os-partner:15960
TEST=daisy build, manual testing
BRANCH=none

Change-Id: I80b3bd23c88c19d807cbcafe8ea2736fe000e1d6
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38468
Reviewed-by: Darren Krahn <dkrahn@chromium.org>
2012-11-25 22:21:50 -08:00
Paul Taysom
0bbc17c69a Added handling of regex for dm params
To handle a more diverse set of configurations, added
processing of regular expressions for the dm params.

BUG=chromium-os:36441
TEST=rand security_test_image for various configurations
BRANCH=none

Change-Id: I4d9e610586cc9f63d55397e60462600ed9b9651f
Reviewed-on: https://gerrit.chromium.org/gerrit/38202
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Paul Taysom <taysom@chromium.org>
Tested-by: Paul Taysom <taysom@chromium.org>
2012-11-19 16:14:31 -08:00
Hung-Te Lin
7682e5e87a newbitmaps: Move files to new location (bmpblk).
BUG=none
TEST=none
BRANCH=none

Change-Id: I4a5ecedd4dd8e2ef866793edd825f4d5716402bf
Reviewed-on: https://gerrit.chromium.org/gerrit/38097
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2012-11-16 23:47:46 -08:00
Hung-Te Lin
5eaf916f52 newbitmaps: Increase font size & fix JP font.
Using PT=18 provides better screen on scaled screens.
IPAPGothic does not look good after being scaled, so let's use Droid Sans
Fallback again.

BRANCH=none
BUG=none
TEST=make # pass

Change-Id: I59f3768a14055d8f135e15b85107406d5a2d4924
Reviewed-on: https://gerrit.chromium.org/gerrit/38016
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2012-11-14 17:59:05 -08:00
Hung-Te Lin
8e32e75f4f newbitmaps: Get rid of ImageMagick and use PIL for image processing.
To simplify dependency (and prepare for building inside chroot), we need to get
rid of dependency for ImageMagick, which is now entirely replaceable by Python
Image Library.

BRANCH=none
BUG=none
TEST=make # pass

Change-Id: Ie3d3a4ac399b2fe58aa75f8e02e4475bcba21c51
Reviewed-on: https://gerrit.chromium.org/gerrit/37985
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2012-11-14 17:59:04 -08:00
Paul Stewart
0c69afc5b3 CHROMIUMOS: "flimflam" init file is now named "shill"
BUG=chromium-os:35909
TEST=None (need suggestions form semenzato)
BRANCH=none

Change-Id: Ife7c545a28fd70407ba2fe1a0a14e20df8e847f7
Reviewed-on: https://gerrit.chromium.org/gerrit/37020
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
2012-11-06 23:13:33 -08:00
Marc Jones
9754cae1c1 Add FAFT keyboard remap GBB flag
Add a new flag, 0x100, to indicate FAFT key stroke overrides.

BUG=chrome-os-partner:14056
TEST=none
BRANCH=stout

Change-Id: I76b7f3f4c51abec5528047f690f20a09b257abc2
Signed-off-by: Marc Jones <marc.jones@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/37074
Reviewed-by: Ronald G. Minnich <rminnich@chromium.org>
Reviewed-by: Gediminas Ramanauskas <gedis@chromium.org>
Tested-by: Gediminas Ramanauskas <gedis@chromium.org>
Commit-Ready: Marc Jones <marc.jones@se-eng.com>
2012-11-06 11:40:28 -08:00
Hung-Te Lin
3f9857420f newbitmaps: Speed up image conversion by using PIL.
Running ImageMagick + PIL is a redundant task; we should let PIL
do flatten, resize, and exporting to different format.

Before: real 11m54s, user 37m10s.
After: real 8m3s, user 16m33s.

BRANCH=none
BUG=none
TEST=make

Change-Id: I65f1e5b769161650310abca46851824755402d9b
Reviewed-on: https://gerrit.chromium.org/gerrit/37200
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2012-11-05 16:52:50 -08:00
Hung-Te Lin
7909cb8293 newbitmaps: Speed up make_default_yaml.
Sub-shell execution is slow. To improve shell script execution speed:
 - Replae $(expr) by $(()).
 - Cache image file data and avoid executing ImageMagick.
 - Prevent extra eval & subshell.
 - Remove bash-only syntax to allow using dash.

 # time ../make_default_yaml en
 Before change: Real 9s, User 1m7s.
 After (bash): Real 1.6s, User 8.8s.
 After (dash): Real 1.0s, User 6.9s.

BRANCH=none
BUG=none
TEST=make

Change-Id: I59626fb1a211de82cf58fcd1331a5641b97e2823
Reviewed-on: https://gerrit.chromium.org/gerrit/37006
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2012-11-05 16:20:11 -08:00
Hung-Te Lin
68a516a43c newbitmaps: Remove language navigation bar in TONORM_CONFIRM.
BRANCH=none
BUG=chrome-os-partner:15823
TEST=make # pass

Change-Id: Ibb998e71059146067403872386bf17659a50c0f3
Reviewed-on: https://gerrit.chromium.org/gerrit/37098
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2012-11-05 16:20:09 -08:00
Mike Frysinger
9e2c3b0b98 fix linking order
Libraries must come after objects when linking.  Otherwise their
references will be elided when earlier objects didn't need them.

BUG=None
TEST=`LDFLAGS=-Wl,--as-needed emerge-daisy vboot_reference` worked
BRANCH=None

Change-Id: Ic8237a767758d002cd848ed3293b17940884b609
Reviewed-on: https://gerrit.chromium.org/gerrit/37166
Reviewed-by: Kees Cook <keescook@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-11-01 19:13:17 -07:00
Hung-Te Lin
97625b69be newbitmaps: Add "USB2 only, no SD" profile.
Change *usb2 to "USB2 only, no SD" and add "*sdusb2" as "USB2 only, with SD".

Also fixed PIL conversion error on Ubuntu Precise edition.

BRANCH=none
BUG=chrome-os-partner:15738
TEST=make # pass

Change-Id: I9bc22b7f82bc6e58e6069ae6dd4951e882edb19c
Reviewed-on: https://gerrit.chromium.org/gerrit/36997
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Dave Parker <dparker@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2012-10-31 18:42:04 -07:00
Shawn Nematbakhsh
ba7fd8dff8 vboot_reference: Fix keyboard input lag at confirm screen.
Changing languages is terribly slow at the confirm screen, when
switching from dev to normal. Reduce sleep time to improve user
experience.

BUG=chrome-os-partner:15726
TEST=boot in dev, hit space, hit arrows rapidly to change language,
observe no lag.
BRANCH=butterfly, stout

Change-Id: I0943debc31d78dcfce87e7f7d4537ae47f5f8cfd
Reviewed-on: https://gerrit.chromium.org/gerrit/36956
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Shawn Nematbakhsh <shawnn@google.com>
Tested-by: Shawn Nematbakhsh <shawnn@google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-10-30 18:23:50 -07:00
Hung-Te Lin
ca8c372e60 sign_official_build: Support signing additional RW firmware in shellball.
There will be more bios*.bin (ex, bios_rw.bin) in firmware updater, and we do
want to sign all files.

BRANCH=signer
BUG=chromium-os:35369
TEST=sign_official_build.sh ssd DEV_IMAGE ../../tests/devkeys

Change-Id: I2ea0c5c3d7a18c43df581f50b4bd907206dcd7ad
Reviewed-on: https://gerrit.chromium.org/gerrit/36890
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2012-10-30 15:33:29 -07:00
Luigi Semenzato
d2852eabf6 Add recovery reason for failure to correct TPM error
The TPM on snow devices may boot in an unusable state.  The workaround
is to detect this early and reboot.  The workaround code prevents
an infinite reboot loop by counting the number of reboots and entering
recovery mode with this reason after a small threshold has been reached.

BUG=chromium:156655
TEST=no test!  Not even compiled!
BRANCH=none

Change-Id: Ica2f14f8f7df8c46b7cbe5dbd578ba93c8f3a78c
Reviewed-on: https://gerrit.chromium.org/gerrit/36790
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Luigi Semenzato <semenzato@chromium.org>
2012-10-29 14:49:36 -07:00
Mike Frysinger
8b42ac8e26 Key increment scripts: fix incrementing keys not in $PWD
Part of the recent rewrite dropped changing of the active dir to
${KEY_DIR}.  Meant the scripts needed to be run inside of the key
dir since not all functions take the key dir as an argument but
instead assume they're in ${PWD}.

BUG=None
TEST=Ran increment_kernel_subkey_and_key_mp.sh and saw it work
BRANCH=None

Change-Id: Icbc02f123e999d186d9c40fd16528a134397699e
Reviewed-on: https://gerrit.chromium.org/gerrit/35803
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-10-16 23:25:29 -07:00
Kees Cook
b59d06e6e8 mount-encrypted: fix mount detection to use device
Instead of fsid, which is unpopulated for tmpfs, use device number
since that will increment for each different tmpfs.

BUG=chrome-os-partner:15192
TEST=parrot build, manual testing
BRANCH=none

Change-Id: I0024f7283c90684daaf1278d3cf6b76cc85bb253
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35615
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Elly Jones <ellyjones@chromium.org>
2012-10-16 11:26:39 -07:00
Kees Cook
adc6764229 mount-encrypted: handle missing TPM on Chrome OS
While not having a TPM was supported for non-Chrome devices, it was not
expected for Chrome devices. This adds logic to fail the TPM calls
before making them when the TPM is missing. The tpm_lite library doesn't
handle the TPM being missing, so we have to do this ourselves.

BUG=chrome-os-partner:15192
TEST=parrot build, verified operation after "mv /dev/tpm0 /dev/tpm0.bak"
BRANCH=none

Change-Id: I2f625305dce7fa698fcad33e412ee37c60da9bc2
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35440
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
2012-10-12 14:24:42 -07:00
Gaurav Shah
9bf0d535fe resign_firmwarefd.sh: Fix flag option name
We didn't get bit by this bug because getlong_opt does partial matching
on long option names. So --flag also works.

BUG=none
TEST=resign a test firmware; ensure preamble flag is preserved.
BRANCH=none

Change-Id: Ifd87c627b82468529fe1241be3629198d194027b
Reviewed-on: https://gerrit.chromium.org/gerrit/35350
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Gaurav Shah <gauravsh@chromium.org>
2012-10-12 11:12:54 -07:00
Paul Taysom
212eb98136 Added patterns for bootcache
The bootcache will be changing the linux command line. Added additional
patterns that are acceptable to the signing software.

BUG=chromium-os:25441
TEST=ran security_test_image script against stumpy recovery images
BRANCH=none

Change-Id: I22d00ebc6191b5499f722974d90c260b78eb63b2
Reviewed-on: https://gerrit.chromium.org/gerrit/34959
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Paul Taysom <taysom@chromium.org>
Tested-by: Paul Taysom <taysom@chromium.org>
2012-10-09 13:45:13 -07:00
Mike Frysinger
4615b96345 signer scripts: return an error when loading configs fail
If we are given a config file that doesn't exist, return an error rather
ignoring it.  This way we don't accidentally give images a pass when we
didn't properly test them.

BUG=None
TEST=`./security_test_image --board=x86-alex --baselines=/` now shows 3 failures rather than all pass
BRANCH=None

Change-Id: I9d130db05befaeac8fcca921f0e43f47c2461f9f
Reviewed-on: https://gerrit.chromium.org/gerrit/34795
Reviewed-by: Ryan Cui <rcui@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-10-05 15:21:10 -07:00
Randall Spangler
09a8447862 crossystem devsw_cur returns devsw_boot if virtual dev switch
devsw_cur is really a meaningless concept on systems with virtual dev
switches; it exists primarily to support factory test of physical
developer switches.  However, some plugins use this instead of the
preferred devsw_boot, and it's easier to modify crossystem than the
plugins at this point in time.

BUG=chrome-os-partner:12928
BRANCH=none (affects all current products, but is an OS-level change, not FW)
TEST=manual

- On link, 'crossystem devsw_cur devsw_boot' with dev switch on -> '1 1'
- On link, 'crossystem devsw_cur devsw_boot' with dev switch off -> '0 0'
- On lumpy or earlier, 'crossystem devsw_cur' should return current dev
  switch position; check this by toggling the physical switch without
  rebooting and see that the reported value follows the switch value.

Change-Id: Ie7416e5cb03c133572c32af677b55ed18884dfb8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34531
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2012-10-04 09:31:00 -07:00
Bill Richardson
788dbc34b0 Allow vbutil_what_keys to examine shellballs too
Currently vbutil_what_keys only displays the kernel keyblock info for disk
images. This adds a -v option (requiring sudo) to cause it to attempt to look
inside any rootfs partitions and extract the BIOS image from the shellball.

This CL also updates the list of known sha1sums.

Without -v:

  vbutil_what_keys recovery_image.bin
  IMAGE: recovery_image.bin
    part 2 kernel:   49d40533b0812d3f31232c5eedd47e7e11acc293 (!DEV DEV REC)
    part 4 kernel:   cc887372ac2d1c415eac93fc11e753629c387358 (!DEV DEV !REC)

With -v:

  vbutil_what_keys -v recovery_image.bin
  IMAGE: recovery_image.bin
    part 2 kernel:   49d40533b0812d3f31232c5eedd47e7e11acc293 (!DEV DEV REC)
    part 4 kernel:   cc887372ac2d1c415eac93fc11e753629c387358 (!DEV DEV !REC)
    part 3 shellball:
      hwid:          X86 LUMPY TEST 6638
      recovery key:  0d800afb53cdd05dd849addee0143ca1d96e893c
      root key:      4e92f07efd4a920c4e4f1ed97cf47b7b04ee1428

BUG=none
BRANCH=none
TEST=manual

This is an optional feature to a debugging utility. You can try the examples
above if you feel like testing it yourself.

Change-Id: Ie0dc918c1a99705c408314e960f4dc98aee7c1a9
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34537
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-10-03 14:37:55 -07:00
Hung-Te Lin
00311b8644 vboot_api_kernel: Print warning in Ctrl-U when dev_boot_usb is not enabled.
Ctrl-U used to simply beep without messages for why it does not work (due to NV
data dev_boot_usb). Since the system is already in Developer mode, it should be
fine to provide some debug information otherwise we can spent time trying to
figure out why the firmware doesn't work.

BRANCH=all
BUG=chrome-os-partner:14474
TEST=flash image to Link, enter DEV and press Ctrl-U; gets beep and warning messages.

Change-Id: Iab20ecdb2e1c4e267b7257a7bd241006241ddf70
Reviewed-on: https://gerrit.chromium.org/gerrit/34406
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2012-10-03 07:33:41 -07:00
Hung-Te Lin
cb85206ebf vboot_api_kernel: Print warning in TONORM when GBB flags force DEV.
We use gbb-flag-force-dev-switch-on in default firmware images to make
things easier for factory and some devs.

But when we request normal mode there should be some sort of warning/error
telling the user that this is not available, otherwise we can spent time trying
to figure out why the firmware doesn't work.

BRANCH=all
BUG=chrome-os-partner:14474
TEST=flash image to Link, set GBB flags to 0x39, boot to DEV screen
     and press SPACE (TONORM); gets beep and warning messages.

Change-Id: Id48c12693c7575001fae7fad92a868cb5465e83d
Reviewed-on: https://gerrit.chromium.org/gerrit/34172
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2012-09-27 19:08:01 -07:00
Mike Frysinger
283cbf89a9 sign_official_build.sh: add an update payload operation
This enables the signer script to sign update payloads.

BUG=chromium-os:34521
TEST=`./sign_official_build.sh update_payload testcase.sha256 . foo` produced a signed foo file
BRANCH=None

Change-Id: I27a9de89e760427251538deec38161944388a152
Reviewed-on: https://gerrit.chromium.org/gerrit/33535
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2012-09-26 16:12:48 -07:00
Vadim Bendebury
65d3c277a2 Make cgpt_add error messages a little more verbose
When the cgpt utility complaints about parameter errors, it is
impossible to tell what exactly went wrong. This change consolidates
error definitions and adds a function to convert integer error values
into text messages.

BRANCH=none
BUG=none
TEST=manual
  . emerge-link vbooot_reference
  . copy generated `cgpt' to a Link device
  . run command with wrong arguments with respect to the existing GPT:
   localhost var # ./cgpt add -i 3 -b 3985408 -s 1757184 -t rootfs -l ROOT-A /dev/sda
   ERROR: cgpt add: Starting LBA overlaps
   ERROR: cgpt add: -i 3 -l ROOT-A -b 3985408 -s 1757184 -t 3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC
  . on the host, in the chroot in src/platform/vboot_reference run

   $ make && make runtests

   observe all tests succeed

Change-Id: Ibd23ca0430a875f70524adc99e0509b26ae699b2
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34003
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-09-26 12:02:24 -07:00
Che-Liang Chiou
210c5ef2d9 crossystem should not grumble about older firmware
Older firmware does not provide nonvolatile-context-storage FDT
property, and crossystem complains about it.

This is harmless; so just make it quiet.

Signed-off-by: Che-Liang Chiou <clchiou@chromium.org>

BRANCH=none
BUG=chrome-os-partner:14475
TEST=manual, see blow

Run crossystem and make sure its output does not contain
  "Unable to open FDT property nonvolatile-context-storage"
messages.

Check crossystem still works by comparing its output w/ and w/o this
change.

Change-Id: I0b8f40775833457a75d801f185344e931ac08847
Reviewed-on: https://gerrit.chromium.org/gerrit/33896
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-09-24 16:29:03 -07:00
Randall Spangler
be94d55d4f Rename RANDOM_POWER_OFF to a more descriptive SAVE_LOCALE_IMMEDIATELY
--snark; no functional change.

BUG=none
TEST=build code
BRANCH=none

Change-Id: Id3a8c5aaf0e5a9d0e1949af602840efcc1895f50
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/33898
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-09-24 11:36:39 -07:00
Stefan Reinauer
a2326ee152 Add CTRL-L in dev screen to support a "legacy boot option"
This option is disabled per default and can be enabled with
crossystem dev_boot_legacy=1
or by setting the GBB flag
GBB_FLAG_FORCE_DEV_BOOT_LEGACY      0x00000080

BUG=chrome-os-partner:6108
TEST=crossystem dev_boot_legacy=1
     boot to dev mode screen, press CTRL-L, see SeaBIOS start
     (other CLs needed)
BRANCH=link
Signed-off-by: Stefan Reinauer <reinauer@chromium.org>

Change-Id: I593d2be7cff5ca07b8d08012c4514a172bd75a38
Reviewed-on: https://gerrit.chromium.org/gerrit/31265
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
2012-09-20 17:32:22 -07:00
Kris Rambish
40bc7b7802 Do not create the kernel data keys.
BUG=None
TEST=Ran it
BRANCH=None

Change-Id: Ib494c64d81c4ee80991a01b2172c7c47b60d5658
Reviewed-on: https://gerrit.chromium.org/gerrit/33659
Tested-by: Kris Rambish <krisr@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
2012-09-19 18:45:21 -07:00
Stefan Reinauer
b7b865cfee Support alternative GPT header signature
In order to dual boot Windows and ChromeOS, Windows must
not find a GPT partition table on the disk. So change
ChromeOS to cope with an alternative signature "CHROMEOS"
instead of the standard "EFI PART"

BUG=chrome-os-partner:6108
TEST=rebuild chromeos, install it,
     run cgpt legacy /dev/sda
     dd if=/dev/sda of=/tmp/x bs=1k
     hexdump -C /tmp/X
     see the string CHROMEOS
BRANCH=link
Signed-off-by: Stefan Reinauer <reinauer@chromium.org>

Change-Id: Ia88eff33b9880bd73a78c1b8e026c1f8298c4557
Reviewed-on: https://gerrit.chromium.org/gerrit/31264
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
2012-09-19 15:33:30 -07:00
Kris Rambish
40d8651bb3 Add scripts to increment single fm/kernel keys.
For firmware and kernel key increment testing we need to be able to
rev only particular keys and verify an autoupdate works.

BUG=None
TEST=Ran it
BRANCH=None

Change-Id: Ic814480b4bf8fbc994132fcd7ba519c3be9b0ccd
Reviewed-on: https://gerrit.chromium.org/gerrit/32458
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Kris Rambish <krisr@chromium.org>
Tested-by: Kris Rambish <krisr@chromium.org>
2012-09-18 16:05:00 -07:00