diff options
author | Randall Spangler <rspangler@chromium.org> | 2014-11-01 15:55:26 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-11-05 06:05:06 +0000 |
commit | 6300a6439e121ac41ad336c7422dcdbb0d649c7c (patch) | |
tree | 04e8ad6d1a0fe05a4989511fe19d6ee2f40974af | |
parent | 6b5b8f65d52bc91ca37e5cb484867251d81136b1 (diff) | |
download | vboot-6300a6439e121ac41ad336c7422dcdbb0d649c7c.tar.gz |
vboot2: be consistent in use of sig_algorithm vs sig_alg in vboot2 structs
Previously, we had a mix of sig_algorithm and sig_alg member names,
and it was hard to remember which struct used which variant. Prefer
sig_alg because of the 80-column limit. Same with hash_alg
vs. hash_algorithm
BUG=chromium:423882
BRANCH=none
TEST=VBOOT2=1 make runtests
Change-Id: Ifbb60f3172549e29efc0fb1f7f693efa51eb7cc3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/226943
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | firmware/2lib/2packed_key2.c | 4 | ||||
-rw-r--r-- | firmware/2lib/include/2struct.h | 10 | ||||
-rw-r--r-- | tests/vb2_common2_tests.c | 4 | ||||
-rw-r--r-- | tests/vb2_convert_structs.c | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/firmware/2lib/2packed_key2.c b/firmware/2lib/2packed_key2.c index e8289273..264ca139 100644 --- a/firmware/2lib/2packed_key2.c +++ b/firmware/2lib/2packed_key2.c @@ -56,12 +56,12 @@ int vb2_unpack_key2(struct vb2_public_key *key, return VB2_ERROR_UNPACK_KEY_STRUCT_VERSION; /* Copy key algorithms */ - key->sig_alg = pkey->sig_algorithm; + key->sig_alg = pkey->sig_alg; sig_size = vb2_rsa_sig_size(key->sig_alg); if (!sig_size) return VB2_ERROR_UNPACK_KEY_SIG_ALGORITHM; - key->hash_alg = pkey->hash_algorithm; + key->hash_alg = pkey->hash_alg; if (!vb2_digest_size(key->hash_alg)) return VB2_ERROR_UNPACK_KEY_HASH_ALGORITHM; diff --git a/firmware/2lib/include/2struct.h b/firmware/2lib/include/2struct.h index be5ba034..bfe23559 100644 --- a/firmware/2lib/include/2struct.h +++ b/firmware/2lib/include/2struct.h @@ -368,14 +368,14 @@ struct vb2_packed_key2 { uint32_t key_size; /* Signature algorithm used by the key (enum vb2_signature_algorithm) */ - uint16_t sig_algorithm; + uint16_t sig_alg; /* * Hash digest algorithm used with the key (enum vb2_hash_algorithm). * This is explicitly specified as part of the key to prevent use of a * strong key with a weak hash. */ - uint16_t hash_algorithm; + uint16_t hash_alg; /* Key version */ uint32_t key_version; @@ -413,10 +413,10 @@ struct vb2_signature2 { uint32_t data_size; /* Signature algorithm used (enum vb2_signature_algorithm) */ - uint16_t sig_algorithm; + uint16_t sig_alg; /* Hash digest algorithm used (enum vb2_hash_algorithm) */ - uint16_t hash_algorithm; + uint16_t hash_alg; /* * GUID of key used to generate this signature. This allows the @@ -538,7 +538,7 @@ struct vb2_fw_preamble2 { * Hash algorithm used (must be same for all entries) (enum * vb2_hash_algorithm). */ - uint16_t hash_algorithm; + uint16_t hash_alg; /* Size of each hash entry, in bytes */ uint16_t hash_entry_size; diff --git a/tests/vb2_common2_tests.c b/tests/vb2_common2_tests.c index 050695ee..4dbc137f 100644 --- a/tests/vb2_common2_tests.c +++ b/tests/vb2_common2_tests.c @@ -147,14 +147,14 @@ static void test_unpack_key2(const VbPublicKey *orig_key) free(key2); key2 = vb2_convert_packed_key2(key1, "Test key", &size); - key2->sig_algorithm = VB2_SIG_INVALID; + key2->sig_alg = VB2_SIG_INVALID; TEST_EQ(vb2_unpack_key2(&pubk, (uint8_t *)key2, size), VB2_ERROR_UNPACK_KEY_SIG_ALGORITHM, "vb2_unpack_key2() bad sig algorithm"); free(key2); key2 = vb2_convert_packed_key2(key1, "Test key", &size); - key2->hash_algorithm = VB2_HASH_INVALID; + key2->hash_alg = VB2_HASH_INVALID; TEST_EQ(vb2_unpack_key2(&pubk, (uint8_t *)key2, size), VB2_ERROR_UNPACK_KEY_HASH_ALGORITHM, "vb2_unpack_key2() bad hash algorithm"); diff --git a/tests/vb2_convert_structs.c b/tests/vb2_convert_structs.c index cb29a979..871be735 100644 --- a/tests/vb2_convert_structs.c +++ b/tests/vb2_convert_structs.c @@ -33,8 +33,8 @@ struct vb2_packed_key2 *vb2_convert_packed_key2( /* Copy/initialize fields */ k2.key_version = key->key_version; - k2.sig_algorithm = vb2_crypto_to_signature(key->algorithm); - k2.hash_algorithm = vb2_crypto_to_hash(key->algorithm); + k2.sig_alg = vb2_crypto_to_signature(key->algorithm); + k2.hash_alg = vb2_crypto_to_hash(key->algorithm); /* TODO: fill in a non-zero GUID */ /* Allocate the new buffer */ |