aboutsummaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2014-11-21 15:33:07 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-01 20:30:41 +0000
commitfc73f087653ee67193a9f2b897433db2cd532f8c (patch)
tree52057d47f6a9ed162202d8d5353293355cbb4383 /host
parent91852e7f58d50a031bcb5c02e68473cefb10ebb0 (diff)
downloadvboot_reference-fc73f087653ee67193a9f2b897433db2cd532f8c.tar.gz
vboot2: Use new hostlib functions in unit tests
This removes the hacky conversion from old-style packed keys and signatures, which existed only because at the time we didn't have the ability in hostlib to create new-format key and signature structs directly. BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: Id7cb3dfce740f2546464a4caae2629af864d7b45 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231543
Diffstat (limited to 'host')
-rw-r--r--host/lib/host_key2.c8
-rw-r--r--host/lib/include/host_key2.h2
2 files changed, 4 insertions, 6 deletions
diff --git a/host/lib/host_key2.c b/host/lib/host_key2.c
index 8f761f65..065be234 100644
--- a/host/lib/host_key2.c
+++ b/host/lib/host_key2.c
@@ -198,8 +198,7 @@ int vb2_private_key_write(const struct vb2_private_key *key,
memcpy(&pkey.guid, &key->guid, sizeof(pkey.guid));
- if (key->desc)
- pkey.c.desc_size = roundup32(strlen(key->desc) + 1);
+ pkey.c.desc_size = vb2_desc_size(key->desc);
if (key->sig_alg != VB2_SIG_NONE) {
/* Pack RSA key */
@@ -437,10 +436,7 @@ int vb2_public_key_pack(struct vb2_packed_key2 **key_ptr,
/* Calculate sizes and offsets */
key.c.fixed_size = sizeof(key);
-
- if (pubk->desc && *pubk->desc)
- key.c.desc_size = roundup32(strlen(pubk->desc) + 1);
-
+ key.c.desc_size = vb2_desc_size(pubk->desc);
key.key_offset = key.c.fixed_size + key.c.desc_size;
if (pubk->sig_alg != VB2_SIG_NONE) {
diff --git a/host/lib/include/host_key2.h b/host/lib/include/host_key2.h
index 813ae60f..96dab3e4 100644
--- a/host/lib/include/host_key2.h
+++ b/host/lib/include/host_key2.h
@@ -10,6 +10,8 @@
#include "2struct.h"
+struct vb2_public_key;
+
/* Private key data, in-memory format for use in signing calls. */
struct vb2_private_key {
struct rsa_st *rsa_private_key; /* Private key data */