summaryrefslogtreecommitdiff
path: root/tests/vb2_api_tests.c
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-05-21 12:20:38 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-05-28 21:10:45 -0700
commitde2cae6b4d6ae864f2c90e6be73f683bad5f2f2f (patch)
tree023d1581f9054c6a54b9631be45f5277b721a23c /tests/vb2_api_tests.c
parent236bfb0bc3bd0aa37bd06702c25993446f9b6dba (diff)
downloadvboot-de2cae6b4d6ae864f2c90e6be73f683bad5f2f2f.tar.gz
vboot: save GBB header in workbuf during firmware verification
Since GBB header will be needed for subsequent GBB reads later on (in kernel verification stage), and since GBB header is relatively small (128 bytes), save the full GBB header onto workbuf during firmware verification stage, and store an offset pointer to it in vb2_shared_data. vb2_gbb_header object may be accessed via the vb2_get_gbb function. Additionally, update functions in firmware/lib/region-init.c to read GBB data from flash, rather than using cparams passed in by depthcharge, which is slated for deprecation. BUG=b:124141368, chromium:954774 TEST=make clean && make runtests BRANCH=none Change-Id: I6e6218231299ce3a5b383663bc3480b20f929840 Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1585500 Reviewed-on: https://chromium-review.googlesource.com/1627430 Commit-Ready: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'tests/vb2_api_tests.c')
-rw-r--r--tests/vb2_api_tests.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/vb2_api_tests.c b/tests/vb2_api_tests.c
index 97fc6d97..c261f963 100644
--- a/tests/vb2_api_tests.c
+++ b/tests/vb2_api_tests.c
@@ -7,13 +7,13 @@
#include <stdio.h>
-#include "2sysincludes.h"
#include "2api.h"
#include "2common.h"
#include "2misc.h"
#include "2nvstorage.h"
#include "2rsa.h"
#include "2secdata.h"
+#include "2sysincludes.h"
#include "test_common.h"
/* Common context for tests */
@@ -21,6 +21,7 @@ static uint8_t workbuf[VB2_FIRMWARE_WORKBUF_RECOMMENDED_SIZE]
__attribute__ ((aligned (VB2_WORKBUF_ALIGN)));
static struct vb2_context ctx;
static struct vb2_shared_data *sd;
+static struct vb2_gbb_header gbb;
const char mock_body[320] = "Mock body";
const int mock_body_size = sizeof(mock_body);
@@ -67,11 +68,15 @@ static void reset_common_data(enum reset_type t)
retval_vb2_check_tpm_clear = VB2_SUCCESS;
retval_vb2_select_fw_slot = VB2_SUCCESS;
- memcpy(sd->gbb_hwid_digest, mock_hwid_digest,
- sizeof(sd->gbb_hwid_digest));
+ memcpy(&gbb.hwid_digest, mock_hwid_digest,
+ sizeof(gbb.hwid_digest));
};
/* Mocked functions */
+struct vb2_gbb_header *vb2_get_gbb(struct vb2_context *c)
+{
+ return &gbb;
+}
int vb2_fw_parse_gbb(struct vb2_context *c)
{