From: Antony Vennard <antony@vennard.ch>
To: David Howells <dhowells@redhat.com>,
David Woodhouse <dwmw2@infradead.org>
Cc: keyrings@vger.kernel.org, linux-kernel@vger.kernel.org,
Antony Vennard <antony@vennard.ch>
Subject: [PATCH 1/1] Load OpenSSL config if present in sign-file.c
Date: Fri, 3 Feb 2017 02:31:18 +0100 [thread overview]
Message-ID: <20170203013118.14634-2-antony@vennard.ch> (raw)
In-Reply-To: <20170203013118.14634-1-antony@vennard.ch>
This patch modifies scripts/sign-file.c such that custom engine
configurations can be loaded for signing kernel modules.
Signed-off-by: Antony Vennard <antony@vennard.ch>
---
scripts/sign-file.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/scripts/sign-file.c b/scripts/sign-file.c
index 19ec468..78901aa 100644
--- a/scripts/sign-file.c
+++ b/scripts/sign-file.c
@@ -24,6 +24,7 @@
#include <arpa/inet.h>
#include <openssl/opensslv.h>
#include <openssl/bio.h>
+#include <openssl/conf.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/err.h>
@@ -137,7 +138,6 @@ static EVP_PKEY *read_private_key(const char *private_key_name)
if (!strncmp(private_key_name, "pkcs11:", 7)) {
ENGINE *e;
- ENGINE_load_builtin_engines();
drain_openssl_errors();
e = ENGINE_by_id("pkcs11");
ERR(!e, "Load PKCS#11 ENGINE");
@@ -227,10 +227,21 @@ int main(int argc, char **argv)
X509 *x509;
BIO *bd, *bm;
int opt, n;
+
OpenSSL_add_all_algorithms();
+ OPENSSL_load_builtin_modules();
+ ENGINE_load_builtin_engines();
ERR_load_crypto_strings();
ERR_clear_error();
+ if (CONF_modules_load_file(NULL, NULL,
+ CONF_MFLAGS_DEFAULT_SECTION |
+ CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) {
+ fprintf(stderr, "FATAL: error loading configuration file.\n");
+ ERR_print_errors_fp(stderr);
+ exit(4);
+ }
+
key_pass = getenv("KBUILD_SIGN_PIN");
#ifndef USE_PKCS7
--
2.9.3
next prev parent reply other threads:[~2017-02-03 1:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 1:31 [PATCH 0/1] " Antony Vennard
2017-02-03 1:31 ` Antony Vennard [this message]
2017-02-03 9:07 ` David Woodhouse
2017-02-03 9:23 ` Antony Vennard
2017-02-03 9:36 ` David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170203013118.14634-2-antony@vennard.ch \
--to=antony@vennard.ch \
--cc=dhowells@redhat.com \
--cc=dwmw2@infradead.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®