| 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 "stateful_util.h" | 22 #include "stateful_util.h" |
| 23 #include "utility.h" |
| 23 | 24 |
| 24 /* Macro to determine the size of a field structure in the KernelImage | 25 /* Macro to determine the size of a field structure in the KernelImage |
| 25 * structure. */ | 26 * structure. */ |
| 26 #define FIELD_LEN(field) (sizeof(((KernelImage*)0)->field)) | 27 #define FIELD_LEN(field) (sizeof(((KernelImage*)0)->field)) |
| 27 | 28 |
| 28 KernelImage* KernelImageNew(void) { | 29 KernelImage* KernelImageNew(void) { |
| 29 KernelImage* image = (KernelImage*) Malloc(sizeof(KernelImage)); | 30 KernelImage* image = (KernelImage*) Malloc(sizeof(KernelImage)); |
| 30 if (image) { | 31 if (image) { |
| 31 image->kernel_sign_key = NULL; | 32 image->kernel_sign_key = NULL; |
| 32 image->kernel_key_signature = NULL; | 33 image->kernel_key_signature = NULL; |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 /* Clean up and return the blob. */ | 745 /* Clean up and return the blob. */ |
| 745 done3: | 746 done3: |
| 746 Free(bootloader_buf); | 747 Free(bootloader_buf); |
| 747 done2: | 748 done2: |
| 748 Free(config_buf); | 749 Free(config_buf); |
| 749 done1: | 750 done1: |
| 750 Free(kernel_buf); | 751 Free(kernel_buf); |
| 751 done0: | 752 done0: |
| 752 return blob; | 753 return blob; |
| 753 } | 754 } |
| OLD | NEW |