From 6682d165c0ddcc6ec5ac2440f1676b3e6eb4d1c0 Mon Sep 17 00:00:00 2001 From: Kangheui Won Date: Fri, 27 Nov 2020 16:00:06 +1100 Subject: vboot2: remove rsa from vb2_hwcrypto_rsa_allowed Initially vb2_hwcrypto_rsa_allowed were meant to only determine if we can use rsa hardware acceleration. However we're planning to also use this method for hashing, hence drop rsa from the name. BUG=b:166038345 BRANCH=zork TEST=CC=x86_64-pc-linux-gnu-clang make runtests Signed-off-by: Kangheui Won Change-Id: I9efb05b3d035dcd584a47d006415ea87bf931ad6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2566865 Reviewed-by: Joel Kitching (cherry picked from commit 3425315e87738b80c9efc15801d491545b38146b) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2581745 --- firmware/2lib/2api.c | 2 +- firmware/2lib/include/2secdata.h | 5 +++-- firmware/lib20/misc.c | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/firmware/2lib/2api.c b/firmware/2lib/2api.c index 95dc6c2d..28de8348 100644 --- a/firmware/2lib/2api.c +++ b/firmware/2lib/2api.c @@ -355,7 +355,7 @@ vb2_error_t vb2api_check_hash_get_digest(struct vb2_context *ctx, vb2_member_of(sd, sd->data_key_offset), sd->data_key_size)); - key.allow_hwcrypto = vb2_hwcrypto_rsa_allowed(ctx); + key.allow_hwcrypto = vb2_hwcrypto_allowed(ctx); /* * Check digest vs. signature. Note that this destroys the signature. diff --git a/firmware/2lib/include/2secdata.h b/firmware/2lib/include/2secdata.h index 880a2ec3..c3355f8c 100644 --- a/firmware/2lib/include/2secdata.h +++ b/firmware/2lib/include/2secdata.h @@ -217,9 +217,10 @@ int vb2_secdata_fwmp_get_flag(struct vb2_context *ctx, uint8_t *vb2_secdata_fwmp_get_dev_key_hash(struct vb2_context *ctx); /* - * Helper function to check if hwcrypto for RSA is allowed + * Helper function to check if hwcrypto is allowed. */ -static inline int vb2_hwcrypto_rsa_allowed(struct vb2_context *ctx) { +static inline int vb2_hwcrypto_allowed(struct vb2_context *ctx) +{ /* disable hwcrypto in recovery mode */ if (ctx->flags & VB2_CONTEXT_RECOVERY_MODE) diff --git a/firmware/lib20/misc.c b/firmware/lib20/misc.c index 6ad3cab4..bc8e9955 100644 --- a/firmware/lib20/misc.c +++ b/firmware/lib20/misc.c @@ -43,7 +43,7 @@ vb2_error_t vb2_load_fw_keyblock(struct vb2_context *ctx) /* Unpack the root key */ VB2_TRY(vb2_unpack_key_buffer(&root_key, key_data, key_size)); - root_key.allow_hwcrypto = vb2_hwcrypto_rsa_allowed(ctx); + root_key.allow_hwcrypto = vb2_hwcrypto_allowed(ctx); /* Load the firmware keyblock header after the root key */ kb = vb2_workbuf_alloc(&wb, sizeof(*kb)); @@ -149,7 +149,7 @@ vb2_error_t vb2_load_fw_preamble(struct vb2_context *ctx) VB2_TRY(vb2_unpack_key_buffer(&data_key, key_data, key_size)); - data_key.allow_hwcrypto = vb2_hwcrypto_rsa_allowed(ctx); + data_key.allow_hwcrypto = vb2_hwcrypto_allowed(ctx); /* Load the firmware preamble header */ pre = vb2_workbuf_alloc(&wb, sizeof(*pre)); -- cgit v1.2.1