Skip to content

Commit d352dcc

Browse files
max619mtrojnar
authored andcommitted
Do not try to load engine twice
1 parent 7734382 commit d352dcc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

osslsigncode.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4231,7 +4231,8 @@ static int read_crypto_params(GLOBAL_OPTIONS *options)
42314231
/* Security token */
42324232
#ifndef OPENSSL_NO_ENGINE
42334233
/* PKCS#11 'dynamic' engine */
4234-
} else if (options->p11engine && !engine_load(options)) {
4234+
} else if (options->p11engine) {
4235+
if(!engine_load(options))
42354236
goto out;
42364237
#endif /* OPENSSL_NO_ENGINE */
42374238
} else if (options->p11module) {
@@ -4240,13 +4241,14 @@ static int read_crypto_params(GLOBAL_OPTIONS *options)
42404241
if ((options->provider && provider_load(options->provider)) || provider_load("pkcs11prov")) {
42414242
load_objects_from_store(options->keyfile, options->pass, &options->pkey, NULL, NULL);
42424243
load_objects_from_store(options->p11cert, options->pass, NULL, options->certs, NULL);
4243-
} else
4244+
} else {
42444245
#endif /* OPENSSL_VERSION_NUMBER>=0x30000000L */
42454246
#ifndef OPENSSL_NO_ENGINE
4246-
/* try to find and load libp11 'pkcs11' engine */
4247-
if (!engine_load(options)) {
4248-
goto out;
4247+
/* try to find and load libp11 'pkcs11' engine */
4248+
if (!engine_load(options)) {
4249+
goto out;
42494250
#endif /* OPENSSL_NO_ENGINE */
4251+
}
42504252
}
42514253
#endif /* !defined(OPENSSL_NO_ENGINE) || OPENSSL_VERSION_NUMBER>=0x30000000L */
42524254
} else {

0 commit comments

Comments
 (0)