summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/security/vboot/Kconfig11
-rw-r--r--src/security/vboot/vboot_logic.c4
2 files changed, 12 insertions, 3 deletions
diff --git a/src/security/vboot/Kconfig b/src/security/vboot/Kconfig
index 094cbb9642..e7744786f6 100644
--- a/src/security/vboot/Kconfig
+++ b/src/security/vboot/Kconfig
@@ -369,6 +369,17 @@ config VBOOT_KEYBLOCK_PREAMBLE_FLAGS
hex "Keyblock preamble flags"
default 0x0
+config VBOOT_HASH_BLOCK_SIZE
+ hex
+ default 0x400
+ help
+ Set the default hash size. Generally 1k is reasonable, but in some
+ cases it may improve hashing speed to increase the size.
+
+ Note that this buffer is allocated in the stack. Although the
+ build should fail if the stack size is exceeded, it's something to
+ be aware of when changing the size.
+
endmenu # Keys
endif # VBOOT
endmenu # Verified Boot (vboot)
diff --git a/src/security/vboot/vboot_logic.c b/src/security/vboot/vboot_logic.c
index dbaa883080..54c82244b6 100644
--- a/src/security/vboot/vboot_logic.c
+++ b/src/security/vboot/vboot_logic.c
@@ -19,8 +19,6 @@
/* The max hash size to expect is for SHA512. */
#define VBOOT_MAX_HASH_SIZE VB2_SHA512_DIGEST_SIZE
-#define TODO_BLOCK_SIZE 1024
-
/* exports */
vb2_error_t vb2ex_read_resource(struct vb2_context *ctx,
@@ -144,7 +142,7 @@ static vb2_error_t hash_body(struct vb2_context *ctx,
{
uint64_t load_ts;
uint32_t remaining;
- uint8_t block[TODO_BLOCK_SIZE];
+ uint8_t block[CONFIG_VBOOT_HASH_BLOCK_SIZE];
uint8_t hash_digest[VBOOT_MAX_HASH_SIZE];
const size_t hash_digest_sz = sizeof(hash_digest);
size_t block_size = sizeof(block);