[PATCH 2/5] scripts: allow user to build rsatoc if COMPILE_HOST_TOOLS

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Sep 21 03:23:07 PDT 2023


rsatoc is automatically built if CONFIG_CRYPTO_RSA_BUILTIN_KEYS=y.
For testing, it can be useful to build the tool standalone, so add an
option to do just that.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 crypto/Kconfig   | 1 +
 scripts/Kconfig  | 7 +++++++
 scripts/Makefile | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/crypto/Kconfig b/crypto/Kconfig
index 04e5ef43705b..4ad7bd844fa1 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -121,6 +121,7 @@ config CRYPTO_RSA
 config CRYPTO_RSA_BUILTIN_KEYS
 	bool
 	default y if CRYPTO_RSA_KEY != ""
+	select RSATOC
 
 config CRYPTO_RSA_KEY
 	depends on CRYPTO_RSA
diff --git a/scripts/Kconfig b/scripts/Kconfig
index 26c6a3c19806..9be04fa7c8bf 100644
--- a/scripts/Kconfig
+++ b/scripts/Kconfig
@@ -110,6 +110,13 @@ config QOICONV
 	help
 	  This enable converting png to qoi images to generate boot logo.
 
+config RSATOC
+	bool "RSA to C converter" if COMPILE_HOST_TOOLS
+	help
+	  This utility converts RSA keys in PEM format to either C or
+	  device tree snippets. This requires OpenSSL on the build host
+	  and will be selected by the build system if required.
+
 endmenu
 
 menu "Target Tools"
diff --git a/scripts/Makefile b/scripts/Makefile
index 75dc5926c057..0a56401fac52 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -11,7 +11,7 @@ hostprogs-always-y					+= bareboxenv
 hostprogs-always-y					+= bareboxcrc32
 hostprogs-always-y					+= kernel-install
 hostprogs-always-$(CONFIG_QOICONV)			+= qoiconv
-hostprogs-always-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS)	+= rsatoc
+hostprogs-always-$(CONFIG_RSATOC)			+= rsatoc
 HOSTCFLAGS_rsatoc.o = `$(PKG_CONFIG) --cflags openssl`
 HOSTLDLIBS_rsatoc = `$(PKG_CONFIG) --libs openssl`
 hostprogs-always-$(CONFIG_IMD)				+= bareboximd
-- 
2.39.2




More information about the barebox mailing list