1
0
Fork 0
Datei suchen
Sergey Frolov 506d9df62d Add ensure_not_tainted_license.sh
This is a part of the work to ensure that tainted images are never
signed with MP keys. A special tainted tag was added to the license file by
https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2560225
and in ensure_not_tainted.sh we detect the presence of this tag.

This script has been manually tested on tainted and non-tainted images.

BUG=chromium:1059363
TEST=manual
BRANCH=none

Change-Id: I17ca27bb7895f268a79cca3ad948808f0f96b8c7
Signed-off-by: Sergey Frolov <sfrolov@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2607414
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Allen Webb <allenwebb@google.com>
2021-01-01 00:19:31 +00:00
cgpt portability fixes: support building vboot on FreeBSD 2020-09-11 01:29:19 +00:00
firmware cgptlib: Always zero-initialize GPT entries buffers 2020-12-16 00:39:29 +00:00
futility futility: update: add new quirk 'no_check_platform' 2020-12-09 17:37:53 +00:00
host Revert "Reland: Clean up implicit fall through." 2020-11-20 01:51:08 +00:00
scripts Add ensure_not_tainted_license.sh 2021-01-01 00:19:31 +00:00
tests futility: update: add new quirk 'no_check_platform' 2020-12-09 17:37:53 +00:00
utility inclusive: change usage of sanity 2020-08-19 02:09:02 +00:00
.clang-format vboot: Add .clang-format file 2018-08-02 17:58:46 -07:00
.gitignore newbitmaps: Refine text layout & font settings. 2012-08-15 18:36:35 -07:00
Android.mk vboot: rewrite GBB functions and API 2019-06-07 22:40:03 +00:00
LICENSE Add LICENSE file 2010-08-05 14:18:38 -07:00
Makefile vboot: deprecate and remove legacy UI code 2020-12-04 13:13:26 +00:00
OWNERS vboot: add OWNERS file 2019-06-13 17:33:55 +00:00
PRESUBMIT.cfg PRESUMBIT: enable signoff_check 2019-11-21 16:31:18 +00:00
README cleanup: DESTDIR refers to the install root, not the bin/ 2014-09-17 01:24:40 +00:00
emerge_test.sh Drop "depthcharge" and "unified_depthcharge" portage use symbols 2016-11-10 07:40:05 -08:00
unblocked_terms.txt COIL: Change sane to inclusive words 2020-09-11 16:57:36 +00:00
vboot_host.pc.in vboot_reference: Install vboot_host.pc file 2015-02-19 01:18:37 +00:00

README

This directory contains a reference implementation for Chrome OS
verified boot in firmware.

----------
Directory Structure
----------

The source is organized into distinct modules -

firmware/

  Contains ONLY the code required by the BIOS to validate the secure boot
  components. There shouldn't be any code in here that signs or generates
  images. BIOS should require ONLY this directory to implement secure boot.
  Refer to firmware/README for futher details.

cgpt/

  Utility to read/write/modify GPT partitions. Similar to GNU parted or any
  other GPT tool, but this has support for Chrome OS extensions.

host/

  Miscellaneous functions needed by userland utilities.

futility/

  The "firmware utility" tool, used to create, sign, and validate Chrome OS
  images.

utility/

  Random other utilities, not necesssarily related to verified boot as such.

tests/

  User-land tests and benchmarks that test the reference implementation.
  Please have a look at these if you'd like to understand how to use the
  reference implementation.

build/

  The output directory where the generated files will be placed, and where
  tests are run.

scripts/

  Tools and scripts used to generate and use new signing keypairs. These are
  typically used only on a secure machine.


--------------------
Building and testing
--------------------

The suite can be built on the host or in the chroot environment.

Building on the host could fail if certain packages are not installed. If
there are host environment build problems due to missing .h files, try
researching what packages the files belong to and install the missing packages
before reporting a problem.


The commands are the more-or-less expected ones:

  make
  make runtests
  make install [ DESTDIR=/usr/local ]



----------
Some useful utilities:
----------

futility vbutil_key         Convert a public key into .vbpubk format
futility vbutil_keyblock    Wrap a public key inside a signature and checksum
futility vbutil_firmware    Create a .vblock with signature info for a
                              firmware image
futility vbutil_kernel      Pack a kernel image, bootloader, and config into
                              a signed binary

dumpRSAPublicKey            Dump RSA Public key (from a DER-encoded X509
                            certificate) in a format suitable for use by
                            RSAVerify* functions in crypto/.

verify_data.c               Verify a given signature on a given file.



----------
Generating a signed firmware image:
----------

* Step 0: Build the tools, install them somewhere.

* Step 1: Generate RSA root and signing keys.

  The root key is always 8192 bits.

    $ openssl genrsa -F4 -out root_key.pem 8192

  The signing key can be between 1024-8192 bits.

    $ openssl genrsa -F4 -out signing_key.pem <1024|2048|4096|8192>

  Note: The -F4 option must be specified to generate RSA keys with a public
  exponent of 65535. RSA keys with 3 as a public exponent (the default)
  won't work.

* Step 2: Generate pre-processed public versions of the above keys using
          dumpRSAPublicKey. This utility expects an x509 certificate as
          input, and emits an intermediate representation for further
          processing.

    $ openssl req -batch -new -x509 -key root_key.pem -out root_key.crt
    $ openssl req -batch -new -x509 -key signing_key.pem -out signing_key.crt
    $ dumpRSAPublicKey root_key.crt > root_key.keyb
    $ dumpRSAPublicKey signing_key.crt > signing_key.keyb

************** TODO: STUFF PAST HERE IS OUT OF DATE ***************

At this point we have all the requisite keys needed to generate a signed
firmware image.

.pem   RSA Public/Private Key Pair
.crt   X509 Key Certificate
.keyb  Pre-processed RSA Public Key


* Step 3: Use utility/firmware_utility to generate a signed firmare blob.

$ utility/firmware_utility --generate \
  --root_key root_key.pem \
  --firmware_sign_key signing_key.pem \
  --firmware_sign_key_pub signing_key.keyb \
  --firmware_sign_algorithm <algoid> \
  --firmware_key_version 1 \
  --firmware_version 1 \
  --in <firmware blob file> \
  --out <output file>

Where <algoid> is based on the signature algorithm to use for firmware
signining. The list of <algoid> specifications can be output by running
'utility/firmware_utility' without any arguments.

Note: --firmware_key_version and --firmware_version are part of a signed
      image and are used to prevent rollbacks to older version. For testing,
      they can just be set to valid values.


* Step 4: Verify that this image verifies.

$ utility/firmware_utility --verify \
                         --in <signed firmware image>
                         --root_key_pub root_key.keyb
Verification SUCCESS.


Note: The verification functions expects a pointer to the
      pre-processed public root key as input. For testing purposes,
      root_key.keyb can be stored in RW part of the firmware. For the
      final firmware, this will be a fixed public key which cannot be
      changed and must be stored in RO firmware.

----------
Generating a signed kernel image:
----------

The steps for generating a signed kernel image are similar to that of
a firmware image. Since verification is chained - RO firmware verifies
RW firmware which verifies the kernel, only the keys change. An additional
kernel signing key must be generated. The firmware signing generated above
is the root key equivalent for signed kernel images.