2019-05-19 19:07:45 +07:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2012-05-11 16:56:56 +07:00
|
|
|
#
|
|
|
|
# Key management configuration
|
|
|
|
#
|
|
|
|
|
|
|
|
config KEYS
|
|
|
|
bool "Enable access key retention support"
|
2013-09-24 16:35:18 +07:00
|
|
|
select ASSOCIATIVE_ARRAY
|
2012-05-11 16:56:56 +07:00
|
|
|
help
|
|
|
|
This option provides support for retaining authentication tokens and
|
|
|
|
access keys in the kernel.
|
|
|
|
|
|
|
|
It also includes provision of methods by which such keys might be
|
|
|
|
associated with a process so that network filesystems, encryption
|
|
|
|
support and the like can find them.
|
|
|
|
|
|
|
|
Furthermore, a special type of key is available that acts as keyring:
|
|
|
|
a searchable sequence of keys. Each process is equipped with access
|
|
|
|
to five standard keyrings: UID-specific, GID-specific, session,
|
|
|
|
process and thread.
|
|
|
|
|
|
|
|
If you are unsure as to whether this is required, answer N.
|
|
|
|
|
2017-06-08 20:47:26 +07:00
|
|
|
config KEYS_COMPAT
|
|
|
|
def_bool y
|
|
|
|
depends on COMPAT && KEYS
|
|
|
|
|
2013-09-24 16:35:19 +07:00
|
|
|
config PERSISTENT_KEYRINGS
|
|
|
|
bool "Enable register of persistent per-UID keyrings"
|
|
|
|
depends on KEYS
|
|
|
|
help
|
|
|
|
This option provides a register of persistent per-UID keyrings,
|
|
|
|
primarily aimed at Kerberos key storage. The keyrings are persistent
|
|
|
|
in the sense that they stay around after all processes of that UID
|
|
|
|
have exited, not that they survive the machine being rebooted.
|
|
|
|
|
|
|
|
A particular keyring may be accessed by either the user whose keyring
|
|
|
|
it is or by a process with administrative privileges. The active
|
|
|
|
LSMs gets to rule on which admin-level processes get to access the
|
|
|
|
cache.
|
|
|
|
|
|
|
|
Keyrings are created and added into the register upon demand and get
|
|
|
|
removed if they expire (a default timeout is set upon creation).
|
|
|
|
|
2013-09-24 16:35:18 +07:00
|
|
|
config BIG_KEYS
|
2013-10-30 18:15:23 +07:00
|
|
|
bool "Large payload keys"
|
2013-09-24 16:35:18 +07:00
|
|
|
depends on KEYS
|
|
|
|
depends on TMPFS
|
2017-10-04 17:27:00 +07:00
|
|
|
select CRYPTO
|
2016-04-13 01:54:58 +07:00
|
|
|
select CRYPTO_AES
|
security/keys: rewrite all of big_key crypto
This started out as just replacing the use of crypto/rng with
get_random_bytes_wait, so that we wouldn't use bad randomness at boot
time. But, upon looking further, it appears that there were even deeper
underlying cryptographic problems, and that this seems to have been
committed with very little crypto review. So, I rewrote the whole thing,
trying to keep to the conventions introduced by the previous author, to
fix these cryptographic flaws.
It makes no sense to seed crypto/rng at boot time and then keep
using it like this, when in fact there's already get_random_bytes_wait,
which can ensure there's enough entropy and be a much more standard way
of generating keys. Since this sensitive material is being stored
untrusted, using ECB and no authentication is simply not okay at all. I
find it surprising and a bit horrifying that this code even made it past
basic crypto review, which perhaps points to some larger issues. This
patch moves from using AES-ECB to using AES-GCM. Since keys are uniquely
generated each time, we can set the nonce to zero. There was also a race
condition in which the same key would be reused at the same time in
different threads. A mutex fixes this issue now.
So, to summarize, this commit fixes the following vulnerabilities:
* Low entropy key generation, allowing an attacker to potentially
guess or predict keys.
* Unauthenticated encryption, allowing an attacker to modify the
cipher text in particular ways in order to manipulate the plaintext,
which is is even more frightening considering the next point.
* Use of ECB mode, allowing an attacker to trivially swap blocks or
compare identical plaintext blocks.
* Key re-use.
* Faulty memory zeroing.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Eric Biggers <ebiggers3@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Kirill Marinushkin <k.marinushkin@gmail.com>
Cc: security@kernel.org
Cc: stable@vger.kernel.org
2017-09-20 21:58:39 +07:00
|
|
|
select CRYPTO_GCM
|
2013-09-24 16:35:18 +07:00
|
|
|
help
|
|
|
|
This option provides support for holding large keys within the kernel
|
|
|
|
(for example Kerberos ticket caches). The data may be stored out to
|
|
|
|
swapspace by tmpfs.
|
|
|
|
|
|
|
|
If you are unsure as to whether this is required, answer N.
|
|
|
|
|
2012-05-11 16:56:56 +07:00
|
|
|
config TRUSTED_KEYS
|
|
|
|
tristate "TRUSTED KEYS"
|
|
|
|
depends on KEYS && TCG_TPM
|
|
|
|
select CRYPTO
|
|
|
|
select CRYPTO_HMAC
|
|
|
|
select CRYPTO_SHA1
|
2015-11-06 02:43:06 +07:00
|
|
|
select CRYPTO_HASH_INFO
|
2012-05-11 16:56:56 +07:00
|
|
|
help
|
|
|
|
This option provides support for creating, sealing, and unsealing
|
|
|
|
keys in the kernel. Trusted keys are random number symmetric keys,
|
|
|
|
generated and RSA-sealed by the TPM. The TPM only unseals the keys,
|
|
|
|
if the boot PCRs and other criteria match. Userspace will only ever
|
|
|
|
see encrypted blobs.
|
|
|
|
|
|
|
|
If you are unsure as to whether this is required, answer N.
|
|
|
|
|
|
|
|
config ENCRYPTED_KEYS
|
|
|
|
tristate "ENCRYPTED KEYS"
|
|
|
|
depends on KEYS
|
|
|
|
select CRYPTO
|
|
|
|
select CRYPTO_HMAC
|
|
|
|
select CRYPTO_AES
|
|
|
|
select CRYPTO_CBC
|
|
|
|
select CRYPTO_SHA256
|
|
|
|
select CRYPTO_RNG
|
|
|
|
help
|
|
|
|
This option provides support for create/encrypting/decrypting keys
|
|
|
|
in the kernel. Encrypted keys are kernel generated random numbers,
|
|
|
|
which are encrypted/decrypted with a 'master' symmetric key. The
|
|
|
|
'master' key can be either a trusted-key or user-key type.
|
|
|
|
Userspace only ever sees/stores encrypted blobs.
|
|
|
|
|
|
|
|
If you are unsure as to whether this is required, answer N.
|
2016-04-13 01:54:58 +07:00
|
|
|
|
|
|
|
config KEY_DH_OPERATIONS
|
|
|
|
bool "Diffie-Hellman operations on retained keys"
|
|
|
|
depends on KEYS
|
2017-04-11 18:07:07 +07:00
|
|
|
select CRYPTO
|
2016-08-20 01:39:09 +07:00
|
|
|
select CRYPTO_HASH
|
2017-06-08 20:50:11 +07:00
|
|
|
select CRYPTO_DH
|
2016-04-13 01:54:58 +07:00
|
|
|
help
|
|
|
|
This option provides support for calculating Diffie-Hellman
|
|
|
|
public keys and shared secrets using values stored as keys
|
|
|
|
in the kernel.
|
|
|
|
|
|
|
|
If you are unsure as to whether this is required, answer N.
|