| 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 * Common functions between firmware and kernel verified boot. | 5 * Common functions between firmware and kernel verified boot. |
| 6 * (Firmware portion) | 6 * (Firmware portion) |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 /* TODO: change all 'return 0', 'return 1' into meaningful return codes */ | 9 /* TODO: change all 'return 0', 'return 1' into meaningful return codes */ |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 if (!RSAVerifyBinary_f(NULL, key, data, sig->data_size, | 119 if (!RSAVerifyBinary_f(NULL, key, data, sig->data_size, |
| 120 GetSignatureDataC(sig), key->algorithm)) | 120 GetSignatureDataC(sig), key->algorithm)) |
| 121 return 1; | 121 return 1; |
| 122 | 122 |
| 123 return 0; | 123 return 0; |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 int VerifyKeyBlock(const VbKeyBlockHeader* block, uint64_t size, | 127 int KeyBlockVerify(const VbKeyBlockHeader* block, uint64_t size, |
| 128 const VbPublicKey *key) { | 128 const VbPublicKey *key) { |
| 129 | 129 |
| 130 const VbSignature* sig; | 130 const VbSignature* sig; |
| 131 | 131 |
| 132 /* Sanity checks before attempting signature of data */ | 132 /* Sanity checks before attempting signature of data */ |
| 133 if (SafeMemcmp(block->magic, KEY_BLOCK_MAGIC, KEY_BLOCK_MAGIC_SIZE)) { | 133 if (SafeMemcmp(block->magic, KEY_BLOCK_MAGIC, KEY_BLOCK_MAGIC_SIZE)) { |
| 134 debug("Not a valid verified boot key block.\n"); | 134 debug("Not a valid verified boot key block.\n"); |
| 135 return 1; | 135 return 1; |
| 136 } | 136 } |
| 137 if (block->header_version_major != KEY_BLOCK_HEADER_VERSION_MAJOR) { | 137 if (block->header_version_major != KEY_BLOCK_HEADER_VERSION_MAJOR) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 /* Verify body signature is inside the block */ | 303 /* Verify body signature is inside the block */ |
| 304 if (VerifySignatureInside(preamble, preamble->preamble_size, | 304 if (VerifySignatureInside(preamble, preamble->preamble_size, |
| 305 &preamble->body_signature)) { | 305 &preamble->body_signature)) { |
| 306 debug("Kernel body signature off end of preamble\n"); | 306 debug("Kernel body signature off end of preamble\n"); |
| 307 return 1; | 307 return 1; |
| 308 } | 308 } |
| 309 | 309 |
| 310 /* Success */ | 310 /* Success */ |
| 311 return 0; | 311 return 0; |
| 312 } | 312 } |
| OLD | NEW |