summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@chromium.org>2011-08-03 14:57:09 +0800
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:21 -0700
commit134eeb15b52efb15164619293d14404f1748f3a3 (patch)
tree9b2781c40c53d3b9287a1eafabb5381dc0a58235 /common
parent744345a6dcf4864d86a20f26993234b02ab0d30c (diff)
CHROMIUM: move VbExHashFirmwareBody() to lib/vbexport/
This patch only moves code around. BUG=chromium-os:16542 TEST=build okay Change-Id: Idc908fd2e652c114ae8029c120386fb44e63b4f9 Reviewed-on: http://gerrit.chromium.org/gerrit/5204 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Gabe Black <gabeblack@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_vboot_twostop.c52
1 files changed, 1 insertions, 51 deletions
diff --git a/common/cmd_vboot_twostop.c b/common/cmd_vboot_twostop.c
index d956c528cd4..593fdbde5f2 100644
--- a/common/cmd_vboot_twostop.c
+++ b/common/cmd_vboot_twostop.c
@@ -20,6 +20,7 @@
#include <chromeos/fdt_decode.h>
#include <chromeos/firmware_storage.h>
#include <chromeos/gbb.h>
+#include <chromeos/hasher_state.h>
#include <chromeos/memory_wipe.h>
#include <chromeos/power_management.h>
@@ -144,57 +145,6 @@ int twostop_init_cparams(struct fdt_twostop_fmap *fmap,
return 0;
}
-typedef struct {
- firmware_storage_t *file;
- struct {
- void *vblock;
- uint32_t offset;
- uint32_t size;
- void *cache;
- } fw[2];
-} hasher_state_t;
-
-/* This can only be called after key block has been verified */
-uintptr_t firmware_body_size(const uintptr_t vblock_address)
-{
- const VbKeyBlockHeader const *keyblock;
- const VbFirmwarePreambleHeader const *preamble;
-
- keyblock = (VbKeyBlockHeader *)vblock_address;
- preamble = (VbFirmwarePreambleHeader *)
- (vblock_address + (uintptr_t)keyblock->key_block_size);
-
- return preamble->body_signature.data_size;
-}
-
-VbError_t VbExHashFirmwareBody(VbCommonParams* cparams, uint32_t firmware_index)
-{
- hasher_state_t *s = cparams->caller_context;
- const int i = (firmware_index == VB_SELECT_FIRMWARE_A ? 0 : 1);
- firmware_storage_t *file = s->file;
-
- if (firmware_index != VB_SELECT_FIRMWARE_A &&
- firmware_index != VB_SELECT_FIRMWARE_B) {
- VBDEBUG(PREFIX "incorrect firmware index: %d\n",
- firmware_index);
- return 1;
- }
-
- /*
- * The key block has been verified. It is safe now to infer the actual
- * firmware body size from the key block.
- */
- s->fw[i].size = firmware_body_size((uintptr_t)s->fw[i].vblock);
-
- if (file->read(file, s->fw[i].offset, s->fw[i].size, s->fw[i].cache)) {
- VBDEBUG(PREFIX "fail to read firmware: %d\n", firmware_index);
- return 1;
- }
-
- VbUpdateFirmwareBodyHash(cparams, s->fw[i].cache, s->fw[i].size);
- return 0;
-}
-
#ifdef CONFIG_OF_CONTROL
static uintptr_t get_current_sp(void)
{