xref: /kernel/linux/linux-6.6/certs/Kconfig (revision 62306a36)
162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_cimenu "Certificates for signature checking"
362306a36Sopenharmony_ci
462306a36Sopenharmony_ciconfig MODULE_SIG_KEY
562306a36Sopenharmony_ci	string "File name or PKCS#11 URI of module signing key"
662306a36Sopenharmony_ci	default "certs/signing_key.pem"
762306a36Sopenharmony_ci	depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES)
862306a36Sopenharmony_ci	help
962306a36Sopenharmony_ci         Provide the file name of a private key/certificate in PEM format,
1062306a36Sopenharmony_ci         or a PKCS#11 URI according to RFC7512. The file should contain, or
1162306a36Sopenharmony_ci         the URI should identify, both the certificate and its corresponding
1262306a36Sopenharmony_ci         private key.
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci         If this option is unchanged from its default "certs/signing_key.pem",
1562306a36Sopenharmony_ci         then the kernel will automatically generate the private key and
1662306a36Sopenharmony_ci         certificate as described in Documentation/admin-guide/module-signing.rst
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_cichoice
1962306a36Sopenharmony_ci	prompt "Type of module signing key to be generated"
2062306a36Sopenharmony_ci	depends on MODULE_SIG || (IMA_APPRAISE_MODSIG && MODULES)
2162306a36Sopenharmony_ci	help
2262306a36Sopenharmony_ci	 The type of module signing key type to generate. This option
2362306a36Sopenharmony_ci	 does not apply if a #PKCS11 URI is used.
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciconfig MODULE_SIG_KEY_TYPE_RSA
2662306a36Sopenharmony_ci	bool "RSA"
2762306a36Sopenharmony_ci	help
2862306a36Sopenharmony_ci	 Use an RSA key for module signing.
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciconfig MODULE_SIG_KEY_TYPE_ECDSA
3162306a36Sopenharmony_ci	bool "ECDSA"
3262306a36Sopenharmony_ci	select CRYPTO_ECDSA
3362306a36Sopenharmony_ci	help
3462306a36Sopenharmony_ci	 Use an elliptic curve key (NIST P384) for module signing. Consider
3562306a36Sopenharmony_ci	 using a strong hash like sha256 or sha384 for hashing modules.
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci	 Note: Remove all ECDSA signing keys, e.g. certs/signing_key.pem,
3862306a36Sopenharmony_ci	 when falling back to building Linux 5.14 and older kernels.
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciendchoice
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ciconfig SYSTEM_TRUSTED_KEYRING
4362306a36Sopenharmony_ci	bool "Provide system-wide ring of trusted keys"
4462306a36Sopenharmony_ci	depends on KEYS
4562306a36Sopenharmony_ci	depends on ASYMMETRIC_KEY_TYPE
4662306a36Sopenharmony_ci	depends on X509_CERTIFICATE_PARSER = y
4762306a36Sopenharmony_ci	help
4862306a36Sopenharmony_ci	  Provide a system keyring to which trusted keys can be added.  Keys in
4962306a36Sopenharmony_ci	  the keyring are considered to be trusted.  Keys may be added at will
5062306a36Sopenharmony_ci	  by the kernel from compiled-in data and from hardware key stores, but
5162306a36Sopenharmony_ci	  userspace may only add extra keys if those keys can be verified by
5262306a36Sopenharmony_ci	  keys already in the keyring.
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci	  Keys in this keyring are used by module signature checking.
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ciconfig SYSTEM_TRUSTED_KEYS
5762306a36Sopenharmony_ci	string "Additional X.509 keys for default system keyring"
5862306a36Sopenharmony_ci	depends on SYSTEM_TRUSTED_KEYRING
5962306a36Sopenharmony_ci	help
6062306a36Sopenharmony_ci	  If set, this option should be the filename of a PEM-formatted file
6162306a36Sopenharmony_ci	  containing trusted X.509 certificates to be included in the default
6262306a36Sopenharmony_ci	  system keyring. Any certificate used for module signing is implicitly
6362306a36Sopenharmony_ci	  also trusted.
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci	  NOTE: If you previously provided keys for the system keyring in the
6662306a36Sopenharmony_ci	  form of DER-encoded *.x509 files in the top-level build directory,
6762306a36Sopenharmony_ci	  those are no longer used. You will need to set this option instead.
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ciconfig SYSTEM_EXTRA_CERTIFICATE
7062306a36Sopenharmony_ci	bool "Reserve area for inserting a certificate without recompiling"
7162306a36Sopenharmony_ci	depends on SYSTEM_TRUSTED_KEYRING
7262306a36Sopenharmony_ci	help
7362306a36Sopenharmony_ci	  If set, space for an extra certificate will be reserved in the kernel
7462306a36Sopenharmony_ci	  image. This allows introducing a trusted certificate to the default
7562306a36Sopenharmony_ci	  system keyring without recompiling the kernel.
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciconfig SYSTEM_EXTRA_CERTIFICATE_SIZE
7862306a36Sopenharmony_ci	int "Number of bytes to reserve for the extra certificate"
7962306a36Sopenharmony_ci	depends on SYSTEM_EXTRA_CERTIFICATE
8062306a36Sopenharmony_ci	default 4096
8162306a36Sopenharmony_ci	help
8262306a36Sopenharmony_ci	  This is the number of bytes reserved in the kernel image for a
8362306a36Sopenharmony_ci	  certificate to be inserted.
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ciconfig SECONDARY_TRUSTED_KEYRING
8662306a36Sopenharmony_ci	bool "Provide a keyring to which extra trustable keys may be added"
8762306a36Sopenharmony_ci	depends on SYSTEM_TRUSTED_KEYRING
8862306a36Sopenharmony_ci	help
8962306a36Sopenharmony_ci	  If set, provide a keyring to which extra keys may be added, provided
9062306a36Sopenharmony_ci	  those keys are not blacklisted and are vouched for by a key built
9162306a36Sopenharmony_ci	  into the kernel or already in the secondary trusted keyring.
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ciconfig SYSTEM_BLACKLIST_KEYRING
9462306a36Sopenharmony_ci	bool "Provide system-wide ring of blacklisted keys"
9562306a36Sopenharmony_ci	depends on KEYS
9662306a36Sopenharmony_ci	help
9762306a36Sopenharmony_ci	  Provide a system keyring to which blacklisted keys can be added.
9862306a36Sopenharmony_ci	  Keys in the keyring are considered entirely untrusted.  Keys in this
9962306a36Sopenharmony_ci	  keyring are used by the module signature checking to reject loading
10062306a36Sopenharmony_ci	  of modules signed with a blacklisted key.
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ciconfig SYSTEM_BLACKLIST_HASH_LIST
10362306a36Sopenharmony_ci	string "Hashes to be preloaded into the system blacklist keyring"
10462306a36Sopenharmony_ci	depends on SYSTEM_BLACKLIST_KEYRING
10562306a36Sopenharmony_ci	help
10662306a36Sopenharmony_ci	  If set, this option should be the filename of a list of hashes in the
10762306a36Sopenharmony_ci	  form "<hash>", "<hash>", ... .  This will be included into a C
10862306a36Sopenharmony_ci	  wrapper to incorporate the list into the kernel.  Each <hash> must be a
10962306a36Sopenharmony_ci	  string starting with a prefix ("tbs" or "bin"), then a colon (":"), and
11062306a36Sopenharmony_ci	  finally an even number of hexadecimal lowercase characters (up to 128).
11162306a36Sopenharmony_ci	  Certificate hashes can be generated with
11262306a36Sopenharmony_ci	  tools/certs/print-cert-tbs-hash.sh .
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ciconfig SYSTEM_REVOCATION_LIST
11562306a36Sopenharmony_ci	bool "Provide system-wide ring of revocation certificates"
11662306a36Sopenharmony_ci	depends on SYSTEM_BLACKLIST_KEYRING
11762306a36Sopenharmony_ci	depends on PKCS7_MESSAGE_PARSER=y
11862306a36Sopenharmony_ci	help
11962306a36Sopenharmony_ci	  If set, this allows revocation certificates to be stored in the
12062306a36Sopenharmony_ci	  blacklist keyring and implements a hook whereby a PKCS#7 message can
12162306a36Sopenharmony_ci	  be checked to see if it matches such a certificate.
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ciconfig SYSTEM_REVOCATION_KEYS
12462306a36Sopenharmony_ci	string "X.509 certificates to be preloaded into the system blacklist keyring"
12562306a36Sopenharmony_ci	depends on SYSTEM_REVOCATION_LIST
12662306a36Sopenharmony_ci	help
12762306a36Sopenharmony_ci	  If set, this option should be the filename of a PEM-formatted file
12862306a36Sopenharmony_ci	  containing X.509 certificates to be included in the default blacklist
12962306a36Sopenharmony_ci	  keyring.
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ciconfig SYSTEM_BLACKLIST_AUTH_UPDATE
13262306a36Sopenharmony_ci	bool "Allow root to add signed blacklist keys"
13362306a36Sopenharmony_ci	depends on SYSTEM_BLACKLIST_KEYRING
13462306a36Sopenharmony_ci	depends on SYSTEM_DATA_VERIFICATION
13562306a36Sopenharmony_ci	help
13662306a36Sopenharmony_ci	  If set, provide the ability to load new blacklist keys at run time if
13762306a36Sopenharmony_ci	  they are signed and vouched by a certificate from the builtin trusted
13862306a36Sopenharmony_ci	  keyring.  The PKCS#7 signature of the description is set in the key
13962306a36Sopenharmony_ci	  payload.  Blacklist keys cannot be removed.
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ciendmenu
142