xref: /linux/certs/Kconfig (revision a4aed36ed5924a05ecfadc470584188bfba2b928)
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
18*a4aed36eSStefan Bergerchoice
19*a4aed36eSStefan Berger	prompt "Type of module signing key to be generated"
20*a4aed36eSStefan Berger	default MODULE_SIG_KEY_TYPE_RSA
21*a4aed36eSStefan Berger	help
22*a4aed36eSStefan Berger	 The type of module signing key type to generate. This option
23*a4aed36eSStefan Berger	 does not apply if a #PKCS11 URI is used.
24*a4aed36eSStefan Berger
25*a4aed36eSStefan Bergerconfig MODULE_SIG_KEY_TYPE_RSA
26*a4aed36eSStefan Berger	bool "RSA"
27*a4aed36eSStefan Berger	depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES)
28*a4aed36eSStefan Berger	help
29*a4aed36eSStefan Berger	 Use an RSA key for module signing.
30*a4aed36eSStefan Berger
31*a4aed36eSStefan Bergerconfig MODULE_SIG_KEY_TYPE_ECDSA
32*a4aed36eSStefan Berger	bool "ECDSA"
33*a4aed36eSStefan Berger	select CRYPTO_ECDSA
34*a4aed36eSStefan Berger	depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES)
35*a4aed36eSStefan Berger	help
36*a4aed36eSStefan Berger	 Use an elliptic curve key (NIST P384) for module signing. Consider
37*a4aed36eSStefan Berger	 using a strong hash like sha256 or sha384 for hashing modules.
38*a4aed36eSStefan Berger
39*a4aed36eSStefan Berger	 Note: Remove all ECDSA signing keys, e.g. certs/signing_key.pem,
40*a4aed36eSStefan Berger	 when falling back to building Linux 5.14 and older kernels.
41*a4aed36eSStefan Berger
42*a4aed36eSStefan Bergerendchoice
43*a4aed36eSStefan Berger
44cfc411e7SDavid Howellsconfig SYSTEM_TRUSTED_KEYRING
45cfc411e7SDavid Howells	bool "Provide system-wide ring of trusted keys"
46cfc411e7SDavid Howells	depends on KEYS
4799716b7cSDavid Howells	depends on ASYMMETRIC_KEY_TYPE
48cfc411e7SDavid Howells	help
49cfc411e7SDavid Howells	  Provide a system keyring to which trusted keys can be added.  Keys in
50cfc411e7SDavid Howells	  the keyring are considered to be trusted.  Keys may be added at will
51cfc411e7SDavid Howells	  by the kernel from compiled-in data and from hardware key stores, but
52cfc411e7SDavid Howells	  userspace may only add extra keys if those keys can be verified by
53cfc411e7SDavid Howells	  keys already in the keyring.
54cfc411e7SDavid Howells
55cfc411e7SDavid Howells	  Keys in this keyring are used by module signature checking.
56cfc411e7SDavid Howells
57cfc411e7SDavid Howellsconfig SYSTEM_TRUSTED_KEYS
58cfc411e7SDavid Howells	string "Additional X.509 keys for default system keyring"
59cfc411e7SDavid Howells	depends on SYSTEM_TRUSTED_KEYRING
60cfc411e7SDavid Howells	help
61cfc411e7SDavid Howells	  If set, this option should be the filename of a PEM-formatted file
62cfc411e7SDavid Howells	  containing trusted X.509 certificates to be included in the default
63cfc411e7SDavid Howells	  system keyring. Any certificate used for module signing is implicitly
64cfc411e7SDavid Howells	  also trusted.
65cfc411e7SDavid Howells
66cfc411e7SDavid Howells	  NOTE: If you previously provided keys for the system keyring in the
67cfc411e7SDavid Howells	  form of DER-encoded *.x509 files in the top-level build directory,
68cfc411e7SDavid Howells	  those are no longer used. You will need to set this option instead.
69cfc411e7SDavid Howells
70c4c36105SMehmet Kayaalpconfig SYSTEM_EXTRA_CERTIFICATE
71c4c36105SMehmet Kayaalp	bool "Reserve area for inserting a certificate without recompiling"
72c4c36105SMehmet Kayaalp	depends on SYSTEM_TRUSTED_KEYRING
73c4c36105SMehmet Kayaalp	help
74c4c36105SMehmet Kayaalp	  If set, space for an extra certificate will be reserved in the kernel
75c4c36105SMehmet Kayaalp	  image. This allows introducing a trusted certificate to the default
76c4c36105SMehmet Kayaalp	  system keyring without recompiling the kernel.
77c4c36105SMehmet Kayaalp
78c4c36105SMehmet Kayaalpconfig SYSTEM_EXTRA_CERTIFICATE_SIZE
79c4c36105SMehmet Kayaalp	int "Number of bytes to reserve for the extra certificate"
80c4c36105SMehmet Kayaalp	depends on SYSTEM_EXTRA_CERTIFICATE
81c4c36105SMehmet Kayaalp	default 4096
82c4c36105SMehmet Kayaalp	help
83c4c36105SMehmet Kayaalp	  This is the number of bytes reserved in the kernel image for a
84c4c36105SMehmet Kayaalp	  certificate to be inserted.
85c4c36105SMehmet Kayaalp
86d3bfe841SDavid Howellsconfig SECONDARY_TRUSTED_KEYRING
87d3bfe841SDavid Howells	bool "Provide a keyring to which extra trustable keys may be added"
88d3bfe841SDavid Howells	depends on SYSTEM_TRUSTED_KEYRING
89d3bfe841SDavid Howells	help
90d3bfe841SDavid Howells	  If set, provide a keyring to which extra keys may be added, provided
91d3bfe841SDavid Howells	  those keys are not blacklisted and are vouched for by a key built
92d3bfe841SDavid Howells	  into the kernel or already in the secondary trusted keyring.
93d3bfe841SDavid Howells
94734114f8SDavid Howellsconfig SYSTEM_BLACKLIST_KEYRING
95734114f8SDavid Howells	bool "Provide system-wide ring of blacklisted keys"
96734114f8SDavid Howells	depends on KEYS
97734114f8SDavid Howells	help
98734114f8SDavid Howells	  Provide a system keyring to which blacklisted keys can be added.
99734114f8SDavid Howells	  Keys in the keyring are considered entirely untrusted.  Keys in this
100734114f8SDavid Howells	  keyring are used by the module signature checking to reject loading
101734114f8SDavid Howells	  of modules signed with a blacklisted key.
102734114f8SDavid Howells
103734114f8SDavid Howellsconfig SYSTEM_BLACKLIST_HASH_LIST
104734114f8SDavid Howells	string "Hashes to be preloaded into the system blacklist keyring"
105734114f8SDavid Howells	depends on SYSTEM_BLACKLIST_KEYRING
106734114f8SDavid Howells	help
107734114f8SDavid Howells	  If set, this option should be the filename of a list of hashes in the
108734114f8SDavid Howells	  form "<hash>", "<hash>", ... .  This will be included into a C
109734114f8SDavid Howells	  wrapper to incorporate the list into the kernel.  Each <hash> should
110734114f8SDavid Howells	  be a string of hex digits.
111734114f8SDavid Howells
11256c58126SEric Snowbergconfig SYSTEM_REVOCATION_LIST
11356c58126SEric Snowberg	bool "Provide system-wide ring of revocation certificates"
11456c58126SEric Snowberg	depends on SYSTEM_BLACKLIST_KEYRING
11556c58126SEric Snowberg	depends on PKCS7_MESSAGE_PARSER=y
11656c58126SEric Snowberg	help
11756c58126SEric Snowberg	  If set, this allows revocation certificates to be stored in the
11856c58126SEric Snowberg	  blacklist keyring and implements a hook whereby a PKCS#7 message can
11956c58126SEric Snowberg	  be checked to see if it matches such a certificate.
12056c58126SEric Snowberg
121d1f04410SEric Snowbergconfig SYSTEM_REVOCATION_KEYS
122d1f04410SEric Snowberg	string "X.509 certificates to be preloaded into the system blacklist keyring"
123d1f04410SEric Snowberg	depends on SYSTEM_REVOCATION_LIST
124d1f04410SEric Snowberg	help
125d1f04410SEric Snowberg	  If set, this option should be the filename of a PEM-formatted file
126d1f04410SEric Snowberg	  containing X.509 certificates to be included in the default blacklist
127d1f04410SEric Snowberg	  keyring.
128d1f04410SEric Snowberg
129cfc411e7SDavid Howellsendmenu
130