| 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 kernel image. | 5 * Functions for generating and manipulating a verified boot kernel image. |
| 6 * (Userland portion) | 6 * (Userland portion) |
| 7 */ | 7 */ |
| 8 #include "kernel_image.h" | 8 #include "kernel_image.h" |
| 9 | 9 |
| 10 #include <fcntl.h> | 10 #include <fcntl.h> |
| 11 #include <stddef.h> | 11 #include <stddef.h> |
| 12 #include <stdio.h> | 12 #include <stdio.h> |
| 13 #include <sys/types.h> | 13 #include <sys/types.h> |
| 14 #include <sys/stat.h> | 14 #include <sys/stat.h> |
| 15 #include <unistd.h> | 15 #include <unistd.h> |
| 16 | 16 |
| 17 #include "cryptolib.h" | 17 #include "cryptolib.h" |
| 18 #include "file_keys.h" | 18 #include "file_keys.h" |
| 19 #include "kernel_blob.h" | 19 #include "kernel_blob.h" |
| 20 #include "rollback_index.h" | 20 #include "rollback_index.h" |
| 21 #include "signature_digest.h" | 21 #include "signature_digest.h" |
| 22 #include "utility.h" | 22 #include "stateful_util.h" |
| 23 | 23 |
| 24 /* Macro to determine the size of a field structure in the KernelImage | 24 /* Macro to determine the size of a field structure in the KernelImage |
| 25 * structure. */ | 25 * structure. */ |
| 26 #define FIELD_LEN(field) (sizeof(((KernelImage*)0)->field)) | 26 #define FIELD_LEN(field) (sizeof(((KernelImage*)0)->field)) |
| 27 | 27 |
| 28 KernelImage* KernelImageNew(void) { | 28 KernelImage* KernelImageNew(void) { |
| 29 KernelImage* image = (KernelImage*) Malloc(sizeof(KernelImage)); | 29 KernelImage* image = (KernelImage*) Malloc(sizeof(KernelImage)); |
| 30 if (image) { | 30 if (image) { |
| 31 image->kernel_sign_key = NULL; | 31 image->kernel_sign_key = NULL; |
| 32 image->kernel_key_signature = NULL; | 32 image->kernel_key_signature = NULL; |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 // Clean up and return the blob. | 723 // Clean up and return the blob. |
| 724 done3: | 724 done3: |
| 725 Free(bootloader_buf); | 725 Free(bootloader_buf); |
| 726 done2: | 726 done2: |
| 727 Free(config_buf); | 727 Free(config_buf); |
| 728 done1: | 728 done1: |
| 729 Free(kernel_buf); | 729 Free(kernel_buf); |
| 730 done0: | 730 done0: |
| 731 return blob; | 731 return blob; |
| 732 } | 732 } |
| OLD | NEW |