Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: src/platform/vboot_reference/include/kernel_image.h

Issue 661353: Vboot Reference: Refactor Code. (Closed)
Patch Set: Review Fixes. Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 kernel image. 5 * Data structure and API definitions for a verified boot kernel image.
6 */ 6 */
7 7
8 #ifndef VBOOT_REFERENCE_KERNEL_IMAGE_H_ 8 #ifndef VBOOT_REFERENCE_KERNEL_IMAGE_H_
9 #define VBOOT_REFERENCE_KERNEL_IMAGE_H_ 9 #define VBOOT_REFERENCE_KERNEL_IMAGE_H_
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 /* Deep free the contents of [image]. */ 68 /* Deep free the contents of [image]. */
69 void KernelImageFree(KernelImage* image); 69 void KernelImageFree(KernelImage* image);
70 70
71 /* Read kernel data from file named [input_file]. 71 /* Read kernel data from file named [input_file].
72 * 72 *
73 * Returns a filled up KernelImage on success, NULL on error. 73 * Returns a filled up KernelImage on success, NULL on error.
74 */ 74 */
75 KernelImage* ReadKernelImage(const char* input_file); 75 KernelImage* ReadKernelImage(const char* input_file);
76 76
77 /* Write kernel key header from [image] to an open file pointed by the 77 /* Get kernel header binary blob from an [image].
78 * file descriptor [fd]. 78 *
79 * Caller owns the returned pointer and must Free() it.
79 */ 80 */
80 void WriteKernelHeader(int fd, KernelImage* image); 81 uint8_t* GetKernelHeaderBlob(const KernelImage* image);
81 82
82 /* Write kernel config from [image] to an open file pointed by the 83 /* Get kernel config binary blob from an [image].
83 * file descriptor [fd]. 84 *
85 * Caller owns the returned pointer and must Free() it.
84 */ 86 */
85 void WriteKernelConfig(int fd, KernelImage* image); 87 uint8_t* GetKernelConfigBlob(const KernelImage* image);
88
89 /* Get a verified kernel binary blob from an [image] and fill
90 * its length into blob_len.
91 *
92 * Caller owns the returned pointer and must Free() it.
93 */
94 uint8_t* GetKernelBlob(const KernelImage* image, int* blob_len);
86 95
87 /* Write kernel data from [image] to a file named [input_file]. 96 /* Write kernel data from [image] to a file named [input_file].
88 * 97 *
89 * Return [image] on success, NULL on error. 98 * Return 1 on success, 0 on error.
90 */ 99 */
91 KernelImage* WriteKernelImage(const char* input_file, 100 int WriteKernelImage(const char* input_file,
92 KernelImage* image); 101 const KernelImage* image);
93 102
94 /* Pretty print the contents of [image]. Only headers and metadata information 103 /* Pretty print the contents of [image]. Only headers and metadata information
95 * is printed. 104 * is printed.
96 */ 105 */
97 void PrintKernelImage(const KernelImage* image); 106 void PrintKernelImage(const KernelImage* image);
98 107
99 /* Error Codes for VerifyFirmware. */ 108 /* Error Codes for VerifyFirmware. */
100 #define VERIFY_KERNEL_SUCCESS 0 109 #define VERIFY_KERNEL_SUCCESS 0
101 #define VERIFY_KERNEL_INVALID_IMAGE 1 110 #define VERIFY_KERNEL_INVALID_IMAGE 1
102 #define VERIFY_KERNEL_KEY_SIGNATURE_FAILED 2 111 #define VERIFY_KERNEL_KEY_SIGNATURE_FAILED 2
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 * 196 *
188 * Return 1 on success, 0 on failure. 197 * Return 1 on success, 0 on failure.
189 */ 198 */
190 int AddKernelKeySignature(KernelImage* image, const char* firmware_key_file); 199 int AddKernelKeySignature(KernelImage* image, const char* firmware_key_file);
191 200
192 /* Add a kernel and kernel config signature to a kernel image [image] 201 /* Add a kernel and kernel config signature to a kernel image [image]
193 * using the private signing key in file [kernel_sigining_key_file]. 202 * using the private signing key in file [kernel_sigining_key_file].
194 * 203 *
195 * Return 1 on success, 0 on failure. 204 * Return 1 on success, 0 on failure.
196 */ 205 */
197 int AddKernelSignature(KernelImage* image, const char* kernel_sigining_key_file, 206 int AddKernelSignature(KernelImage* image,
198 int algorithm); 207 const char* kernel_sigining_key_file);
199 208
200 #endif /* VBOOT_REFERENCE_KERNEL_IMAGE_H_ */ 209 #endif /* VBOOT_REFERENCE_KERNEL_IMAGE_H_ */
OLDNEW
« no previous file with comments | « src/platform/vboot_reference/include/firmware_utility.h ('k') | src/platform/vboot_reference/include/rsa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698