From d3b2117f9abe2f7413f6315867ae3c3dbfaf5db1 Mon Sep 17 00:00:00 2001 From: Joel Kitching Date: Wed, 4 Sep 2019 14:12:42 +0800 Subject: vboot: standardize on "keyblock" as one word Stardardize on inconsistency between "keyblock" and "key block" both in code, comments, and textual output. BUG=b:124141368, chromium:968464 TEST=make clean && make runtests BRANCH=none Change-Id: Ib8819a2426c1179286663f21f0d254f3de9d94a4 Signed-off-by: Joel Kitching Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1786385 Tested-by: Joel Kitching Reviewed-by: Joel Kitching Commit-Queue: Joel Kitching --- firmware/lib20/common.c | 20 ++++++++++---------- firmware/lib20/include/vb2_common.h | 22 +++++++++++----------- firmware/lib20/include/vb2_struct.h | 22 +++++++++++----------- firmware/lib20/kernel.c | 18 +++++++++--------- 4 files changed, 41 insertions(+), 41 deletions(-) (limited to 'firmware/lib20') diff --git a/firmware/lib20/common.c b/firmware/lib20/common.c index c9d52e97..2c6886c5 100644 --- a/firmware/lib20/common.c +++ b/firmware/lib20/common.c @@ -94,27 +94,27 @@ vb2_error_t vb2_check_keyblock(const struct vb2_keyblock *block, uint32_t size, const struct vb2_signature *sig) { if(size < sizeof(*block)) { - VB2_DEBUG("Not enough space for key block header.\n"); + VB2_DEBUG("Not enough space for keyblock header.\n"); return VB2_ERROR_KEYBLOCK_TOO_SMALL_FOR_HEADER; } - if (memcmp(block->magic, KEY_BLOCK_MAGIC, KEY_BLOCK_MAGIC_SIZE)) { - VB2_DEBUG("Not a valid verified boot key block.\n"); + if (memcmp(block->magic, KEYBLOCK_MAGIC, KEYBLOCK_MAGIC_SIZE)) { + VB2_DEBUG("Not a valid verified boot keyblock.\n"); return VB2_ERROR_KEYBLOCK_MAGIC; } - if (block->header_version_major != KEY_BLOCK_HEADER_VERSION_MAJOR) { - VB2_DEBUG("Incompatible key block header version.\n"); + if (block->header_version_major != KEYBLOCK_HEADER_VERSION_MAJOR) { + VB2_DEBUG("Incompatible keyblock header version.\n"); return VB2_ERROR_KEYBLOCK_HEADER_VERSION; } if (size < block->keyblock_size) { - VB2_DEBUG("Not enough data for key block.\n"); + VB2_DEBUG("Not enough data for keyblock.\n"); return VB2_ERROR_KEYBLOCK_SIZE; } if (vb2_verify_signature_inside(block, block->keyblock_size, sig)) { - VB2_DEBUG("Key block signature off end of block\n"); + VB2_DEBUG("Keyblock signature off end of block\n"); return VB2_ERROR_KEYBLOCK_SIG_OUTSIDE; } @@ -133,7 +133,7 @@ vb2_error_t vb2_check_keyblock(const struct vb2_keyblock *block, uint32_t size, /* Verify data key is inside the block and inside signed data */ if (vb2_verify_packed_key_inside(block, block->keyblock_size, &block->data_key)) { - VB2_DEBUG("Data key off end of key block\n"); + VB2_DEBUG("Data key off end of keyblock\n"); return VB2_ERROR_KEYBLOCK_DATA_KEY_OUTSIDE; } if (vb2_verify_packed_key_inside(block, sig->data_size, @@ -157,10 +157,10 @@ vb2_error_t vb2_verify_keyblock(struct vb2_keyblock *block, uint32_t size, if (rv) return rv; - VB2_DEBUG("Checking key block signature...\n"); + VB2_DEBUG("Checking keyblock signature...\n"); rv = vb2_verify_data((const uint8_t *)block, size, sig, key, wb); if (rv) { - VB2_DEBUG("Invalid key block signature.\n"); + VB2_DEBUG("Invalid keyblock signature.\n"); return VB2_ERROR_KEYBLOCK_SIG_INVALID; } diff --git a/firmware/lib20/include/vb2_common.h b/firmware/lib20/include/vb2_common.h index d16572a5..911dc0a3 100644 --- a/firmware/lib20/include/vb2_common.h +++ b/firmware/lib20/include/vb2_common.h @@ -94,28 +94,28 @@ vb2_error_t vb2_verify_data(const uint8_t *data, uint32_t size, const struct vb2_workbuf *wb); /** - * Check the sanity of a key block structure. + * Check the sanity of a keyblock structure. * - * Verifies all the header fields. Does not verify key index or key block - * flags. Should be called before verifying the key block data itself using + * Verifies all the header fields. Does not verify key index or keyblock + * flags. Should be called before verifying the keyblock data itself using * the key. (This function does not itself verify the signature - just that * the right amount of data is claimed to be signed.) * - * @param block Key block to verify - * @param size Size of key block buffer + * @param block Keyblock to verify + * @param size Size of keyblock buffer * @param sig Which signature inside the keyblock to use */ vb2_error_t vb2_check_keyblock(const struct vb2_keyblock *block, uint32_t size, const struct vb2_signature *sig); /** - * Verify a key block using a public key. + * Verify a keyblock using a public key. * * Header fields are also checked for sanity. Does not verify key index or key * block flags. Signature inside block is destroyed during check. * - * @param block Key block to verify - * @param size Size of key block buffer + * @param block Keyblock to verify + * @param size Size of keyblock buffer * @param key Key to use to verify block * @param wb Work buffer * @return VB2_SUCCESS, or non-zero error code if error. @@ -125,13 +125,13 @@ vb2_error_t vb2_verify_keyblock(struct vb2_keyblock *block, uint32_t size, const struct vb2_workbuf *wb); /** - * Verify a key block using its hash. + * Verify a keyblock using its hash. * * Header fields are also checked for sanity. Does not verify key index or key * block flags. Use this for self-signed keyblocks in developer mode. * - * @param block Key block to verify - * @param size Size of key block buffer + * @param block Keyblock to verify + * @param size Size of keyblock buffer * @param key Key to use to verify block * @param wb Work buffer * @return VB2_SUCCESS, or non-zero error code if error. diff --git a/firmware/lib20/include/vb2_struct.h b/firmware/lib20/include/vb2_struct.h index 2024bde5..d6279e19 100644 --- a/firmware/lib20/include/vb2_struct.h +++ b/firmware/lib20/include/vb2_struct.h @@ -46,14 +46,14 @@ struct vb2_signature { #define EXPECTED_VB2_SIGNATURE_SIZE 24 -#define KEY_BLOCK_MAGIC "CHROMEOS" -#define KEY_BLOCK_MAGIC_SIZE 8 +#define KEYBLOCK_MAGIC "CHROMEOS" +#define KEYBLOCK_MAGIC_SIZE 8 -#define KEY_BLOCK_HEADER_VERSION_MAJOR 2 -#define KEY_BLOCK_HEADER_VERSION_MINOR 1 +#define KEYBLOCK_HEADER_VERSION_MAJOR 2 +#define KEYBLOCK_HEADER_VERSION_MINOR 1 /* - * Key block, containing the public key used to sign some other chunk of data. + * Keyblock, containing the public key used to sign some other chunk of data. * * This should be followed by: * 1) The data_key key data, pointed to by data_key.key_offset. @@ -64,34 +64,34 @@ struct vb2_signature { */ struct vb2_keyblock { /* Magic number */ - uint8_t magic[KEY_BLOCK_MAGIC_SIZE]; + uint8_t magic[KEYBLOCK_MAGIC_SIZE]; /* Version of this header format */ uint32_t header_version_major; uint32_t header_version_minor; /* - * Length of this entire key block, including keys, signatures, and + * Length of this entire keyblock, including keys, signatures, and * padding, in bytes */ uint32_t keyblock_size; uint32_t reserved0; /* - * Signature for this key block (header + data pointed to by data_key) + * Signature for this keyblock (header + data pointed to by data_key) * For use with signed data keys */ struct vb2_signature keyblock_signature; /* - * SHA-512 hash for this key block (header + data pointed to by + * SHA-512 hash for this keyblock (header + data pointed to by * data_key) For use with unsigned data keys. * * Only supported for kernel keyblocks, not firmware keyblocks. */ struct vb2_signature keyblock_hash; - /* Flags for key (VB2_KEY_BLOCK_FLAG_*) */ + /* Flags for key (VB2_KEYBLOCK_FLAG_*) */ uint32_t keyblock_flags; uint32_t reserved1; @@ -143,7 +143,7 @@ struct vb2_fw_preamble { uint32_t firmware_version; uint32_t reserved1; - /* Key to verify kernel key block */ + /* Key to verify kernel keyblock */ struct vb2_packed_key kernel_subkey; /* Signature for the firmware body */ diff --git a/firmware/lib20/kernel.c b/firmware/lib20/kernel.c index a40a4971..172f7ffb 100644 --- a/firmware/lib20/kernel.c +++ b/firmware/lib20/kernel.c @@ -56,7 +56,7 @@ vb2_error_t vb2_verify_keyblock_hash(const struct vb2_keyblock *block, if (rv) return rv; - VB2_DEBUG("Checking key block hash...\n"); + VB2_DEBUG("Checking keyblock hash...\n"); /* Digest goes at start of work buffer */ digest_size = vb2_digest_size(VB2_HASH_SHA512); @@ -83,7 +83,7 @@ vb2_error_t vb2_verify_keyblock_hash(const struct vb2_keyblock *block, if (vb2_safe_memcmp(vb2_signature_data_const(sig), digest, digest_size) != 0) { - VB2_DEBUG("Invalid key block hash.\n"); + VB2_DEBUG("Invalid keyblock hash.\n"); return VB2_ERROR_KEYBLOCK_SIG_INVALID; } @@ -166,19 +166,19 @@ vb2_error_t vb2_load_kernel_keyblock(struct vb2_context *ctx) return rv; } - /* Check the key block flags against the current boot mode */ + /* Check the keyblock flags against the current boot mode */ if (!(kb->keyblock_flags & - (dev_switch ? VB2_KEY_BLOCK_FLAG_DEVELOPER_1 : - VB2_KEY_BLOCK_FLAG_DEVELOPER_0))) { - VB2_DEBUG("Key block developer flag mismatch.\n"); + (dev_switch ? VB2_KEYBLOCK_FLAG_DEVELOPER_1 : + VB2_KEYBLOCK_FLAG_DEVELOPER_0))) { + VB2_DEBUG("Keyblock developer flag mismatch.\n"); keyblock_is_valid = 0; if (need_keyblock_valid) return VB2_ERROR_KERNEL_KEYBLOCK_DEV_FLAG; } if (!(kb->keyblock_flags & - (rec_switch ? VB2_KEY_BLOCK_FLAG_RECOVERY_1 : - VB2_KEY_BLOCK_FLAG_RECOVERY_0))) { - VB2_DEBUG("Key block recovery flag mismatch.\n"); + (rec_switch ? VB2_KEYBLOCK_FLAG_RECOVERY_1 : + VB2_KEYBLOCK_FLAG_RECOVERY_0))) { + VB2_DEBUG("Keyblock recovery flag mismatch.\n"); keyblock_is_valid = 0; if (need_keyblock_valid) return VB2_ERROR_KERNEL_KEYBLOCK_REC_FLAG; -- cgit v1.2.1