Skip to content

KEYS: Change how keys are determined to be trusted

David Howells linux-crypto lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10KEYS: Generalise system_verify_data() to provide access to internal contentarch/x86/kernel/kexec-bzimage64.c certs/system_keyring.c crypto/asymmetric_keys/Kconfig +12 more+156 -1610 replies
2/10PKCS#7: Make trust determination dependent on contents of trust keyringcerts/system_keyring.c crypto/asymmetric_keys/pkcs7_key_type.c crypto/asymmetric_keys/pkcs7_parser.h +6 more+11 -300 replies
3/10KEYS: Add facility to check key trustworthiness upon link creationDocumentation/security/keys.txt crypto/asymmetric_keys/x509_public_key.c include/linux/key-type.h +3 more+87 -200 replies
4/10KEYS: Allow authentication data to be stored in an asymmetric keycrypto/asymmetric_keys/asymmetric_type.c crypto/asymmetric_keys/public_key.c crypto/asymmetric_keys/x509_cert_parser.c +3 more+33 -120 replies
5/10KEYS: Add identifier pointers to public_key_signature structcrypto/asymmetric_keys/public_key.c include/crypto/public_key.h+3 -00 replies
6/10X.509: Retain the key verification datacrypto/asymmetric_keys/pkcs7_trust.c crypto/asymmetric_keys/pkcs7_verify.c crypto/asymmetric_keys/x509_cert_parser.c +2 more+72 -710 replies
7/10X.509: Extract signature digest and make self-signed cert checks earliercrypto/asymmetric_keys/pkcs7_verify.c crypto/asymmetric_keys/x509_cert_parser.c crypto/asymmetric_keys/x509_parser.h +1 more+121 -730 replies
8/10PKCS#7: Make the signature a pointer rather than embedding itcrypto/asymmetric_keys/pkcs7_parser.c crypto/asymmetric_keys/pkcs7_parser.h crypto/asymmetric_keys/pkcs7_trust.c +1 more+56 -480 replies
9/10X.509: Move the trust validation code out to its own filecrypto/asymmetric_keys/Makefile crypto/asymmetric_keys/public_key_trust.c crypto/asymmetric_keys/x509_parser.h +1 more+199 -1680 replies
10/10KEYS: Move the point of trust determination to __key_link()certs/system_keyring.c crypto/asymmetric_keys/Makefile crypto/asymmetric_keys/asymmetric_keys.h +10 more+108 -840 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/10] KEYS: Change how keys are determined to be trusted

Here's a set of patches that changes how keys are determined to be trusted
- currently, that's a case of whether a key has KEY_FLAG_TRUSTED set upon it. A keyring can then have a flag set (KEY_FLAG_TRUSTED ONLY) that indicates that only keys with this flag set may be added to that keyring.

Further, any time an X.509 certificate is instantiated without this flag set, the certificate is judged against the contents of the system trusted keyring to determine whether KEY_FLAG_TRUSTED should be set upon it.

With these patches, KEY_FLAG_TRUSTED is removed. The kernel may add implicitly trusted keys to a trusted-only keyring by asserting KEY_ALLOC_TRUSTED when the key is created, but otherwise the key will only be allowed to be added to the keyring if it can be verified by a key already in that keyring. The system trusted keyring is not then special in this sense and other trusted keyrings can be set up that are wholly independent of it.

To make this work, we have to retain sufficient data from the X.509 certificate that we can then verify the signature at need.

The patches can be found here also:

http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=keys-trust

and are tagged with:

	keys-trust-20151021

David
---
David Howells (10):
KEYS: Generalise system_verify_data() to provide access to internal content PKCS#7: Make trust determination dependent on contents of trust keyring
KEYS: Add facility to check key trustworthiness upon link creation
KEYS: Allow authentication data to be stored in an asymmetric key
KEYS: Add identifier pointers to public_key_signature struct X.509: Retain the key verification data
X.509: Extract signature digest and make self-signed cert checks earlier PKCS#7: Make the signature a pointer rather than embedding it X.509: Move the trust validation code out to its own file
KEYS: Move the point of trust determination to __key_link()

 Documentation/security/keys.txt           |   17 ++
 arch/x86/kernel/kexec-bzimage64.c         |   18 --
 certs/system_keyring.c                    |   49 +++--
 crypto/asymmetric_keys/Kconfig            |    1 
 crypto/asymmetric_keys/Makefile           |    4 
 crypto/asymmetric_keys/asymmetric_keys.h  |    2 
 crypto/asymmetric_keys/asymmetric_type.c  |   22 ++
 crypto/asymmetric_keys/mscode_parser.c    |   21 +-
 crypto/asymmetric_keys/pkcs7_key_type.c   |   64 +++---
 crypto/asymmetric_keys/pkcs7_parser.c     |   59 +++--
 crypto/asymmetric_keys/pkcs7_parser.h     |   11 -
 crypto/asymmetric_keys/pkcs7_trust.c      |   44 ++--
 crypto/asymmetric_keys/pkcs7_verify.c     |  108 ++++------
 crypto/asymmetric_keys/public_key.c       |   43 ++++
 crypto/asymmetric_keys/public_key.h       |    6 +
 crypto/asymmetric_keys/public_key_trust.c |  180 +++++++++++++++++
 crypto/asymmetric_keys/verify_pefile.c    |   40 +---
 crypto/asymmetric_keys/verify_pefile.h    |    5 
 crypto/asymmetric_keys/x509_cert_parser.c |   53 +++--
 crypto/asymmetric_keys/x509_parser.h      |   12 -
 crypto/asymmetric_keys/x509_public_key.c  |  312 +++++++++--------------------
 include/crypto/pkcs7.h                    |    6 -
 include/crypto/public_key.h               |   28 +--
 include/keys/asymmetric-subtype.h         |    6 -
 include/keys/asymmetric-type.h            |    8 -
 include/keys/system_keyring.h             |    7 -
 include/linux/key-type.h                  |   10 +
 include/linux/key.h                       |   12 +
 include/linux/verification.h              |   49 +++++
 include/linux/verify_pefile.h             |   22 --
 kernel/module_signing.c                   |    5 
 security/integrity/digsig_asymmetric.c    |    5 
 security/keys/key.c                       |   44 +++-
 security/keys/keyring.c                   |   18 +-
 34 files changed, 735 insertions(+), 556 deletions(-)
 create mode 100644 crypto/asymmetric_keys/public_key_trust.c
 create mode 100644 include/linux/verification.h
 delete mode 100644 include/linux/verify_pefile.h