Re: [PATCH v4 2/7] tpm2-sessions: Add full HMAC and encrypt/decrypt session handling

2018-10-24 Thread James Bottomley
On Wed, 2018-10-24 at 02:48 +0300, Jarkko Sakkinen wrote: > On Mon, 22 Oct 2018, James Bottomley wrote: > > [...] I'll tidy up the descriptions. > These all sould be combined with the existing session stuff inside > tpm2-cmd.c and not have duplicate infrastructures. The fil

Re: [PATCH v4 0/7] add integrity and security to TPM2 transactions

2018-10-24 Thread James Bottomley
On Wed, 2018-10-24 at 02:51 +0300, Jarkko Sakkinen wrote: > I would consider sending first a patch set that would iterate the > existing session stuff to be ready for this i.e. merge in two > iterations (emphasis on the word "consider"). We can probably merge > the groundwork quite fast. I

Re: [PATCH v4 2/7] tpm2-sessions: Add full HMAC and encrypt/decrypt session handling

2018-10-23 Thread James Bottomley
On Mon, 2018-10-22 at 19:19 -0300, Ard Biesheuvel wrote: [...] > > +static void hmac_init(struct shash_desc *desc, u8 *key, int > > keylen) > > +{ > > + u8 pad[SHA256_BLOCK_SIZE]; > > + int i; > > + > > + desc->tfm = sha256_hash; > > + desc->flags =

[PATCH v4 7/7] tpm2-sessions: NOT FOR COMMITTING add sessions testing

2018-10-22 Thread James Bottomley
encryption. It also does policy unsealing which mimics the more complex of the trusted key scenarios. Signed-off-by: James Bottomley --- v3: add policy unseal testing with two sessions --- drivers/char/tpm/Makefile | 1 + drivers/char/tpm/tpm-chip.c | 1 + drivers/char/tpm

[PATCH v4 6/7] tpm: add the null key name as a tpm2 sysfs variable

2018-10-22 Thread James Bottomley
and the TPM can then run a TPM2_Certify operation on this derived primary key using the newly created AIK. Signed-off-by: James Bottomley --- drivers/char/tpm/tpm-sysfs.c | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm-sysfs.c b

[PATCH v4 5/7] trusted keys: Add session encryption protection to the seal/unseal path

2018-10-22 Thread James Bottomley
to get rid of this security hole. Signed-off-by: James Bottomley --- drivers/char/tpm/tpm2-cmd.c | 155 1 file changed, 98 insertions(+), 57 deletions(-) diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index 22f1c7bee173

[PATCH v4 4/7] tpm2: add session encryption protection to tpm2_get_random()

2018-10-22 Thread James Bottomley
If 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. Signed-off-by: James Bottomley --- v3

[PATCH v4 3/7] tpm2: add hmac checks to tpm2_pcr_extend()

2018-10-22 Thread James Bottomley
We 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. Signed-off-by: James Bottomley --- v3: add error handling to sessions --- drivers/char

[PATCH v4 2/7] tpm2-sessions: Add full HMAC and encrypt/decrypt session handling

2018-10-22 Thread James Bottomley
remains for the kernel by using a kernel space to take it out of the TPM when userspace wants to use it. Signed-off-by: James Bottomley --- 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

[PATCH v4 1/7] tpm-buf: create new functions for handling TPM buffers

2018-10-22 Thread James Bottomley
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. Signed-off-by: James Bottomley --- v2: added this patch to separate out

[PATCH v4 0/7] add integrity and security to TPM2 transactions

2018-10-22 Thread James Bottomley
. 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 (7): tpm-buf: create new functions for handling TPM buffers tpm2-sessions: Add

Re: [PATCH 1/2] crypto: fix cfb mode decryption

2018-10-21 Thread James Bottomley
On October 21, 2018 9:58:04 AM GMT, Ard Biesheuvel wrote: >On 21 October 2018 at 10:07, James Bottomley > wrote: >> On Sun, 2018-10-21 at 09:05 +0200, Ard Biesheuvel wrote: >>> (+ James) >> >> Thanks! >> >>> On 20 October 2

Re: [PATCH 1/2] crypto: fix cfb mode decryption

2018-10-21 Thread James Bottomley
On Sun, 2018-10-21 at 09:05 +0200, Ard Biesheuvel wrote: > (+ James) Thanks! > On 20 October 2018 at 01:01, Dmitry Eremin-Solenikov > wrote: > > crypto_cfb_decrypt_segment() incorrectly XOR'ed generated keystream > > with > > IV, rather than with data stream, resulting in incorrect > >

Re: CAAM and IMA/EVM : caam_rsa_enc: DECO: desc idx 7: Protocol Size Error

2018-04-10 Thread James Bottomley
On Tue, 2018-04-10 at 23:01 +0100, Martin Townsend wrote: > Using openssl to get the signature in my x509 cert > >    Signature Algorithm: sha256WithRSAEncryption > 68:82:cc:5d:f9:ee:fb:1a:77:72:a6:a9:c6:4c:cc:d7:f6:2a: > 17:a5:db:bf:5a:2b:8d:39:60:dc:a0:93:39:45:0f:bc:a7:e8: >  

Re: [tpmdd-devel] in-kernel user of ecdsa

2018-03-12 Thread James Bottomley
On Mon, 2018-03-12 at 20:56 +0100, Stephan Mueller wrote: > Am Montag, 12. März 2018, 19:09:18 CET schrieb James Bottomley: > > Hi James, > > > > > On Mon, 2018-03-12 at 19:07 +0200, Tudor Ambarus wrote: > > > > > > Hi, > > > > > >

Re: [tpmdd-devel] in-kernel user of ecdsa

2018-03-12 Thread James Bottomley
On Mon, 2018-03-12 at 19:07 +0200, Tudor Ambarus wrote: > Hi, > > Would you consider using ECDSA in the kernel module signing facility? > When compared with RSA, ECDSA has shorter keys, the key generation > process is faster, the sign operation is faster, but the verify > operation is slower than

Re: [PATCH v3 1/6] tpm-buf: create new functions for handling TPM buffers

2018-03-12 Thread James Bottomley
On Mon, 2018-03-12 at 09:00 -0700, J Freyensee wrote: > > > > +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,

Re: [PATCH v3 0/6] add integrity and security to TPM2 transactions

2018-03-12 Thread James Bottomley
On Mon, 2018-03-12 at 12:58 +0200, Jarkko Sakkinen wrote: > On Sat, 2018-03-10 at 14:13 -0800, James Bottomley wrote: > > > > 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 > > intercepte

[PATCH v3 6/6] tpm2-sessions: NOT FOR COMMITTING add sessions testing

2018-03-10 Thread James Bottomley
encryption. It also does policy unsealing which mimics the more complex of the trusted key scenarios. Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.com> --- v3: add policy unseal testing with two sessions --- drivers/char/tpm/Makefile | 1 + drivers/char/tpm/tpm-

[PATCH v3 5/6] trusted keys: Add session encryption protection to the seal/unseal path

2018-03-10 Thread James Bottomley
to get rid of this security hole. Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.com> --- drivers/char/tpm/tpm2-cmd.c | 156 1 file changed, 98 insertions(+), 58 deletions(-) diff --git a/drivers/char/tpm/tpm2-cmd.c b/driver

[PATCH v3 4/6] tpm2: add session encryption protection to tpm2_get_random()

2018-03-10 Thread James Bottomley
If 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. Signed-off-by: James Bottomley

[PATCH v3 3/6] tpm2: add hmac checks to tpm2_pcr_extend()

2018-03-10 Thread James Bottomley
We 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. Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.com> --- v3: add

[PATCH v3 2/6] tpm2-sessions: Add full HMAC and encrypt/decrypt session handling

2018-03-10 Thread James Bottomley
remains for the kernel by using a kernel space to take it out of the TPM when userspace wants to use it. Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.com> --- v2: Added docbook and improved response check API v3: Add readpublic, fix hmac length, add API for close on

[PATCH v3 1/6] tpm-buf: create new functions for handling TPM buffers

2018-03-10 Thread James Bottomley
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. Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.

[PATCH v3 0/6] add integrity and security to TPM2 transactions

2018-03-10 Thread James Bottomley
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

Re: [RFC 0/5] add integrity and security to TPM2 transactions

2018-03-10 Thread James Bottomley
On Sat, 2018-03-10 at 14:49 +0200, Jarkko Sakkinen wrote: > On Wed, 2018-03-07 at 15:29 -0800, James Bottomley wrote: > > > > 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 > > intercepte

[RFC v2 5/5] tpm2-sessions: NOT FOR COMMITTING add sessions testing

2018-03-07 Thread James Bottomley
ing that the same sealed data comes back again via an HMAC and response encryption. Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.com> --- drivers/char/tpm/Makefile | 1 + drivers/char/tpm/tpm-chip.c | 1 + drivers/char/tpm/tpm2-sessions-tes

[RFC v2 3/5] tpm2: add hmac checks to tpm2_pcr_extend()

2018-03-07 Thread James Bottomley
We 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. Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.com> --- drivers/ch

[RFC v2 2/5] tpm2-sessions: Add full HMAC and encrypt/decrypt session handling

2018-03-07 Thread James Bottomley
remains for the kernel by using a kernel space to take it out of the TPM when userspace wants to use it. Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.com> --- v2: Added docbook and improved response check API --- drivers/char/tpm/Kconfig |3 + drivers/ch

[RFC v2 1/5] tpm-buf: create new functions for handling TPM buffers

2018-03-07 Thread James Bottomley
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. Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.

[RFC 0/5] add integrity and security to TPM2 transactions

2018-03-07 Thread James Bottomley
file. James --- James Bottomley (5): 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() tpm2-sessions

Re: [RFC 0/2] add integrity and security to TPM2 transactions

2018-03-05 Thread James Bottomley
On Mon, 2018-03-05 at 07:04 -0700, Jason Gunthorpe wrote: > On Fri, Mar 02, 2018 at 10:04:54PM -0800, James Bottomley wrote: > > > > 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 > &

Re: [PATCH 1/2] tpm2-sessions: Add full HMAC and encrypt/decrypt session handling

2018-03-05 Thread James Bottomley
On Mon, 2018-03-05 at 13:35 +0200, Jarkko Sakkinen wrote: > On Fri, Mar 02, 2018 at 10:06:15PM -0800, James Bottomley wrote: > > > > diff --git a/drivers/char/tpm/tpm2b.h b/drivers/char/tpm/tpm2b.h > > new file mode 100644 > > index ..c7726f2895aa > >

[PATCH 2/2] tpm2-sessions: NOT FOR COMMITTING add sessions testing

2018-03-02 Thread James Bottomley
encryption. Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.com> --- drivers/char/tpm/Makefile | 1 + drivers/char/tpm/tpm-chip.c | 1 + drivers/char/tpm/tpm2-sessions-test.c | 178 ++ 3 files changed, 180 insertions(+)

[PATCH 1/2] tpm2-sessions: Add full HMAC and encrypt/decrypt session handling

2018-03-02 Thread James Bottomley
remains for the kernel by using a kernel space to take it out of the TPM when userspace wants to use it. Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.com> --- drivers/char/tpm/Kconfig | 3 + drivers/char/tpm/Makefile| 2 +- drivers/char/tpm

[RFC 0/2] add integrity and security to TPM2 transactions

2018-03-02 Thread James Bottomley
handling and add the Cipher FeedBack encryption scheme: https://marc.info/?l=linux-crypto-vger=151994371015475 --- James Bottomley (2): tpm2-sessions: Add full HMAC and encrypt/decrypt session handling tpm2-sessions: NOT FOR COMMITTING add sessions testing drivers/char/tpm/Kconfig

[PATCH 2/2] crypto: ecdh: fix to allow multi segment scatterlists

2018-03-01 Thread James Bottomley
Apparently the ecdh use case was in bluetooth which always has single element scatterlists, so the ecdh module was hard coded to expect them. Now we're using this in TPM, we need multi-element scatterlists, so remove this limitation. Signed-off-by: James Bottomley <james.bot

[PATCH 1/2] crypto: cfb: add support for Cipher FeedBack mode

2018-03-01 Thread James Bottomley
into the plain text to get the final ciphertext. https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#CFB Signed-off-by: James Bottomley <james.bottom...@hansenpartnership.com> --- crypto/Kconfig | 8 ++ crypto/Makefile | 1 + crypto/cfb.c

[PATCH 0/2] add crypto support for TPM communication

2018-03-01 Thread James Bottomley
of the scatterlist is hard coded to 1 which causes a kernel BUG if you use a longer scatterlist.  Since all the current kernel consumers use a single element scatterlist, this bug won't manifest until we add the TPM routines to use crypto, so I didn't mark it for stable. James Bottomley (2): crypto

Re: [RFC V4 PATCH 00/15] Signature verification of hibernate snapshot

2013-09-26 Thread James Bottomley
On Thu, 2013-09-26 at 08:24 +0200, Jiri Kosina wrote: On Wed, 25 Sep 2013, James Bottomley wrote: I don't get this. Why is it important that current kernel can't recreate the signature? The thread model is an attack on the saved information (i.e. the suspend image) between it being

Re: [RFC V4 PATCH 00/15] Signature verification of hibernate snapshot

2013-09-25 Thread James Bottomley
On Wed, 2013-09-25 at 17:25 -0400, Alan Stern wrote: On Wed, 25 Sep 2013, David Howells wrote: I have pushed some keyrings patches that will likely affect this to: http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=keys-devel I intend to ask James to

Re: [RFC V4 PATCH 00/15] Signature verification of hibernate snapshot

2013-09-25 Thread James Bottomley
On Thu, 2013-09-26 at 02:27 +0200, Pavel Machek wrote: On Wed 2013-09-25 15:16:54, James Bottomley wrote: On Wed, 2013-09-25 at 17:25 -0400, Alan Stern wrote: On Wed, 25 Sep 2013, David Howells wrote: I have pushed some keyrings patches that will likely affect