From 9ea7e854688bf3366396578b319341f6c8b8ccc8 Mon Sep 17 00:00:00 2001 From: olszomal Date: Mon, 5 May 2025 10:57:52 +0200 Subject: [PATCH] Fix engine-less builds --- osslsigncode.c | 12 ++++++++---- osslsigncode.h | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/osslsigncode.c b/osslsigncode.c index 176a471..f422689 100644 --- a/osslsigncode.c +++ b/osslsigncode.c @@ -4242,15 +4242,19 @@ static int read_crypto_params(GLOBAL_OPTIONS *options) else if (options->p11engine) { if(!engine_load(options)) goto out; + } #endif /* OPENSSL_NO_ENGINE */ - } else if (options->p11module) { + else if (options->p11module) { #if OPENSSL_VERSION_NUMBER>=0x30000000L /* Try to load PKCS#11 provider first */ if ((options->provider && provider_load(options->provider)) || provider_load("pkcs11prov")) { load_objects_from_store(options->keyfile, options->pass, &options->pkey, NULL, NULL); load_objects_from_store(options->p11cert, options->pass, NULL, options->certs, NULL); - } else + } #endif /* OPENSSL_VERSION_NUMBER>=0x30000000L */ +#if !defined(OPENSSL_NO_ENGINE) && OPENSSL_VERSION_NUMBER>=0x30000000L + else +#endif /* !defined(OPENSSL_NO_ENGINE) || OPENSSL_VERSION_NUMBER>=0x30000000L */ #ifndef OPENSSL_NO_ENGINE /* try to find and load libp11 'pkcs11' engine */ if (!engine_load(options)) @@ -4280,9 +4284,9 @@ static int read_crypto_params(GLOBAL_OPTIONS *options) if (sk_X509_num(options->certs) == 0 && !read_pkcs7_certfile(options)) { return 0; /* FAILED */ } -#if !defined(OPENSSL_NO_ENGINE) || OPENSSL_VERSION_NUMBER>=0x30000000L +#if !defined(OPENSSL_NO_ENGINE) || OPENSSL_VERSION_NUMBER<0x1010108f out: -#endif /* !defined(OPENSSL_NO_ENGINE) || OPENSSL_VERSION_NUMBER>=0x30000000L */ +#endif /* !defined(OPENSSL_NO_ENGINE) || OPENSSL_VERSION_NUMBER<0x1010108f */ return (options->pkey && sk_X509_num(options->certs) > 0) ? 1 : 0; } diff --git a/osslsigncode.h b/osslsigncode.h index 048a2f2..e218743 100644 --- a/osslsigncode.h +++ b/osslsigncode.h @@ -268,11 +268,13 @@ typedef struct { int output_pkcs7; #ifndef OPENSSL_NO_ENGINE char *p11engine; + STACK_OF(EngineControl) *engine_ctrls; + int login; +#endif /* OPENSSL_NO_ENGINE */ +#if !defined(OPENSSL_NO_ENGINE) || OPENSSL_VERSION_NUMBER>=0x30000000L char *p11module; char *p11cert; - int login; - STACK_OF(EngineControl) *engine_ctrls; -#endif /* OPENSSL_NO_ENGINE */ +#endif /* !defined(OPENSSL_NO_ENGINE) || OPENSSL_VERSION_NUMBER>=0x30000000L */ int askpass; char *readpass; char *pass;