2021-05-24 02:17:58

by Lee, Chun-Yi

[permalink] [raw]
Subject: [PATCH v8 0/4] Check codeSigning extended key usage extension

NIAP PP_OS certification requests that the OS shall validate the
CodeSigning extended key usage extension field for integrity
verifiction of exectable code:

https://www.niap-ccevs.org/MMO/PP/-442-/
FIA_X509_EXT.1.1

This patchset adds the logic for parsing the codeSigning EKU extension
field in X.509. And checking the CodeSigning EKU when verifying
signature of kernel module or kexec PE binary in PKCS#7.

v8:
- Fixed the bug of is_key_on_revocation_list() when
CONFIG_SYSTEM_REVOCATION_LIST is not set.

v7:
- Fixed the broken function call in is_key_on_revocation_list().
(be found by kernel test robot)
- Use a general name check_eku_by_usage() instead of check_codesign_eku().

v6:
- Add more length checking when parsing extKeyUsage and EKU's OID blob.
- Add 'usage' parameter to the comment of pkcs7_validate_trust function.

v5:
Fixed the wording in module-signing.rst.

v4:
Fixed the wording in patch description.

v3:
- Add codeSigning EKU to x509.genkey key generation config.
- Add openssl command option example for generating CodeSign EKU to
module-signing.rst document.

v2:
Changed the help wording in the Kconfig.

Lee, Chun-Yi (4):
X.509: Add CodeSigning extended key usage parsing
PKCS#7: Check codeSigning EKU for kernel module and kexec pe
verification
modsign: Add codeSigning EKU when generating X.509 key generation
config
Documentation/admin-guide/module-signing.rst: add openssl command
option example for CodeSign EKU

Documentation/admin-guide/module-signing.rst | 6 ++++
certs/Makefile | 1 +
certs/blacklist.c | 6 ++--
certs/system_keyring.c | 4 +--
crypto/asymmetric_keys/Kconfig | 9 ++++++
crypto/asymmetric_keys/pkcs7_trust.c | 43 ++++++++++++++++++++++++++--
crypto/asymmetric_keys/x509_cert_parser.c | 25 ++++++++++++++++
include/crypto/pkcs7.h | 4 ++-
include/crypto/public_key.h | 1 +
include/keys/system_keyring.h | 7 +++--
include/linux/oid_registry.h | 5 ++++
11 files changed, 101 insertions(+), 10 deletions(-)

--
2.16.4


2021-05-24 02:18:23

by Lee, Chun-Yi

[permalink] [raw]
Subject: [PATCH v8,4/4] Documentation/admin-guide/module-signing.rst: add openssl command option example for CodeSign EKU

Add an openssl command option example for generating CodeSign extended
key usage in X.509 when CONFIG_CHECK_CODESIGN_EKU is enabled.

Signed-off-by: "Lee, Chun-Yi" <[email protected]>
---
Documentation/admin-guide/module-signing.rst | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/Documentation/admin-guide/module-signing.rst b/Documentation/admin-guide/module-signing.rst
index 7d7c7c8a545c..ca3b8f19466c 100644
--- a/Documentation/admin-guide/module-signing.rst
+++ b/Documentation/admin-guide/module-signing.rst
@@ -170,6 +170,12 @@ generate the public/private key files::
-config x509.genkey -outform PEM -out kernel_key.pem \
-keyout kernel_key.pem

+When ``CONFIG_CHECK_CODESIGN_EKU`` option is enabled, the following openssl
+command option should be added where for generating CodeSign extended key usage
+in X.509::
+
+ -addext "extendedKeyUsage=codeSigning"
+
The full pathname for the resulting kernel_key.pem file can then be specified
in the ``CONFIG_MODULE_SIG_KEY`` option, and the certificate and key therein will
be used instead of an autogenerated keypair.
--
2.16.4