aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-01-31 16:12:31 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-01-31 16:12:31 -0500
commitae0cb7be35fe6c7e8bcc816ec4185d0a37748cc1 (patch)
tree2453151c8d507502ce91c6827f3e8a35e1777996
parent2a7149031457c5dd05f670737a9dd5d32524f145 (diff)
parentebceb1c87c0c482d47cb92dc3cc51d28f7387716 (diff)
Merge branch 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull tpm updates from James Morris: - reduce polling delays in tpm_tis - support retrieving TPM 2.0 Event Log through EFI before ExitBootServices - replace tpm-rng.c with a hwrng device managed by the driver for each TPM device - TPM resource manager synthesizes TPM_RC_COMMAND_CODE response instead of returning -EINVAL for unknown TPM commands. This makes user space more sound. - CLKRUN fixes: * Keep #CLKRUN disable through the entier TPM command/response flow * Check whether #CLKRUN is enabled before disabling and enabling it again because enabling it breaks PS/2 devices on a system where it is disabled * 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: tpm: remove unused variables tpm: remove unused data fields from I2C and OF device ID tables tpm: only attempt to disable the LPC CLKRUN if is already enabled tpm: follow coding style for variable declaration in tpm_tis_core_init() tpm: delete the TPM_TIS_CLK_ENABLE flag tpm: Update MAINTAINERS for Jason Gunthorpe tpm: Keep CLKRUN enabled throughout the duration of transmit_cmd() tpm_tis: Move ilb_base_addr to tpm_tis_data tpm2-cmd: allow more attempts for selftest execution tpm: return a TPM_RC_COMMAND_CODE response if command is not implemented tpm: Move Linux RNG connection to hwrng tpm: use struct tpm_chip for tpm_chip_find_get() tpm: parse TPM event logs based on EFI table efi: call get_event_log before ExitBootServices tpm: add event log format version tpm: rename event log provider files tpm: move tpm_eventlog.h outside of drivers folder tpm: use tpm_msleep() value as max delay tpm: reduce tpm polling delay in tpm_tis_core tpm: move wait_for_tpm_stat() to respective driver files
-rw-r--r--MAINTAINERS3
-rw-r--r--arch/x86/boot/compressed/eboot.c1
-rw-r--r--drivers/char/hw_random/Kconfig13
-rw-r--r--drivers/char/hw_random/Makefile1
-rw-r--r--drivers/char/hw_random/tpm-rng.c50
-rw-r--r--drivers/char/tpm/Kconfig11
-rw-r--r--drivers/char/tpm/Makefile5
-rw-r--r--drivers/char/tpm/tpm-chip.c67
-rw-r--r--drivers/char/tpm/tpm-interface.c231
-rw-r--r--drivers/char/tpm/tpm.h52
-rw-r--r--drivers/char/tpm/tpm1_eventlog.c13
-rw-r--r--drivers/char/tpm/tpm2-cmd.c12
-rw-r--r--drivers/char/tpm/tpm2_eventlog.c2
-rw-r--r--drivers/char/tpm/tpm_eventlog_acpi.c (renamed from drivers/char/tpm/tpm_acpi.c)4
-rw-r--r--drivers/char/tpm/tpm_eventlog_efi.c66
-rw-r--r--drivers/char/tpm/tpm_eventlog_of.c (renamed from drivers/char/tpm/tpm_of.c)6
-rw-r--r--drivers/char/tpm/tpm_i2c_infineon.c27
-rw-r--r--drivers/char/tpm/tpm_tis.c108
-rw-r--r--drivers/char/tpm/tpm_tis_core.c193
-rw-r--r--drivers/char/tpm/tpm_tis_core.h16
-rw-r--r--drivers/char/tpm/xen-tpmfront.c61
-rw-r--r--drivers/firmware/efi/Makefile2
-rw-r--r--drivers/firmware/efi/efi.c4
-rw-r--r--drivers/firmware/efi/libstub/Makefile3
-rw-r--r--drivers/firmware/efi/libstub/tpm.c81
-rw-r--r--drivers/firmware/efi/tpm.c40
-rw-r--r--include/linux/efi.h46
-rw-r--r--include/linux/tpm.h39
-rw-r--r--include/linux/tpm_eventlog.h (renamed from drivers/char/tpm/tpm_eventlog.h)34
-rw-r--r--security/integrity/ima/ima_crypto.c2
-rw-r--r--security/integrity/ima/ima_init.c2
-rw-r--r--security/integrity/ima/ima_queue.c2
-rw-r--r--security/keys/trusted.c35
33 files changed, 789 insertions, 443 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index bc29978d263c..7872d430e7b1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13869,9 +13869,10 @@ F: drivers/platform/x86/toshiba-wmi.c
13869TPM DEVICE DRIVER 13869TPM DEVICE DRIVER
13870M: Peter Huewe <peterhuewe@gmx.de> 13870M: Peter Huewe <peterhuewe@gmx.de>
13871M: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> 13871M: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
13872R: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> 13872R: Jason Gunthorpe <jgg@ziepe.ca>
13873L: linux-integrity@vger.kernel.org 13873L: linux-integrity@vger.kernel.org
13874Q: https://patchwork.kernel.org/project/linux-integrity/list/ 13874Q: https://patchwork.kernel.org/project/linux-integrity/list/
13875W: https://kernsec.org/wiki/index.php/Linux_Kernel_Integrity
13875T: git git://git.infradead.org/users/jjs/linux-tpmdd.git 13876T: git git://git.infradead.org/users/jjs/linux-tpmdd.git
13876S: Maintained 13877S: Maintained
13877F: drivers/char/tpm/ 13878F: drivers/char/tpm/
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index e56dbc67e837..353e20c3f114 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -999,6 +999,7 @@ struct boot_params *efi_main(struct efi_config *c,
999 999
1000 /* Ask the firmware to clear memory on unclean shutdown */ 1000 /* Ask the firmware to clear memory on unclean shutdown */
1001 efi_enable_reset_attack_mitigation(sys_table); 1001 efi_enable_reset_attack_mitigation(sys_table);
1002 efi_retrieve_tpm2_eventlog(sys_table);
1002 1003
1003 setup_graphics(boot_params); 1004 setup_graphics(boot_params);
1004 1005
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig
index f6e3e5abc117..88044eda0ac6 100644
--- a/drivers/char/hw_random/Kconfig
+++ b/drivers/char/hw_random/Kconfig
@@ -306,19 +306,6 @@ config HW_RANDOM_POWERNV
306 306
307 If unsure, say Y. 307 If unsure, say Y.
308 308
309config HW_RANDOM_TPM
310 tristate "TPM HW Random Number Generator support"
311 depends on TCG_TPM
312 default HW_RANDOM
313 ---help---
314 This driver provides kernel-side support for the Random Number
315 Generator in the Trusted Platform Module
316
317 To compile this driver as a module, choose M here: the
318 module will be called tpm-rng.
319
320 If unsure, say Y.
321
322config HW_RANDOM_HISI 309config HW_RANDOM_HISI
323 tristate "Hisilicon Random Number Generator support" 310 tristate "Hisilicon Random Number Generator support"
324 depends on HW_RANDOM && ARCH_HISI 311 depends on HW_RANDOM && ARCH_HISI
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile
index f3728d008fff..0ef05c61d9c8 100644
--- a/drivers/char/hw_random/Makefile
+++ b/drivers/char/hw_random/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o
27obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o 27obj-$(CONFIG_HW_RANDOM_PSERIES) += pseries-rng.o
28obj-$(CONFIG_HW_RANDOM_POWERNV) += powernv-rng.o 28obj-$(CONFIG_HW_RANDOM_POWERNV) += powernv-rng.o
29obj-$(CONFIG_HW_RANDOM_HISI) += hisi-rng.o 29obj-$(CONFIG_HW_RANDOM_HISI) += hisi-rng.o
30obj-$(CONFIG_HW_RANDOM_TPM) += tpm-rng.o
31obj-$(CONFIG_HW_RANDOM_BCM2835) += bcm2835-rng.o 30obj-$(CONFIG_HW_RANDOM_BCM2835) += bcm2835-rng.o
32obj-$(CONFIG_HW_RANDOM_IPROC_RNG200) += iproc-rng200.o 31obj-$(CONFIG_HW_RANDOM_IPROC_RNG200) += iproc-rng200.o
33obj-$(CONFIG_HW_RANDOM_MSM) += msm-rng.o 32obj-$(CONFIG_HW_RANDOM_MSM) += msm-rng.o
diff --git a/drivers/char/hw_random/tpm-rng.c b/drivers/char/hw_random/tpm-rng.c
deleted file mode 100644
index d6d448266f07..000000000000
--- a/drivers/char/hw_random/tpm-rng.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Copyright (C) 2012 Kent Yoder IBM Corporation
3 *
4 * HWRNG interfaces to pull RNG data from a TPM
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/module.h>
21#include <linux/hw_random.h>
22#include <linux/tpm.h>
23
24#define MODULE_NAME "tpm-rng"
25
26static int tpm_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
27{
28 return tpm_get_random(TPM_ANY_NUM, data, max);
29}
30
31static struct hwrng tpm_rng = {
32 .name = MODULE_NAME,
33 .read = tpm_rng_read,
34};
35
36static int __init rng_init(void)
37{
38 return hwrng_register(&tpm_rng);
39}
40module_init(rng_init);
41
42static void __exit rng_exit(void)
43{
44 hwrng_unregister(&tpm_rng);
45}
46module_exit(rng_exit);
47
48MODULE_LICENSE("GPL v2");
49MODULE_AUTHOR("Kent Yoder <key@linux.vnet.ibm.com>");
50MODULE_DESCRIPTION("RNG driver for TPM devices");
diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
index a30352202f1f..18c81cbe4704 100644
--- a/drivers/char/tpm/Kconfig
+++ b/drivers/char/tpm/Kconfig
@@ -26,6 +26,17 @@ menuconfig TCG_TPM
26 26
27if TCG_TPM 27if TCG_TPM
28 28
29config HW_RANDOM_TPM
30 bool "TPM HW Random Number Generator support"
31 depends on TCG_TPM && HW_RANDOM && !(TCG_TPM=y && HW_RANDOM=m)
32 default y
33 ---help---
34 This setting exposes the TPM's Random Number Generator as a hwrng
35 device. This allows the kernel to collect randomness from the TPM at
36 boot, and provides the TPM randomines in /dev/hwrng.
37
38 If unsure, say Y.
39
29config TCG_TIS_CORE 40config TCG_TIS_CORE
30 tristate 41 tristate
31 ---help--- 42 ---help---
diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
index 34b4bcf46f43..acd758381c58 100644
--- a/drivers/char/tpm/Makefile
+++ b/drivers/char/tpm/Makefile
@@ -6,8 +6,9 @@ obj-$(CONFIG_TCG_TPM) += tpm.o
6tpm-y := tpm-interface.o tpm-dev.o tpm-sysfs.o tpm-chip.o tpm2-cmd.o \ 6tpm-y := tpm-interface.o tpm-dev.o tpm-sysfs.o tpm-chip.o tpm2-cmd.o \
7 tpm-dev-common.o tpmrm-dev.o tpm1_eventlog.o tpm2_eventlog.o \ 7 tpm-dev-common.o tpmrm-dev.o tpm1_eventlog.o tpm2_eventlog.o \
8 tpm2-space.o 8 tpm2-space.o
9tpm-$(CONFIG_ACPI) += tpm_ppi.o tpm_acpi.o