Skip to content

Commit 27b5b22

Browse files
masahir0yjarkkojs
authored andcommitted
certs: fix and refactor CONFIG_SYSTEM_BLACKLIST_HASH_LIST build
Commit addf466 ("certs: Check that builtin blacklist hashes are valid") was applied 8 months after the submission. In the meantime, the base code had been removed by commit b8c96a6 ("certs: simplify $(srctree)/ handling and remove config_filename macro"). Fix the Makefile. Create a local copy of $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST). It is included from certs/blacklist_hashes.c and also works as a timestamp. Send error messages from check-blacklist-hashes.awk to stderr instead of stdout. Fixes: addf466 ("certs: Check that builtin blacklist hashes are valid") Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Reviewed-by: Mickaël Salaün <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent 6a1c376 commit 27b5b22

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

Diff for: certs/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
/blacklist_hashes_checked
2+
/blacklist_hash_list
33
/extract-cert
44
/x509_certificate_list
55
/x509_revocation_list

Diff for: certs/Makefile

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o c
77
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o common.o
88
obj-$(CONFIG_SYSTEM_REVOCATION_LIST) += revocation_certificates.o
99
ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),)
10-
quiet_cmd_check_blacklist_hashes = CHECK $(patsubst "%",%,$(2))
11-
cmd_check_blacklist_hashes = $(AWK) -f $(srctree)/scripts/check-blacklist-hashes.awk $(2); touch $@
1210

13-
$(eval $(call config_filename,SYSTEM_BLACKLIST_HASH_LIST))
11+
$(obj)/blacklist_hashes.o: $(obj)/blacklist_hash_list
12+
CFLAGS_blacklist_hashes.o := -I $(obj)
1413

15-
$(obj)/blacklist_hashes.o: $(obj)/blacklist_hashes_checked
14+
quiet_cmd_check_and_copy_blacklist_hash_list = GEN $@
15+
cmd_check_and_copy_blacklist_hash_list = \
16+
$(AWK) -f $(srctree)/scripts/check-blacklist-hashes.awk $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) >&2; \
17+
cat $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) > $@
1618

17-
CFLAGS_blacklist_hashes.o += -I$(srctree)
18-
19-
targets += blacklist_hashes_checked
20-
$(obj)/blacklist_hashes_checked: $(SYSTEM_BLACKLIST_HASH_LIST_SRCPREFIX)$(SYSTEM_BLACKLIST_HASH_LIST_FILENAME) scripts/check-blacklist-hashes.awk FORCE
21-
$(call if_changed,check_blacklist_hashes,$(SYSTEM_BLACKLIST_HASH_LIST_SRCPREFIX)$(CONFIG_SYSTEM_BLACKLIST_HASH_LIST))
19+
$(obj)/blacklist_hash_list: $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) FORCE
20+
$(call if_changed,check_and_copy_blacklist_hash_list)
2221
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o
2322
else
2423
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o
2524
endif
25+
targets += blacklist_hash_list
2626

2727
quiet_cmd_extract_certs = CERT $@
2828
cmd_extract_certs = $(obj)/extract-cert $(extract-cert-in) $@
@@ -33,7 +33,7 @@ $(obj)/system_certificates.o: $(obj)/x509_certificate_list
3333
$(obj)/x509_certificate_list: $(CONFIG_SYSTEM_TRUSTED_KEYS) $(obj)/extract-cert FORCE
3434
$(call if_changed,extract_certs)
3535

36-
targets += x509_certificate_list blacklist_hashes_checked
36+
targets += x509_certificate_list
3737

3838
# If module signing is requested, say by allyesconfig, but a key has not been
3939
# supplied, then one will need to be generated to make sure the build does not

Diff for: certs/blacklist_hashes.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
#include "blacklist.h"
33

44
const char __initconst *const blacklist_hashes[] = {
5-
#include CONFIG_SYSTEM_BLACKLIST_HASH_LIST
5+
#include "blacklist_hash_list"
66
, NULL
77
};

0 commit comments

Comments
 (0)