xref: /linux/certs/Kconfig (revision c17ee635fd3a482b2ad2bf5e269755c2eae5f25e)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
2cfc411e7SDavid Howellsmenu "Certificates for signature checking"
3cfc411e7SDavid Howells
4cfc411e7SDavid Howellsconfig MODULE_SIG_KEY
5cfc411e7SDavid Howells	string "File name or PKCS#11 URI of module signing key"
6cfc411e7SDavid Howells	default "certs/signing_key.pem"
7781a5739SNayna Jain	depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES)
8cfc411e7SDavid Howells	help
9cfc411e7SDavid Howells         Provide the file name of a private key/certificate in PEM format,
10cfc411e7SDavid Howells         or a PKCS#11 URI according to RFC7512. The file should contain, or
11cfc411e7SDavid Howells         the URI should identify, both the certificate and its corresponding
12cfc411e7SDavid Howells         private key.
13cfc411e7SDavid Howells
14cfc411e7SDavid Howells         If this option is unchanged from its default "certs/signing_key.pem",
15cfc411e7SDavid Howells         then the kernel will automatically generate the private key and
165fb94e9cSMauro Carvalho Chehab         certificate as described in Documentation/admin-guide/module-signing.rst
17cfc411e7SDavid Howells
18a4aed36eSStefan Bergerchoice
19a4aed36eSStefan Berger	prompt "Type of module signing key to be generated"
20be0d5fa7SMasahiro Yamada	depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES)
21a4aed36eSStefan Berger	help
22a4aed36eSStefan Berger	 The type of module signing key type to generate. This option
23a4aed36eSStefan Berger	 does not apply if a #PKCS11 URI is used.
24a4aed36eSStefan Berger
25a4aed36eSStefan Bergerconfig MODULE_SIG_KEY_TYPE_RSA
26a4aed36eSStefan Berger	bool "RSA"
27a4aed36eSStefan Berger	help
28a4aed36eSStefan Berger	 Use an RSA key for module signing.
29a4aed36eSStefan Berger
30a4aed36eSStefan Bergerconfig MODULE_SIG_KEY_TYPE_ECDSA
31a4aed36eSStefan Berger	bool "ECDSA"
32a4aed36eSStefan Berger	select CRYPTO_ECDSA
33446b1e0bSDimitri John Ledkov	depends on !(MODULE_SIG_SHA256 || MODULE_SIG_SHA3_256)
34a4aed36eSStefan Berger	help
35d4f5bfe2SDimitri John Ledkov	 Use an elliptic curve key (NIST P384) for module signing. Use
36d4f5bfe2SDimitri John Ledkov	 a strong hash of same or higher bit length, i.e. sha384 or
37d4f5bfe2SDimitri John Ledkov	 sha512 for hashing modules.
38a4aed36eSStefan Berger
39a4aed36eSStefan Berger	 Note: Remove all ECDSA signing keys, e.g. certs/signing_key.pem,
40a4aed36eSStefan Berger	 when falling back to building Linux 5.14 and older kernels.
41a4aed36eSStefan Berger
42*0ad9a719SDavid Howellsconfig MODULE_SIG_KEY_TYPE_MLDSA_44
43*0ad9a719SDavid Howells	bool "ML-DSA-44"
44*0ad9a719SDavid Howells	select CRYPTO_MLDSA
45*0ad9a719SDavid Howells	depends on OPENSSL_SUPPORTS_ML_DSA
46*0ad9a719SDavid Howells	help
47*0ad9a719SDavid Howells	  Use an ML-DSA-44 key (NIST FIPS 204) for module signing.  ML-DSA
48*0ad9a719SDavid Howells	  support requires OpenSSL-3.5 minimum; preferably OpenSSL-4+.  With
49*0ad9a719SDavid Howells	  the latter, the entire module body will be signed; with the former,
50*0ad9a719SDavid Howells	  signedAttrs will be used as it lacks support for CMS_NOATTR with
51*0ad9a719SDavid Howells	  ML-DSA.
52*0ad9a719SDavid Howells
53*0ad9a719SDavid Howellsconfig MODULE_SIG_KEY_TYPE_MLDSA_65
54*0ad9a719SDavid Howells	bool "ML-DSA-65"
55*0ad9a719SDavid Howells	select CRYPTO_MLDSA
56*0ad9a719SDavid Howells	depends on OPENSSL_SUPPORTS_ML_DSA
57*0ad9a719SDavid Howells	help
58*0ad9a719SDavid Howells	  Use an ML-DSA-65 key (NIST FIPS 204) for module signing.  ML-DSA
59*0ad9a719SDavid Howells	  support requires OpenSSL-3.5 minimum; preferably OpenSSL-4+.  With
60*0ad9a719SDavid Howells	  the latter, the entire module body will be signed; with the former,
61*0ad9a719SDavid Howells	  signedAttrs will be used as it lacks support for CMS_NOATTR with
62*0ad9a719SDavid Howells	  ML-DSA.
63*0ad9a719SDavid Howells
64*0ad9a719SDavid Howellsconfig MODULE_SIG_KEY_TYPE_MLDSA_87
65*0ad9a719SDavid Howells	bool "ML-DSA-87"
66*0ad9a719SDavid Howells	select CRYPTO_MLDSA
67*0ad9a719SDavid Howells	depends on OPENSSL_SUPPORTS_ML_DSA
68*0ad9a719SDavid Howells	help
69*0ad9a719SDavid Howells	  Use an ML-DSA-87 key (NIST FIPS 204) for module signing.  ML-DSA
70*0ad9a719SDavid Howells	  support requires OpenSSL-3.5 minimum; preferably OpenSSL-4+.  With
71*0ad9a719SDavid Howells	  the latter, the entire module body will be signed; with the former,
72*0ad9a719SDavid Howells	  signedAttrs will be used as it lacks support for CMS_NOATTR with
73*0ad9a719SDavid Howells	  ML-DSA.
74*0ad9a719SDavid Howells
75a4aed36eSStefan Bergerendchoice
76a4aed36eSStefan Berger
77cfc411e7SDavid Howellsconfig SYSTEM_TRUSTED_KEYRING
78cfc411e7SDavid Howells	bool "Provide system-wide ring of trusted keys"
79cfc411e7SDavid Howells	depends on KEYS
8099716b7cSDavid Howells	depends on ASYMMETRIC_KEY_TYPE
812154aca2SMasahiro Yamada	depends on X509_CERTIFICATE_PARSER = y
82cfc411e7SDavid Howells	help
83cfc411e7SDavid Howells	  Provide a system keyring to which trusted keys can be added.  Keys in
84cfc411e7SDavid Howells	  the keyring are considered to be trusted.  Keys may be added at will
85cfc411e7SDavid Howells	  by the kernel from compiled-in data and from hardware key stores, but
86cfc411e7SDavid Howells	  userspace may only add extra keys if those keys can be verified by
87cfc411e7SDavid Howells	  keys already in the keyring.
88cfc411e7SDavid Howells
89cfc411e7SDavid Howells	  Keys in this keyring are used by module signature checking.
90cfc411e7SDavid Howells
91cfc411e7SDavid Howellsconfig SYSTEM_TRUSTED_KEYS
92cfc411e7SDavid Howells	string "Additional X.509 keys for default system keyring"
93cfc411e7SDavid Howells	depends on SYSTEM_TRUSTED_KEYRING
94cfc411e7SDavid Howells	help
95cfc411e7SDavid Howells	  If set, this option should be the filename of a PEM-formatted file
96cfc411e7SDavid Howells	  containing trusted X.509 certificates to be included in the default
97cfc411e7SDavid Howells	  system keyring. Any certificate used for module signing is implicitly
98cfc411e7SDavid Howells	  also trusted.
99cfc411e7SDavid Howells
100cfc411e7SDavid Howells	  NOTE: If you previously provided keys for the system keyring in the
101cfc411e7SDavid Howells	  form of DER-encoded *.x509 files in the top-level build directory,
102cfc411e7SDavid Howells	  those are no longer used. You will need to set this option instead.
103cfc411e7SDavid Howells
104c4c36105SMehmet Kayaalpconfig SYSTEM_EXTRA_CERTIFICATE
105c4c36105SMehmet Kayaalp	bool "Reserve area for inserting a certificate without recompiling"
106c4c36105SMehmet Kayaalp	depends on SYSTEM_TRUSTED_KEYRING
107c4c36105SMehmet Kayaalp	help
108c4c36105SMehmet Kayaalp	  If set, space for an extra certificate will be reserved in the kernel
109c4c36105SMehmet Kayaalp	  image. This allows introducing a trusted certificate to the default
110c4c36105SMehmet Kayaalp	  system keyring without recompiling the kernel.
111c4c36105SMehmet Kayaalp
112c4c36105SMehmet Kayaalpconfig SYSTEM_EXTRA_CERTIFICATE_SIZE
113c4c36105SMehmet Kayaalp	int "Number of bytes to reserve for the extra certificate"
114c4c36105SMehmet Kayaalp	depends on SYSTEM_EXTRA_CERTIFICATE
115c4c36105SMehmet Kayaalp	default 4096
116c4c36105SMehmet Kayaalp	help
117c4c36105SMehmet Kayaalp	  This is the number of bytes reserved in the kernel image for a
118c4c36105SMehmet Kayaalp	  certificate to be inserted.
119c4c36105SMehmet Kayaalp
120d3bfe841SDavid Howellsconfig SECONDARY_TRUSTED_KEYRING
121d3bfe841SDavid Howells	bool "Provide a keyring to which extra trustable keys may be added"
122d3bfe841SDavid Howells	depends on SYSTEM_TRUSTED_KEYRING
123d3bfe841SDavid Howells	help
124d3bfe841SDavid Howells	  If set, provide a keyring to which extra keys may be added, provided
125d3bfe841SDavid Howells	  those keys are not blacklisted and are vouched for by a key built
126b4650306SMimi Zohar	  into the kernel, machine keyring (if configured), or already in the
127b4650306SMimi Zohar	  secondary trusted keyring.
128b4650306SMimi Zohar
129b4650306SMimi Zoharconfig SECONDARY_TRUSTED_KEYRING_SIGNED_BY_BUILTIN
130b4650306SMimi Zohar	bool "Only allow additional certs signed by keys on the builtin trusted keyring"
131b4650306SMimi Zohar	depends on SECONDARY_TRUSTED_KEYRING
132b4650306SMimi Zohar	help
133b4650306SMimi Zohar	  If set, only certificates signed by keys on the builtin trusted
134b4650306SMimi Zohar	  keyring may be loaded onto the secondary trusted keyring.
135b4650306SMimi Zohar
136b4650306SMimi Zohar	  Note: The machine keyring, if configured, will be linked to the
137b4650306SMimi Zohar	  secondary keyring.  When enabling this option, it is recommended
138b4650306SMimi Zohar	  to also configure INTEGRITY_CA_MACHINE_KEYRING_MAX to prevent
139b4650306SMimi Zohar	  linking code signing keys with imputed trust to the secondary
140b4650306SMimi Zohar	  trusted keyring.
141d3bfe841SDavid Howells
142734114f8SDavid Howellsconfig SYSTEM_BLACKLIST_KEYRING
143734114f8SDavid Howells	bool "Provide system-wide ring of blacklisted keys"
144734114f8SDavid Howells	depends on KEYS
145734114f8SDavid Howells	help
146734114f8SDavid Howells	  Provide a system keyring to which blacklisted keys can be added.
147734114f8SDavid Howells	  Keys in the keyring are considered entirely untrusted.  Keys in this
148734114f8SDavid Howells	  keyring are used by the module signature checking to reject loading
149734114f8SDavid Howells	  of modules signed with a blacklisted key.
150734114f8SDavid Howells
151734114f8SDavid Howellsconfig SYSTEM_BLACKLIST_HASH_LIST
152734114f8SDavid Howells	string "Hashes to be preloaded into the system blacklist keyring"
153734114f8SDavid Howells	depends on SYSTEM_BLACKLIST_KEYRING
154734114f8SDavid Howells	help
155734114f8SDavid Howells	  If set, this option should be the filename of a list of hashes in the
156734114f8SDavid Howells	  form "<hash>", "<hash>", ... .  This will be included into a C
157addf4663SMickaël Salaün	  wrapper to incorporate the list into the kernel.  Each <hash> must be a
158addf4663SMickaël Salaün	  string starting with a prefix ("tbs" or "bin"), then a colon (":"), and
159addf4663SMickaël Salaün	  finally an even number of hexadecimal lowercase characters (up to 128).
160addf4663SMickaël Salaün	  Certificate hashes can be generated with
161addf4663SMickaël Salaün	  tools/certs/print-cert-tbs-hash.sh .
162734114f8SDavid Howells
16356c58126SEric Snowbergconfig SYSTEM_REVOCATION_LIST
16456c58126SEric Snowberg	bool "Provide system-wide ring of revocation certificates"
16556c58126SEric Snowberg	depends on SYSTEM_BLACKLIST_KEYRING
16656c58126SEric Snowberg	depends on PKCS7_MESSAGE_PARSER=y
16756c58126SEric Snowberg	help
16856c58126SEric Snowberg	  If set, this allows revocation certificates to be stored in the
16956c58126SEric Snowberg	  blacklist keyring and implements a hook whereby a PKCS#7 message can
17056c58126SEric Snowberg	  be checked to see if it matches such a certificate.
17156c58126SEric Snowberg
172d1f04410SEric Snowbergconfig SYSTEM_REVOCATION_KEYS
173d1f04410SEric Snowberg	string "X.509 certificates to be preloaded into the system blacklist keyring"
174d1f04410SEric Snowberg	depends on SYSTEM_REVOCATION_LIST
175d1f04410SEric Snowberg	help
176d1f04410SEric Snowberg	  If set, this option should be the filename of a PEM-formatted file
177d1f04410SEric Snowberg	  containing X.509 certificates to be included in the default blacklist
178d1f04410SEric Snowberg	  keyring.
179d1f04410SEric Snowberg
1806364d106SMickaël Salaünconfig SYSTEM_BLACKLIST_AUTH_UPDATE
1816364d106SMickaël Salaün	bool "Allow root to add signed blacklist keys"
1826364d106SMickaël Salaün	depends on SYSTEM_BLACKLIST_KEYRING
1836364d106SMickaël Salaün	depends on SYSTEM_DATA_VERIFICATION
1846364d106SMickaël Salaün	help
1856364d106SMickaël Salaün	  If set, provide the ability to load new blacklist keys at run time if
1866364d106SMickaël Salaün	  they are signed and vouched by a certificate from the builtin trusted
1876364d106SMickaël Salaün	  keyring.  The PKCS#7 signature of the description is set in the key
1886364d106SMickaël Salaün	  payload.  Blacklist keys cannot be removed.
1896364d106SMickaël Salaün
190*0ad9a719SDavid Howellsconfig OPENSSL_SUPPORTS_ML_DSA
191*0ad9a719SDavid Howells	def_bool $(success, openssl list -key-managers | grep -q ML-DSA-87)
192*0ad9a719SDavid Howells	help
193*0ad9a719SDavid Howells	  Support for ML-DSA-44/65/87 was added in openssl-3.5, so as long
194*0ad9a719SDavid Howells	  as older versions are supported, the key types may only be
195*0ad9a719SDavid Howells	  set after testing the installed binary for support.
196*0ad9a719SDavid Howells
197cfc411e7SDavid Howellsendmenu
198