[PATCH 5/9] pefile: Parse the presumed PKCS#7 content of the certificate blob

From: Vivek Goyal
Date: Thu Jul 03 2014 - 17:08:22 EST


Parse the content of the certificate blob, presuming it to be PKCS#7 format.

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
Signed-off-by: Vivek Goyal <vgoyal@xxxxxxxxxx>
---
arch/x86/kernel/pefile_parser.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/pefile_parser.c b/arch/x86/kernel/pefile_parser.c
index 088779e..e4d3410 100644
--- a/arch/x86/kernel/pefile_parser.c
+++ b/arch/x86/kernel/pefile_parser.c
@@ -199,6 +199,7 @@ static int pefile_parse_binary(const void *pebuf, unsigned int pelen,
*/
int pefile_parse_verify_sig(const void *pebuf, unsigned int pelen)
{
+ void *pkcs7;
struct pefile_context ctx;
int ret;

@@ -213,6 +214,15 @@ int pefile_parse_verify_sig(const void *pebuf, unsigned int pelen)
if (ret < 0)
return ret;

+ pkcs7 = pkcs7_parse_message(pebuf + ctx.sig_offset, ctx.sig_len);
+ if (IS_ERR(pkcs7))
+ return PTR_ERR(pkcs7);
+ ctx.pkcs7 = pkcs7;
+
/* Not yet complete */
- return -ENOANO;
+ ret = -ENOANO;
+
+error:
+ pkcs7_free_message(ctx.pkcs7);
+ return ret;
}
--
1.9.0

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