diff options
author | Randall Spangler <rspangler@chromium.org> | 2016-05-25 16:42:44 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-26 17:31:54 -0700 |
commit | ca7251286655fe8865d0089bfc23b42ffececbf3 (patch) | |
tree | 438e449305363449da687cf635cd35decba023e9 /futility/vb2_helper.c | |
parent | 2afa87360d3a4c357e4bb2d37fdff9cdefbe0ffc (diff) | |
download | vboot-ca7251286655fe8865d0089bfc23b42ffececbf3.tar.gz |
vboot: Disambiguate vb2.1 structs and functions
Futility needs to link against both vboot1/vboot2.0 and vboot2.1
functions. This was easy in the past because it did (vboot1 +
vboot2.1) and there's no overlap.
In replacing vboot1 function calls and structs with vboot2.0, now there
are symbol collisions between vboot2.0 and vboot2.1. For example, both
of them use a struct called vb2_signature, but the structs are defined
differently. Functions which operate on those structs also overload.
Rename the vb2.1 structs to start with vb21_ instead of vb2_. Do the
same for vb2.1 functions which operate on vb2.1 data.
BUG=chromium:611535
BRANCH=none
TEST=make runtests
Change-Id: I24defd87cbd9ef64239faf1a8e98ab2372d27539
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/347458
Reviewed-by: Daisuke Nojiri <dnojiri@google.com>
Diffstat (limited to 'futility/vb2_helper.c')
-rw-r--r-- | futility/vb2_helper.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/futility/vb2_helper.c b/futility/vb2_helper.c index f8118ecf..d953f2f5 100644 --- a/futility/vb2_helper.c +++ b/futility/vb2_helper.c @@ -13,8 +13,7 @@ #include "2rsa.h" #include "2sha.h" #include "util_misc.h" -#include "vb2_common.h" -#include "vb2_struct.h" +#include "vb21_common.h" #include "host_common.h" #include "host_key2.h" @@ -50,17 +49,17 @@ int vb2_lookup_hash_alg(const char *str, enum vb2_hash_algorithm *alg) return 1; } -enum futil_file_type ft_recognize_vb2_key(uint8_t *buf, uint32_t len) +enum futil_file_type ft_recognize_vb21_key(uint8_t *buf, uint32_t len) { struct vb2_public_key pubkey; struct vb2_private_key *privkey = 0; /* The pubkey points into buf, so nothing to free */ - if (VB2_SUCCESS == vb2_unpack_key(&pubkey, buf, len)) + if (VB2_SUCCESS == vb21_unpack_key(&pubkey, buf, len)) return FILE_TYPE_VB2_PUBKEY; /* The private key unpacks into new structs */ - if (VB2_SUCCESS == vb2_private_key_unpack(&privkey, buf, len)) { + if (VB2_SUCCESS == vb21_private_key_unpack(&privkey, buf, len)) { vb2_private_key_free(privkey); return FILE_TYPE_VB2_PRIVKEY; } @@ -78,9 +77,9 @@ static inline void vb2_print_bytes(const void *ptr, uint32_t len) static int vb2_public_key_sha1sum(struct vb2_public_key *key, uint8_t *digest) { - struct vb2_packed_key *pkey; + struct vb21_packed_key *pkey; - if (vb2_public_key_pack(&pkey, key)) + if (vb21_public_key_pack(&pkey, key)) return 0; vb2_digest_buffer((uint8_t *)pkey + pkey->key_offset, pkey->key_size, @@ -90,7 +89,8 @@ static int vb2_public_key_sha1sum(struct vb2_public_key *key, uint8_t *digest) return 1; } -int ft_show_vb2_pubkey(const char *name, uint8_t *buf, uint32_t len, void *data) +int ft_show_vb21_pubkey(const char *name, uint8_t *buf, uint32_t len, + void *data) { struct vb2_public_key key; const struct vb2_text_vs_enum *entry; @@ -98,7 +98,7 @@ int ft_show_vb2_pubkey(const char *name, uint8_t *buf, uint32_t len, void *data) /* The key's members will point into the state buffer after this. Don't * free anything. */ - if (VB2_SUCCESS != vb2_unpack_key(&key, buf, len)) + if (VB2_SUCCESS != vb21_unpack_key(&key, buf, len)) return 1; printf("Public Key file: %s\n", name); @@ -138,14 +138,14 @@ static int vb2_private_key_sha1sum(struct vb2_private_key *key, uint8_t *digest) return 1; } -int ft_show_vb2_privkey(const char *name, uint8_t *buf, uint32_t len, - void *data) +int ft_show_vb21_privkey(const char *name, uint8_t *buf, uint32_t len, + void *data) { struct vb2_private_key *key = 0; const struct vb2_text_vs_enum *entry; uint8_t sha1sum[VB2_SHA1_DIGEST_SIZE]; - if (VB2_SUCCESS != vb2_private_key_unpack(&key, buf, len)) + if (VB2_SUCCESS != vb21_private_key_unpack(&key, buf, len)) return 1; printf("Private key file: %s\n", name); |