aboutsummaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2014-12-04 09:54:37 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-05 00:02:00 +0000
commit308d2540929cd95e2a565be95ce0b1d45d2fbed2 (patch)
tree8df30f986fd05e934ca3461398cfc63cda398026 /host
parent6f1b82ac14f341d9733d6e95d518b3ee352002ef (diff)
downloadvboot_reference-308d2540929cd95e2a565be95ce0b1d45d2fbed2.tar.gz
vboot2: Get rid of extra '2' at end of new struct names
Now that lib20 and lib21 are distinct, they can have overlapping struct names. This will be cleaner in the long run, since vboot 2.0 (lib20) is just a temporary stepping stone to vboot 2.1 (lib21). It would be a shame to need to carry around the overhead of that extra digit forever. No functional changes, just a lot of renaming. BUG=chromium:423882 BRANCH=none TEST=make runtests && VBOOT2=1 make runtests (works with/withoug VBOOT2 flag) And compile firmware for veyron_pinky Change-Id: I25f348fd31e32d08ca576836dfdd1278828765a1 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/233183 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'host')
-rw-r--r--host/lib21/host_fw_preamble.c16
-rw-r--r--host/lib21/host_key.c38
-rw-r--r--host/lib21/host_keyblock.c14
-rw-r--r--host/lib21/host_signature.c18
-rw-r--r--host/lib21/include/host_fw_preamble2.h4
-rw-r--r--host/lib21/include/host_key2.h16
-rw-r--r--host/lib21/include/host_keyblock2.h2
-rw-r--r--host/lib21/include/host_signature2.h2
8 files changed, 55 insertions, 55 deletions
diff --git a/host/lib21/host_fw_preamble.c b/host/lib21/host_fw_preamble.c
index 557c157c..6b5686b1 100644
--- a/host/lib21/host_fw_preamble.c
+++ b/host/lib21/host_fw_preamble.c
@@ -16,22 +16,22 @@
#include "host_signature2.h"
#include "vb2_common.h"
-int vb2_fw_preamble_create(struct vb2_fw_preamble2 **fp_ptr,
+int vb2_fw_preamble_create(struct vb2_fw_preamble **fp_ptr,
const struct vb2_private_key *signing_key,
- const struct vb2_signature2 **hash_list,
+ const struct vb2_signature **hash_list,
uint32_t hash_count,
uint32_t fw_version,
uint32_t flags,
const char *desc)
{
- struct vb2_fw_preamble2 fp = {
- .c.magic = VB2_MAGIC_FW_PREAMBLE2,
- .c.struct_version_major = VB2_FW_PREAMBLE2_VERSION_MAJOR,
- .c.struct_version_minor = VB2_FW_PREAMBLE2_VERSION_MAJOR,
+ struct vb2_fw_preamble fp = {
+ .c.magic = VB2_MAGIC_FW_PREAMBLE,
+ .c.struct_version_major = VB2_FW_PREAMBLE_VERSION_MAJOR,
+ .c.struct_version_minor = VB2_FW_PREAMBLE_VERSION_MAJOR,
.c.fixed_size = sizeof(fp),
.c.desc_size = vb2_desc_size(desc),
.flags = flags,
- .firmware_version = fw_version,
+ .fw_version = fw_version,
.hash_count = hash_count,
};
@@ -77,6 +77,6 @@ int vb2_fw_preamble_create(struct vb2_fw_preamble2 **fp_ptr,
return VB2_FW_PREAMBLE_CREATE_SIGN;
}
- *fp_ptr = (struct vb2_fw_preamble2 *)buf;
+ *fp_ptr = (struct vb2_fw_preamble *)buf;
return VB2_SUCCESS;
}
diff --git a/host/lib21/host_key.c b/host/lib21/host_key.c
index 5fc41889..1f456835 100644
--- a/host/lib21/host_key.c
+++ b/host/lib21/host_key.c
@@ -38,8 +38,8 @@ int vb2_private_key_unpack(struct vb2_private_key **key_ptr,
const uint8_t *buf,
uint32_t size)
{
- const struct vb2_packed_private_key2 *pkey =
- (const struct vb2_packed_private_key2 *)buf;
+ const struct vb2_packed_private_key *pkey =
+ (const struct vb2_packed_private_key *)buf;
struct vb2_private_key *key;
const unsigned char *start;
uint32_t min_offset = 0;
@@ -51,7 +51,7 @@ int vb2_private_key_unpack(struct vb2_private_key **key_ptr,
*
* TODO: If it doesn't match, pass through to the old packed key format.
*/
- if (pkey->c.magic != VB2_MAGIC_PACKED_PRIVATE_KEY2)
+ if (pkey->c.magic != VB2_MAGIC_PACKED_PRIVATE_KEY)
return VB2_ERROR_UNPACK_PRIVATE_KEY_MAGIC;
if (vb2_verify_common_header(buf, size))
@@ -68,7 +68,7 @@ int vb2_private_key_unpack(struct vb2_private_key **key_ptr,
* haven't added any new fields.
*/
if (pkey->c.struct_version_major !=
- VB2_PACKED_PRIVATE_KEY2_VERSION_MAJOR)
+ VB2_PACKED_PRIVATE_KEY_VERSION_MAJOR)
return VB2_ERROR_UNPACK_PRIVATE_KEY_STRUCT_VERSION;
/* Allocate the new key */
@@ -179,10 +179,10 @@ int vb2_private_key_set_desc(struct vb2_private_key *key, const char *desc)
int vb2_private_key_write(const struct vb2_private_key *key,
const char *filename)
{
- struct vb2_packed_private_key2 pkey = {
- .c.magic = VB2_MAGIC_PACKED_PRIVATE_KEY2,
- .c.struct_version_major = VB2_PACKED_PRIVATE_KEY2_VERSION_MAJOR,
- .c.struct_version_minor = VB2_PACKED_PRIVATE_KEY2_VERSION_MINOR,
+ struct vb2_packed_private_key pkey = {
+ .c.magic = VB2_MAGIC_PACKED_PRIVATE_KEY,
+ .c.struct_version_major = VB2_PACKED_PRIVATE_KEY_VERSION_MAJOR,
+ .c.struct_version_minor = VB2_PACKED_PRIVATE_KEY_VERSION_MINOR,
.c.fixed_size = sizeof(pkey),
.sig_alg = key->sig_alg,
.hash_alg = key->hash_alg,
@@ -369,7 +369,7 @@ int vb2_public_key_read_keyb(struct vb2_public_key **key_ptr,
memcpy(key_buf, key_data, key_size);
free(key_data);
- if (vb2_unpack_key2_data(key, key_buf, key_size)) {
+ if (vb2_unpack_key_data(key, key_buf, key_size)) {
vb2_public_key_free(key);
return VB2_ERROR_READ_KEYB_UNPACK;
}
@@ -395,8 +395,8 @@ int vb2_public_key_set_desc(struct vb2_public_key *key, const char *desc)
return VB2_SUCCESS;
}
-int vb2_packed_key2_read(struct vb2_packed_key2 **key_ptr,
- const char *filename)
+int vb2_packed_key_read(struct vb2_packed_key **key_ptr,
+ const char *filename)
{
struct vb2_public_key key;
uint8_t *buf;
@@ -408,21 +408,21 @@ int vb2_packed_key2_read(struct vb2_packed_key2 **key_ptr,
return VB2_ERROR_READ_PACKED_KEY_DATA;
/* Sanity check: make sure key unpacks properly */
- if (vb2_unpack_key2(&key, buf, size))
+ if (vb2_unpack_key(&key, buf, size))
return VB2_ERROR_READ_PACKED_KEY;
- *key_ptr = (struct vb2_packed_key2 *)buf;
+ *key_ptr = (struct vb2_packed_key *)buf;
return VB2_SUCCESS;
}
-int vb2_public_key_pack(struct vb2_packed_key2 **key_ptr,
+int vb2_public_key_pack(struct vb2_packed_key **key_ptr,
const struct vb2_public_key *pubk)
{
- struct vb2_packed_key2 key = {
- .c.magic = VB2_MAGIC_PACKED_KEY2,
- .c.struct_version_major = VB2_PACKED_KEY2_VERSION_MAJOR,
- .c.struct_version_minor = VB2_PACKED_KEY2_VERSION_MINOR,
+ struct vb2_packed_key key = {
+ .c.magic = VB2_MAGIC_PACKED_KEY,
+ .c.struct_version_major = VB2_PACKED_KEY_VERSION_MAJOR,
+ .c.struct_version_minor = VB2_PACKED_KEY_VERSION_MINOR,
};
uint8_t *buf;
uint32_t *buf32;
@@ -470,7 +470,7 @@ int vb2_public_key_pack(struct vb2_packed_key2 **key_ptr,
pubk->arrsize * sizeof(uint32_t));
}
- *key_ptr = (struct vb2_packed_key2 *)buf;
+ *key_ptr = (struct vb2_packed_key *)buf;
return VB2_SUCCESS;
}
diff --git a/host/lib21/host_keyblock.c b/host/lib21/host_keyblock.c
index f242cdde..42b91c77 100644
--- a/host/lib21/host_keyblock.c
+++ b/host/lib21/host_keyblock.c
@@ -15,23 +15,23 @@
#include "host_misc.h"
#include "host_signature2.h"
-int vb2_keyblock_create(struct vb2_keyblock2 **kb_ptr,
+int vb2_keyblock_create(struct vb2_keyblock **kb_ptr,
const struct vb2_public_key *data_key,
const struct vb2_private_key **signing_keys,
uint32_t signing_key_count,
uint32_t flags,
const char *desc)
{
- struct vb2_keyblock2 kb = {
- .c.magic = VB2_MAGIC_KEYBLOCK2,
- .c.struct_version_major = VB2_KEYBLOCK2_VERSION_MAJOR,
- .c.struct_version_minor = VB2_KEYBLOCK2_VERSION_MAJOR,
+ struct vb2_keyblock kb = {
+ .c.magic = VB2_MAGIC_KEYBLOCK,
+ .c.struct_version_major = VB2_KEYBLOCK_VERSION_MAJOR,
+ .c.struct_version_minor = VB2_KEYBLOCK_VERSION_MAJOR,
.c.fixed_size = sizeof(kb),
.flags = flags,
.sig_count = signing_key_count,
};
- struct vb2_packed_key2 *key = NULL;
+ struct vb2_packed_key *key = NULL;
uint32_t sig_size;
uint8_t *buf;
@@ -72,6 +72,6 @@ int vb2_keyblock_create(struct vb2_keyblock2 **kb_ptr,
return VB2_KEYBLOCK_CREATE_SIGN;
}
- *kb_ptr = (struct vb2_keyblock2 *)buf;
+ *kb_ptr = (struct vb2_keyblock *)buf;
return VB2_SUCCESS;
}
diff --git a/host/lib21/host_signature.c b/host/lib21/host_signature.c
index 9ffb3a82..553aa386 100644
--- a/host/lib21/host_signature.c
+++ b/host/lib21/host_signature.c
@@ -79,16 +79,16 @@ static int vb2_digest_info(enum vb2_hash_algorithm hash_alg,
}
}
-int vb2_sign_data(struct vb2_signature2 **sig_ptr,
+int vb2_sign_data(struct vb2_signature **sig_ptr,
const uint8_t *data,
uint32_t size,
const struct vb2_private_key *key,
const char *desc)
{
- struct vb2_signature2 s = {
- .c.magic = VB2_MAGIC_SIGNATURE2,
- .c.struct_version_major = VB2_SIGNATURE2_VERSION_MAJOR,
- .c.struct_version_minor = VB2_SIGNATURE2_VERSION_MINOR,
+ 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,
.c.fixed_size = sizeof(s),
.sig_alg = key->sig_alg,
.hash_alg = key->hash_alg,
@@ -179,7 +179,7 @@ int vb2_sign_data(struct vb2_signature2 **sig_ptr,
}
free(sig_digest);
- *sig_ptr = (struct vb2_signature2 *)buf;
+ *sig_ptr = (struct vb2_signature *)buf;
return VB2_SUCCESS;
}
@@ -192,7 +192,7 @@ int vb2_sig_size_for_key(uint32_t *size_ptr,
if (!size)
return VB2_ERROR_SIG_SIZE_FOR_KEY;
- size += sizeof(struct vb2_signature2);
+ size += sizeof(struct vb2_signature);
size += vb2_desc_size(desc ? desc : key->desc);
*size_ptr = size;
@@ -225,7 +225,7 @@ int vb2_sign_object(uint8_t *buf,
const char *desc)
{
struct vb2_struct_common *c = (struct vb2_struct_common *)buf;
- struct vb2_signature2 *sig = NULL;
+ struct vb2_signature *sig = NULL;
int rv;
rv = vb2_sign_data(&sig, buf, sig_offset, key, desc);
@@ -253,7 +253,7 @@ int vb2_sign_object_multiple(uint8_t *buf,
int rv, i;
for (i = 0; i < key_count; i++) {
- struct vb2_signature2 *sig = NULL;
+ struct vb2_signature *sig = NULL;
rv = vb2_sign_data(&sig, buf, sig_offset, key_list[i], NULL);
if (rv)
diff --git a/host/lib21/include/host_fw_preamble2.h b/host/lib21/include/host_fw_preamble2.h
index 52644493..9723441f 100644
--- a/host/lib21/include/host_fw_preamble2.h
+++ b/host/lib21/include/host_fw_preamble2.h
@@ -25,9 +25,9 @@ struct vb2_private_key;
* @param desc Description for preamble, or NULL if none
* @return VB2_SUCCESS, or non-zero error code if failure.
*/
-int vb2_fw_preamble_create(struct vb2_fw_preamble2 **fp_ptr,
+int vb2_fw_preamble_create(struct vb2_fw_preamble **fp_ptr,
const struct vb2_private_key *signing_key,
- const struct vb2_signature2 **hash_list,
+ const struct vb2_signature **hash_list,
uint32_t hash_count,
uint32_t fw_version,
uint32_t flags,
diff --git a/host/lib21/include/host_key2.h b/host/lib21/include/host_key2.h
index 96dab3e4..7c48dcaf 100644
--- a/host/lib21/include/host_key2.h
+++ b/host/lib21/include/host_key2.h
@@ -29,7 +29,7 @@ struct vb2_private_key {
void vb2_private_key_free(struct vb2_private_key *key);
/**
- * Unpack a private key from vb2_packed_private_key2 format.
+ * Unpack a private key from vb2_packed_private_key format.
*
* @param key_ptr Destination for newly allocated key; this must be
* freed with vb2_private_key_free().
@@ -42,7 +42,7 @@ int vb2_private_key_unpack(struct vb2_private_key **key_ptr,
uint32_t size);
/**
- * Read a private key from vb2_packed_private_key2 format.
+ * Read a private key from vb2_packed_private_key format.
*
* @param key_ptr Destination for newly allocated key; this must be
* freed with vb2_private_key_free().
@@ -76,7 +76,7 @@ int vb2_private_key_read_pem(struct vb2_private_key **key_ptr,
int vb2_private_key_set_desc(struct vb2_private_key *key, const char *desc);
/**
- * Write a private key to vb2_packed_private_key2 format.
+ * Write a private key to vb2_packed_private_key format.
*
* @param key Key to write
* @param filename File to write key data to.
@@ -101,7 +101,7 @@ int vb2_private_key_hash(const struct vb2_private_key **key_ptr,
*
* Note that this should ONLY be called for public keys allocated via one
* of those functions; public keys created or filled in other ways (such as
- * vb2_unpack_key2()) do not allocate memory for sub-fields in the same way.
+ * vb2_unpack_key()) do not allocate memory for sub-fields in the same way.
*
* @param key Key to free
*/
@@ -133,17 +133,17 @@ int vb2_public_key_read_keyb(struct vb2_public_key **key_ptr,
int vb2_public_key_set_desc(struct vb2_public_key *key, const char *desc);
/**
- * Read a public key in vb2_packed_key2 format.
+ * Read a public key in vb2_packed_key format.
*
* @param key_ptr On success, points to the newly allocated key buffer.
* Caller is responsible for calling free() on this.
* @return VB2_SUCCESS, or non-zero if error.
*/
-int vb2_packed_key2_read(struct vb2_packed_key2 **key_ptr,
+int vb2_packed_key_read(struct vb2_packed_key **key_ptr,
const char *filename);
/**
- * Pack a public key into vb2_packed_key2 format.
+ * Pack a public key into vb2_packed_key format.
*
* @param pubk Public key to pack
* @param key_ptr On success, points to a newly allocated packed key
@@ -151,7 +151,7 @@ int vb2_packed_key2_read(struct vb2_packed_key2 **key_ptr,
* this.
* @return VB2_SUCCESS, or non-zero if error.
*/
-int vb2_public_key_pack(struct vb2_packed_key2 **key_ptr,
+int vb2_public_key_pack(struct vb2_packed_key **key_ptr,
const struct vb2_public_key *pubk);
/**
diff --git a/host/lib21/include/host_keyblock2.h b/host/lib21/include/host_keyblock2.h
index 5b05ab1f..23d34843 100644
--- a/host/lib21/include/host_keyblock2.h
+++ b/host/lib21/include/host_keyblock2.h
@@ -26,7 +26,7 @@ struct vb2_public_key;
* taken from the data key.
* @return VB2_SUCCESS, or non-zero error code if failure.
*/
-int vb2_keyblock_create(struct vb2_keyblock2 **kb_ptr,
+int vb2_keyblock_create(struct vb2_keyblock **kb_ptr,
const struct vb2_public_key *data_key,
const struct vb2_private_key **signing_keys,
uint32_t signing_key_count,
diff --git a/host/lib21/include/host_signature2.h b/host/lib21/include/host_signature2.h
index 2e5718b7..aecd6dfc 100644
--- a/host/lib21/include/host_signature2.h
+++ b/host/lib21/include/host_signature2.h
@@ -24,7 +24,7 @@ struct vb2_private_key;
* key description will be used.
* @return VB2_SUCCESS, or non-zero error code on failure.
*/
-int vb2_sign_data(struct vb2_signature2 **sig_ptr,
+int vb2_sign_data(struct vb2_signature **sig_ptr,
const uint8_t *data,
uint32_t size,
const struct vb2_private_key *key,