Skip to contentSkip to conversation

cfg80211: ship certificates as hex files

PATCH New Johannes Berg 1 participant 1 message Dec 19, 2017 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 cfg80211: ship certificates as hex files

From: Johannes Berg <[email protected]>

Not only does this remove the need for the hexdump code in most normal kernel builds (still there for the extra directory), but it also removes the need to ship binary files, which apparently is somewhat problematic, as Randy reported.

While at it, also add the generated files to clean-files.

---
 net/wireless/Makefile            |  29 ++++---------
 net/wireless/certs/sforshee.hex  |  86 +++++++++++++++++++++++++++++++++++++++
 net/wireless/certs/sforshee.x509 | Bin 680 -> 0 bytes
 3 files changed, 95 insertions(+), 20 deletions(-)
 create mode 100644 net/wireless/certs/sforshee.hex
 delete mode 100644 net/wireless/certs/sforshee.x509
net/wireless/Makefile +9 -20
index b662be3422e1..1d84f91bbfb0 100644
@@ -23,27 +23,14 @@ ifneq ($(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR),)
 cfg80211-y += extra-certs.o
 endif
 
-$(obj)/shipped-certs.c: $(wildcard $(srctree)/$(src)/certs/*.x509)
+$(obj)/shipped-certs.c: $(wildcard $(srctree)/$(src)/certs/*.hex)
 	@$(kecho) "  GEN     $@"
-	@(set -e; \
-	  allf=""; \
-	  for f in $^ ; do \
-	      # similar to hexdump -v -e '1/1 "0x%.2x," "\n"' \
-	      thisf=$$(od -An -v -tx1 < $$f | \
-	                   sed -e 's/ /\n/g' | \
-	                   sed -e 's/^[0-9a-f]\+$$/\0/;t;d' | \
-	                   sed -e 's/^/0x/;s/$$/,/'); \
-	      # file should not be empty - maybe command substitution failed? \
-	      test ! -z "$$thisf";\
-	      allf=$$allf$$thisf;\
-	  done; \
-	  ( \
-	      echo '#include "reg.h"'; \
-	      echo 'const u8 shipped_regdb_certs[] = {'; \
-	      echo "$$allf"; \
-	      echo '};'; \
-	      echo 'unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);'; \
-	  ) > $@)
+	@(echo '#include "reg.h"'; \
+	  echo 'const u8 shipped_regdb_certs[] = {'; \
+	  cat $^ ; \
+	  echo '};'; \
+	  echo 'unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);'; \
+	 ) > $@
 
 $(obj)/extra-certs.c: $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%) \
 		      $(wildcard $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%)/*.x509)
@@ -67,3 +54,5 @@ $(obj)/extra-certs.c: $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%) \
 	      echo '};'; \
 	      echo 'unsigned int extra_regdb_certs_len = sizeof(extra_regdb_certs);'; \
 	  ) > $@)
+
+clean-files += shipped-certs.c extra-certs.c
net/wireless/certs/sforshee.hex new file +86 -0

86 lines not on this page · raw message

net/wireless/certs/sforshee.x509 deleted binary +0 -0
deleted file mode 100644
index c6f8f9d6b98839048822ebbe27ecb831614ccf3d..0000000000000000000000000000000000000000
GIT binary patch
Signature · 1 line
2.14.2