| 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 * Functions for generating and manipulating a verified boot firmware image. | 5 * Functions for generating and manipulating a verified boot firmware image. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "firmware_image.h" | 8 #include "firmware_image.h" |
| 9 | 9 |
| 10 #include <fcntl.h> | |
| 11 #include <limits.h> | |
| 12 #include <sys/types.h> | 10 #include <sys/types.h> |
| 13 #include <sys/stat.h> | 11 #include <sys/stat.h> |
| 12 #include <fcntl.h> |
| 14 #include <unistd.h> | 13 #include <unistd.h> |
| 15 | 14 |
| 15 #include "cryptolib.h" |
| 16 #include "file_keys.h" | 16 #include "file_keys.h" |
| 17 #include "padding.h" | |
| 18 #include "rsa_utility.h" | |
| 19 #include "sha_utility.h" | |
| 20 #include "signature_digest.h" | 17 #include "signature_digest.h" |
| 21 #include "utility.h" | 18 #include "utility.h" |
| 22 | 19 |
| 23 /* Macro to determine the size of a field structure in the FirmwareImage | 20 /* Macro to determine the size of a field structure in the FirmwareImage |
| 24 * structure. */ | 21 * structure. */ |
| 25 #define FIELD_LEN(field) (sizeof(((FirmwareImage*)0)->field)) | 22 #define FIELD_LEN(field) (sizeof(((FirmwareImage*)0)->field)) |
| 26 | 23 |
| 27 FirmwareImage* FirmwareImageNew(void) { | 24 FirmwareImage* FirmwareImageNew(void) { |
| 28 FirmwareImage* image = (FirmwareImage*) Malloc(sizeof(FirmwareImage)); | 25 FirmwareImage* image = (FirmwareImage*) Malloc(sizeof(FirmwareImage)); |
| 29 if (image) { | 26 if (image) { |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 Free(firmware_buf); | 462 Free(firmware_buf); |
| 466 return 0; | 463 return 0; |
| 467 } | 464 } |
| 468 image->firmware_signature = (uint8_t*) Malloc(signature_len); | 465 image->firmware_signature = (uint8_t*) Malloc(signature_len); |
| 469 Memcpy(image->firmware_signature, firmware_signature, signature_len); | 466 Memcpy(image->firmware_signature, firmware_signature, signature_len); |
| 470 Free(firmware_signature); | 467 Free(firmware_signature); |
| 471 Free(firmware_buf); | 468 Free(firmware_buf); |
| 472 Free(preamble_blob); | 469 Free(preamble_blob); |
| 473 return 1; | 470 return 1; |
| 474 } | 471 } |
| OLD | NEW |