OLD | NEW |
1 This directory contains a reference implementation for Chrome OS | 1 This directory contains a reference implementation for Chrome OS |
2 verified boot in firmware. | 2 verified boot in firmware. |
3 | 3 |
4 ---------- | 4 ---------- |
5 Directory Structure | 5 Directory Structure |
6 ---------- | 6 ---------- |
7 | 7 |
8 include/ - Contains all the code headers. firmware_image.h and | 8 include/ - Contains all the code headers. firmware_image.h and |
9 kernel_image.h contains the structures that represent a verified boot | 9 kernel_image.h contains the structures that represent a verified boot |
10 firmware and kernel image. Note that the | 10 firmware and kernel image. Note that the |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 1) Crypto implementation from crypto/. The verified boot code should | 49 1) Crypto implementation from crypto/. The verified boot code should |
50 use the wrappers from rsa_utility.h and sha_utility.h - RSAVerify_f() | 50 use the wrappers from rsa_utility.h and sha_utility.h - RSAVerify_f() |
51 and Digest*() functions. | 51 and Digest*() functions. |
52 | 52 |
53 2) Verified Firmware and Kernel image verification functions - only | 53 2) Verified Firmware and Kernel image verification functions - only |
54 functions that work on binary blobs (VerifyFirmware() and | 54 functions that work on binary blobs (VerifyFirmware() and |
55 VerifyKernel()) are required. The functions that work on Firmware and | 55 VerifyKernel()) are required. The functions that work on Firmware and |
56 Kernel images (e.g. VerifyFirmwareImage()) are only useful for | 56 Kernel images (e.g. VerifyFirmwareImage()) are only useful for |
57 user-land utilities that manipulate signed firmware and kernel images. | 57 user-land utilities that manipulate signed firmware and kernel images. |
58 | 58 |
| 59 |
| 60 ---------- |
| 61 Generating a signed firmware image: |
| 62 ---------- |
| 63 |
| 64 * Step 1: Generate RSA root and signing keys. |
| 65 |
| 66 # Root key is always 8192 bits. |
| 67 $ openssl genrsa -F4 -out root_key.pem 8192 |
| 68 |
| 69 # Signing key can be between 1024-8192 bits. |
| 70 $ openssl genrsa -F4 -out signing_key.pem <1024|2048|4096|8192> |
| 71 |
| 72 Note: The -F4 option must be specified to generate RSA keys with |
| 73 a public exponent of 65535. RSA keys with 3 as a public |
| 74 exponent (the default) won't work. |
| 75 |
| 76 * Step 2: Generate pre-processed public versions of the above keys using |
| 77 utils/dumpRSAPublicKey |
| 78 |
| 79 # dumpRSAPublicKey expects an x509 certificate as input. |
| 80 $ openssl req -batch -new -x509 -key root_key.pem -out root_key.crt |
| 81 $ openssl req -batch -new -x509 -key signing_key.pem -out signing_key.crt |
| 82 $ utils/dumpRSAPublicKey root_key.crt > root_key.keyb |
| 83 $ utils/dumpRSAPublicKey signing_key.crt > signing_key.keyb |
| 84 |
| 85 At this point we have all the requisite keys needed to generate a signed |
| 86 firmware image. |
| 87 |
| 88 .pem RSA Public/Private Key Pair |
| 89 .crt X509 Key Certificate |
| 90 .keyb Pre-processed RSA Public Key |
| 91 |
| 92 |
| 93 * Step 3: Use utils/firmware_utility to generate a signed firmare blob. |
| 94 |
| 95 $ utils/firmware_utility --generate \ |
| 96 --root_key root_key.pem \ |
| 97 --firmware_sign_key signing_key.pem \ |
| 98 --firmware_sign_key_pub signing_key.keyb \ |
| 99 --firmware_sign_algorithm <algoid> \ |
| 100 --firmware_key_version 1 \ |
| 101 --firmware_version 1 \ |
| 102 --in <firmware blob file> \ |
| 103 --out <output file> |
| 104 |
| 105 Where <algoid> is based on the signature algorithm to use for firmware |
| 106 signining. The list of <algoid> specifications can be output by running |
| 107 'utils/firmware_utility' without any arguments. |
| 108 |
| 109 Note: --firmware_key_version and --firmware_version are part of a signed |
| 110 image and are used to prevent rollbacks to older version. For testing, |
| 111 they can just be set valid values. |
| 112 |
| 113 |
| 114 * Step 4: Verify that this image verifies. |
| 115 |
| 116 $ utils/firmware_utility --verify \ |
| 117 --in <signed firmware image> |
| 118 --root_key_pub root_key.keyb |
| 119 Verification SUCCESS. |
| 120 |
| 121 |
| 122 Note: The verification functions expects a pointer to the |
| 123 pre-processed public root key as input. For testing purposes, |
| 124 root_key.keyb can be stored in RW part of the firmware. For the |
| 125 final firmware, this will be a fixed public key which cannot be |
| 126 changed and must be stored in RO firmware. |
| 127 |
| 128 ---------- |
| 129 Generating a signed kernel image: |
| 130 ---------- |
| 131 |
| 132 The steps for generating a signed kernel image are similar to that of |
| 133 a firmware image. Since verification is chained - RO firmware verifies |
| 134 RW firmware which verifies the kernel, only the keys change. An additional |
| 135 kernel signing key must be generated. The firmware signing generated above |
| 136 is the root key equivalent for signed kernel images. |
OLD | NEW |