Skip to content

Commit 7cf6a8a

Browse files
committed
Merge tag 'tpmdd-next-v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd
Pull tpm updates from Jarkko Sakkinen: - Tightened validation of key hashes for SYSTEM_BLACKLIST_HASH_LIST. An invalid hash format causes a compilation error. Previously, they got included to the kernel binary but were silently ignored at run-time. - Allow root user to append new hashes to the blacklist keyring. - Trusted keys backed with Cryptographic Acceleration and Assurance Module (CAAM), which part of some of the new NXP's SoC's. Now there is total three hardware backends for trusted keys: TPM, ARM TEE and CAAM. - A scattered set of fixes and small improvements for the TPM driver. * tag 'tpmdd-next-v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd: MAINTAINERS: add KEYS-TRUSTED-CAAM doc: trusted-encrypted: describe new CAAM trust source KEYS: trusted: Introduce support for NXP CAAM-based trusted keys crypto: caam - add in-kernel interface for blob generator crypto: caam - determine whether CAAM supports blob encap/decap KEYS: trusted: allow use of kernel RNG for key material KEYS: trusted: allow use of TEE as backend without TCG_TPM support tpm: Add field upgrade mode support for Infineon TPM2 modules tpm: Fix buffer access in tpm2_get_tpm_pt() char: tpm: cr50_i2c: Suppress duplicated error message in .remove() tpm: cr50: Add new device/vendor ID 0x504a6666 tpm: Remove read16/read32/write32 calls from tpm_tis_phy_ops tpm: ibmvtpm: Correct the return value in tpm_ibmvtpm_probe() tpm/tpm_ftpm_tee: Return true/false (not 1/0) from bool functions certs: Explain the rationale to call panic() certs: Allow root user to append signed hashes to the blacklist keyring certs: Check that builtin blacklist hashes are valid certs: Make blacklist_vet_description() more strict certs: Factor out the blacklist hash creation tools/certs: Add print-cert-tbs-hash.sh
2 parents a9d1046 + 7f3113e commit 7cf6a8a

36 files changed

Lines changed: 1056 additions & 281 deletions

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6081,11 +6081,22 @@
60816081
sources:
60826082
- "tpm"
60836083
- "tee"
6084+
- "caam"
60846085
If not specified then it defaults to iterating through
60856086
the trust source list starting with TPM and assigns the
60866087
first trust source as a backend which is initialized
60876088
successfully during iteration.
60886089

6090+
trusted.rng= [KEYS]
6091+
Format: <string>
6092+
The RNG used to generate key material for trusted keys.
6093+
Can be one of:
6094+
- "kernel"
6095+
- the same value as trusted.source: "tpm" or "tee"
6096+
- "default"
6097+
If not specified, "default" is used. In this case,
6098+
the RNG's choice is left to each individual trust source.
6099+
60896100
tsc= Disable clocksource stability checks for TSC.
60906101
Format: <string>
60916102
[x86] reliable: mark tsc clocksource as reliable, this

Documentation/security/keys/trusted-encrypted.rst

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ safe.
3535
Rooted to Hardware Unique Key (HUK) which is generally burnt in on-chip
3636
fuses and is accessible to TEE only.
3737

38+
(3) CAAM (Cryptographic Acceleration and Assurance Module: IP on NXP SoCs)
39+
40+
When High Assurance Boot (HAB) is enabled and the CAAM is in secure
41+
mode, trust is rooted to the OTPMK, a never-disclosed 256-bit key
42+
randomly generated and fused into each SoC at manufacturing time.
43+
Otherwise, a common fixed test key is used instead.
44+
3845
* Execution isolation
3946

4047
(1) TPM
@@ -46,6 +53,10 @@ safe.
4653
Customizable set of operations running in isolated execution
4754
environment verified via Secure/Trusted boot process.
4855

56+
(3) CAAM
57+
58+
Fixed set of operations running in isolated execution environment.
59+
4960
* Optional binding to platform integrity state
5061

5162
(1) TPM
@@ -63,6 +74,11 @@ safe.
6374
Relies on Secure/Trusted boot process for platform integrity. It can
6475
be extended with TEE based measured boot process.
6576

