Fix engine-less builds

This commit is contained in:
olszomal 2025-05-05 10:57:52 +02:00 committed by Michał Trojnara
parent 68e8845ef1
commit 9ea7e85468
2 changed files with 13 additions and 7 deletions

View File

@ -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;
}

View File

@ -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;