certs: Fix wrong kconfig option used for x509_revocation_list
Subsystems (2)
PATCH 1/1 certs: Fix wrong kconfig option used for x509_revocation_list
This fixes a build issue when x509_revocation_list is not defined.
$ make ARCH=x86_64 O=build64 all
EXTRACT_CERTS ../
At main.c:154:
- SSL error:0909006C:PEM routines:get_name:no start line: crypto/pem/pem_lib.c:745
extract-cert: ../: Is a directory
make[2]: [../certs/Makefile:119: certs/x509_revocation_list] Error 1 (ignored)
When the new CONFIG_SYSTEM_REVOCATION_LIST was added [1], it was not carried into the code for preloading the revocation certificates [2]. Change from using the original CONFIG_SYSTEM_BLACKLIST_KEYRING to the new CONFIG_SYSTEM_REVOCATION_LIST.
[1] https://lore.kernel.org/keyrings/[email protected]/T/#m562c1b27bf402190e7bb573ad20eff5b6310d08f
[2] https://lore.kernel.org/keyrings/[email protected]/T/#m07e258bf019ccbac23820fad5192ceffa74fc6ab
--- certs/Makefile | 7 +++++-- certs/blacklist.c | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-)
certs/Makefile +5 -2
@@ -4,7 +4,10 @@ # obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o common.o -obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o revocation_certificates.o common.o +obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o common.o +ifeq ($(CONFIG_SYSTEM_REVOCATION_LIST),y) +obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += revocation_certificates.o +endif ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),"") obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o else
@@ -105,7 +108,7 @@ $(obj)/signing_key.x509: scripts/extract-cert $(X509_DEP) FORCE $(call if_changed,extract_certs,$(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY)) endif # CONFIG_MODULE_SIG -ifeq ($(CONFIG_SYSTEM_BLACKLIST_KEYRING),y) +ifeq ($(CONFIG_SYSTEM_REVOCATION_LIST),y) $(eval $(call config_filename,SYSTEM_REVOCATION_KEYS))
certs/blacklist.c +4 -0
@@ -21,8 +21,10 @@static struct key *blacklist_keyring; +#ifdef CONFIG_SYSTEM_REVOCATION_LIST extern __initconst const u8 revocation_certificate_list[];extern __initconst const unsigned long revocation_certificate_list_size; +#endif /* * The description must be a type prefix, a colon and then an even number of
@@ -225,6 +227,7 @@ static int __init blacklist_init(void)*/ device_initcall (blacklist_init); +#ifdef CONFIG_SYSTEM_REVOCATION_LIST /* * Load the compiled-in list of revocation X.509 certificates. */
@@ -237,3 +240,4 @@ static __init int load_revocation_certificate_list(void) blacklist_keyring); }late_initcall (load_revocation_certificate_list); +#endif
Signature · 1 line
2.18.4
David Howells
maintainercerts/Makefile line 10
Quoted 3 lines · Eric Snowberg
certs/Makefile +3
-0+ifeq ($(CONFIG_SYSTEM_REVOCATION_LIST),y) +obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += revocation_certificates.o +endif
Should the ifeq be referring to CONFIG_SYSTEM_REVOCATION_KEYS rather than CONFIG_SYSTEM_REVOCATION_LIST? In fact, since S_R_K depends indirectly on S_B_K, you should be able to just do:
+obj-$(CONFIG_SYSTEM_REVOCATION_KEYS) += revocation_certificates.o
Quoted 1 line
+#ifdef
CONFIG_SYSTEM_REVOCATION_LIST
Here also?
Quoted 1 line
+ hostprogs-always-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += extract-cert
And here too?
(As an aside, I wonder if SYSTEM_REVOCATION_CERTS would be a better name, but I'm okay with leaving it as-is for now).
David
Quoted 13 lines · David Howells
certs/Makefile line 10
Quoted 3 lines · Eric Snowberg
certs/Makefile +3
-0+ifeq ($(CONFIG_SYSTEM_REVOCATION_LIST),y) +obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += revocation_certificates.o +endifShould the ifeq be referring to
CONFIG_SYSTEM_REVOCATION_KEYSrather thanCONFIG_SYSTEM_REVOCATION_LIST? In fact, sinceS_R_Kdepends indirectly onS_B_K, you should be able to just do:
Quoted 1 line
+obj-$(CONFIG_SYSTEM_REVOCATION_KEYS) += revocation_certificates.o
Since S_R_K is a string, I could not get that to work. I could get this to work:
obj-$(CONFIG_SYSTEM_REVOCATION_LIST) += revocation_certificates.o
If there is another way of doing this with S_R_K instead, let me know.
Quoted 3 lines
Quoted 1 line
+#ifdef
CONFIG_SYSTEM_REVOCATION_LISTHere also?
When S_R_L is defined, S_R_K will also always be defined too. Either as an empty string or a path to a file. With my change, it works the same as the current code in CONFIG_SYSTEM_TRUSTED_KEYS and CONFIG_SYSTEM_TRUSTED_KEYRING, which also uses the extract_certs script. It can properly handle a NULL string. If I changed it to S_R_K here, it seems confusing to me, since one might assume it is only defined when someone adds a string to S_R_K. But, I can change it if you’d like.
Quoted 3 lines
Quoted 1 line
+ hostprogs-always-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += extract-cert
And here too?
David Howells
maintainerQuoted 1 line · Eric Snowberg
Since
S_R_Kis a string, I could not get that to work.
Okay.
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ hostprogs-always-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += extract-cert
I think this should then refer to CONFIG_SYSTEM_REVOCATION_LIST.
David
Jarkko Sakkinen
maintainerQuoted 1 line · Eric Snowberg
This fixes a build issue when
x509_revocation_listis not defined.
"Fix a"
Let's stick to the imperative form in commit messages.
Quoted 81 lines
$ make ARCH=x86_64 O=build64 all
EXTRACT_CERTS../
At main.c:154:
- SSL error:0909006C:PEM routines:get_name:no start line:crypto/pem/pem_lib.c:745
extract-cert: ../: Is a directory
make[2]: [../certs/Makefile:119:certs/x509_revocation_list] Error 1 (ignored)When the new
CONFIG_SYSTEM_REVOCATION_LISTwas added [1], it was not carried into the code for preloading the revocation certificates [2]. Change from using the originalCONFIG_SYSTEM_BLACKLIST_KEYRINGto the newCONFIG_SYSTEM_REVOCATION_LIST.[1] https://lore.kernel.org/keyrings/[email protected]/T/#m562c1b27bf402190e7bb573ad20eff5b6310d08f
[2] https://lore.kernel.org/keyrings/[email protected]/T/#m07e258bf019ccbac23820fad5192ceffa74fc6abReported-by Randy Dunlap <[email protected]>Signed-off-by Eric Snowberg <[email protected]>--- certs/Makefile | 7 +++++-- certs/blacklist.c | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-)certs/Makefile +5
-2@@ -4,7 +4,10 @@ # obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o common.o -obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o revocation_certificates.o common.o +obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o common.o +ifeq ($(CONFIG_SYSTEM_REVOCATION_LIST),y) +obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += revocation_certificates.o +endif ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),"") obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o else@@ -105,7 +108,7 @@ $(obj)/signing_key.x509: scripts/extract-cert $(X509_DEP) FORCE $(call if_changed,extract_certs,$(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY)) endif # CONFIG_MODULE_SIG -ifeq ($(CONFIG_SYSTEM_BLACKLIST_KEYRING),y) +ifeq ($(CONFIG_SYSTEM_REVOCATION_LIST),y) $(eval $(call config_filename,SYSTEM_REVOCATION_KEYS))certs/blacklist.c +4
-0@@ -21,8 +21,10 @@static struct key *blacklist_keyring; +#ifdef CONFIG_SYSTEM_REVOCATION_LIST extern __initconst const u8 revocation_certificate_list[];extern __initconst const unsigned long revocation_certificate_list_size; +#endif /* * The description must be a type prefix, a colon and then an even number of @@ -225,6 +227,7 @@ static int __init blacklist_init(void)*/ device_initcall (blacklist_init); +#ifdef CONFIG_SYSTEM_REVOCATION_LIST /* * Load the compiled-in list of revocation X.509 certificates. */ @@ -237,3 +240,4 @@ static __init int load_revocation_certificate_list(void) blacklist_keyring); }late_initcall (load_revocation_certificate_list); +#endif Signature · 1 line
2.18.4
Code change looks good.
/Jarkko