]> www.infradead.org Git - users/jedix/linux-maple.git/commit
security: keys: trusted: Make sealed key properly interoperable
authorJames Bottomley <James.Bottomley@HansenPartnership.com>
Wed, 27 Jan 2021 19:06:17 +0000 (11:06 -0800)
committerJarkko Sakkinen <jarkko@kernel.org>
Fri, 9 Apr 2021 05:58:31 +0000 (08:58 +0300)
commit5d93625a76dabdab156a1331d50db61fb67220d2
tree2bdb7cf3f80790361c9c37d3ac26d6f5e2f0c621
parent14676f1eb79660b6ee262644fa788a5c42ac19e4
security: keys: trusted: Make sealed key properly interoperable

The current implementation appends a migratable flag to the end of a
key, meaning the format isn't exactly interoperable because the using
party needs to know to strip this extra byte.  However, all other
consumers of TPM sealed blobs expect the unseal to return exactly the
key.  Since TPM2 keys have a key property flag that corresponds to
migratable, use that flag instead and make the actual key the only
sealed quantity.  This is secure because the key properties are bound
to a hash in the private part, so if they're altered the key won't
load.

Backwards compatibility is implemented by detecting whether we're
loading a new format key or not and correctly setting migratable from
the last byte of old format keys.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
include/linux/tpm.h
security/keys/trusted-keys/trusted_tpm2.c