From 50c23daa4c540e373ca7c4675c121e44d839884c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Trojnara?= Date: Tue, 3 Jun 2025 08:20:52 +0200 Subject: [PATCH] Code simplification No functional change intended. --- osslsigncode.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osslsigncode.c b/osslsigncode.c index 2554058..ea28753 100644 --- a/osslsigncode.c +++ b/osslsigncode.c @@ -4125,7 +4125,7 @@ static int read_pkcs7_certfile(GLOBAL_OPTIONS *options) * [in] options: structure holds the input data * [returns] pointer to ENGINE */ -static ENGINE *engine_dynamic(GLOBAL_OPTIONS *options) +static ENGINE *engine_dynamic(const char *path) { ENGINE *engine; char *id; @@ -4135,18 +4135,18 @@ static ENGINE *engine_dynamic(GLOBAL_OPTIONS *options) fprintf(stderr, "Failed to load 'dynamic' engine\n"); return NULL; /* FAILED */ } - if (options->p11engine) { /* strip directory and extension */ + if (path) { /* strip directory and extension */ char *ptr; - ptr = strrchr(options->p11engine, '/'); + ptr = strrchr(path, '/'); if (!ptr) /* no slash -> try backslash */ - ptr = strrchr(options->p11engine, '\\'); + ptr = strrchr(path, '\\'); if (ptr) { /* directory separator found */ ptr++; /* skip it */ if (!strncmp(ptr, "lib", 3)) ptr += 3; /* skip the "lib" prefix */ } else /* directory separator not found */ - ptr = options->p11engine; + ptr = (char *)path; id = OPENSSL_strdup(ptr); ptr = strchr(id, '.'); if (ptr) /* file extensions found */ @@ -4154,7 +4154,7 @@ static ENGINE *engine_dynamic(GLOBAL_OPTIONS *options) } else { id = OPENSSL_strdup("pkcs11"); } - if (!ENGINE_ctrl_cmd_string(engine, "SO_PATH", options->p11engine, 0) + if (!ENGINE_ctrl_cmd_string(engine, "SO_PATH", path, 0) || !ENGINE_ctrl_cmd_string(engine, "ID", id, 0) || !ENGINE_ctrl_cmd_string(engine, "LIST_ADD", "1", 0) || !ENGINE_ctrl_cmd_string(engine, "LOAD", NULL, 0)) { @@ -4250,7 +4250,7 @@ static int engine_load(GLOBAL_OPTIONS *options) if (strchr(id, '.')) { /* Treat strings with a dot as paths to dynamic engine modules */ - engine = engine_dynamic(options); + engine = engine_dynamic(id); } else { /* Treat strings without a dot as engine IDs */ engine = ENGINE_by_id(id);