| 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 // Utility for manipulating verified boot firmware images. | 5 // Utility for manipulating verified boot firmware images. |
| 6 // | 6 // |
| 7 | 7 |
| 8 #include "kernel_utility.h" | 8 #include "kernel_utility.h" |
| 9 | 9 |
| 10 #include <errno.h> | 10 #include <errno.h> |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 void KernelUtility::OutputSignedImage(void) { | 193 void KernelUtility::OutputSignedImage(void) { |
| 194 if (image_) { | 194 if (image_) { |
| 195 if (!WriteKernelImage(out_file_.c_str(), image_)) { | 195 if (!WriteKernelImage(out_file_.c_str(), image_)) { |
| 196 cerr << "Couldn't write verified boot kernel image to file " | 196 cerr << "Couldn't write verified boot kernel image to file " |
| 197 << out_file_ <<".\n"; | 197 << out_file_ <<".\n"; |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 bool KernelUtility::GenerateSignedImage(void) { | 202 bool KernelUtility::GenerateSignedImage(void) { |
| 203 uint32_t kernel_key_pub_len; | 203 uint64_t kernel_key_pub_len; |
| 204 uint8_t* header_checksum; | 204 uint8_t* header_checksum; |
| 205 DigestContext ctx; | 205 DigestContext ctx; |
| 206 image_ = KernelImageNew(); | 206 image_ = KernelImageNew(); |
| 207 | 207 |
| 208 Memcpy(image_->magic, KERNEL_MAGIC, KERNEL_MAGIC_SIZE); | 208 Memcpy(image_->magic, KERNEL_MAGIC, KERNEL_MAGIC_SIZE); |
| 209 | 209 |
| 210 // TODO(gauravsh): make this a command line option. | 210 // TODO(gauravsh): make this a command line option. |
| 211 image_->header_version = 1; | 211 image_->header_version = 1; |
| 212 image_->firmware_sign_algorithm = (uint16_t) firmware_sign_algorithm_; | 212 image_->firmware_sign_algorithm = (uint16_t) firmware_sign_algorithm_; |
| 213 // Copy pre-processed public signing key. | 213 // Copy pre-processed public signing key. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 } | 349 } |
| 350 if (fu.is_verify()) { | 350 if (fu.is_verify()) { |
| 351 cerr << "Verification "; | 351 cerr << "Verification "; |
| 352 if (fu.VerifySignedImage()) | 352 if (fu.VerifySignedImage()) |
| 353 cerr << "SUCCESS.\n"; | 353 cerr << "SUCCESS.\n"; |
| 354 else | 354 else |
| 355 cerr << "FAILURE.\n"; | 355 cerr << "FAILURE.\n"; |
| 356 } | 356 } |
| 357 return 0; | 357 return 0; |
| 358 } | 358 } |
| OLD | NEW |