Skip to content

Commit f44b645

Browse files
committed
certs: simplify empty certs creation in certs/Makefile
To create an empty cert file, we need to pass "" to the extract-cert tool, which is common for all the three call-sites of cmd_extract_certs. Factor out the logic into extract-cert-in. One exceptional case is PKCS#11 case, where we override extract-cert-in with the URI. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <n.schier@avm.de>
1 parent 6ce019f commit f44b645

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

certs/Makefile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o
1313
endif
1414

1515
quiet_cmd_extract_certs = CERT $@
16-
cmd_extract_certs = $(obj)/extract-cert $(2) $@
16+
cmd_extract_certs = $(obj)/extract-cert $(extract-cert-in) $@
17+
extract-cert-in = $(or $(filter-out $(obj)/extract-cert, $(real-prereqs)),"")
1718

1819
$(obj)/system_certificates.o: $(obj)/x509_certificate_list
1920

2021
$(obj)/x509_certificate_list: $(CONFIG_SYSTEM_TRUSTED_KEYS) $(obj)/extract-cert FORCE
21-
$(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_TRUSTED_KEYS),$<,""))
22+
$(call if_changed,extract_certs)
2223

2324
targets += x509_certificate_list
2425

@@ -52,22 +53,22 @@ $(obj)/x509.genkey:
5253

5354
endif # CONFIG_MODULE_SIG_KEY
5455

55-
# If CONFIG_MODULE_SIG_KEY isn't a PKCS#11 URI, depend on it
56-
ifneq ($(filter-out pkcs11:%, $(CONFIG_MODULE_SIG_KEY)),)
57-
X509_DEP := $(CONFIG_MODULE_SIG_KEY)
58-
endif
59-
6056
$(obj)/system_certificates.o: $(obj)/signing_key.x509
6157

62-
$(obj)/signing_key.x509: $(X509_DEP) $(obj)/extract-cert FORCE
63-
$(call if_changed,extract_certs,$(if $(CONFIG_MODULE_SIG_KEY),$(if $(X509_DEP),$<,$(CONFIG_MODULE_SIG_KEY)),""))
58+
PKCS11_URI := $(filter pkcs11:%, $(CONFIG_MODULE_SIG_KEY))
59+
ifdef PKCS11_URI
60+
$(obj)/signing_key.x509: extract-cert-in := $(PKCS11_URI)
61+
endif
62+
63+
$(obj)/signing_key.x509: $(filter-out $(PKCS11_URI),$(CONFIG_MODULE_SIG_KEY)) $(obj)/extract-cert FORCE
64+
$(call if_changed,extract_certs)
6465

6566
targets += signing_key.x509
6667

6768
$(obj)/revocation_certificates.o: $(obj)/x509_revocation_list
6869

6970
$(obj)/x509_revocation_list: $(CONFIG_SYSTEM_REVOCATION_KEYS) $(obj)/extract-cert FORCE
70-
$(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_REVOCATION_KEYS),$<,""))
71+
$(call if_changed,extract_certs)
7172

7273
targets += x509_revocation_list
7374

0 commit comments

Comments
 (0)