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