aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexandru Gagniuc <mr.nuke.me@gmail.com>2021-07-14 17:05:40 -0500
committerTom Rini <trini@konsulko.com>2021-07-16 15:38:49 -0400
commit6909edb4cedf90c7a1fb68302dc2cec6291a0fcd (patch)
treed83b006910ce994532cbbfed5987ceb530674009 /lib
parent0980164b1306400e91e5ac389a514111ff74fc01 (diff)
downloadu-boot-6909edb4cedf90c7a1fb68302dc2cec6291a0fcd.zip
u-boot-6909edb4cedf90c7a1fb68302dc2cec6291a0fcd.tar.gz
u-boot-6909edb4cedf90c7a1fb68302dc2cec6291a0fcd.tar.bz2
image: rsa: Move verification algorithm to a linker list
Move the RSA verification crytpo_algo structure out of the crypto_algos array, and into a linker list. Although it appears we are adding an #ifdef to rsa-verify.c, the gains outweigh this small inconvenience. This is because rsa_verify() is defined differently based on #ifdefs. This change allows us to have a single definition of rsa_verify(). Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/rsa/rsa-verify.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c
index 1998c77..bb8cc61 100644
--- a/lib/rsa/rsa-verify.c
+++ b/lib/rsa/rsa-verify.c
@@ -571,3 +571,19 @@ int rsa_verify(struct image_sign_info *info,
return rsa_verify_hash(info, hash, sig, sig_len);
}
+
+#ifndef USE_HOSTCC
+
+U_BOOT_CRYPTO_ALGO(rsa2048) = {
+ .name = "rsa2048",
+ .key_len = RSA2048_BYTES,
+ .verify = rsa_verify,
+};
+
+U_BOOT_CRYPTO_ALGO(rsa4096) = {
+ .name = "rsa4096",
+ .key_len = RSA4096_BYTES,
+ .verify = rsa_verify,
+};
+
+#endif