Commit Graph

1662 Commits

Author SHA1 Message Date
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
Gaurav Shah
d52030f340 vboot_reference: Fix Watchlists
Review URL: http://codereview.chromium.org/2777005
2010-06-17 13:22:34 -07:00
vbendeb
cae179aaf9 This CL makes sure that the tests dirctory Makefile works
properly, i.e. rebuild relevant targets if any of the
dependencies (implicit or explicit) change.

To make dependency generation easier the three source files
in the tests directory shared among many programs
(rollback_index_mock.c test_common.c timer_utils.c and
crc32_test.c) are separated into a library, with each of
them getting its own the automated dependency script
generated by the compiler.

To simplify rule definitions, all applications built in the
test directory get linked with -lcrypto and -lrt, which is
not a problem as the linker will not use the library unless
needed.

Tested by touching different .h and .c files in ./tests,
running make and then and observing the make results.

Also verified that emerging works for x86 in chroot environment.

Review URL: http://codereview.chromium.org/2847012
2010-06-16 13:56:58 -07:00
Randall Spangler
f302905224 Move all system includes in vboot_firmware to sysincludes.h
This makes it much easier to port vboot_firmware to platforms (such as
UEFI) which don't have the standard include files; only sysincludes.h
needs to be altered.

Review URL: http://codereview.chromium.org/2833012
2010-06-16 13:42:58 -07:00
Randall Spangler
bd529f05dd Move old vkernel code out of vboot_firmware.
It will go away entirely once the build has moved to vboot_kernel.

