From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: linux-integrity@vger.kernel.org
Cc: zohar@linux.ibm.com, Stefan Berger <stefanb@linux.ibm.com>
Subject: [PATCH v3 4/9] evmctl: Define and use an ENGINE field in libimaevm_params
Date: Wed, 8 Sep 2021 15:23:38 -0400 [thread overview]
Message-ID: <20210908192343.4147739-5-stefanb@linux.vnet.ibm.com> (raw)
In-Reply-To: <20210908192343.4147739-1-stefanb@linux.vnet.ibm.com>
From: Stefan Berger <stefanb@linux.ibm.com>
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>
---
src/evmctl.c | 11 +++++------
src/imaevm.h | 2 ++
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/evmctl.c b/src/evmctl.c
index 4b6f3fb..625a511 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -2651,7 +2651,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;
@@ -2772,8 +2771,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 */
@@ -2849,9 +2848,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
diff --git a/src/imaevm.h b/src/imaevm.h
index 491f136..8792aa2 100644
--- a/src/imaevm.h
+++ b/src/imaevm.h
@@ -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 {
--
2.31.1
next prev parent reply other threads:[~2021-09-08 19:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-08 19:23 [PATCH v3 0/9] ima-evm-utils: Add support for signing with pkcs11 URIs Stefan Berger
2021-09-08 19:23 ` [PATCH v3 1/9] evmctl: Implement support for EVMCTL_KEY_PASSWORD environment variable Stefan Berger
2021-09-08 19:23 ` [PATCH v3 2/9] evmctl: Handle failure to initialize the openssl engine Stefan Berger
2021-09-08 19:23 ` [PATCH v3 3/9] evmctl: Implement function for setting up an OpenSSL engine Stefan Berger
2021-09-13 16:54 ` Mimi Zohar
2021-09-08 19:23 ` Stefan Berger [this message]
2021-09-08 19:23 ` [PATCH v3 5/9] evmctl: use the pkcs11 engine for pkcs11: prefixed URIs Stefan Berger
2021-09-08 19:23 ` [PATCH v3 6/9] libimaevm: Add support for pkcs11 private keys for signing a v2 hash Stefan Berger
2021-09-08 19:23 ` [PATCH v3 7/9] tests: Import softhsm_setup script to enable pkcs11 test case Stefan Berger
2021-09-13 16:54 ` Mimi Zohar
2021-09-08 19:23 ` [PATCH v3 8/9] tests: Extend sign_verify test with pkcs11-specific test Stefan Berger
2021-09-13 16:55 ` Mimi Zohar
2021-09-08 19:23 ` [PATCH v3 9/9] tests: Get the packages for pkcs11 testing on the CI/CD system Stefan Berger
2021-09-13 16:55 ` Mimi Zohar
2021-09-13 16:53 ` [PATCH v3 0/9] ima-evm-utils: Add support for signing with pkcs11 URIs Mimi Zohar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210908192343.4147739-5-stefanb@linux.vnet.ibm.com \
--to=stefanb@linux.vnet.ibm.com \
--cc=linux-integrity@vger.kernel.org \
--cc=stefanb@linux.ibm.com \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).