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 /host/lib21 | |
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 'host/lib21')
-rw-r--r-- | host/lib21/host_key.c | 24 | ||||
-rw-r--r-- | host/lib21/include/host_key2.h | 8 |
2 files changed, 32 insertions, 0 deletions
diff --git a/host/lib21/host_key.c b/host/lib21/host_key.c index 2ebd08a1..ecb7328b 100644 --- a/host/lib21/host_key.c +++ b/host/lib21/host_key.c @@ -33,6 +33,22 @@ const struct vb2_text_vs_enum vb2_text_vs_hash[] = { {0, 0} }; +const struct vb2_text_vs_enum vb2_text_vs_crypto[] = { + {"RSA1024 SHA1", VB2_ALG_RSA1024_SHA1}, + {"RSA1024 SHA256", VB2_ALG_RSA1024_SHA256}, + {"RSA1024 SHA512", VB2_ALG_RSA1024_SHA512}, + {"RSA2048 SHA1", VB2_ALG_RSA2048_SHA1}, + {"RSA2048 SHA256", VB2_ALG_RSA2048_SHA256}, + {"RSA2048 SHA512", VB2_ALG_RSA2048_SHA512}, + {"RSA4096 SHA1", VB2_ALG_RSA4096_SHA1}, + {"RSA4096 SHA256", VB2_ALG_RSA4096_SHA256}, + {"RSA4096 SHA512", VB2_ALG_RSA4096_SHA512}, + {"RSA8192 SHA1", VB2_ALG_RSA8192_SHA1}, + {"RSA8192 SHA256", VB2_ALG_RSA8192_SHA256}, + {"RSA8192 SHA512", VB2_ALG_RSA8192_SHA512}, + {0, 0} +}; + const struct vb2_text_vs_enum *vb2_lookup_by_num( const struct vb2_text_vs_enum *table, const unsigned int num) @@ -61,6 +77,14 @@ const char *vb2_get_sig_algorithm_name(enum vb2_signature_algorithm sig_alg) return entry ? entry->name : VB2_INVALID_ALG_NAME; } +const char *vb2_get_crypto_algorithm_name(enum vb2_crypto_algorithm alg) +{ + const struct vb2_text_vs_enum *entry = + vb2_lookup_by_num(vb2_text_vs_crypto, alg); + + return entry ? entry->name : VB2_INVALID_ALG_NAME; +} + void vb2_private_key_free(struct vb2_private_key *key) { if (!key) diff --git a/host/lib21/include/host_key2.h b/host/lib21/include/host_key2.h index 5a2ec0ad..f786ec9f 100644 --- a/host/lib21/include/host_key2.h +++ b/host/lib21/include/host_key2.h @@ -67,6 +67,14 @@ extern const struct vb2_text_vs_enum vb2_text_vs_hash[]; const char *vb2_get_sig_algorithm_name(enum vb2_signature_algorithm sig_alg); /** + * Return the name of a crypto algorithm. + * + * @param alg Crypto algorithm to look up + * @return The corresponding name, or VB2_INVALID_ALG_NAME if no match. + */ +const char *vb2_get_crypto_algorithm_name(enum vb2_crypto_algorithm alg); + +/** * Free a private key. * * @param key Key containing internal data to free. |