Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572849

[PATCH 1/1] Load OpenSSL config if present in sign-file.c

From Antony Vennard <antony@vennard.ch>
Newsgroups linux.kernel
Subject [PATCH 1/1] Load OpenSSL config if present in sign-file.c
Date 2017-02-03 02:50 +0100
Message-ID <t6BaG-3o4-19@gated-at.bofh.it> (permalink)
References <t6B0Z-3kB-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/1] Load OpenSSL config if present in sign-file.c Antony Vennard <antony@vennard.ch> - 2017-02-03 02:40 +0100
  [PATCH 1/1] Load OpenSSL config if present in sign-file.c Antony Vennard <antony@vennard.ch> - 2017-02-03 02:50 +0100
  Re: [PATCH 0/1] Load OpenSSL config if present in sign-file.c David Woodhouse <dwmw2@infradead.org> - 2017-02-03 10:10 +0100
    Re: [PATCH 0/1] Load OpenSSL config if present in sign-file.c Antony Vennard <antony@vennard.ch> - 2017-02-03 10:30 +0100
      Re: [PATCH 0/1] Load OpenSSL config if present in sign-file.c David Woodhouse <dwmw2@infradead.org> - 2017-02-03 10:40 +0100

csiph-web