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/file_type_usbpd1.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/file_type_usbpd1.c')
-rw-r--r-- | futility/file_type_usbpd1.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/futility/file_type_usbpd1.c b/futility/file_type_usbpd1.c index fe0042b1..18485cc8 100644 --- a/futility/file_type_usbpd1.c +++ b/futility/file_type_usbpd1.c @@ -26,7 +26,7 @@ #include "file_type.h" #include "futility.h" #include "futility_options.h" -#include "vb2_common.h" +#include "vb21_common.h" #include "host_common.h" #include "host_key2.h" #include "host_signature2.h" @@ -84,7 +84,7 @@ static int parse_size_opts(uint32_t len, int ft_sign_usbpd1(const char *name, uint8_t *buf, uint32_t len, void *data) { struct vb2_private_key *key_ptr = 0; - struct vb2_signature *sig_ptr = 0; + struct vb21_signature *sig_ptr = 0; uint8_t *keyb_data = 0; uint32_t keyb_size; int retval = 1; @@ -137,7 +137,7 @@ int ft_sign_usbpd1(const char *name, uint8_t *buf, uint32_t len, void *data) Debug("sig_offset 0x%08x\n", sig_offset); /* Sign the blob */ - r = vb2_sign_data(&sig_ptr, buf + rw_offset, rw_size, key_ptr, "Bah"); + r = vb21_sign_data(&sig_ptr, buf + rw_offset, rw_size, key_ptr, "Bah"); if (r) { fprintf(stderr, "Unable to sign data (error 0x%08x, if that helps)\n", @@ -303,17 +303,17 @@ static void vb2_pubkey_from_usbpd1(struct vb2_public_key *key, key->id = vb2_hash_id(hash_alg); } -static int vb2_sig_from_usbpd1(struct vb2_signature **sig, - enum vb2_signature_algorithm sig_alg, - enum vb2_hash_algorithm hash_alg, - const uint8_t *o_sig, - uint32_t o_sig_size, - uint32_t data_size) +static int vb21_sig_from_usbpd1(struct vb21_signature **sig, + enum vb2_signature_algorithm sig_alg, + enum vb2_hash_algorithm hash_alg, + const uint8_t *o_sig, + uint32_t o_sig_size, + uint32_t data_size) { - struct vb2_signature s = { - .c.magic = VB2_MAGIC_SIGNATURE, - .c.struct_version_major = VB2_SIGNATURE_VERSION_MAJOR, - .c.struct_version_minor = VB2_SIGNATURE_VERSION_MINOR, + struct vb21_signature s = { + .c.magic = VB21_MAGIC_SIGNATURE, + .c.struct_version_major = VB21_SIGNATURE_VERSION_MAJOR, + .c.struct_version_minor = VB21_SIGNATURE_VERSION_MINOR, .c.fixed_size = sizeof(s), .sig_alg = sig_alg, .hash_alg = hash_alg, @@ -329,7 +329,7 @@ static int vb2_sig_from_usbpd1(struct vb2_signature **sig, memcpy(buf, &s, sizeof(s)); memcpy(buf + sizeof(s), o_sig, o_sig_size); - *sig = (struct vb2_signature *)buf; + *sig = (struct vb21_signature *)buf; return VB2_SUCCESS; } @@ -339,14 +339,14 @@ static void show_usbpd1_stuff(const char *name, const uint8_t *o_pubkey, uint32_t o_pubkey_size) { struct vb2_public_key key; - struct vb2_packed_key *pkey; + struct vb21_packed_key *pkey; uint8_t sha1sum[VB2_SHA1_DIGEST_SIZE]; int i; vb2_pubkey_from_usbpd1(&key, sig_alg, hash_alg, o_pubkey, o_pubkey_size); - if (vb2_public_key_pack(&pkey, &key)) + if (vb21_public_key_pack(&pkey, &key)) return; vb2_digest_buffer((uint8_t *)pkey + pkey->key_offset, pkey->key_size, @@ -373,7 +373,7 @@ static int try_our_own(enum vb2_signature_algorithm sig_alg, const uint8_t *data, uint32_t data_size) { struct vb2_public_key pubkey; - struct vb2_signature *sig; + struct vb21_signature *sig; uint8_t buf[VB2_WORKBUF_RECOMMENDED_SIZE] __attribute__ ((aligned (VB2_WORKBUF_ALIGN))); struct vb2_workbuf wb = { @@ -385,11 +385,11 @@ static int try_our_own(enum vb2_signature_algorithm sig_alg, vb2_pubkey_from_usbpd1(&pubkey, sig_alg, hash_alg, o_pubkey, o_pubkey_size); - if ((rv = vb2_sig_from_usbpd1(&sig, sig_alg, hash_alg, - o_sig, o_sig_size, data_size))) + if ((rv = vb21_sig_from_usbpd1(&sig, sig_alg, hash_alg, + o_sig, o_sig_size, data_size))) return rv; - rv = vb2_verify_data(data, data_size, sig, &pubkey, &wb); + rv = vb21_verify_data(data, data_size, sig, &pubkey, &wb); free(sig); |