Commit Graph

1662 Commits

Author SHA1 Message Date
Randall Spangler
b8976b6d44 Remove load_kernel from build
Review URL: http://codereview.chromium.org/2535001
2010-06-02 16:38:33 -07:00
Randall Spangler
40226c05ab Put gpt.h back
Review URL: http://codereview.chromium.org/2504001
2010-06-02 15:01:03 -07:00
Randall Spangler
3dcf9dce04 Much rearranging of cgptlib. Passes all its (new) unit tests.
Also includes part of LoadKernel(), which I'll split into a separate
CL.  With some hacks, gets into VerifyKernel() before dying because
I'm not passing in the right key blob.

cgptlib is now pretty stable, and worth looking at.  LoadKernel() less so.

Thanks,
   Randall

Review URL: http://codereview.chromium.org/2438005
2010-06-02 12:46:17 -07:00
Bill Richardson
5374a06114 Add cgpt utility to installable binaries.
Review URL: http://codereview.chromium.org/2490001
2010-06-02 08:23:30 -07:00
Louis Yung-Chieh Lo
e6cf857685 cgpt supports dev and add/delete/modify commands.
Review URL: http://codereview.chromium.org/2374001
2010-05-29 18:54:25 +08:00
Gaurav Shah
67660cda7a Add --subkey_in and --subkey_out options to firmware signing utility.
With this change, just like the kernel signing utility, the firmware signing utility now supports outputting the key signature (subkey) header and reusing it to generate new signed firmware images without requiring the root key (assuming the firmware signing key doesn't change).

Also, some minor comment fixes I missed the last time around.

Review URL: http://codereview.chromium.org/2366004
2010-05-29 01:58:07 -07:00
Gaurav Shah
6bcaa107fb Change to the new prototype/name for Get/WriteStoredVersions().
This should fix the compilation error after Luigi's latest change went in.

Review URL: http://codereview.chromium.org/2358002
2010-05-28 12:31:11 -07:00
Gaurav Shah
f666780e86 Add --subkey_in option to kernel signing utility.
This allows for using an existing key signature (subkey) header to generate new signed images if the kernel signing is unchanged. This obviates the need to take out the firmware private key each time a new signed kernel image is generated.

A similar change will also be propagated to the firmware signing utility. We would REALLY like to reduce the need to take out the verified boot private root key (used for generating R/W firmware key signature headers) everytime we generate a new signed R/W firmware image.

Review URL: http://codereview.chromium.org/2372001
2010-05-28 11:47:33 -07:00
Gaurav Shah
2a9c66cd71 Cleanup option parsing for firmware signing utility.
This is basically the same as Bill's changes for kernel_utility.

Review URL: http://codereview.chromium.org/2322003
2010-05-28 11:42:48 -07:00
Luigi Semenzato
52a8d2df06 Add recovery mode protection to new NVRAM locking scheme.
Also fix the TPM initialization.

Review URL: http://codereview.chromium.org/2344002
2010-05-28 10:34:31 -07:00
Hung-Te Lin
262668fcf3 Added gbb_utility (tool for Google Binary Block)
Review URL: http://codereview.chromium.org/2346001
2010-05-28 10:32:02 -07:00
Bill Richardson
3c6f7a09a4 Better error messages, allow larger-than-needed input when reading.
Review URL: http://codereview.chromium.org/2351002
2010-05-28 09:27:10 -07:00
Randall Spangler
0ff6feaa79 Initial LoadKernel() implementation.
Review URL: http://codereview.chromium.org/2327002
2010-05-27 18:36:02 -07:00
Bill Richardson
4052c3e3b8 random cleanup
Review URL: http://codereview.chromium.org/2353001
2010-05-27 18:16:09 -07:00
Bill Richardson
82e0860e6d need to chmod binaries
Review URL: http://codereview.chromium.org/2325002
2010-05-27 18:03:32 -07:00
Randall Spangler
a9f17aa44a VerifyKernelHeader() fills a KernelImage*
Rather than copying individual fields.  More suitable for use in LoadKernel().

Added StatefulSkip(), so that fields in the input stream can be skipped more cleanly.

Review URL: http://codereview.chromium.org/2327001
2010-05-27 16:18:35 -07:00
Luigi Semenzato
ded1cecd36 Add missing TPM constant and fix test code.
Review URL: http://codereview.chromium.org/2320001
2010-05-27 15:19:58 -07:00
Bill Richardson
371df8bbbf Add install target to put utilities into chroot (in /opt/bin/)
Review URL: http://codereview.chromium.org/2225008
2010-05-27 14:19:47 -07:00
Luigi Semenzato
596b64052e New anti-rollback strategy (no TPM NVRAM write cycles for locking).
Review URL: http://codereview.chromium.org/2225005
2010-05-27 14:04:52 -07:00
Gaurav Shah
b85b06bb25 Add a --subkey switch to kernel signing utility.
This option makes the signing utility just output the kernel subkey (key signature) header which can be used to generate subsequent signed kernel images without needing the firmware root key and using the same kernel signing key. (This feature will be a part of a subsequent CL).

Review URL: http://codereview.chromium.org/2310002
2010-05-27 13:29:20 -07:00
Bill Richardson
d6ff721eb0 StatefulMem* functions should be library functions.
We want the BIOS to implement the stub functions, but that shouldn't include
our StatefulMem* functions.

Also, we ensure that we don't accidently use native linux functions instead
of the stub functions.

Review URL: http://codereview.chromium.org/2255006
2010-05-27 12:27:32 -07:00
Bill Richardson
f5db4b86fa Modifying the kernel_utility tool to create our magic blob.
For the --generate operation, the --in <file> option is gone and there are
three new required options:

  --vmlinuz <file>         Embedded kernel image
  --config <file>          Embedded kernel command-line parameters
  --bootloader <file>      Embedded bootloader stub

This takes the specified kernel, extracts the 32-bit component, and combines
that with the configuration file (essentially just the kernel cmdline
string) and the bootstub image . The resulting blob is signed and ready to
put in a kernel partition.

There's also an optional --padding parameter, to specify how much extra
(unsigned) space to leave between the signature header and the kernel blob.
The default is 0x4000, which is about four times as much needed when using
the largest signature size we currently support.

Review URL: http://codereview.chromium.org/2283005
2010-05-27 11:15:14 -07:00
Randall Spangler
3003c1dd50 Moved cgptlib into vboot_firmware
Moved cgptlib tests into tests

Review URL: http://codereview.chromium.org/2303003
2010-05-27 09:20:11 -07:00
Louis Yung-Chieh Lo
418ad3b620 complete 'cgpt show' and refactor for incoming commands.
Sorry for late. I spent some time to handle Guid endian issue and UTF16/UTF8 consversion. Also, refactored code for incoming commands.

Review URL: http://codereview.chromium.org/2231002
2010-05-27 11:21:17 +08:00
Gaurav Shah
bcd8f4a07c Make kernel signature a part of the kernel preamble.
With this change, the kernel signature is a part of the preamble block (and therefore, used during preamble signature verification).

BUG=670
TEST=image verification tests still pass. corrected splicing test expectations (and it passes).

Review URL: http://codereview.chromium.org/2292001
2010-05-26 13:19:00 -07:00
Gaurav Shah
5fe021b411 Rebaseline linktest with new/modified kernel verification API functions.
Review URL: http://codereview.chromium.org/2248003
2010-05-26 10:53:16 -07:00
Gaurav Shah
bf7615bc31 Change kernel vboot header layout and add support for separate header verification.
This CL adds 2 things:
- Instead of having a kernel config, now we have a kernel preamble which contains some important parameters needed by the bootloader in the firmware to kernel hand-off. These parameters are verified using a separate preamble signature in addition to the kernel signature on actual kernel image data.

- Adds a new VerifyKernelHeader() API function which verifies the kernel verified boot header excluding the kernel data and also extracts parameters out of this header needed to verify the actual kernel image data (if deemed necessary). This allows for vboot header verification and data verification to be performed separately.

Review URL: http://codereview.chromium.org/2234003
2010-05-26 10:26:00 -07:00
Bill Richardson
0b8f35c6a5 Rearrange vboot_reference directories to isolate external components.
This creates a new vboot_firmware subdirectory, and which contains the
entirety of the BIOS code. There shouldn't be anything in this directory
that is NOT required by the BIOS.

Review URL: http://codereview.chromium.org/2219004
2010-05-26 09:18:38 -07:00
Randall Spangler
a45586722f Expose GptData.current_kernel as an output of GptNextKernelEntry()
LoadKernel() needs to pass the kernel partition number out to the
BIOS, so it can be passed to the bootloader.

Review URL: http://codereview.chromium.org/2161007
2010-05-25 11:09:06 -07:00
Bill Richardson
93b09e5a4d Code cleanup.
Fix improper test of return value, replace order-dependent indices with
enumerated types in option parsing.

Review URL: http://codereview.chromium.org/2183001
2010-05-25 10:48:39 -07:00
Randall Spangler
590d10b109 Added struct members for bootloader offset/size.
Review URL: http://codereview.chromium.org/2163003
2010-05-24 16:04:11 -07:00
Randall Spangler
102bfba73a Load kernel APIs added (once more, from the correct repo)
Review URL: http://codereview.chromium.org/2165003
2010-05-24 15:14:33 -07:00
Louis Yung-Chieh Lo
8eaf239a04 support 'cgpt repair'
Review URL: http://codereview.chromium.org/2083020
2010-05-22 07:10:29 +08:00
Louis Yung-Chieh Lo
b31ddcec6a add cgpt framework and attribute support.
Review URL: http://codereview.chromium.org/2082015
2010-05-21 16:35:44 +08:00
Louis Yung-Chieh Lo
0dce41c2ec rename cgpt files with cgptlib prefix (to avoid conflicts to cgpt utility)
Review URL: http://codereview.chromium.org/2082007
2010-05-17 22:45:30 -07:00
Louis Yung-Chieh Lo
b17db3c4b9 cgpt supports GptNextKernelEntry() and GptUpdateKernelEntry()
Review URL: http://codereview.chromium.org/1922004
2010-05-05 11:21:08 -07:00
Louis Yung-Chieh Lo
49fa8e51ad Add more test cases for GptInit() and fixed some bugs
Review URL: http://codereview.chromium.org/1701017
2010-04-30 16:10:48 -07:00
Gaurav Shah
bd52fc793a VBoot Reference: Make kernel_config a 4K byte block, and move it after the verified boot block.
The kernel_config is now stored as a 4K binary block instead of the kconfig_options structure that was being used before. Since the verified boot code doesn't care what kernel config options are (other than the length of the kernel image and for verifying them before the rest of kernel), it is ok to keep them as a blackbox.

This CL also changes the verified boot kernel layout - VBlock Data followed by Kernel Config followed by the Kernel Image. This will allow them to be stored separately, or as a concatenated block (for easy memory mapping during kernel load). This should ease the process of generating a layout for verified boot kernel images which is also compatible with legacy BIOSes that don't support this mechanism.

Finally, there is also a new firmware API function to determine the size of a kernel verified boot block, given a pointer to its beginning (for determining the offset to the kernel config and data).

Review URL: http://codereview.chromium.org/1732022
2010-04-29 15:30:25 -07:00
Gaurav Shah
887e3d4700 Vboot Reference: Remove dependency on TrouSers by not including tss/tcs.h
Use "tss_constants.h" with TPM data type and constant definitions  instead.

Review URL: http://codereview.chromium.org/1712018
2010-04-27 16:26:48 -07:00
Gaurav Shah
2480a18c45 Vboot Reference: Make kernel signing utility more flexible.
The CL adds the --config and --vblock option to kernel_utility.

--config <file> uses the file to populate the configuration portion within a signed vbootimage

Currently, the configuration file is assumed to only contain command line options to be passed to the kernel. In the future, we might want to change it so that it contains information about the kernel load address, entry points, etc. (refer to rspangler@ drive map design doc)

--vblock makes the tool only output the verification header instead of a one monolithic signed kernel image containing the verification information (with config information contained within it) followed by the actual kernel image

Review URL: http://codereview.chromium.org/1752013
2010-04-26 11:41:53 -07:00
Louis Yung-Chieh Lo
37f6b55a25 Add helper functions and files for gpt tests.
Review URL: http://codereview.chromium.org/1729006
2010-04-22 21:22:22 -07:00
Louis Yung-Chieh Lo
4bbf21e476 A simple test infrastructure -- idea stolen from Gaurav.
Review URL: http://codereview.chromium.org/1761004
2010-04-21 17:29:05 -07:00
Louis Yung-Chieh Lo
e1a25ab108 cgptlib stub for verified boot development.
Review URL: http://codereview.chromium.org/1547038
2010-04-20 10:52:41 -07:00
Gaurav Shah
065d360e10 Fix bug in GetLogicalFirmwareVersion().
Missed an offset while retrieving the firmware version.

Review URL: http://codereview.chromium.org/1665007
2010-04-19 15:42:46 -07:00
Gaurav Shah
0265882a34 Change VerifyFirmware() to take separate pointers to firmware verification header and firmware data.
The firmware verification code no longer assumes that verification data and firmware data are contiguous and follow each other. Needed for EFI where the actual firmware must be stored in its own firmware volume.

BUG=1704
TEST=modified existing tests for the new API, and they still pass

Review URL: http://codereview.chromium.org/1578035
2010-04-18 16:35:07 -07:00
Gaurav Shah
65127cc38a Add a --vblock option to firmware_utility to only output the verification block.
Needed if the verification block needs to be stored separately than the actual firmware data instead of one monlithic blob.

TEST = Tried the new option and verified that the output is correct.

Review URL: http://codereview.chromium.org/1525032
2010-04-14 14:29:02 -07:00
Gaurav Shah
c7686471b8 Remove big_[firmware|kernel]_tests from the script used in the autotest.
These tests wouldn't work on a 32-bit system.

Review URL: http://codereview.chromium.org/1624002
2010-04-05 18:44:05 -07:00
Gaurav Shah
f3dd1a6784 VBoot Reference: Output debug information using debug() instead of fprintf().
This should make it easier to switch off debug messages if needed.

TESTS=builds fine, autotest builds fine (using both arm/x86-generic)

Review URL: http://codereview.chromium.org/1607006
2010-04-05 15:50:00 -07:00
Gaurav Shah
ef7510fe40 Updated README
I clobbered my branch associated with the last CL. This is a new issue with the same change.

Review URL: http://codereview.chromium.org/1584005
2010-03-31 14:09:31 -07:00
Gaurav Shah
fc70d72aaa VBoot Reference: Refactoring Part 3
Refactor and restructure reference code into individual self-contain modules. I have revamped the way the code is structured to make it easy to determine which parts belong in the firmware and which are used by userland tools.

common/ - common utilities and stub functions (Firmware)
cryptolib/ - crypto library (Firmware)
misclibs/ - miscellaneous userland libraries (Userland)
sctips/ - Miscellaenous scripts (Userland)
tests/ - Tests (Userland)
vfirmware/ - Verified Firmware Implementation
vfirmware/firmware_image_fw.c (Firmware)
vfirmware/firmware_image.c (Userland)

vkernel/ - Verified Kernel Implementation
vkernel/kernel_image_fw.c (Firmware)
vkernel/kernel_image.c (Userland)

Review URL: http://codereview.chromium.org/1581005
2010-03-31 13:26:55 -07:00