77+
(3) CAAM
78+
79+
Relies on the High Assurance Boot (HAB) mechanism of NXP SoCs
80+
for platform integrity.
81+
6682
* Interfaces and APIs
6783

6884
(1) TPM
@@ -74,10 +90,13 @@ safe.
7490
TEEs have well-documented, standardized client interface and APIs. For
7591
more details refer to ``Documentation/staging/tee.rst``.
7692

93+
(3) CAAM
94+
95+
Interface is specific to silicon vendor.
7796

7897
* Threat model
7998

80-
The strength and appropriateness of a particular TPM or TEE for a given
99+
The strength and appropriateness of a particular trust source for a given
81100
purpose must be assessed when using them to protect security-relevant data.
82101

83102

@@ -87,22 +106,32 @@ Key Generation
87106
Trusted Keys
88107
------------
89108

90-
New keys are created from random numbers generated in the trust source. They
91-
are encrypted/decrypted using a child key in the storage key hierarchy.
92-
Encryption and decryption of the child key must be protected by a strong
93-
access control policy within the trust source.
109+
New keys are created from random numbers. They are encrypted/decrypted using
110+
a child key in the storage key hierarchy. Encryption and decryption of the
111+
child key must be protected by a strong access control policy within the
112+
trust source. The random number generator in use differs according to the
113+
selected trust source:
94114

95-
* TPM (hardware device) based RNG
115+
* TPM: hardware device based RNG
96116

97-
Strength of random numbers may vary from one device manufacturer to
98-
another.
117+
Keys are generated within the TPM. Strength of random numbers may vary
118+
from one device manufacturer to another.
99119

100-
* TEE (OP-TEE based on Arm TrustZone) based RNG
120+
* TEE: OP-TEE based on Arm TrustZone based RNG
101121

102122
RNG is customizable as per platform needs. It can either be direct output
103123
from platform specific hardware RNG or a software based Fortuna CSPRNG
104124
which can be seeded via multiple entropy sources.
105125

126+
* CAAM: Kernel RNG
127+
128+
The normal kernel random number generator is used. To seed it from the
129+
CAAM HWRNG, enable CRYPTO_DEV_FSL_CAAM_RNG_API and ensure the device
130+
is probed.
131+
132+
Users may override this by specifying ``trusted.rng=kernel`` on the kernel
133+
command-line to override the used RNG with the kernel's random number pool.
134+
106135
Encrypted Keys
107136
--------------
108137

@@ -189,6 +218,19 @@ Usage::
189218
specific to TEE device implementation. The key length for new keys is always
190219
in bytes. Trusted Keys can be 32 - 128 bytes (256 - 1024 bits).
191220

221+
Trusted Keys usage: CAAM
222+
------------------------
223+
224+
Usage::
225+
226+
keyctl add trusted name "new keylen" ring
227+
keyctl add trusted name "load hex_blob" ring
228+
keyctl print keyid
229+
230+
"keyctl print" returns an ASCII hex copy of the sealed key, which is in a
231+
CAAM-specific format. The key length for new keys is always in bytes.
232+
Trusted Keys can be 32 - 128 bytes (256 - 1024 bits).
233+
192234
Encrypted Keys usage
193235
--------------------
194236

MAINTAINERS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4575,7 +4575,9 @@ L: keyrings@vger.kernel.org
45754575
S: Maintained
45764576
F: Documentation/admin-guide/module-signing.rst
45774577
F: certs/
4578+
F: scripts/check-blacklist-hashes.awk
45784579
F: scripts/sign-file.c
4580+
F: tools/certs/
45794581

45804582
CFAG12864B LCD DRIVER
45814583
M: Miguel Ojeda <ojeda@kernel.org>
@@ -10865,6 +10867,15 @@ S: Supported
1086510867
F: include/keys/trusted_tee.h
1086610868
F: security/keys/trusted-keys/trusted_tee.c
1086710869

