1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-04-28 06:33:36 +02:00

evmctl: Define and use an ENGINE field in libimaevm_params

Extend the global libimaevm_params structure with an ENGINE field 'eng'
and use it in place of the local ENGINE variable in main().

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
Stefan Berger 2021-09-13 18:18:08 -04:00 committed by Mimi Zohar
parent 29aa7465d5
commit 1de1e3c8ce
2 changed files with 7 additions and 6 deletions

View File

@ -2660,7 +2660,6 @@ static ENGINE *setup_engine(const char *engine_id)
int main(int argc, char *argv[])
{
int err = 0, c, lind;
ENGINE *eng = NULL;
unsigned long keyid;
char *eptr;
@ -2781,8 +2780,8 @@ int main(int argc, char *argv[])
verify_list_sig = 1;
break;
case 139: /* --engine e */
eng = setup_engine(optarg);
if (!eng)
imaevm_params.eng = setup_engine(optarg);
if (!imaevm_params.eng)
goto error;
break;
case 140: /* --xattr-user */
@ -2858,9 +2857,9 @@ int main(int argc, char *argv[])
}
error:
if (eng) {
ENGINE_finish(eng);
ENGINE_free(eng);
if (imaevm_params.eng) {
ENGINE_finish(imaevm_params.eng);
ENGINE_free(imaevm_params.eng);
#if OPENSSL_API_COMPAT < 0x10100000L
ENGINE_cleanup();
#endif

View File

@ -48,6 +48,7 @@
#include <errno.h>
#include <sys/types.h>
#include <openssl/rsa.h>
#include <openssl/engine.h>
#ifdef USE_FPRINTF
#define do_log(level, fmt, args...) \
@ -197,6 +198,7 @@ struct libimaevm_params {
const char *keyfile;
const char *keypass;
uint32_t keyid; /* keyid overriding value, unless 0. (Host order.) */
ENGINE *eng;
};
struct RSA_ASN1_template {