add integrity and security to TPM2 transactions
Subsystems (3)
James Bottomley
maintainerv3 cover add integrity and security to TPM2 transactions
By now, everybody knows we have a problem with the TPM2_RS_PW easy button on TPM2 in that transactions on the TPM bus can be intercepted and altered. ?The way to fix this is to use real sessions for HMAC capabilities to ensure integrity and to use parameter and response encryption to ensure confidentiality of the data flowing over the TPM bus.
This patch series is about adding a simple API which can ensure the above properties as a layered addition to the existing TPM handling code. ?This series now includes protections for PCR extend, getting random numbers from the TPM and data sealing and unsealing. ?It therefore eliminates all uses of TPM2_RS_PW in the kernel and adds encryption protection to sensitive data flowing into and out of the TPM.
This series is also dependent on additions to the crypto subsystem to fix problems in the elliptic curve key handling and add the Cipher FeedBack encryption scheme:
https://marc.info/?l=linux-crypto-vger&m=151994371015475
In the third version I've added data sealing and unsealing protection, apart from one API based problem which means that the way trusted keys were protected it's not currently possible to HMAC protect an authority that comes with a policy, so the API will have to be extended to fix that case
I've verified this using the test suite in the last patch on a VM connected to a tpm2 emulator. ?I also instrumented the emulator to make sure the sensitive data was properly encrypted.
James
---
James Bottomley (6):
tpm-buf: create new functions for handling TPM buffers
tpm2-sessions: Add full HMAC and encrypt/decrypt session handling
tpm2: add hmac checks to tpm2_pcr_extend()
tpm2: add session encryption protection to tpm2_get_random() trusted keys: Add session encryption protection to the seal/unseal path
tpm2-sessions: NOT FOR COMMITTING add sessions testing
drivers/char/tpm/Kconfig | 3 + drivers/char/tpm/Makefile | 3 +- drivers/char/tpm/tpm-buf.c | 191 ++++++ drivers/char/tpm/tpm-chip.c | 1 + drivers/char/tpm/tpm.h | 123 ++-- drivers/char/tpm/tpm2-cmd.c | 298 +++++---- drivers/char/tpm/tpm2-sessions-test.c | 359 ++++++++++ drivers/char/tpm/tpm2-sessions.c | 1166 +++++++++++++++++++++++++++++++++ drivers/char/tpm/tpm2-sessions.h | 57 ++ 9 files changed, 1993 insertions(+), 208 deletions(-) create mode 100644 drivers/char/tpm/tpm-buf.c create mode 100644 drivers/char/tpm/tpm2-sessions-test.c create mode 100644 drivers/char/tpm/tpm2-sessions.c create mode 100644 drivers/char/tpm/tpm2-sessions.h
Signature · 5 lines
2.12.3 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerPATCH v3 1/6 tpm-buf: create new functions for handling TPM buffers
This separates out the old tpm_buf_... handling functions from static inlines into tpm.h and makes them their own tpm-buf.c file. It also adds handling for tpm2b structures and also incremental pointer advancing parsers.
---
v2: added this patch to separate out the API changes
v3: added tpm_buf_reset_cmd()
--- drivers/char/tpm/Makefile | 2 +- drivers/char/tpm/tpm-buf.c | 191 +++++++++++++++++++++++++++++++++++++++++++++ drivers/char/tpm/tpm.h | 95 ++++------------------ 3 files changed, 208 insertions(+), 80 deletions(-) create mode 100644 drivers/char/tpm/tpm-buf.c
drivers/char/tpm/Makefile +1 -1
@@ -5,7 +5,7 @@ obj-$(CONFIG_TCG_TPM) += tpm.o tpm-y := tpm-interface.o tpm-dev.o tpm-sysfs.o tpm-chip.o tpm2-cmd.o \ tpm-dev-common.o tpmrm-dev.o tpm1_eventlog.o tpm2_eventlog.o \ - tpm2-space.o + tpm2-space.o tpm-buf.o tpm-$(CONFIG_ACPI) += tpm_ppi.o tpm_eventlog_acpi.o tpm-$(CONFIG_EFI) += tpm_eventlog_efi.o tpm-$(CONFIG_OF) += tpm_eventlog_of.o
drivers/char/tpm/tpm-buf.c new file +191 -0
191 lines not on this page · raw message
drivers/char/tpm/tpm.h +16 -79
107 lines not on this page · raw message
Signature · 5 lines
2.12.3 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/6] tpm-buf: create new functions for handling TPM buffers
drivers/char/tpm/tpm-buf.c line 41
Quoted 6 lines
drivers/char/tpm/tpm-buf.c new file +5
-0+int tpm_buf_init (struct tpm_buf *buf,u16 tag,u32 ordinal) +{ +int rc; + + rc =__tpm_buf_init (buf);
Assuming that functions like tpm_buf_init() are the top-level API being defined in this patch, shouldn't it check if buf is valid before passing into the internal functions like __tpm_buf_init(buf) (maybe WARN()/BUG_ON()?).? Or does __tpm_buf_init(buf) do this check?
Thanks,
Jay
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerRe: [PATCH v3 1/6] tpm-buf: create new functions for handling TPM buffers
Quoted 12 lines · J Freyensee
drivers/char/tpm/tpm-buf.c line 41
Quoted 6 lines
drivers/char/tpm/tpm-buf.c new file +5
-0+int tpm_buf_init (struct tpm_buf *buf,u16 tag,u32 ordinal) +{ +int rc; + + rc =__tpm_buf_init (buf);Assuming that functions like
tpm_buf_init()are the top-level API being defined in this patch, shouldn't it check if buf is valid before passing into the internal functions like__tpm_buf_init(buf)(maybe WARN()/BUG_ON()?).? Or does__tpm_buf_init(buf)do this check?
These are kernel internal APIs designed for on stack struct tpm_buf usage, so I can't think of a viable threat model that would require this type of checking ... do you have one?
James
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/6] tpm-buf: create new functions for handling TPM buffers
Quoted 11 lines · James Bottomley
Quoted 10 lines · J Freyensee
drivers/char/tpm/tpm-buf.c line 41
Quoted 5 lines
drivers/char/tpm/tpm-buf.c new file +5
-0+int tpm_buf_init (struct tpm_buf *buf,u16 tag,u32 ordinal) +{ +int rc; + + rc =__tpm_buf_init (buf);Assuming that functions like
tpm_buf_init()are the top-level API being defined in this patch, shouldn't it check if buf is valid before passing into the internal functions like__tpm_buf_init(buf)(maybe WARN()/BUG_ON()?).? Or does__tpm_buf_init(buf)do this check?
Quoted 2 lines
These are kernel internal APIs designed for on stack struct
tpm_bufusage,
ok.
Quoted 2 lines
so I can't think of a viable threat model that would require this type of checking ... do you have one?
no, nothing particular in mind.? I just get a little nervous when I see variables being passed unchecked into internal functions starting with '__'.
Regards,
Jay
Quoted 3 lines
James
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/6] tpm-buf: create new functions for handling TPM buffers
In reply to James Bottomleydrivers/char/tpm/tpm.h struct tpm_cmd_t { · line 407
Quoted 2 lines · James Bottomley
drivers/char/tpm/tpm.h +1
-0TPM_BUF_OVERFLOW =BIT (0 ), + TPM_BUF_2B = BIT(1),
Instead of re-using this I would prefer to have another enum for buffer type. tpm_buf_init() could have the signature:
int tpm_buf_init(unsigned int type);
For commands there should be a function:
void tpm_buf_set_command_header(struct tpm_buf *buf, u16 tag, u32 ordinal);
And tpm_buf_append_2b() should not exist at all. It should be maintained automatically by other append commands.
/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/6] tpm-buf: create new functions for handling TPM buffers
Quoted 7 lines · Jarkko Sakkinen
drivers/char/tpm/tpm.h struct tpm_cmd_t { · line 407
Quoted 2 lines · James Bottomley
drivers/char/tpm/tpm.h +1
-0TPM_BUF_OVERFLOW =BIT (0 ), + TPM_BUF_2B = BIT(1),Instead of re-using this I would prefer to have another enum for buffer type.
tpm_buf_init()could have the signature:
Quoted 8 lines
int
tpm_buf_init(unsigned int type);For commands there should be a function:
void
tpm_buf_set_command_header(struct tpm_buf *buf, u16 tag, u32 ordinal);And
tpm_buf_append_2b()should not exist at all. It should be maintained automatically by other append commands.
Can you send the next version this patch as a separate entity? Once I can land this we have kind of stable ground for the following patches. After that it is easier test and review them.
/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerPATCH v3 2/6 tpm2-sessions: Add full HMAC and encrypt/decrypt session handling
In reply to James BottomleyThis code adds true session based HMAC authentication plus parameter decryption and response encryption using AES.
The basic design of this code is to segregate all the nasty crypto, hash and hmac code into tpm2-sessions.c and export a usable API.
The API first of all starts off by gaining a session with
tpm2_start_auth_session()
Which initiates a session with the TPM and allocates an opaque tpm2_auth structure to handle the session parameters. Then the use is simply:
* tpm_buf_append_name() in place of the tpm_buf_append_u32 for the handles
* tpm_buf_append_hmac_session() where tpm2_append_auth() would go
* tpm_buf_fill_hmac_session() called after the entire command buffer is finished but before tpm_transmit_cmd() is called which computes the correct HMAC and places it in the command at the correct location.
Finally, after tpm_transmit_cmd() is called, tpm_buf_check_hmac_response() is called to check that the returned HMAC matched and collect the new state for the next use of the session, if any.
The features of the session is controlled by the session attributes set in tpm_buf_append_hmac_session(). If TPM2_SA_CONTINUE_SESSION is not specified, the session will be flushed and the tpm2_auth structure freed in tpm_buf_check_hmac_response(); otherwise the session may be used again. Parameter encryption is specified by or'ing the flag TPM2_SA_DECRYPT and response encryption by or'ing the flag TPM2_SA_ENCRYPT. the various encryptions will be taken care of by tpm_buf_fill_hmac_session() and tpm_buf_check_hmac_response() respectively.
To get all of this to work securely, the Kernel now needs a primary key to encrypt the session salt to, so we derive an EC key from the NULL seed and store it in the tpm_chip structure. We also make sure that this seed remains for the kernel by using a kernel space to take it out of the TPM when userspace wants to use it.
---
v2: Added docbook and improved response check API
v3: Add readpublic, fix hmac length, add API for close on error
allow for the hmac session not being first in the sessions
--- drivers/char/tpm/Kconfig | 3 + drivers/char/tpm/Makefile | 2 +- drivers/char/tpm/tpm.h | 27 + drivers/char/tpm/tpm2-cmd.c | 34 +- drivers/char/tpm/tpm2-sessions.c | 1166 ++++++++++++++++++++++++++++++++++++++ drivers/char/tpm/tpm2-sessions.h | 57 ++ 6 files changed, 1273 insertions(+), 16 deletions(-) create mode 100644 drivers/char/tpm/tpm2-sessions.c create mode 100644 drivers/char/tpm/tpm2-sessions.h
drivers/char/tpm/Kconfig +3 -0
@@ -8,6 +8,9 @@ menuconfig TCG_TPM select SECURITYFS select CRYPTO select CRYPTO_HASH_INFO + select CRYPTO_ECDH + select CRYPTO_AES + select CRYPTO_CFB ---help--- If you have a TPM security chip in your system, which implements the Trusted Computing Group's specification,
drivers/char/tpm/Makefile +1 -1
@@ -5,7 +5,7 @@ obj-$(CONFIG_TCG_TPM) += tpm.o tpm-y := tpm-interface.o tpm-dev.o tpm-sysfs.o tpm-chip.o tpm2-cmd.o \ tpm-dev-common.o tpmrm-dev.o tpm1_eventlog.o tpm2_eventlog.o \ - tpm2-space.o tpm-buf.o + tpm2-space.o tpm-buf.o tpm2-sessions.o tpm-$(CONFIG_ACPI) += tpm_ppi.o tpm_eventlog_acpi.o tpm-$(CONFIG_EFI) += tpm_eventlog_efi.o tpm-$(CONFIG_OF) += tpm_eventlog_of.o
drivers/char/tpm/tpm.h +27 -0
@@ -42,6 +42,9 @@#include <asm/intel-family.h> #endif +/* fixed define for the curve we use which is NIST_P256 */ +#define EC_PT_SZ 32 +enum tpm_const {TPM_MINOR =224 ,/* officially assigned */ TPM_BUFSIZE =4096 ,
@@ -93,6 +96,7 @@ enum tpm2_const {enum tpm2_structures {TPM2_ST_NO_SESSIONS =0x8001 ,TPM2_ST_SESSIONS =0x8002 , +TPM2_ST_CREATION =0x8021 , };/* Indicates from what layer of the software stack the error comes from */
@@ -114,16 +118,25 @@ enum tpm2_return_codes {enum tpm2_algorithms {TPM2_ALG_ERROR =0x0000 ,TPM2_ALG_SHA1 =0x0004 , +TPM2_ALG_AES =0x0006 ,TPM2_ALG_KEYEDHASH =0x0008 ,TPM2_ALG_SHA256 =0x000B ,TPM2_ALG_SHA384 =0x000C ,TPM2_ALG_SHA512 =0x000D ,TPM2_ALG_NULL =0x0010 ,TPM2_ALG_SM3_256 =0x0012 , +TPM2_ALG_ECC =0x0023 , +TPM2_ALG_CFB =0x0043 , +}; + +enum tpm2_curves { +TPM2_ECC_NONE =0x0000 , +TPM2_ECC_NIST_P256 =0x0003 , };enum tpm2_command_codes {TPM2_CC_FIRST =0x011F , +TPM2_CC_CREATE_PRIMARY =0x0131 ,TPM2_CC_SELF_TEST =0x0143 ,TPM2_CC_STARTUP =0x0144 ,TPM2_CC_SHUTDOWN =0x0145 ,
@@ -133,6 +146,8 @@ enum tpm2_command_codes {TPM2_CC_CONTEXT_LOAD =0x0161 ,TPM2_CC_CONTEXT_SAVE =0x0162 ,TPM2_CC_FLUSH_CONTEXT =0x0165 , +TPM2_CC_READ_PUBLIC =0x0173 , +TPM2_CC_START_AUTH_SESS =0x0176 ,TPM2_CC_GET_CAPABILITY =0x017A ,TPM2_CC_GET_RANDOM =0x017B , TPM2_CC_PCR_READ = 0x017E,
@@ -141,6 +156,7 @@ enum tpm2_command_codes { };enum tpm2_permanent_handles { +TPM2_RH_NULL =0x40000007 ,TPM2_RS_PW =0x40000009 , };
@@ -243,11 +259,18 @@ struct tpm_chip {#endif /* CONFIG_ACPI */ struct tpm_space work_space; +struct tpm_space kernel_space;u32 nr_commands;u32 *cc_attrs_tbl;/* active locality */ int locality; + +/* details for communication security via sessions */ +u32 tpmkey; +u8 tpmkeyname[34 ]; +u8 ec_point_x[EC_PT_SZ ]; +u8 ec_point_y[EC_PT_SZ ]; };#define to_tpm_chip (d) container_of(d, struct tpm_chip, dev)
@@ -429,6 +452,9 @@ u8 tpm_get_inc_u8(const u8 **ptr);u16 tpm_get_inc_u16 (const u8 **ptr);u32 tpm_get_inc_u32 (const u8 **ptr); +/* opaque structure, holds auth session parameters like the session key */ +struct tpm2_auth ; +extern struct class *tpm_class;extern struct class *tpmrm_class;extern dev_t tpm_devt;
@@ -548,4 +574,5 @@ static inline int tpm_read_log_efi(struct tpm_chip *chip)int tpm_bios_log_setup (struct tpm_chip *chip);void tpm_bios_log_teardown (struct tpm_chip *chip); +int tpm2_sessions_init (struct tpm_chip *chip);#endif
drivers/char/tpm/tpm2-cmd.c +19 -15
@@ -16,17 +16,10 @@*/ #include "tpm.h" +#include "tpm2-sessions.h" #include <crypto/hash_info.h> #include <keys/trusted-type.h> -enum tpm2_object_attributes { -TPM2_OA_USER_WITH_AUTH =BIT (6 ), -}; - -enum tpm2_session_attributes { -TPM2_SA_CONTINUE_SESSION =BIT (0 ), -}; -struct tpm2_startup_in {__be16 startup_type; } __packed;
@@ -398,15 +391,19 @@ static const struct tpm_input_header tpm2_get_tpm_pt_header = {/** * tpm2_flush_context_cmd() - execute a TPM2_FlushContext command * @chip: TPM chip to use -* @payload: the key data in clear and encrypted form -* @options: authentication values and other options +* @handle: the handle to flush +* @flags: flags for transmit * +* Note: @flags may be TPM_TRANSMIT_UNLOCKED or 0. If @flags is 0, we +* assume the flush handle is going through the kernel space. +* Return: same as with tpm_transmit_cmd */ void tpm2_flush_context_cmd (struct tpm_chip *chip,u32 handle,unsigned int flags) {struct tpm_buf buf; +struct tpm_space *space =NULL ;int rc; rc =tpm_buf_init (&buf,TPM2_ST_NO_SESSIONS ,TPM2_CC_FLUSH_CONTEXT );
@@ -415,10 +412,12 @@ void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle, handle);return ; } +if (!flags) + space = &chip->kernel_space;tpm_buf_append_u32 (&buf, handle); - (void )tpm_transmit_cmd (chip,NULL , buf.data,PAGE_SIZE ,0 , flags, + (void )tpm_transmit_cmd (chip, space, buf.data,PAGE_SIZE ,0 , flags,"flushing context" );tpm_buf_destroy (&buf);
@@ -435,10 +434,10 @@ void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle,* @hmac: the session HMAC or password, may be NULL if not used * @hmac_len: the session HMAC or password length, maybe 0 if not used */ -static void tpm2_buf_append_auth (struct tpm_buf *buf,u32 session_handle, -const u8 *nonce,u16 nonce_len, -u8 attributes, -const u8 *hmac,u16 hmac_len) +void tpm2_buf_append_auth (struct tpm_buf *buf,u32 session_handle, +const u8 *nonce,u16 nonce_len, +u8 attributes, +const u8 *hmac,u16 hmac_len) {tpm_buf_append_u32 (buf,9 + nonce_len + hmac_len);tpm_buf_append_u32 (buf, session_handle);
@@ -1095,6 +1094,11 @@ int tpm2_auto_startup(struct tpm_chip *chip) rc =tpm2_get_cc_attrs_tbl (chip); +if (rc) + goto out; + + rc =tpm2_sessions_init (chip); + out:if (rc >0 ) rc = -ENODEV ;
drivers/char/tpm/tpm2-sessions.c new file +1166 -0
1,166 lines not on this page · raw message
drivers/char/tpm/tpm2-sessions.h new file +57 -0
57 lines not on this page · raw message
Signature · 6 lines
2.12.3 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerPATCH v3 3/6 tpm2: add hmac checks to tpm2_pcr_extend()
In reply to James BottomleyWe use tpm2_pcr_extend() in trusted keys to extend a PCR to prevent a key from being re-loaded until the next reboot. To use this functionality securely, that extend must be protected by a session hmac.
---
v3: add error handling to sessions
--- drivers/char/tpm/tpm2-cmd.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-)
drivers/char/tpm/tpm2-cmd.c +13 -20
@@ -247,13 +247,6 @@ int tpm2_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf)return rc; } -struct tpm2_null_auth_area { -__be32 handle; -__be16 nonce_size; -u8 attributes; -__be16 auth_size; -} __packed; -/** * tpm2_pcr_extend() - extend a PCR value *
@@ -268,7 +261,7 @@ int tpm2_pcr_extend(struct tpm_chip *chip, int pcr_idx, u32 count, struct tpm2_digest *digests) {struct tpm_buf buf; -struct tpm2_null_auth_area auth_area; +struct tpm2_auth *auth;int rc;int i;int j;
@@ -276,20 +269,19 @@ int tpm2_pcr_extend(struct tpm_chip *chip, int pcr_idx, u32 count,if (count >ARRAY_SIZE (chip->active_banks))return -EINVAL ; - rc =tpm_buf_init (&buf,TPM2_ST_SESSIONS ,TPM2_CC_PCR_EXTEND ); + rc =tpm2_start_auth_session (chip, &auth);if (rc)return rc; -tpm_buf_append_u32 (&buf, pcr_idx); + rc =tpm_buf_init (&buf,TPM2_ST_SESSIONS ,TPM2_CC_PCR_EXTEND ); +if (rc) { +tpm2_end_auth_session (auth); +return rc; + } - auth_area.handle =cpu_to_be32 (TPM2_RS_PW ); - auth_area.nonce_size =0 ; - auth_area.attributes =0 ; - auth_area.auth_size =0 ; +tpm_buf_append_name (&buf, auth, pcr_idx,NULL ); +tpm_buf_append_hmac_session (&buf, auth,0 ,NULL ,0 ); -tpm_buf_append_u32 (&buf,sizeof (struct tpm2_null_auth_area )); -tpm_buf_append (&buf, (const unsigned char *)&auth_area, -sizeof (auth_area));tpm_buf_append_u32 (&buf, count);for (i =0 ; i < count; i++) {
@@ -302,9 +294,10 @@ int tpm2_pcr_extend(struct tpm_chip *chip, int pcr_idx, u32 count, hash_digest_size[tpm2_hash_map[j].crypto_id]); } } - - rc =tpm_transmit_cmd (chip,NULL , buf.data,PAGE_SIZE ,0 ,0 , -"attempting extend a PCR value" ); +tpm_buf_fill_hmac_session (&buf, auth); + rc =tpm_transmit_cmd (chip, &chip->kernel_space, buf.data,PAGE_SIZE , +0 ,0 ,"attempting extend a PCR value" ); + rc =tpm_buf_check_hmac_response (&buf, auth, rc);tpm_buf_destroy (&buf);
Signature · 5 lines
2.12.3 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerPATCH v3 4/6 tpm2: add session encryption protection to tpm2_get_random()
In reply to James BottomleyIf some entity is snooping the TPM bus, they can see the random numbers we're extracting from the TPM and do prediction attacks against their consumers. Foil this attack by using response encryption to prevent the attacker from seeing the random sequence.
---
v3: add error handling to sessions and redo to be outside loop
--- drivers/char/tpm/tpm2-cmd.c | 73 +++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 35 deletions(-)
drivers/char/tpm/tpm2-cmd.c +38 -35
@@ -38,10 +38,6 @@ struct tpm2_get_tpm_pt_out {__be32 value; } __packed; -struct tpm2_get_random_in { -__be16 size; -} __packed; -struct tpm2_get_random_out {__be16 size;u8 buffer[TPM_MAX_RNG_DATA ];
@@ -51,8 +47,6 @@ union tpm2_cmd_params {struct tpm2_startup_in startup_in;struct tpm2_get_tpm_pt_in get_tpm_pt_in;struct tpm2_get_tpm_pt_out get_tpm_pt_out; -struct tpm2_get_random_in getrandom_in; -struct tpm2_get_random_out getrandom_out; };struct tpm2_cmd {
@@ -304,17 +298,6 @@ int tpm2_pcr_extend(struct tpm_chip *chip, int pcr_idx, u32 count,return rc; } - -#define TPM2_GETRANDOM_IN_SIZE \ - (sizeof(struct tpm_input_header) + \ - sizeof(struct tpm2_get_random_in)) - -static const struct tpm_input_header tpm2_getrandom_header = { - .tag =cpu_to_be16 (TPM2_ST_NO_SESSIONS ), - .length =cpu_to_be32 (TPM2_GETRANDOM_IN_SIZE ), - .ordinal =cpu_to_be32 (TPM2_CC_GET_RANDOM ) -}; -/** * tpm2_get_random() - get random bytes from the TPM RNG *
@@ -327,44 +310,64 @@ static const struct tpm_input_header tpm2_getrandom_header = {*/ int tpm2_get_random (struct tpm_chip *chip,u8 *out,size_t max) { -struct tpm2_cmd cmd; -u32 recd, rlength; +u32 recd;u32 num_bytes;int err;int total =0 ;int retries =5 ;u8 *dest = out; +struct tpm_buf buf; +struct tpm2_get_random_out *rout; +struct tpm2_auth *auth; - num_bytes =min_t (u32, max,sizeof (cmd.params.getrandom_out.buffer)); + num_bytes =min_t (u32, max,TPM_MAX_RNG_DATA ); -if (!out || !num_bytes || - max >sizeof (cmd.params.getrandom_out.buffer)) +if (!out || !num_bytes + || max >TPM_MAX_RNG_DATA )return -EINVAL ; -do { - cmd.header.in = tpm2_getrandom_header; - cmd.params.getrandom_in.size =cpu_to_be16 (num_bytes); + err =tpm2_start_auth_session (chip, &auth); +if (err) +return err; + + err =tpm_buf_init (&buf,TPM2_ST_SESSIONS ,TPM2_CC_GET_RANDOM ); +if (err) { +tpm2_end_auth_session (auth); +return err; + } - err =tpm_transmit_cmd (chip,NULL , &cmd,sizeof (cmd), - offsetof(struct tpm2_get_random_out , - buffer), +do { +tpm_buf_append_hmac_session (&buf, auth,TPM2_SA_ENCRYPT + |TPM2_SA_CONTINUE_SESSION , +NULL ,0 ); +tpm_buf_append_u16 (&buf, num_bytes); +tpm_buf_fill_hmac_session (&buf, auth); + err =tpm_transmit_cmd (chip, &chip->kernel_space, buf.data, +PAGE_SIZE ,TPM_HEADER_SIZE +2 ,0 ,"attempting get random" ); + err =tpm_buf_check_hmac_response (&buf, auth, err);if (err)break ; - recd =min_t (u32,be16_to_cpu (cmd.params.getrandom_out.size), - num_bytes); - rlength =be32_to_cpu (cmd.header.out.length); -if (rlength < offsetof(struct tpm2_get_random_out , buffer) + - recd) -return -EFAULT ; -memcpy (dest, cmd.params.getrandom_out.buffer, recd); + rout = (struct tpm2_get_random_out *)&buf.data[TPM_HEADER_SIZE +4 ]; + recd =be16_to_cpu (rout->size); + recd =min_t (u32, recd, num_bytes); +if (tpm_buf_length (&buf) <TPM_HEADER_SIZE +4 + +2 + recd) { + total = -EFAULT ; +break ; + } +memcpy (dest, rout->buffer, recd); dest += recd; total += recd; num_bytes -= recd; +tpm_buf_reset_cmd (&buf,TPM2_ST_SESSIONS ,TPM2_CC_GET_RANDOM ); }while (retries-- && total < max); +tpm_buf_destroy (&buf); +tpm2_end_auth_session (auth); +return total ? total : -EIO ; }
Signature · 5 lines
2.12.3 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info@ http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerPATCH v3 5/6 trusted keys: Add session encryption protection to the seal/unseal path
In reply to James BottomleyIf some entity is snooping the TPM bus, the can see the data going in to be sealed and the data coming out as it is unsealed. Add parameter and response encryption to these cases to ensure that no secrets are leaked even if the bus is snooped.
As part of doing this conversion it was discovered that policy sessions can't work with HMAC protected authority because of missing pieces (the tpm Nonce). I've added code to work the same way as before, which will result in potential authority exposure (while still adding security for the command and the returned blob), and a fixme to redo the API to get rid of this security hole.
--- drivers/char/tpm/tpm2-cmd.c | 156 ++++++++++++++++++++++++++++---------------- 1 file changed, 98 insertions(+), 58 deletions(-)
drivers/char/tpm/tpm2-cmd.c +98 -58
@@ -463,8 +463,9 @@ int tpm2_seal_trusted(struct tpm_chip *chip, struct trusted_key_options *options) {unsigned int blob_len; -struct tpm_buf buf; +struct tpm_buf buf, t2b;u32 hash, rlength; +struct tpm2_auth *auth;int i;int rc;
@@ -478,45 +479,56 @@ int tpm2_seal_trusted(struct tpm_chip *chip,if (i ==ARRAY_SIZE (tpm2_hash_map))return -EINVAL ; - rc =tpm_buf_init (&buf,TPM2_ST_SESSIONS ,TPM2_CC_CREATE ); + rc =tpm2_start_auth_session (chip, &auth);if (rc)return rc; -tpm_buf_append_u32 (&buf, options->keyhandle); -tpm2_buf_append_auth (&buf,TPM2_RS_PW , -NULL /* nonce */ ,0 , -0 /* session_attributes */ , - options->keyauth/* hmac */ , -TPM_DIGEST_SIZE ); + rc =tpm_buf_init (&buf,TPM2_ST_SESSIONS ,TPM2_CC_CREATE ); +if (rc) { +tpm2_end_auth_session (auth); +return rc; + } + rc =tpm_buf_init_2b (&t2b); +if (rc) { +tpm_buf_destroy (&buf); +tpm2_end_auth_session (auth); +return rc; + } + +tpm_buf_append_name (&buf, auth, options->keyhandle,NULL ); +tpm_buf_append_hmac_session (&buf, auth,TPM2_SA_DECRYPT , + options->keyauth,TPM_DIGEST_SIZE );/* sensitive */ -tpm_buf_append_u16 (&buf,4 +TPM_DIGEST_SIZE + payload->key_len +1 ); +tpm_buf_append_u16 (&t2b,TPM_DIGEST_SIZE ); +tpm_buf_append (&t2b, options->blobauth,TPM_DIGEST_SIZE ); +tpm_buf_append_u16 (&t2b, payload->key_len +1 ); +tpm_buf_append (&t2b, payload->key, payload->key_len); +tpm_buf_append_u8 (&t2b, payload->migratable); -tpm_buf_append_u16 (&buf,TPM_DIGEST_SIZE ); -tpm_buf_append (&buf, options->blobauth,TPM_DIGEST_SIZE ); -tpm_buf_append_u16 (&buf, payload->key_len +1 ); -tpm_buf_append (&buf, payload->key, payload->key_len); -tpm_buf_append_u8 (&buf, payload->migratable); +tpm_buf_append_2b (&buf, &t2b);/* public */ -tpm_buf_append_u16 (&buf,14 + options->policydigest_len); -tpm_buf_append_u16 (&buf,TPM2_ALG_KEYEDHASH ); -tpm_buf_append_u16 (&buf, hash); +tpm_buf_append_u16 (&t2b,TPM2_ALG_KEYEDHASH ); +tpm_buf_append_u16 (&t2b, hash);/* policy */ if (options->policydigest_len) { -tpm_buf_append_u32 (&buf,0 ); -tpm_buf_append_u16 (&buf, options->policydigest_len); -tpm_buf_append (&buf, options->policydigest, +tpm_buf_append_u32 (&t2b,0 ); +tpm_buf_append_u16 (&t2b, options->policydigest_len); +tpm_buf_append (&t2b, options->policydigest, options->policydigest_len); }else { -tpm_buf_append_u32 (&buf,TPM2_OA_USER_WITH_AUTH ); -tpm_buf_append_u16 (&buf,0 ); +tpm_buf_append_u32 (&t2b,TPM2_OA_USER_WITH_AUTH ); +tpm_buf_append_u16 (&t2b,0 ); }/* public parameters */ -tpm_buf_append_u16 (&buf,TPM2_ALG_NULL ); -tpm_buf_append_u16 (&buf,0 ); +tpm_buf_append_u16 (&t2b,TPM2_ALG_NULL ); +/* unique (zero) */ +tpm_buf_append_u16 (&t2b,0 ); + +tpm_buf_append_2b (&buf, &t2b);/* outside info */ tpm_buf_append_u16 (&buf,0 );
@@ -529,8 +541,11 @@ int tpm2_seal_trusted(struct tpm_chip *chip, goto out; } - rc =tpm_transmit_cmd (chip,NULL , buf.data,PAGE_SIZE ,4 ,0 , -"sealing data" ); +tpm_buf_fill_hmac_session (&buf, auth); + + rc =tpm_transmit_cmd (chip, &chip->kernel_space, buf.data, +PAGE_SIZE ,4 ,0 ,"sealing data" ); + rc =tpm_buf_check_hmac_response (&buf, auth, rc);if (rc) goto out;
@@ -549,6 +564,7 @@ int tpm2_seal_trusted(struct tpm_chip *chip, payload->blob_len = blob_len; out: +tpm_buf_destroy (&t2b);tpm_buf_destroy (&buf);if (rc >0 ) {
@@ -568,7 +584,6 @@ int tpm2_seal_trusted(struct tpm_chip *chip,* @payload: the key data in clear and encrypted form * @options: authentication values and other options * @blob_handle: returned blob handle -* @flags: tpm transmit flags * * Return: 0 on success. * -E2BIG on wrong payload size.
@@ -578,9 +593,10 @@ int tpm2_seal_trusted(struct tpm_chip *chip,static int tpm2_load_cmd (struct tpm_chip *chip,struct trusted_key_payload *payload,struct trusted_key_options *options, -u32 *blob_handle,unsigned int flags) +u32 *blob_handle) {struct tpm_buf buf; +struct tpm2_auth *auth;unsigned int private_len;unsigned int public_len;unsigned int blob_len;
@@ -595,17 +611,18 @@ static int tpm2_load_cmd(struct tpm_chip *chip,if (blob_len > payload->blob_len)return -E2BIG ; - rc =tpm_buf_init (&buf,TPM2_ST_SESSIONS ,TPM2_CC_LOAD ); + rc =tpm2_start_auth_session (chip, &auth);if (rc)return rc; -tpm_buf_append_u32 (&buf, options->keyhandle); -tpm2_buf_append_auth (&buf,TPM2_RS_PW , -NULL /* nonce */ ,0 , -0 /* session_attributes */ , - options->keyauth/* hmac */ , -TPM_DIGEST_SIZE ); + rc =tpm_buf_init (&buf,TPM2_ST_SESSIONS ,TPM2_CC_LOAD ); +if (rc) { +tpm2_end_auth_session (auth); +return rc; + } +tpm_buf_append_name (&buf, auth, options->keyhandle,NULL ); +tpm_buf_append_hmac_session (&buf, auth,0 , options->keyauth,TPM_DIGEST_SIZE );tpm_buf_append (&buf, payload->blob, blob_len);if (buf.flags &TPM_BUF_OVERFLOW ) {
@@ -613,8 +630,10 @@ static int tpm2_load_cmd(struct tpm_chip *chip, goto out; } - rc =tpm_transmit_cmd (chip,NULL , buf.data,PAGE_SIZE ,4 , flags, -"loading blob" ); +tpm_buf_fill_hmac_session (&buf, auth); + rc =tpm_transmit_cmd (chip, &chip->kernel_space, buf.data,PAGE_SIZE , +4 ,0 ,"loading blob" ); + rc =tpm_buf_check_hmac_response (&buf, auth, rc);if (!rc) *blob_handle =be32_to_cpup ( (__be32 *) &buf.data[TPM_HEADER_SIZE ]);
@@ -635,7 +654,6 @@ static int tpm2_load_cmd(struct tpm_chip *chip,* @payload: the key data in clear and encrypted form * @options: authentication values and other options * @blob_handle: blob handle -* @flags: tpm_transmit_cmd flags * * Return: 0 on success * -EPERM on tpm error status
@@ -644,29 +662,55 @@ static int tpm2_load_cmd(struct tpm_chip *chip,static int tpm2_unseal_cmd (struct tpm_chip *chip,struct trusted_key_payload *payload,struct trusted_key_options *options, -u32 blob_handle,unsigned int flags) +u32 blob_handle) {struct tpm_buf buf; +struct tpm2_auth *auth;u16 data_len;u8 *data;int rc;u32 rlength; - rc =tpm_buf_init (&buf,TPM2_ST_SESSIONS ,TPM2_CC_UNSEAL ); + rc =tpm2_start_auth_session (chip, &auth);if (rc)return rc; -tpm_buf_append_u32 (&buf, blob_handle); -tpm2_buf_append_auth (&buf, - options->policyhandle ? - options->policyhandle :TPM2_RS_PW , -NULL /* nonce */ ,0 , -TPM2_SA_CONTINUE_SESSION , - options->blobauth/* hmac */ , -TPM_DIGEST_SIZE ); - - rc =tpm_transmit_cmd (chip,NULL , buf.data,PAGE_SIZE ,6 , flags, -"unsealing" ); + rc =tpm_buf_init (&buf,TPM2_ST_SESSIONS ,TPM2_CC_UNSEAL ); +if (rc) { +tpm2_end_auth_session (auth); +return rc; + } + +tpm_buf_append_name (&buf, auth, blob_handle,NULL ); + +if (!options->policyhandle) { +tpm_buf_append_hmac_session (&buf, auth,TPM2_SA_ENCRYPT , + options->blobauth,TPM_DIGEST_SIZE ); + }else { +/* +* FIXME: the policy can't be used for HMAC protection +* of the authorization because it must be generated +* with the initial nonces which isn't passed in, so +* append a second encryption session to at least HMAC +* protect the command and encrypt the sealed blob on +* return so the only thing the attacker can get is +* the password. +* +* We also consume the policy session otherwise it +* would be absorbed into the kernel space. +*/ +tpm2_buf_append_auth (&buf, options->policyhandle, +NULL /* nonce */ ,0 ,0 , + options->blobauth/* hmac */ , +TPM_DIGEST_SIZE ); +tpm_buf_append_hmac_session (&buf, auth,TPM2_SA_ENCRYPT , +NULL ,0 ); + } + +tpm_buf_fill_hmac_session (&buf, auth); + rc =tpm_transmit_cmd (chip, &chip->kernel_space, buf.data,PAGE_SIZE , +6 ,0 ,"unsealing" ); + rc =tpm_buf_check_hmac_response (&buf, auth, rc);if (rc >0 ) rc = -EPERM ;
@@ -712,17 +756,13 @@ int tpm2_unseal_trusted(struct tpm_chip *chip,u32 blob_handle;int rc; -mutex_lock (&chip->tpm_mutex); - rc =tpm2_load_cmd (chip, payload, options, &blob_handle, -TPM_TRANSMIT_UNLOCKED ); + rc =tpm2_load_cmd (chip, payload, options, &blob_handle);if (rc) goto out; - rc =tpm2_unseal_cmd (chip, payload, options, blob_handle, -TPM_TRANSMIT_UNLOCKED ); -tpm2_flush_context_cmd (chip, blob_handle,TPM_TRANSMIT_UNLOCKED ); + rc =tpm2_unseal_cmd (chip, payload, options, blob_handle); +tpm2_flush_context_cmd (chip, blob_handle,0 ); out: -mutex_unlock (&chip->tpm_mutex);return rc; }
Signature · 5 lines
2.12.3 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerPATCH v3 6/6 tpm2-sessions: NOT FOR COMMITTING add sessions testing
In reply to James BottomleyThis runs through a preset sequence using sessions to demonstrate that the session handling code functions. It does both HMAC, encryption and decryption by testing an encrypted sealing operation with authority and proving that the same sealed data comes back again via an HMAC and response encryption. It also does policy unsealing which mimics the more complex of the trusted key scenarios.
---
v3: add policy unseal testing with two sessions
--- drivers/char/tpm/Makefile | 1 + drivers/char/tpm/tpm-chip.c | 1 + drivers/char/tpm/tpm.h | 1 + drivers/char/tpm/tpm2-cmd.c | 2 + drivers/char/tpm/tpm2-sessions-test.c | 359 ++++++++++++++++++++++++++++++++++ 5 files changed, 364 insertions(+) create mode 100644 drivers/char/tpm/tpm2-sessions-test.c
drivers/char/tpm/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_TCG_TPM) += tpm.o tpm-y := tpm-interface.o tpm-dev.o tpm-sysfs.o tpm-chip.o tpm2-cmd.o \ tpm-dev-common.o tpmrm-dev.o tpm1_eventlog.o tpm2_eventlog.o \ tpm2-space.o tpm-buf.o tpm2-sessions.o +obj-m += tpm2-sessions-test.o tpm-$(CONFIG_ACPI) += tpm_ppi.o tpm_eventlog_acpi.o tpm-$(CONFIG_EFI) += tpm_eventlog_efi.o tpm-$(CONFIG_OF) += tpm_eventlog_of.o
drivers/char/tpm/tpm-chip.c +1 -0
@@ -118,6 +118,7 @@ struct tpm_chip *tpm_chip_find_get(struct tpm_chip *chip)return res; } +EXPORT_SYMBOL (tpm_chip_find_get);/** * tpm_dev_release() - free chip memory and the device number
drivers/char/tpm/tpm.h +1 -0
@@ -146,6 +146,7 @@ enum tpm2_command_codes {TPM2_CC_CONTEXT_LOAD =0x0161 ,TPM2_CC_CONTEXT_SAVE =0x0162 ,TPM2_CC_FLUSH_CONTEXT =0x0165 , +TPM2_CC_POLICY_COMMAND_CODE =0x16c ,TPM2_CC_READ_PUBLIC =0x0173 ,TPM2_CC_START_AUTH_SESS =0x0176 , TPM2_CC_GET_CAPABILITY = 0x017A,
drivers/char/tpm/tpm2-cmd.c +2 -0
@@ -418,6 +418,7 @@ void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle,tpm_buf_destroy (&buf); } +EXPORT_SYMBOL_GPL (tpm2_flush_context_cmd);/** * tpm_buf_append_auth() - append TPMS_AUTH_COMMAND to the buffer.
@@ -448,6 +449,7 @@ void tpm2_buf_append_auth(struct tpm_buf *buf, u32 session_handle,if (hmac && hmac_len)tpm_buf_append (buf, hmac, hmac_len); } +EXPORT_SYMBOL_GPL (tpm2_buf_append_auth);/** * tpm2_seal_trusted() - seal the payload of a trusted key
drivers/char/tpm/tpm2-sessions-test.c new file +359 -0
359 lines not on this page · raw message
Signature · 5 lines
2.12.3 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 27 lines · James Bottomley
By now, everybody knows we have a problem with the
TPM2_RS_PWeasy button on TPM2 in that transactions on the TPM bus can be intercepted and altered. The way to fix this is to use real sessions for HMAC capabilities to ensure integrity and to use parameter and response encryption to ensure confidentiality of the data flowing over the TPM bus.This patch series is about adding a simple API which can ensure the above properties as a layered addition to the existing TPM handling code. This series now includes protections for PCR extend, getting random numbers from the TPM and data sealing and unsealing. It therefore eliminates all uses of
TPM2_RS_PWin the kernel and adds encryption protection to sensitive data flowing into and out of the TPM.This series is also dependent on additions to the crypto subsystem to fix problems in the elliptic curve key handling and add the Cipher FeedBack encryption scheme:
https://marc.info/?l=linux-crypto-vger&m=151994371015475
In the third version I've added data sealing and unsealing protection, apart from one API based problem which means that the way trusted keys were protected it's not currently possible to HMAC protect an authority that comes with a policy, so the API will have to be extended to fix that case
Quoted 5 lines
I've verified this using the test suite in the last patch on a VM connected to a tpm2 emulator. I also instrumented the emulator to make sure the sensitive data was properly encrypted.
James
1. Can I ignore v2 and just review/test this version? I haven't even peeked into v2 yet.
2. Do you know in which kernel version will the crypto additions land?
/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerQuoted 41 lines · Jarkko Sakkinen
Quoted 40 lines · James Bottomley
By now, everybody knows we have a problem with the
TPM2_RS_PWeasy button on TPM2 in that transactions on the TPM bus can be intercepted
and altered.??The way to fix this is to use real sessions for HMAC capabilities to ensure integrity and to use parameter and response encryption to ensure confidentiality of the data flowing over the TPM
bus.This patch series is about adding a simple API which can ensure the above properties as a layered addition to the existing TPM handling code.??This series now includes protections for PCR extend, getting random numbers from the TPM and data sealing and unsealing.??It therefore eliminates all uses of
TPM2_RS_PWin the kernel and adds encryption protection to sensitive data flowing into and out of the TPM.This series is also dependent on additions to the crypto subsystem to
fix problems in the elliptic curve key handling and add the Cipher FeedBack encryption scheme:https://marc.info/?l=linux-crypto-vger&m=151994371015475
In the third version I've added data sealing and unsealing protection,
apart from one API based problem which means that the way trusted keys
were protected it's not currently possible to HMAC protect an authority
that comes with a policy, so the API will have to be extended to fix
that caseI've verified this using the test suite in the last patch on a VM connected to a tpm2 emulator.??I also instrumented the emulator to make
sure the sensitive data was properly encrypted.
Quoted 4 lines
Quoted 1 line
James
1. Can I ignore v2 and just review/test this version? I haven't even ???peeked into v2 yet.
Yes, v3 is a more complete version of v2 with a couple of sessions API additions.
I think the way I'm going to fix the trusted key policy problem is to move it back into the kernel for the simple PCR lock policy (which will make changing from 1.2 to 2.0 seamless because the external Key API will then become the same) so the kernel gets the missing TPM nonce and can then do TPM2_PolicyAuthValue.
User generated policy sessions for trusted keys are very flexible but also a hugely bad idea for consumers because it's so different from the way 1.2 works and it means now the user has to exercise a TPM API to produce the policy sessions.
Longer term, I think having a particular trusted key represent a policy session which can then be attached to a different trusted key representing the blob is the best idea because we can expose the policy build up via the trusted key API and keep all the TPM nastiness inside the kernel.
Quoted 2 lines
2. Do you know in which kernel version will the crypto additions land?
They're here:
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git/log/
So I'd guess next merge window. You can do what we do in SCSI and create a "postmerge" branch based on the cryptodev one (we often have SCSI stuff with block tree precursors). ?The way I run it is that I don't send the merge window pull request until I see the merge-base against Linus master move to the base of the patches (meaning all the precursors are upstream).
Quoted 2 lines
/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · James Bottomley
I think the way I'm going to fix the trusted key policy problem is to move it back into the kernel for the simple PCR lock policy (which will make changing from 1.2 to 2.0 seamless because the external Key API will then become the same) so the kernel gets the missing TPM nonce and can then do
TPM2_PolicyAuthValue.
Sounds reasonable.
Quoted 10 lines
User generated policy sessions for trusted keys are very flexible but also a hugely bad idea for consumers because it's so different from the way 1.2 works and it means now the user has to exercise a TPM API to produce the policy sessions.
Longer term, I think having a particular trusted key represent a policy session which can then be attached to a different trusted key representing the blob is the best idea because we can expose the policy build up via the trusted key API and keep all the TPM nastiness inside the kernel.
/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html