Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions osslsigncode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4166,21 +4166,6 @@ static ENGINE *engine_dynamic(GLOBAL_OPTIONS *options)
return engine;
}

/*
* Load a pkcs11 engine
* [in] none
* [returns] pointer to ENGINE
*/
static ENGINE *engine_pkcs11(void)
{
ENGINE *engine = ENGINE_by_id("pkcs11");
if (!engine) {
fprintf(stderr, "Failed to find and load 'pkcs11' engine\n");
return NULL; /* FAILED */
}
return engine; /* OK */
}

/*
* Load the private key and the signer certificate from a security token
* [in, out] options: structure holds the input data
Expand Down Expand Up @@ -4260,12 +4245,18 @@ static int read_token(GLOBAL_OPTIONS *options, ENGINE *engine)

static int engine_load(GLOBAL_OPTIONS *options)
{
const char *id = options->p11engine ? options->p11engine : "pkcs11";
ENGINE *engine;

if (options->p11engine)
if (strchr(id, '.')) {
/* Treat strings with a dot as paths to dynamic engine modules */
engine = engine_dynamic(options);
else
engine = engine_pkcs11();
} else {
/* Treat strings without a dot as engine IDs */
engine = ENGINE_by_id(id);
if (!engine)
fprintf(stderr, "Failed to find and load '%s' engine\n", id);
}
if (!engine)
return 0; /* FAILED */
printf("Engine \"%s\" set.\n", ENGINE_get_id(engine));
Expand Down