summaryrefslogtreecommitdiff
path: root/firmware/lib20/packed_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/lib20/packed_key.c')
-rw-r--r--firmware/lib20/packed_key.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/firmware/lib20/packed_key.c b/firmware/lib20/packed_key.c
index 4baf97ce..48f11116 100644
--- a/firmware/lib20/packed_key.c
+++ b/firmware/lib20/packed_key.c
@@ -23,9 +23,9 @@ int vb2_verify_packed_key_inside(const void *parent,
key->key_offset, key->key_size);
}
-int vb2_unpack_key(struct vb2_public_key *key,
- const uint8_t *buf,
- uint32_t size)
+int vb2_unpack_key_buffer(struct vb2_public_key *key,
+ const uint8_t *buf,
+ uint32_t size)
{
const struct vb2_packed_key *packed_key =
(const struct vb2_packed_key *)buf;
@@ -75,3 +75,15 @@ int vb2_unpack_key(struct vb2_public_key *key,
return VB2_SUCCESS;
}
+
+int vb2_unpack_key(struct vb2_public_key *key,
+ const struct vb2_packed_key *packed_key)
+{
+ if (!packed_key)
+ return VB2_ERROR_UNPACK_KEY_BUFFER;
+
+ return vb2_unpack_key_buffer(key,
+ (const uint8_t *)packed_key,
+ packed_key->key_offset +
+ packed_key->key_size);
+}