| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 * | 4 * |
| 5 * Data structure and API definitions for a verified boot firmware image. | 5 * Data structure and API definitions for a verified boot firmware image. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef VBOOT_REFERENCE_FIRMWARE_IMAGE_H_ | 8 #ifndef VBOOT_REFERENCE_FIRMWARE_IMAGE_H_ |
| 9 #define VBOOT_REFERENCE_FIRMWARE_IMAGE_H_ | 9 #define VBOOT_REFERENCE_FIRMWARE_IMAGE_H_ |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 * key. */ | 29 * key. */ |
| 30 uint8_t* firmware_sign_key; /* Pre-processed public half of signing key. */ | 30 uint8_t* firmware_sign_key; /* Pre-processed public half of signing key. */ |
| 31 uint16_t firmware_key_version; /* Key Version# for preventing rollbacks. */ | 31 uint16_t firmware_key_version; /* Key Version# for preventing rollbacks. */ |
| 32 uint8_t header_checksum[SHA512_DIGEST_SIZE]; /* SHA-512 hash of the header.*/ | 32 uint8_t header_checksum[SHA512_DIGEST_SIZE]; /* SHA-512 hash of the header.*/ |
| 33 | 33 |
| 34 uint8_t firmware_key_signature[RSA8192NUMBYTES]; /* Signature of the header | 34 uint8_t firmware_key_signature[RSA8192NUMBYTES]; /* Signature of the header |
| 35 * above. */ | 35 * above. */ |
| 36 | 36 |
| 37 /* Firmware Preamble. */ | 37 /* Firmware Preamble. */ |
| 38 uint16_t firmware_version; /* Firmware Version# for preventing rollbacks.*/ | 38 uint16_t firmware_version; /* Firmware Version# for preventing rollbacks.*/ |
| 39 uint32_t firmware_len; /* Length of the rest of the R/W firmware data. */ | 39 uint64_t firmware_len; /* Length of the rest of the R/W firmware data. */ |
| 40 uint8_t preamble[FIRMWARE_PREAMBLE_SIZE]; /* Remaining preamble data.*/ | 40 uint8_t preamble[FIRMWARE_PREAMBLE_SIZE]; /* Remaining preamble data.*/ |
| 41 | 41 |
| 42 uint8_t* preamble_signature; /* Signature over the preamble. */ | 42 uint8_t* preamble_signature; /* Signature over the preamble. */ |
| 43 | 43 |
| 44 /* The firmware signature comes first as it may allow us to parallelize | 44 /* The firmware signature comes first as it may allow us to parallelize |
| 45 * the firmware data fetch and RSA public operation. | 45 * the firmware data fetch and RSA public operation. |
| 46 */ | 46 */ |
| 47 uint8_t* firmware_signature; /* Signature on [firmware_data]. */ | 47 uint8_t* firmware_signature; /* Signature on [firmware_data]. */ |
| 48 uint8_t* firmware_data; /* Rest of firmware data */ | 48 uint8_t* firmware_data; /* Rest of firmware data */ |
| 49 | 49 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 74 * | 74 * |
| 75 * Caller owns the returned pointer and must Free() it. | 75 * Caller owns the returned pointer and must Free() it. |
| 76 */ | 76 */ |
| 77 uint8_t* GetFirmwarePreambleBlob(const FirmwareImage* image); | 77 uint8_t* GetFirmwarePreambleBlob(const FirmwareImage* image); |
| 78 | 78 |
| 79 /* Get a verified firmware binary blob from an [image] and fill its | 79 /* Get a verified firmware binary blob from an [image] and fill its |
| 80 * length into blob_len. | 80 * length into blob_len. |
| 81 * | 81 * |
| 82 * Caller owns the returned pointer and must Free() it. | 82 * Caller owns the returned pointer and must Free() it. |
| 83 */ | 83 */ |
| 84 uint8_t* GetFirmwareBlob(const FirmwareImage* image, int* blob_len); | 84 uint8_t* GetFirmwareBlob(const FirmwareImage* image, uint64_t* blob_len); |
| 85 | 85 |
| 86 /* Write firmware data from [image] into a file named [input_file]. | 86 /* Write firmware data from [image] into a file named [input_file]. |
| 87 * | 87 * |
| 88 * Return 1 on success, 0 on failure. | 88 * Return 1 on success, 0 on failure. |
| 89 */ | 89 */ |
| 90 int WriteFirmwareImage(const char* input_file, | 90 int WriteFirmwareImage(const char* input_file, |
| 91 const FirmwareImage* image); | 91 const FirmwareImage* image); |
| 92 | 92 |
| 93 | 93 |
| 94 /* Pretty print the contents of [image]. Only headers and metadata information | 94 /* Pretty print the contents of [image]. Only headers and metadata information |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 int AddFirmwareKeySignature(FirmwareImage* image, const char* root_key_file); | 183 int AddFirmwareKeySignature(FirmwareImage* image, const char* root_key_file); |
| 184 | 184 |
| 185 /* Add firmware and preamble signature to a firmware image [image] | 185 /* Add firmware and preamble signature to a firmware image [image] |
| 186 * using the private signing key in file [signing_key_file]. | 186 * using the private signing key in file [signing_key_file]. |
| 187 * | 187 * |
| 188 * Return 1 on success, 0 on failure. | 188 * Return 1 on success, 0 on failure. |
| 189 */ | 189 */ |
| 190 int AddFirmwareSignature(FirmwareImage* image, const char* signing_key_file); | 190 int AddFirmwareSignature(FirmwareImage* image, const char* signing_key_file); |
| 191 | 191 |
| 192 #endif /* VBOOT_REFERENCE_FIRMWARE_IMAGE_H_ */ | 192 #endif /* VBOOT_REFERENCE_FIRMWARE_IMAGE_H_ */ |
| OLD | NEW |