diff options
author | Randall Spangler <rspangler@chromium.org> | 2016-06-02 16:05:49 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-26 19:42:38 -0700 |
commit | 98263a1b17397032b3f7d747d48f8fd914217237 (patch) | |
tree | 5a9ce0f9da372f8a8d3ce49990d2d7de47e96a6a /host/lib/util_misc.c | |
parent | bba272a8776c61f308aafa5ed7d8bbd1f99f5282 (diff) | |
download | vboot-98263a1b17397032b3f7d747d48f8fd914217237.tar.gz |
vboot: Upgrade VerifyFirmwarePreamble() to vboot2.0
This replaces all calls to vboot1 VerifyFirmwarePreamble() with
equivalent vb2.0 functions. No effect on ToT firmware, which already
uses the vboot2.0 functions.
BUG=chromium:611535
BRANCH=none
TEST=make runtests
Change-Id: I5c84e9ed0e0c75e2ea8dbd9bfcde0597bc457f24
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/349322
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'host/lib/util_misc.c')
-rw-r--r-- | host/lib/util_misc.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/host/lib/util_misc.c b/host/lib/util_misc.c index dbcdc6e1..2b0f91c8 100644 --- a/host/lib/util_misc.c +++ b/host/lib/util_misc.c @@ -20,19 +20,24 @@ #include "cryptolib.h" #include "host_common.h" #include "util_misc.h" +#include "vb2_common.h" #include "vboot_common.h" -void PrintPubKeySha1Sum(VbPublicKey *key) +const char *packed_key_sha1_string(const struct vb2_packed_key *key) { uint8_t *buf = ((uint8_t *)key) + key->key_offset; - uint64_t buflen = key->key_size; + uint32_t buflen = key->key_size; uint8_t digest[VB2_SHA1_DIGEST_SIZE]; + static char dest[VB2_SHA1_DIGEST_SIZE * 2 + 1]; + char *dnext = dest; vb2_digest_buffer(buf, buflen, VB2_HASH_SHA1, digest, sizeof(digest)); int i; for (i = 0; i < sizeof(digest); i++) - printf("%02x", digest[i]); + dnext += sprintf(dnext, "%02x", digest[i]); + + return dest; } void PrintPrivKeySha1Sum(VbPrivateKey *key) |