diff options
author | Paul Selkirk <paul@psgd.org> | 2020-02-26 14:14:22 -0500 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2020-02-26 14:14:22 -0500 |
commit | 6b2513f1e0def3a134383aa635cb41feac37be31 (patch) | |
tree | 28447300724c209cda998fce9878a50d8380c105 /projects/hsm | |
parent | b60bdf04c301aa41ff9e375d13f12c05cee1fdb8 (diff) | |
parent | 087b079befab46622a306c2afd6205a510305af3 (diff) |
Merge branch 'js_keywrap' to 'master'
Diffstat (limited to 'projects/hsm')
-rw-r--r-- | projects/hsm/mgmt-misc.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/projects/hsm/mgmt-misc.c b/projects/hsm/mgmt-misc.c index 377af73..116197d 100644 --- a/projects/hsm/mgmt-misc.c +++ b/projects/hsm/mgmt-misc.c @@ -230,8 +230,42 @@ static int cmd_rsa_modexpng(struct cli_def *cli, const char *command, char *argv return CLI_ERROR; } +static int cmd_keywrap_core(struct cli_def *cli, const char *command, char *argv[], int argc) +{ + int onoff; + + if (argc != 1) { + cli_print(cli, "Wrong number of arguments (%i).", argc); + cli_print(cli, "Syntax: %s <on|off>", command); + return CLI_ERROR; + } + + if (strcmp(argv[0], "on") == 0) + onoff = 1; + else if (strcmp(argv[0], "off") == 0) + onoff = 0; + else { + cli_print(cli, "Argument must be 'on' or 'off' - not '%s'", argv[0]); + return CLI_ERROR; + } + + int ret = hal_aes_use_keywrap_core(onoff); + if (ret) + cli_print(cli, "keywrap core enabled"); + else if (onoff) + cli_print(cli, "keywrap core not found"); + else + cli_print(cli, "keywrap core disabled"); + return CLI_OK; +} + void configure_cli_misc(struct cli_def *cli) { + struct cli_command *c_keywrap = cli_register_command(cli, NULL, "keywrap", NULL, 0, 0, NULL); + + /* keywrap core */ + cli_register_command(cli, c_keywrap, "core", cmd_keywrap_core, 0, 0, "Toggle use of the keywrap core"); + #ifdef DO_PROFILING struct cli_command *c_profile = cli_register_command(cli, NULL, "profile", NULL, 0, 0, NULL); |