summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-10-01 23:40:24 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-10-15 14:55:11 +0200
commitb39100bcea12b29d64c536ea5f4c57380dfcf056 (patch)
treea0a33c844c9552e4e46aba3f01109332b63af1a8 /scripts
parentd091a81f3ece732826dd4dec0b241624159ae1d6 (diff)
downloadbarebox-b39100bcea12b29d64c536ea5f4c57380dfcf056.tar.gz
barebox-b39100bcea12b29d64c536ea5f4c57380dfcf056.tar.xz
rsa: Allow to directly compile in rsa public keys
So far we relied on the U-Boot mkimage tool to generate us device tree snippets containing rsa public keys which we then compiled into barebox. Make this easier and allow to directly specify a filename or PKCS#11 URI in Kconfig. With this we no longer need the U-Boot mkimage tool here and no more external steps to prepare device tree snippets. With this rsa public keys can be directly compiled as C structs into barebox which is much more direct than putting it into the device tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.lib17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index c4d307ae30..becc3688f7 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -526,5 +526,22 @@ quiet_cmd_stm32_image = STM32-IMG $@
quiet_cmd_b64dec = B64DEC $@
cmd_b64dec = base64 -d $< > $@
+# rsa_keys
+# ---------------------------------------------------------------------------
+# Build a header file containing a rsa public key.
+#
+# The keys can change without the build system noticing, so we always
+# have to call rsatoc. To avoid unnecessary rebuilds of barebox compare
+# its output to the last rsatoc output. Only if it differs overwrite the
+# target file.
+quiet_cmd_rsa_keys = RSAKEY $@
+cmd_rsa_keys = \
+ $(objtree)/scripts/rsatoc -o $@.tmp $(2) && \
+ if cmp -s $@.tmp $@; then \
+ rm $@.tmp; \
+ else \
+ mv $@.tmp $@; \
+ fi
+
%: %.base64
$(call cmd,b64dec)