mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-04-28 06:33:36 +02:00
evmctl: Implement function for setting up an OpenSSL engine
Move the code that sets up an OpenSSL engine into its own function. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
parent
47510a1050
commit
29aa7465d5
32
src/evmctl.c
32
src/evmctl.c
@ -2640,6 +2640,23 @@ static char *get_password(void)
|
|||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ENGINE *setup_engine(const char *engine_id)
|
||||||
|
{
|
||||||
|
ENGINE *eng = ENGINE_by_id(engine_id);
|
||||||
|
if (!eng) {
|
||||||
|
log_err("engine %s isn't available\n", optarg);
|
||||||
|
ERR_print_errors_fp(stderr);
|
||||||
|
} else if (!ENGINE_init(eng)) {
|
||||||
|
log_err("engine %s init failed\n", optarg);
|
||||||
|
ERR_print_errors_fp(stderr);
|
||||||
|
ENGINE_free(eng);
|
||||||
|
eng = NULL;
|
||||||
|
}
|
||||||
|
if (eng)
|
||||||
|
ENGINE_set_default(eng, ENGINE_METHOD_ALL);
|
||||||
|
return eng;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int err = 0, c, lind;
|
int err = 0, c, lind;
|
||||||
@ -2764,19 +2781,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 = ENGINE_by_id(optarg);
|
eng = setup_engine(optarg);
|
||||||
if (!eng) {
|
if (!eng)
|
||||||
log_err("engine %s isn't available\n", optarg);
|
|
||||||
ERR_print_errors_fp(stderr);
|
|
||||||
} else if (!ENGINE_init(eng)) {
|
|
||||||
log_err("engine %s init failed\n", optarg);
|
|
||||||
ERR_print_errors_fp(stderr);
|
|
||||||
ENGINE_free(eng);
|
|
||||||
eng = NULL;
|
|
||||||
}
|
|
||||||
if (eng)
|
|
||||||
ENGINE_set_default(eng, ENGINE_METHOD_ALL);
|
|
||||||
else
|
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
case 140: /* --xattr-user */
|
case 140: /* --xattr-user */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user