| 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 * High-level firmware API for loading and verifying rewritable firmware. | 5 * High-level firmware API for loading and verifying rewritable firmware. |
| 6 * (Firmware portion) | 6 * (Firmware portion) |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "load_firmware_fw.h" | 9 #include "load_firmware_fw.h" |
| 10 #include "rollback_index.h" | 10 #include "rollback_index.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 /* Get the key for preamble/data verification from the key block. */ | 117 /* Get the key for preamble/data verification from the key block. */ |
| 118 data_key = PublicKeyToRSA(&key_block->data_key); | 118 data_key = PublicKeyToRSA(&key_block->data_key); |
| 119 if (!data_key) { | 119 if (!data_key) { |
| 120 VBDEBUG(("Unable to parse data key.\n")); | 120 VBDEBUG(("Unable to parse data key.\n")); |
| 121 continue; | 121 continue; |
| 122 } | 122 } |
| 123 | 123 |
| 124 /* Verify the preamble, which follows the key block. */ | 124 /* Verify the preamble, which follows the key block. */ |
| 125 preamble = (VbFirmwarePreambleHeader*)((uint8_t*)key_block + | 125 preamble = (VbFirmwarePreambleHeader*)((uint8_t*)key_block + |
| 126 key_block->key_block_size); | 126 key_block->key_block_size); |
| 127 if ((0 != VerifyFirmwarePreamble2(preamble, | 127 if ((0 != VerifyFirmwarePreamble(preamble, |
| 128 vblock_size - key_block->key_block_size, | 128 vblock_size - key_block->key_block_size, |
| 129 data_key))) { | 129 data_key))) { |
| 130 VBDEBUG(("Preamble verfication failed.\n")); | 130 VBDEBUG(("Preamble verfication failed.\n")); |
| 131 RSAPublicKeyFree(data_key); | 131 RSAPublicKeyFree(data_key); |
| 132 continue; | 132 continue; |
| 133 } | 133 } |
| 134 | 134 |
| 135 /* Check for rollback of firmware version. */ | 135 /* Check for rollback of firmware version. */ |
| 136 if (key_version == tpm_key_version && | 136 if (key_version == tpm_key_version && |
| 137 preamble->firmware_version < tpm_fw_version) { | 137 preamble->firmware_version < tpm_fw_version) { |
| 138 VBDEBUG(("Firmware version rollback detected.\n")); | 138 VBDEBUG(("Firmware version rollback detected.\n")); |
| 139 RSAPublicKeyFree(data_key); | 139 RSAPublicKeyFree(data_key); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 257 |
| 258 /* Success */ | 258 /* Success */ |
| 259 VBDEBUG(("Will boot firmware index %d\n", (int)params->firmware_index)); | 259 VBDEBUG(("Will boot firmware index %d\n", (int)params->firmware_index)); |
| 260 return LOAD_FIRMWARE_SUCCESS; | 260 return LOAD_FIRMWARE_SUCCESS; |
| 261 } | 261 } |
| 262 | 262 |
| 263 /* If we're still here, no good firmware, so go to recovery mode. */ | 263 /* If we're still here, no good firmware, so go to recovery mode. */ |
| 264 VBDEBUG(("Alas, no good firmware.\n")); | 264 VBDEBUG(("Alas, no good firmware.\n")); |
| 265 return LOAD_FIRMWARE_RECOVERY; | 265 return LOAD_FIRMWARE_RECOVERY; |
| 266 } | 266 } |
| OLD | NEW |