[Cryptech-Commits] [sw/stm32] branch js_keywrap updated: Cleanup, move 'keywrap core' command to the hsm project, where it will actually be useful for short-term testing.
git at cryptech.is
git at cryptech.is
Tue Sep 11 23:08:06 UTC 2018
This is an automated email from the git hooks/post-receive script.
paul at psgd.org pushed a commit to branch js_keywrap
in repository sw/stm32.
The following commit(s) were added to refs/heads/js_keywrap by this push:
new 07af68c Cleanup, move 'keywrap core' command to the hsm project, where it will actually be useful for short-term testing.
07af68c is described below
commit 07af68c08baefbced001a0081256cb1fff8ed491
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Tue Sep 11 19:05:58 2018 -0400
Cleanup, move 'keywrap core' command to the hsm project, where it will actually be useful for short-term testing.
---
projects/cli-test/mgmt-cli.c | 1 +
projects/cli-test/mgmt-keywrap.c | 25 +------------------------
projects/hsm/mgmt-misc.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/projects/cli-test/mgmt-cli.c b/projects/cli-test/mgmt-cli.c
index 4240d5c..416be77 100644
--- a/projects/cli-test/mgmt-cli.c
+++ b/projects/cli-test/mgmt-cli.c
@@ -47,6 +47,7 @@
#include "mgmt-test.h"
#include "mgmt-keystore.h"
#include "mgmt-masterkey.h"
+#include "mgmt-keywrap.h"
#undef HAL_OK
#define HAL_OK LIBHAL_OK
diff --git a/projects/cli-test/mgmt-keywrap.c b/projects/cli-test/mgmt-keywrap.c
index 77e38c9..7d3e219 100644
--- a/projects/cli-test/mgmt-keywrap.c
+++ b/projects/cli-test/mgmt-keywrap.c
@@ -217,7 +217,7 @@ static int cmd_keywrap_test(struct cli_def *cli, const char *command, char *argv
cli_print(cli, "hal_aes_keyunwrap: %s", hal_error_string(err));
return CLI_ERROR;
}
- if (q_len != keysize) {
+ if (q_len != (size_t)keysize) {
cli_print(cli, "unwrap size mismatch: expected %d, got %d", (int)keysize, (int)q_len);
return CLI_ERROR;
}
@@ -307,33 +307,10 @@ static int cmd_keywrap_test(struct cli_def *cli, const char *command, char *argv
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) {
- hal_aes_use_keywrap_core(onoff);
- return CLI_OK;
- }
- }
-
- cli_print(cli, "Syntax: keywrap core <on|off>");
- return CLI_ERROR;
-}
-
void configure_cli_keywrap(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");
-
/* keywrap test */
cli_register_command(cli, c_keywrap, "test", cmd_keywrap_test, 0, 0, "Test the keywrap core");
}
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);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Commits
mailing list