Review URL: http://codereview.chromium.org/2866006
2010-06-16 12:51:26 -07:00
vbendeb
2a0155663e One of the last moment mods of the original make rework
CL (http://codereview.chromium.org/2845001) resulted in broken
dependencies.

This CL completes the modification (the trick is to ensure
that the default target is always the first).

Note that the tests subdirectory Makefile still does not
properly follow the dependencies, it will have to be
addressed in a separate CL.

Tested by touching different .h and .c files and observing the results.

Review URL: http://codereview.chromium.org/2819004
2010-06-16 12:49:31 -07:00
Randall Spangler
d471f2a839 Remove old firmware verification code, now that firmware build has switched to the new algorithms.
Review URL: http://codereview.chromium.org/2835006
2010-06-16 12:05:10 -07:00
Randall Spangler
695cd16f13 Add load_kernel2_test
Add debug messages to LoadKernel2()

Review URL: http://codereview.chromium.org/2800007
2010-06-15 23:38:23 -07:00
Randall Spangler
e995895b18 Explicitly pack vboot_struct structures, since they're going on disk.
Review URL: http://codereview.chromium.org/2829004
2010-06-15 21:36:24 -07:00
Bill Richardson
962483c1e2 This fixes the EFI BIOS boot problems introduced with cgpt.
There were two changes. First, we need to pack the GPT header to make it
match the spec (duh). Second, there's a subtle bug in how the BIOS recovers
from corrupted headers. The EFI spec says that the primary GPT header must
be at sector 1 (counting from zero) and the secondary GPT header must be at
the last sector on the drive. The BIOS correctly looks in those locations to
find the headers. However, if the secondary GPT header is invalid (as it
usually is due to our build process), the BIOS is supposed to update it from
the primary header. In this case, rather than write to the last sector on
the drive where it just looked, the BIOS trusts the alternate_lba field of
the primary header. That field is supposed to point to the secondary header
location, but the BIOS just blindly uses it no matter where it points. The
cgpt tool wasn't initializing that field, so it pointed to sector 0, which
is the PMBR. The BIOS overwrote that, resulting in an unbootable drive.

Review URL: http://codereview.chromium.org/2844006
2010-06-15 21:07:18 -07:00
vbendeb
c5e5f4ef55 The code compiled fine on the desktop, but causes a warning in the chroot environment, which in turn causes make to stop.
The fix is to use an explicit format statement.

Tested in chroot environment for x86-generic - was failing before the fix and passes after the fix.

TBR: msb

Review URL: http://codereview.chromium.org/2808009
2010-06-15 18:54:26 -07:00
Randall Spangler
a55e5ca76c Refactor LoadFirmware() to avoid global variables, which don't work when running out of ROM
Review URL: http://codereview.chromium.org/2848006
2010-06-15 18:45:09 -07:00
vbendeb
e3b4ac96bc Rough first draft of the firmware signing utility.
Based on utility/vbutil_kernel.c.

Should be merged with it eventually. Not really tested either, suggesting to submit it just to have a baseline for the verified boot chain.

Review URL: http://codereview.chromium.org/2792014
2010-06-15 15:01:20 -07:00
Randall Spangler
39ed88efe9 Implemented pipelined hash calculation in LoadFirmware()
Review URL: http://codereview.chromium.org/2802002
2010-06-15 14:53:01 -07:00
Randall Spangler
dcab8fab94 Add vbutil_firmware
Review URL: http://codereview.chromium.org/2837005
2010-06-15 14:50:51 -07:00
Luigi Semenzato
63ca39c4a9 Add ForceClear also on dev->normal transitions. Fix wrong API description.
Review URL: http://codereview.chromium.org/2807006
2010-06-15 13:33:01 -07:00
Axel Hansen
38476532ad Fixed VerifyFirmwarePreamble to check for a valid signing algorithm
Changed VerifyFirmwarePreamble to check for a valid kernel_subkey_sign_algorithm from the preamble.
Originally, an incorrect kernel_subkey_sign_algorithm wouldn't be detected and could cause the RSA
verification to read past the end of a buffer.

Review URL: http://codereview.chromium.org/2837002
Patch from Axel Hansen <axelrh@google.com>.
2010-06-15 10:53:18 -07:00
Luigi Semenzato
2666f10dec Fix normal/recovery mode, and RO firmware vs. RW firmware behavior.
Review URL: http://codereview.chromium.org/2792009
2010-06-15 08:12:32 -07:00
Randall Spangler
81d696f394 fix typos in load_kernel_test
Review URL: http://codereview.chromium.org/2820004
2010-06-14 17:23:32 -07:00
vbendeb
70e9509a27 Rework the vboot_reference make system.
After this change the generated files are placed in a
separate tree (such thet they don't show in the
`git status' output anymore) and the dependencies are
followed properly (if a .h file changes the
appropriate .o files and apps get rebuilt).

Tested as follows:

> $ make clean
> $ make # build succeeds
> $ git status # shows clean directory
> $ RUNTESTS=1 make # (captured test output matches that of the test run before any changes)
> $ touch ./vboot_firmware/include/tlcl.h
> $ make  # make succeeds
> $ find build -type f -newer ./vboot_firmware/include/tlcl.h
build/vboot_firmware/lib/rollback_index.o
build/vboot_firmware/lib/rollback_index.o.d
build/vboot_firmware/a.out
build/vboot_fw.a
build/utility/vbutil_key
build/utility/kernel_utility.d
build/utility/vbutil_key.d
build/utility/verify_data
build/utility/load_kernel_test.d
build/utility/vbutil_keyblock.d
build/utility/vbutil_kernel
build/utility/vbutil_kernel.d
build/utility/firmware_utility
build/utility/signature_digest_utility.d
build/utility/kernel_utility
build/utility/verify_data.d
build/utility/vbutil_keyblock
build/utility/signature_digest_utility
build/utility/load_kernel_test
build/utility/firmware_utility.d
build/tests/vboot_common3_tests
build/tests/vboot_common2_tests
build/host/a.out
$ >

Review URL: http://codereview.chromium.org/2845001
2010-06-14 15:41:27 -07:00
Randall Spangler
83c88cfa69 More cleanup
Review URL: http://codereview.chromium.org/2718012
2010-06-11 16:14:18 -07:00
Randall Spangler
729b87258b Clean up of key block functions
No substantial new code, just making the old code consistent.

Review URL: http://codereview.chromium.org/2729021
2010-06-11 11:16:20 -07:00
Randall Spangler
7d6898dbaa Added vbutil_kernel.
Review URL: http://codereview.chromium.org/2730011
2010-06-11 09:22:13 -07:00
Bill Richardson
f1372d9109 Nearly complete rewrite of cgpt tool.
This fixes a number of bugs, adds a bunch of commands, and essentially makes
cgpt ready to use as a replacement for gpt. Still to do is to add commands
and options that will let it generated intentionally bad partitions, for use
in testing.

Review URL: http://codereview.chromium.org/2719008
2010-06-11 09:15:55 -07:00
Randall Spangler
6a97b3e2a1 Add vbutil_keyblock
Review URL: http://codereview.chromium.org/2748008
2010-06-10 17:55:02 -07:00
Randall Spangler
d55c645372 Utility to pack public key, version, algorithm into a single file in VbPublicKey format
Review URL: http://codereview.chromium.org/2762009
2010-06-10 12:43:51 -07:00
Luigi Semenzato
4f11c36ebc Protect the kernel version space from redefinition.
Review URL: http://codereview.chromium.org/2786005
2010-06-10 11:01:04 -07:00
Randall Spangler
d183644564 Major refactoring of structures, with unit tests. This matches the doc I sent out earlier.
Firmware-side code for LoadKernel() is in place now.  LoadFirmware() replacement coming soon.

The new functions are implemented in parallel to the existing ones (i.e., everything that used to work still does).

Review URL: http://codereview.chromium.org/2745007
2010-06-10 09:59:04 -07:00
Luigi Semenzato
59204c57d0 Import recent tpm_lite changes that make all TPM commands return a status.
Review URL: http://codereview.chromium.org/2711006
2010-06-09 13:37:15 -07:00
Randall Spangler
4a7a9e3925 Uses TPM return codes.
Rollback_index funcs now all return 0 if succcess, nonzero if error.
(Note: not fully implemented; Luigi, please clean this up in a
subsequent CL)

LoadKernel() checks return codes from TPM funcs.

LoadKernel() only looks at versions from TPM in normal boot mode.

Review URL: http://codereview.chromium.org/2735004
2010-06-08 15:44:24 -07:00
Randall Spangler
57c08f6641 add load firmware stub
Review URL: http://codereview.chromium.org/2776002
2010-06-08 12:53:11 -07:00
Randall Spangler
7202eae824 Add dummy implementation of LoadFirmware(); currently a wrapper around the old implementation.
Review URL: http://codereview.chromium.org/2743004
2010-06-08 11:02:17 -07:00
Anush Elangovan
0e2a83e074 Update Watchlists
Change-Id: I2903aa4ba58bdc4be69defb4b9f99a94537d3432
2010-06-08 01:33:23 -07:00
Gaurav Shah
5173426100 Add option to specify a kernel subkey signing key to firmware signing utility.
If no kernel subkey signing key is specified, it reuses the firmware signing key.

Review URL: http://codereview.chromium.org/2696003
2010-06-08 00:16:35 -07:00
Randall Spangler
a319ac9c33 Added LoadFirmware() API
Supports passing back the kernel sign key blob, and updating the
firmware data hash during decompression.  Doesn't require data for
both firmware volumes before deciding which one to boot.

Intended to replace VerifyFirmwareDriver_f().

Review URL: http://codereview.chromium.org/2691006
2010-06-07 15:18:29 -07:00
Randall Spangler
c1a9f4d533 Added recovery-mode return code to LoadKernel()
This will be used if the TPM functions return error.

Review URL: http://codereview.chromium.org/2681003
2010-06-07 15:15:00 -07:00
Randall Spangler
e414b08c7b Move tlcl stub implementation to stub subdir.
Review URL: http://codereview.chromium.org/2668003
2010-06-04 14:21:59 -07:00
Luigi Semenzato
0a48681c4e Implement strategy for 64-write limit with unowned TPM.
Review URL: http://codereview.chromium.org/2655005
2010-06-04 13:34:43 -07:00
Bill Richardson
77d26e5190 Enable attributes to display and set properly.
Review URL: http://codereview.chromium.org/2614002
2010-06-04 12:26:42 -07:00
Randall Spangler
af5ae8e21b add inherit review settings for new repo
Review URL: http://codereview.chromium.org/2680001
2010-06-04 11:34:20 -07:00
Bill Richardson
31066a4515 Ignore the AlternateLBA field in the GPT headers.
We know where to look, and we'll look there regardless. We don't care where
the header creator thinks it should be.

Update tests to match.

Oh, and don't assume that I mean "/dev/FOO" if I just say "FOO". That's
really annoying.

Review URL: http://codereview.chromium.org/2606002
2010-06-03 15:20:19 -07:00
Hung-Te Lin
08dc5f381d Add 'recovery_key' in Google Binary Block (GBB) utility
Review URL: http://codereview.chromium.org/2553001
2010-06-03 14:35:47 -07:00
Bill Richardson
96ee63bbf3 Explicitly list dependency files instead of searching for them.
Review URL: http://codereview.chromium.org/2586003
2010-06-03 12:47:38 -07:00
Gaurav Shah
9592919196 Add a kernel subkey signing algorithm key and algorithm fields to firmware preamble.
Review URL: http://codereview.chromium.org/2589001
2010-06-03 11:11:33 -07:00
Randall Spangler
58efd70dc3 Turn off debug printf in LoadKernel()
Review URL: http://codereview.chromium.org/2559002
2010-06-03 10:53:48 -07:00
Randall Spangler
19d1313735 fixed VerifyKernelHeader
removed extra debugging
fixed printf() format specifiers

Review URL: http://codereview.chromium.org/2561001
2010-06-03 09:43:43 -07:00
Gaurav Shah
d4f13e3580 Remove obsolete VerifyKernelDriver() and associated data structures.
The kernel rollback test needs to be rebaselined to use the LoadKernel() (or may combined with load_kernel_test). Will do that as a separate CL when that is close to its final form.

Review URL: http://codereview.chromium.org/2584001
2010-06-03 07:50:50 -07:00
Gaurav Shah
e642198b93 Add a Makefile target to run all vboot_reference tests.
Review URL: http://codereview.chromium.org/2561003
2010-06-03 07:49:32 -07:00
Colin Chow
afdd058ebc fix int reference to unint64 from http://codereview.chromium.org/2438005
Review URL: http://codereview.chromium.org/2550001
2010-06-02 18:20:59 -07:00
Hung-Te Lin
21ef1a3678 Refine gbb_utility for better maintainance
* now -g (get mode) becomes default
 * properties are now managed in a more generalized way so adding new property would be more easy

Review URL: http://codereview.chromium.org/2549001
2010-06-02 18:13:47 -07:00