From 3b32acbc7d6e78f6414e4bba9de80c2a91b9bfe2 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Mon, 13 Sep 2021 18:18:09 -0400 Subject: [PATCH] evmctl: use the pkcs11 engine for pkcs11: prefixed URIs If the key has the pkcs11: URI prefix then setup the pkcs11 engine if the user hasn't chosen a specific engine already. Signed-off-by: Stefan Berger Signed-off-by: Mimi Zohar --- src/evmctl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/evmctl.c b/src/evmctl.c index fbe1d0a..aea55e9 100644 --- a/src/evmctl.c +++ b/src/evmctl.c @@ -2836,6 +2836,14 @@ int main(int argc, char *argv[]) if (!imaevm_params.keypass) imaevm_params.keypass = getenv("EVMCTL_KEY_PASSWORD"); + if (imaevm_params.keyfile != NULL && + imaevm_params.eng == NULL && + !strncmp(imaevm_params.keyfile, "pkcs11:", 7)) { + imaevm_params.eng = setup_engine("pkcs11"); + if (!imaevm_params.eng) + goto error; + } + if (argv[optind] == NULL) usage(); else