mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/6] crypto: rsa: support RSA keys with CONFIG_CRYPTO_BUILTIN_KEYS disabled
Date: Wed,  9 Oct 2024 16:01:51 +0200	[thread overview]
Message-ID: <20241009140155.1990882-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20241009140155.1990882-1-a.fatoum@pengutronix.de>

Enabling CONFIG_CRYPTO_RSA, but not CONFIG_CRYPTO_BUILTIN_KEYS currently
results in a linker error:

  crypto/rsa.c:484: undefined reference to `public_key_add'

Fix this by only calling public_key_add() if we have
CONFIG_CRYPTO_BUILTIN_KEYS=y. If that option is disabled, it means only
standalone keys can be used.

Fixes: 54caa724c737 ("crypto: add public_key functions")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 crypto/rsa.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/crypto/rsa.c b/crypto/rsa.c
index 04b6c9d8c729..d3a48b6809de 100644
--- a/crypto/rsa.c
+++ b/crypto/rsa.c
@@ -488,11 +488,12 @@ static void rsa_init_keys_of(void)
 	}
 }
 
-static int rsa_init_keys(void)
+static __maybe_unused int rsa_init_keys(void)
 {
 	rsa_init_keys_of();
 
 	return 0;
 }
-
+#ifdef CONFIG_CRYPTO_BUILTIN_KEYS
 device_initcall(rsa_init_keys);
+#endif
-- 
2.39.5




  parent reply	other threads:[~2024-10-09 14:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09 14:01 [PATCH 0/6] crypto: ecdsa: fix fallout Ahmad Fatoum
2024-10-09 14:01 ` [PATCH 1/6] crypto: reorder ECDSA Kconfig entries Ahmad Fatoum
2024-10-09 14:01 ` Ahmad Fatoum [this message]
2024-10-09 14:01 ` [PATCH 3/6] keytoc: return error on failure to set PKCS#11 pin Ahmad Fatoum
2024-10-09 14:01 ` [PATCH 4/6] crypto: ecdsa: make crypto/ecdsa.h header self-containing Ahmad Fatoum
2024-10-09 14:01 ` [PATCH 5/6] test: self: jwt: regenerate jwt_test.pem.c_shipped Ahmad Fatoum
2024-10-09 14:01 ` [PATCH 6/6] test: self: rename REGENERATE_RSATOC to REGNERATE_KEYTOC Ahmad Fatoum
2024-10-14 11:31 ` [PATCH 0/6] crypto: ecdsa: fix fallout Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241009140155.1990882-3-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox