summaryrefslogtreecommitdiff
path: root/futility
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-10-07 15:28:43 +0800
committerCommit Bot <commit-bot@chromium.org>2019-12-25 22:33:00 +0000
commit582453dd62a9616a95a19b42a36f6adb8988e329 (patch)
tree1b65180b07771eef688cac73b23dbc0dafe082a1 /futility
parent80c1a85a87e589ed74962cad98f4892dbe6a3283 (diff)
downloadvboot-582453dd62a9616a95a19b42a36f6adb8988e329.tar.gz
vboot: fix up some host key functions for host_key2.cfactory-excelsior-12812.B
Deprecate: PublicKeyInit --> vb2_init_packed_key PublicKeyCopy --> vb2_copy_packed_key Rename: packed_key_looks_ok --> vb2_packed_key_looks_ok Move vb2_packed_key_looks_ok from host_key.c to host_key2.c. Move tests/vboot_common_tests.c to tests/vb2_host_key_tests.c. Remove firmware/lib/vboot_common.c. Remove host/lib/host_key.c. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: I627b2af0416ac69460f9860614a69cad8bdb76a7 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1844597 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'futility')
-rw-r--r--futility/cmd_show.c2
-rw-r--r--futility/cmd_sign.c2
-rw-r--r--futility/cmd_vbutil_kernel.c1
-rw-r--r--futility/file_type_bios.c11
-rw-r--r--futility/updater.c2
-rw-r--r--futility/updater_archive.c4
-rw-r--r--futility/vb1_helper.c2
7 files changed, 12 insertions, 12 deletions
diff --git a/futility/cmd_show.c b/futility/cmd_show.c
index 9a2eec19..402b1330 100644
--- a/futility/cmd_show.c
+++ b/futility/cmd_show.c
@@ -87,7 +87,7 @@ int ft_show_pubkey(const char *name, uint8_t *buf, uint32_t len, void *data)
{
struct vb2_packed_key *pubkey = (struct vb2_packed_key *)buf;
- if (!packed_key_looks_ok(pubkey, len)) {
+ if (vb2_packed_key_looks_ok(pubkey, len)) {
printf("%s looks bogus\n", name);
return 1;
}
diff --git a/futility/cmd_sign.c b/futility/cmd_sign.c
index ce37e87e..109287c9 100644
--- a/futility/cmd_sign.c
+++ b/futility/cmd_sign.c
@@ -62,7 +62,7 @@ int ft_sign_pubkey(const char *name, uint8_t *buf, uint32_t len, void *data)
struct vb2_packed_key *data_key = (struct vb2_packed_key *)buf;
struct vb2_keyblock *block;
- if (!packed_key_looks_ok(data_key, len)) {
+ if (vb2_packed_key_looks_ok(data_key, len)) {
fprintf(stderr, "Public key looks bad.\n");
return 1;
}
diff --git a/futility/cmd_vbutil_kernel.c b/futility/cmd_vbutil_kernel.c
index a0c001ac..1684c185 100644
--- a/futility/cmd_vbutil_kernel.c
+++ b/futility/cmd_vbutil_kernel.c
@@ -27,7 +27,6 @@
#include "kernel_blob.h"
#include "vb1_helper.h"
#include "vb2_common.h"
-#include "vboot_common.h"
/* Global opts */
static int opt_verbose;
diff --git a/futility/file_type_bios.c b/futility/file_type_bios.c
index 35a4f1dd..9d45269c 100644
--- a/futility/file_type_bios.c
+++ b/futility/file_type_bios.c
@@ -95,7 +95,7 @@ int ft_show_gbb(const char *name, uint8_t *buf, uint32_t len, void *data)
struct vb2_packed_key *pubkey =
(struct vb2_packed_key *)(buf + gbb->rootkey_offset);
- if (packed_key_looks_ok(pubkey, gbb->rootkey_size)) {
+ if (vb2_packed_key_looks_ok(pubkey, gbb->rootkey_size) == VB2_SUCCESS) {
if (state) {
state->rootkey.offset =
state->area[BIOS_FMAP_GBB].offset +
@@ -112,7 +112,8 @@ int ft_show_gbb(const char *name, uint8_t *buf, uint32_t len, void *data)
}
pubkey = (struct vb2_packed_key *)(buf + gbb->recovery_key_offset);
- if (packed_key_looks_ok(pubkey, gbb->recovery_key_size)) {
+ if (vb2_packed_key_looks_ok(pubkey, gbb->recovery_key_size)
+ == VB2_SUCCESS) {
if (state) {
state->recovery_key.offset =
state->area[BIOS_FMAP_GBB].offset +
@@ -264,9 +265,9 @@ static int fmap_sign_fw_preamble(const char *name, uint8_t *buf, uint32_t len,
goto whatever;
}
- if (!packed_key_looks_ok(&keyblock->data_key,
- keyblock->data_key.key_offset +
- keyblock->data_key.key_size)) {
+ if (vb2_packed_key_looks_ok(&keyblock->data_key,
+ keyblock->data_key.key_offset +
+ keyblock->data_key.key_size)) {
fprintf(stderr, "Warning: %s public key is invalid. "
"Signing the entire FW FMAP region...\n", name);
goto whatever;
diff --git a/futility/updater.c b/futility/updater.c
index 6a7d8ffa..1dc0ed50 100644
--- a/futility/updater.c
+++ b/futility/updater.c
@@ -666,7 +666,7 @@ static const struct vb2_packed_key *get_rootkey(
struct vb2_packed_key *key = NULL;
key = (struct vb2_packed_key *)((uint8_t *)gbb + gbb->rootkey_offset);
- if (!packed_key_looks_ok(key, gbb->rootkey_size)) {
+ if (vb2_packed_key_looks_ok(key, gbb->rootkey_size)) {
ERROR("Invalid root key.\n");
return NULL;
}
diff --git a/futility/updater_archive.c b/futility/updater_archive.c
index 5d8e414d..36873a68 100644
--- a/futility/updater_archive.c
+++ b/futility/updater_archive.c
@@ -1035,8 +1035,8 @@ static const char *get_gbb_key_hash(const struct vb2_gbb_header *gbb,
if (!gbb)
return "<No GBB>";
key = (struct vb2_packed_key *)((uint8_t *)gbb + offset);
- if (!packed_key_looks_ok(key, size))
- return "<Invalid key>";
+ if (vb2_packed_key_looks_ok(key, size))
+ return "<Invalid key>";
return packed_key_sha1_string(key);
}
diff --git a/futility/vb1_helper.c b/futility/vb1_helper.c
index d1d7535e..74391827 100644
--- a/futility/vb1_helper.c
+++ b/futility/vb1_helper.c
@@ -797,7 +797,7 @@ enum futil_file_type ft_recognize_vb1_key(uint8_t *buf, uint32_t len)
{
/* Maybe just a packed public key? */
const struct vb2_packed_key *pubkey = (struct vb2_packed_key *)buf;
- if (packed_key_looks_ok(pubkey, len))
+ if (vb2_packed_key_looks_ok(pubkey, len) == VB2_SUCCESS)
return FILE_TYPE_PUBKEY;
/* How about a private key? */