Verified boot wrapper - replace utility functions

This is part 3 of the vboot wrapper API refactoring.  It replaces the
function calls to utility.c functions with new API calls.  (It also
fixes up some integer type mismatches in cryptolib that were causing
warnings on the H2C build; those had been fixed a while ago in H2C but
hadn't been propagated across.)

BUG=chromium-os:17006
TEST=make && make runtests

Change-Id: I771085dcdf79d9592de64f35e3b758111a80dd9f
Reviewed-on: http://gerrit.chromium.org/gerrit/3263
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Randall Spangler
2011-06-27 13:57:28 -07:00
parent 32a6526d25
commit bd81b3a7d3
15 changed files with 83 additions and 137 deletions

View File

@@ -11,6 +11,7 @@
#include "rollback_index.h"
#include "tpm_bootmode.h"
#include "utility.h"
#include "vboot_api.h"
#include "vboot_common.h"
#include "vboot_nvstorage.h"
@@ -77,7 +78,7 @@ int LoadFirmware(LoadFirmwareParams* params) {
recovery = VBNV_RECOVERY_RO_SHARED_DATA;
goto LoadFirmwareExit;
}
shared->timer_load_firmware_enter = VbGetTimer();
shared->timer_load_firmware_enter = VbExGetTimer();
/* Handle test errors */
VbNvGet(vnc, VBNV_TEST_ERROR_FUNC, &test_err);
@@ -136,7 +137,7 @@ int LoadFirmware(LoadFirmwareParams* params) {
}
/* Allocate our internal data */
lfi = (VbLoadFirmwareInternal*)Malloc(sizeof(VbLoadFirmwareInternal));
lfi = (VbLoadFirmwareInternal*)VbExMalloc(sizeof(VbLoadFirmwareInternal));
if (!lfi)
return LOAD_FIRMWARE_RECOVERY;
@@ -275,7 +276,7 @@ int LoadFirmware(LoadFirmwareParams* params) {
VBDEBUG(("Firmware body verification failed.\n"));
*check_result = VBSD_LF_CHECK_VERIFY_BODY;
RSAPublicKeyFree(data_key);
Free(body_digest);
VbExFree(body_digest);
VBPERFEND("VB_VFD");
continue;
}
@@ -283,7 +284,7 @@ int LoadFirmware(LoadFirmwareParams* params) {
/* Done with the digest and data key, so can free them now */
RSAPublicKeyFree(data_key);
Free(body_digest);
VbExFree(body_digest);
/* If we're still here, the firmware is valid. */
VBDEBUG(("Firmware %d is valid.\n", index));
@@ -327,7 +328,7 @@ int LoadFirmware(LoadFirmwareParams* params) {
}
/* Free internal data */
Free(lfi);
VbExFree(lfi);
params->load_firmware_internal = NULL;
/* Handle finding good firmware */
@@ -390,7 +391,7 @@ LoadFirmwareExit:
recovery : VBNV_RECOVERY_NOT_REQUESTED);
VbNvTeardown(vnc);
shared->timer_load_firmware_exit = VbGetTimer();
shared->timer_load_firmware_exit = VbExGetTimer();
/* Note that we don't reduce params->shared_data_size to shared->data_used,
* since we want to leave space for LoadKernel() to add to the shared data