From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752051AbdBCBji (ORCPT ); Thu, 2 Feb 2017 20:39:38 -0500 Received: from chameleon.vennard.ch ([37.35.107.252]:40496 "EHLO chameleon.vennard.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751595AbdBCBjg (ORCPT ); Thu, 2 Feb 2017 20:39:36 -0500 X-Greylist: delayed 393 seconds by postgrey-1.27 at vger.kernel.org; Thu, 02 Feb 2017 20:39:35 EST DKIM-Filter: OpenDKIM Filter v2.10.3 chameleon.vennard.ch 4701E1206EB Authentication-Results: chameleon.vennard.ch; dkim=none From: Antony Vennard To: David Howells , David Woodhouse Cc: keyrings@vger.kernel.org, linux-kernel@vger.kernel.org, Antony Vennard Subject: [PATCH 1/1] Load OpenSSL config if present in sign-file.c Date: Fri, 3 Feb 2017 02:31:18 +0100 Message-Id: <20170203013118.14634-2-antony@vennard.ch> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170203013118.14634-1-antony@vennard.ch> References: <20170203013118.14634-1-antony@vennard.ch> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch modifies scripts/sign-file.c such that custom engine configurations can be loaded for signing kernel modules. Signed-off-by: Antony Vennard --- 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 #include #include +#include #include #include #include @@ -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