summaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@google.com>2017-08-19 12:25:42 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-08-24 01:25:50 -0700
commita9cbc267362c71005790cf5b7ca6a8f8d864cea0 (patch)
treecf8349b2dff4fa1510bdac07f31772434451bce2 /host
parentb2b3970923b7971acf78b11d5678ddc3a3a23521 (diff)
downloadvboot-a9cbc267362c71005790cf5b7ca6a8f8d864cea0.tar.gz
tests: Add support for exponent 3 keys
BRANCH=none BUG=b:64854892 TEST=make runlongtests Change-Id: I827ce47b68339dc4df7f84b26a0b6643af27037b Signed-off-by: Caveh Jalali <caveh@google.com> Reviewed-on: https://chromium-review.googlesource.com/628176 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'host')
-rw-r--r--host/lib21/host_key.c36
-rw-r--r--host/lib21/include/host_key2.h8
2 files changed, 44 insertions, 0 deletions
diff --git a/host/lib21/host_key.c b/host/lib21/host_key.c
index c0235b3b..2066a223 100644
--- a/host/lib21/host_key.c
+++ b/host/lib21/host_key.c
@@ -49,6 +49,34 @@ const struct vb2_text_vs_enum vb2_text_vs_crypto[] = {
{"RSA8192 SHA1", VB2_ALG_RSA8192_SHA1},
{"RSA8192 SHA256", VB2_ALG_RSA8192_SHA256},
{"RSA8192 SHA512", VB2_ALG_RSA8192_SHA512},
+ {"RSA2048 EXP3 SHA1", VB2_ALG_RSA2048_EXP3_SHA1},
+ {"RSA2048 EXP3 SHA256", VB2_ALG_RSA2048_EXP3_SHA256},
+ {"RSA2048 EXP3 SHA512", VB2_ALG_RSA2048_EXP3_SHA512},
+ {"RSA3072 EXP3 SHA1", VB2_ALG_RSA3072_EXP3_SHA1},
+ {"RSA3072 EXP3 SHA256", VB2_ALG_RSA3072_EXP3_SHA256},
+ {"RSA3072 EXP3 SHA512", VB2_ALG_RSA3072_EXP3_SHA512},
+ {0, 0}
+};
+
+const struct vb2_text_vs_enum vb2_file_vs_crypto[] = {
+ {"rsa1024", VB2_ALG_RSA1024_SHA1},
+ {"rsa1024", VB2_ALG_RSA1024_SHA256},
+ {"rsa1024", VB2_ALG_RSA1024_SHA512},
+ {"rsa2048", VB2_ALG_RSA2048_SHA1},
+ {"rsa2048", VB2_ALG_RSA2048_SHA256},
+ {"rsa2048", VB2_ALG_RSA2048_SHA512},
+ {"rsa4096", VB2_ALG_RSA4096_SHA1},
+ {"rsa4096", VB2_ALG_RSA4096_SHA256},
+ {"rsa4096", VB2_ALG_RSA4096_SHA512},
+ {"rsa8192", VB2_ALG_RSA8192_SHA1},
+ {"rsa8192", VB2_ALG_RSA8192_SHA256},
+ {"rsa8192", VB2_ALG_RSA8192_SHA512},
+ {"rsa2048_exp3", VB2_ALG_RSA2048_EXP3_SHA1},
+ {"rsa2048_exp3", VB2_ALG_RSA2048_EXP3_SHA256},
+ {"rsa2048_exp3", VB2_ALG_RSA2048_EXP3_SHA512},
+ {"rsa3072_exp3", VB2_ALG_RSA3072_EXP3_SHA1},
+ {"rsa3072_exp3", VB2_ALG_RSA3072_EXP3_SHA256},
+ {"rsa3072_exp3", VB2_ALG_RSA3072_EXP3_SHA512},
{0, 0}
};
@@ -88,6 +116,14 @@ const char *vb2_get_crypto_algorithm_name(enum vb2_crypto_algorithm alg)
return entry ? entry->name : VB2_INVALID_ALG_NAME;
}
+const char *vb2_get_crypto_algorithm_file(enum vb2_crypto_algorithm alg)
+{
+ const struct vb2_text_vs_enum *entry =
+ vb2_lookup_by_num(vb2_file_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 f786ec9f..5ce41c06 100644
--- a/host/lib21/include/host_key2.h
+++ b/host/lib21/include/host_key2.h
@@ -75,6 +75,14 @@ const char *vb2_get_sig_algorithm_name(enum vb2_signature_algorithm sig_alg);
const char *vb2_get_crypto_algorithm_name(enum vb2_crypto_algorithm alg);
/**
+ * Return the name of a crypto algorithm.
+ *
+ * @param alg Crypto algorithm to look up
+ * @return The corresponding stem filename, or VB2_INVALID_ALG_NAME if no match.
+ */
+const char *vb2_get_crypto_algorithm_file(enum vb2_crypto_algorithm alg);
+
+/**
* Free a private key.
*
* @param key Key containing internal data to free.