lkml.org 
[lkml]   [2014]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 8/9] PEFILE: Validate PKCS#7 trust chain
Date
Validate the PKCS#7 trust chain against the contents of the system keyring.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Vivek Goyal <vgoyal@redhat.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


\
 
 \ /
  Last update: 2014-07-03 23:41    [W:0.152 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site