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:
parent
29aa7465d5
commit
1de1e3c8ce
11
src/evmctl.c
11
src/evmctl.c
@ -2660,7 +2660,6 @@ static ENGINE *setup_engine(const char *engine_id)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int err = 0, c, lind;
|
int err = 0, c, lind;
|
||||||
ENGINE *eng = NULL;
|
|
||||||
unsigned long keyid;
|
unsigned long keyid;
|
||||||
char *eptr;
|
char *eptr;
|
||||||
|
|
||||||
@ -2781,8 +2780,8 @@ int main(int argc, char *argv[])
|
|||||||
verify_list_sig = 1;
|
verify_list_sig = 1;
|
||||||
break;
|
break;
|
||||||
case 139: /* --engine e */
|
case 139: /* --engine e */
|
||||||
eng = setup_engine(optarg);
|
imaevm_params.eng = setup_engine(optarg);
|
||||||
if (!eng)
|
if (!imaevm_params.eng)
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
case 140: /* --xattr-user */
|
case 140: /* --xattr-user */
|
||||||
@ -2858,9 +2857,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (eng) {
|
if (imaevm_params.eng) {
|
||||||
ENGINE_finish(eng);
|
ENGINE_finish(imaevm_params.eng);
|
||||||
ENGINE_free(eng);
|
ENGINE_free(imaevm_params.eng);
|
||||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||||
ENGINE_cleanup();
|
ENGINE_cleanup();
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <openssl/rsa.h>
|
#include <openssl/rsa.h>
|
||||||
|
#include <openssl/engine.h>
|
||||||
|
|
||||||
#ifdef USE_FPRINTF
|
#ifdef USE_FPRINTF
|
||||||
#define do_log(level, fmt, args...) \
|
#define do_log(level, fmt, args...) \
|
||||||
@ -197,6 +198,7 @@ struct libimaevm_params {
|
|||||||
const char *keyfile;
|
const char *keyfile;
|
||||||
const char *keypass;
|
const char *keypass;
|
||||||
uint32_t keyid; /* keyid overriding value, unless 0. (Host order.) */
|
uint32_t keyid; /* keyid overriding value, unless 0. (Host order.) */
|
||||||
|
ENGINE *eng;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RSA_ASN1_template {
|
struct RSA_ASN1_template {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user