aboutsummaryrefslogtreecommitdiff
path: root/projects/hsm
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2018-09-11 19:05:58 -0400
committerPaul Selkirk <paul@psgd.org>2018-09-11 19:05:58 -0400
commit07af68c08baefbced001a0081256cb1fff8ed491 (patch)
tree896784a987f3b1264c548ba79b46f0c41840673b /projects/hsm
parent5d7128c74e0ec9df380e7af4d4bc57af1f0da372 (diff)
Cleanup, move 'keywrap core' command to the hsm project, where it will actually be useful for short-term testing.
Diffstat (limited to 'projects/hsm')
-rw-r--r--projects/hsm/mgmt-misc.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/projects/hsm/mgmt-misc.c b/projects/hsm/mgmt-misc.c
index 86f1be8..72ee1f2 100644
--- a/projects/hsm/mgmt-misc.c
+++ b/projects/hsm/mgmt-misc.c
@@ -155,8 +155,39 @@ static int cmd_reboot(struct cli_def *cli, const char *command, char *argv[], in
return CLI_OK;
}
+static int cmd_keywrap_core(struct cli_def *cli, const char *command, char *argv[], int argc)
+{
+ command = command;
+
+ if (argc == 1) {
+ int onoff = -1;
+ if (strcmp(argv[0], "on") == 0)
+ onoff = 1;
+ else if (strcmp(argv[0], "off") == 0)
+ onoff = 0;
+ if (onoff >= 0) {
+ 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;
+ }
+ }
+
+ cli_print(cli, "Syntax: keywrap core <on|off>");
+ return CLI_ERROR;
+}
+
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);