diff options
author | Randall Spangler <rspangler@chromium.org> | 2016-10-18 12:00:07 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2016-11-06 02:33:02 +0000 |
commit | 46a382d6136f2fd206fd8c95180dbb816c9ad5ce (patch) | |
tree | d97739fd8373f7b3a0844fc5dc854caa9919aae3 /tests/vb21_common2_tests.c | |
parent | a03a164a76a97f3f6a60ddf18c466b38f8a77400 (diff) | |
download | vboot-46a382d6136f2fd206fd8c95180dbb816c9ad5ce.tar.gz |
vboot: Remove vboot1 cryptolib padding source
The old vboot1 cryptolib hard-coded many of its padding arrays in a
padding.c file. Use the equivalent vboot2 apis instead.
This change is almost exclusively on the host and test side; the only
firmware impact is on a single line of debug output.
BUG=chromium:611535
BRANCH=none
TEST=make runtests; emerge-kevin coreboot depthcharge
Change-Id: If689ffd92f0255847bea2424950da4547b2c0df3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400902
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'tests/vb21_common2_tests.c')
-rw-r--r-- | tests/vb21_common2_tests.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/vb21_common2_tests.c b/tests/vb21_common2_tests.c index 15e4d505..b121fa5a 100644 --- a/tests/vb21_common2_tests.c +++ b/tests/vb21_common2_tests.c @@ -239,7 +239,8 @@ static void test_verify_data(const struct vb2_public_key *pubk_orig, int test_algorithm(int key_algorithm, const char *keys_dir) { char filename[1024]; - int rsa_len = siglen_map[key_algorithm] * 8; + int rsa_bits = 8 * vb2_rsa_sig_size( + vb2_crypto_to_signature(key_algorithm)); enum vb2_signature_algorithm sig_alg = vb2_crypto_to_signature(key_algorithm); @@ -250,10 +251,11 @@ int test_algorithm(int key_algorithm, const char *keys_dir) struct vb2_public_key *pubk = NULL; struct vb21_packed_key *key2 = NULL; - printf("***Testing algorithm: %s\n", algo_strings[key_algorithm]); + printf("***Testing algorithm: %s\n", + vb2_get_crypto_algorithm_name(key_algorithm)); snprintf(filename, sizeof(filename), - "%s/key_rsa%d.pem", keys_dir, rsa_len); + "%s/key_rsa%d.pem", keys_dir, rsa_bits); TEST_SUCC(vb2_private_key_read_pem(&prik, filename), "Read private key"); prik->hash_alg = hash_alg; @@ -261,7 +263,7 @@ int test_algorithm(int key_algorithm, const char *keys_dir) vb2_private_key_set_desc(prik, "private key"); snprintf(filename, sizeof(filename), - "%s/key_rsa%d.keyb", keys_dir, rsa_len); + "%s/key_rsa%d.keyb", keys_dir, rsa_bits); TEST_SUCC(vb2_public_key_read_keyb(&pubk, filename), "Read public key"); pubk->hash_alg = hash_alg; @@ -305,7 +307,7 @@ int main(int argc, char *argv[]) { /* Test all the algorithms */ int alg; - for (alg = 0; alg < kNumAlgorithms; alg++) { + for (alg = 0; alg < VB2_ALG_COUNT; alg++) { if (test_algorithm(alg, argv[1])) return 1; } |