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

Side by Side Diff: src/platform/vboot_reference/utils/firmware_image.c

Issue 669014: Vboot Reference: Kernel Boot signing utility. (Closed)
Patch Set: linter 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 * 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> 10 #include <fcntl.h>
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if(st.remaining_len != 0) { /* Overrun or underrun. */ 128 if(st.remaining_len != 0) { /* Overrun or underrun. */
129 Free(firmware_buf); 129 Free(firmware_buf);
130 return NULL; 130 return NULL;
131 } 131 }
132 132
133 Free(firmware_buf); 133 Free(firmware_buf);
134 return image; 134 return image;
135 } 135 }
136 136
137 int GetFirmwareHeaderLen(const FirmwareImage* image) { 137 int GetFirmwareHeaderLen(const FirmwareImage* image) {
138 return (FIELD_LEN(header_len) + FIELD_LEN(header_len) + 138 return (FIELD_LEN(header_len) + FIELD_LEN(firmware_sign_algorithm) +
139 RSAProcessedKeySize(image->firmware_sign_algorithm) + 139 RSAProcessedKeySize(image->firmware_sign_algorithm) +
140 FIELD_LEN(firmware_key_version) + FIELD_LEN(header_checksum)); 140 FIELD_LEN(firmware_key_version) + FIELD_LEN(header_checksum));
141 } 141 }
142 142
143 uint8_t* GetFirmwareHeaderBlob(const FirmwareImage* image) { 143 uint8_t* GetFirmwareHeaderBlob(const FirmwareImage* image) {
144 uint8_t* header_blob = NULL; 144 uint8_t* header_blob = NULL;
145 MemcpyState st; 145 MemcpyState st;
146 146
147 header_blob = (uint8_t*) Malloc(GetFirmwareHeaderLen(image)); 147 header_blob = (uint8_t*) Malloc(GetFirmwareHeaderLen(image));
148 st.remaining_len = GetFirmwareHeaderLen(image); 148 st.remaining_len = GetFirmwareHeaderLen(image);
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 if (!(firmware_signature = SignatureBuf(image->firmware_data, 579 if (!(firmware_signature = SignatureBuf(image->firmware_data,
580 image->firmware_len, 580 image->firmware_len,
581 signing_key_file, 581 signing_key_file,
582 image->firmware_sign_algorithm))) 582 image->firmware_sign_algorithm)))
583 return 0; 583 return 0;
584 image->firmware_signature = (uint8_t*) Malloc(signature_len); 584 image->firmware_signature = (uint8_t*) Malloc(signature_len);
585 Memcpy(image->firmware_signature, firmware_signature, signature_len); 585 Memcpy(image->firmware_signature, firmware_signature, signature_len);
586 Free(firmware_signature); 586 Free(firmware_signature);
587 return 1; 587 return 1;
588 } 588 }
OLDNEW
« no previous file with comments | « src/platform/vboot_reference/utils/Makefile ('k') | src/platform/vboot_reference/utils/firmware_utility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698