10870+
KEYS-TRUSTED-CAAM
10871+
M: Ahmad Fatoum <a.fatoum@pengutronix.de>
10872+
R: Pengutronix Kernel Team <kernel@pengutronix.de>
10873+
L: linux-integrity@vger.kernel.org
10874+
L: keyrings@vger.kernel.org
10875+
S: Maintained
10876+
F: include/keys/trusted_caam.h
10877+
F: security/keys/trusted-keys/trusted_caam.c
10878+
1086810879
KEYS/KEYRINGS
1086910880
M: David Howells <dhowells@redhat.com>
1087010881
M: Jarkko Sakkinen <jarkko@kernel.org>

certs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2+
/blacklist_hashes_checked
23
/extract-cert
34
/x509_certificate_list
45
/x509_revocation_list

certs/Kconfig

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,11 @@ config SYSTEM_BLACKLIST_HASH_LIST
104104
help
105105
If set, this option should be the filename of a list of hashes in the
106106
form "<hash>", "<hash>", ... . This will be included into a C
107-
wrapper to incorporate the list into the kernel. Each <hash> should
108-
be a string of hex digits.
107+
wrapper to incorporate the list into the kernel. Each <hash> must be a
108+
string starting with a prefix ("tbs" or "bin"), then a colon (":"), and
109+
finally an even number of hexadecimal lowercase characters (up to 128).
110+
Certificate hashes can be generated with
111+
tools/certs/print-cert-tbs-hash.sh .
109112

110113
config SYSTEM_REVOCATION_LIST
111114
bool "Provide system-wide ring of revocation certificates"
@@ -124,4 +127,14 @@ config SYSTEM_REVOCATION_KEYS
124127
containing X.509 certificates to be included in the default blacklist
125128
keyring.
126129

130+
config SYSTEM_BLACKLIST_AUTH_UPDATE
131+
bool "Allow root to add signed blacklist keys"
132+
depends on SYSTEM_BLACKLIST_KEYRING
133+
depends on SYSTEM_DATA_VERIFICATION
134+
help
135+
If set, provide the ability to load new blacklist keys at run time if
136+
they are signed and vouched by a certificate from the builtin trusted
137+
keyring. The PKCS#7 signature of the description is set in the key
138+
payload. Blacklist keys cannot be removed.
139+
127140
endmenu

certs/Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o c
77
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o common.o
88
obj-$(CONFIG_SYSTEM_REVOCATION_LIST) += revocation_certificates.o
99
ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),)
10+
quiet_cmd_check_blacklist_hashes = CHECK $(patsubst "%",%,$(2))
11+
cmd_check_blacklist_hashes = $(AWK) -f $(srctree)/scripts/check-blacklist-hashes.awk $(2); touch $@
12+
13+
$(eval $(call config_filename,SYSTEM_BLACKLIST_HASH_LIST))
14+
15+
$(obj)/blacklist_hashes.o: $(obj)/blacklist_hashes_checked
16+
17+
CFLAGS_blacklist_hashes.o += -I$(srctree)
18+
19+
targets += blacklist_hashes_checked
20+
$(obj)/blacklist_hashes_checked: $(SYSTEM_BLACKLIST_HASH_LIST_SRCPREFIX)$(SYSTEM_BLACKLIST_HASH_LIST_FILENAME) scripts/check-blacklist-hashes.awk FORCE
21+
$(call if_changed,check_blacklist_hashes,$(SYSTEM_BLACKLIST_HASH_LIST_SRCPREFIX)$(CONFIG_SYSTEM_BLACKLIST_HASH_LIST))
1022
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o
1123
else
1224
obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o
@@ -21,7 +33,7 @@ $(obj)/system_certificates.o: $(obj)/x509_certificate_list
2133
$(obj)/x509_certificate_list: $(CONFIG_SYSTEM_TRUSTED_KEYS) $(obj)/extract-cert FORCE
2234
$(call if_changed,extract_certs)
2335

24-
targets += x509_certificate_list
36+
targets += x509_certificate_list blacklist_hashes_checked
2537

2638
# If module signing is requested, say by allyesconfig, but a key has not been
2739
# supplied, then one will need to be generated to make sure the build does not

0 commit comments

Comments
 (0)