lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu,  3 Jul 2014 17:07:20 -0400
From:	Vivek Goyal <vgoyal@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	ebiederm@...ssion.com, hpa@...or.com, mjg59@...f.ucam.org,
	greg@...ah.com, bp@...en8.de, dyoung@...hat.com,
	chaowang@...hat.com, bhe@...hat.com, akpm@...ux-foundation.org,
	dhowells@...hat.com, pjones@...hat.com,
	Vivek Goyal <vgoyal@...hat.com>
Subject: [PATCH 8/9] PEFILE: Validate PKCS#7 trust chain

Validate the PKCS#7 trust chain against the contents of the system keyring.

Signed-off-by: David Howells <dhowells@...hat.com>
Signed-off-by: Vivek Goyal <vgoyal@...hat.com>
---
 arch/x86/Kconfig                |  1 +
 arch/x86/kernel/pefile_parser.c | 12 +++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 29b9967..741d90d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1579,6 +1579,7 @@ config SIGNED_PE_FILE_PARSER
 	depends on PKCS7_MESSAGE_PARSER=y
 	select ASN1
 	select OID_REGISTRY
+	select SYSTEM_TRUSTED_KEYRING
 	---help---
 	  This option provides support for parsing signed PE
 	  (Protable Executable) binaries.
diff --git a/arch/x86/kernel/pefile_parser.c b/arch/x86/kernel/pefile_parser.c
index f11c254..de61279 100644
--- a/arch/x86/kernel/pefile_parser.c
+++ b/arch/x86/kernel/pefile_parser.c
@@ -18,6 +18,7 @@
 #include <linux/asn1.h>
 #include <keys/asymmetric-subtype.h>
 #include <keys/asymmetric-parser.h>
+#include <keys/system_keyring.h>
 #include <crypto/hash.h>
 #include <crypto/pkcs7.h>
 #include "pefile_parser.h"
@@ -388,6 +389,7 @@ int pefile_parse_verify_sig(const void *pebuf, unsigned int pelen)
 	void *pkcs7;
 	struct pefile_context ctx;
 	int ret;
+	bool trusted;
 
 	kenter("");
 
@@ -421,9 +423,13 @@ int pefile_parse_verify_sig(const void *pebuf, unsigned int pelen)
 	ret = pkcs7_verify(pkcs7);
 	if (ret < 0)
 		goto error;
-
-	/* Not yet complete */
-	ret = -ENOANO;
+	/*
+	 * Trust is being verified against system_trusted_keyring. This is
+	 * a trusted keyring and all the keys in this keyring should be
+	 * trusted. So there should not be any need to check "trusted"
+	 * parameter.
+	 */
+	ret = pkcs7_validate_trust(pkcs7, system_trusted_keyring, &trusted);
 
 error:
 	pkcs7_free_message(ctx.pkcs7);
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