diff options
author | Julius Werner <jwerner@chromium.org> | 2020-03-10 23:27:10 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-06 18:54:38 +0000 |
commit | b1c6ef3892c4e36a1375249ce4494959d2457011 (patch) | |
tree | 2c584a236674c6d57c8064aec663d728e31812d6 /tests/vb2_sha_tests.c | |
parent | 509a887c5a89530e9748241625ad3cb25f5de3c5 (diff) | |
download | vboot-b1c6ef3892c4e36a1375249ce4494959d2457011.tar.gz |
Rewrite algorithm type parsers and make them globally available
There is some code strewn around between futility and the vb21-specific
part of hostlib to allow parsing of textual algorithm names to vboot
enums, but it is somewhat disorganized and not written in a super
efficient way. This patch rewrites it and centralizes all the algorithm
mapping stuff under 2crypto.c so it can be a single source of truth for
all of vboot. (String parsing routines still need to stay in hostlib
since not all firmware targets support things like stroul() and
strcasecmp().)
BRANCH=None
BUG=None
TEST=make runtests
Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I719b2499992a6e4395a29231bc8b9a7680c5b174
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2099447
Reviewed-by: Joel Kitching <kitching@chromium.org>
Commit-Queue: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'tests/vb2_sha_tests.c')
-rw-r--r-- | tests/vb2_sha_tests.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/tests/vb2_sha_tests.c b/tests/vb2_sha_tests.c index 30d32f6c..9fcac1f3 100644 --- a/tests/vb2_sha_tests.c +++ b/tests/vb2_sha_tests.c @@ -169,22 +169,6 @@ static void misc_tests(void) "vb2_digest_finalize() invalid alg"); } -static void hash_algorithm_name_tests(void) -{ - enum vb2_hash_algorithm alg; - char test_name[256]; - - for (alg = 1; alg < VB2_HASH_ALG_COUNT; alg++) { - sprintf(test_name, "%s: %s (alg=%d)", - __func__, vb2_get_hash_algorithm_name(alg), alg); - TEST_STR_NEQ(vb2_get_hash_algorithm_name(alg), - VB2_INVALID_ALG_NAME, test_name); - } - - TEST_STR_EQ(vb2_get_hash_algorithm_name(VB2_HASH_INVALID), - VB2_INVALID_ALG_NAME, "hash alg name invalid"); -} - int main(int argc, char *argv[]) { /* Initialize long_msg with 'a' x 1,000,000 */ @@ -196,7 +180,6 @@ int main(int argc, char *argv[]) sha256_tests(); sha512_tests(); misc_tests(); - hash_algorithm_name_tests(); free(long_msg); |