Add support for flags in the firmware preamble.

The old (v2.0) parser is compatible with new (v2.1) structs.  That is,
this won't break existing firmware or vbutil_firmware.

A new (v2.1) parser parsing an old (v2.0) struct will return 0 for the
flags.

This will be used to support the RO-normal code path in a subsequent CL.

BUG=chromium-os:17304
TEST=added unit tests; make && make runtests

Change-Id: I73bcd8acd3330b0d7d143061b5ef838e6d79cf1a
Reviewed-on: http://gerrit.chromium.org/gerrit/4030
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Randall Spangler
2011-07-13 09:48:41 -07:00
parent d70241f37d
commit a712e01ae7
11 changed files with 125 additions and 26 deletions

View File

@@ -102,6 +102,14 @@ int VerifyFirmwarePreamble(const VbFirmwarePreambleHeader* preamble,
uint64_t size, const RSAPublicKey* key);
/* Returns the flags from a firmware preamble, or a default value for
* older preamble versions which didn't contain flags. Use this
* function to ensure compatibility with older preamble versions
* (2.0). Assumes the preamble has already been verified via
* VerifyFirmwarePreamble(). */
uint32_t VbGetFirmwarePreambleFlags(const VbFirmwarePreambleHeader* preamble);
/* Checks the sanity of a kernel preamble of size [size] bytes,
* using public key [key].
*