[Cryptech-Commits] [sw/stm32] 01/05: Track removal of `type` argument from hal_rpc_pkey_find().
git at cryptech.is
git at cryptech.is
Fri Sep 16 19:52:53 UTC 2016
This is an automated email from the git hooks/post-receive script.
sra at hactrn.net pushed a commit to branch ksng
in repository sw/stm32.
commit e8efb628278e025e5d922b00c3386d444e9d92f4
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Fri Sep 9 00:38:07 2016 -0400
Track removal of `type` argument from hal_rpc_pkey_find().
---
projects/cli-test/mgmt-keystore.c | 27 ++++++---------------------
projects/hsm/mgmt-keystore.c | 27 ++++++---------------------
2 files changed, 12 insertions(+), 42 deletions(-)
diff --git a/projects/cli-test/mgmt-keystore.c b/projects/cli-test/mgmt-keystore.c
index 202f042..108b447 100644
--- a/projects/cli-test/mgmt-keystore.c
+++ b/projects/cli-test/mgmt-keystore.c
@@ -181,13 +181,15 @@ static int cmd_keystore_set_key(struct cli_def *cli, const char *command, char *
static int cmd_keystore_delete_key(struct cli_def *cli, const char *command, char *argv[], int argc)
{
+ const hal_client_handle_t client = { HAL_HANDLE_NONE };
+ const hal_session_handle_t session = { HAL_HANDLE_NONE };
+ hal_pkey_handle_t pkey = { HAL_HANDLE_NONE };
hal_error_t status;
hal_uuid_t name;
- hal_key_type_t type;
- if (argc != 2) {
+ if (argc != 1) {
cli_print(cli, "Wrong number of arguments (%i).", argc);
- cli_print(cli, "Syntax: keystore delete key <name> <type>");
+ cli_print(cli, "Syntax: keystore delete key <name>");
return CLI_ERROR;
}
@@ -196,24 +198,7 @@ static int cmd_keystore_delete_key(struct cli_def *cli, const char *command, cha
return CLI_ERROR;
}
- if (!strcmp(argv[1], "rsa-private"))
- type = HAL_KEY_TYPE_RSA_PRIVATE;
- else if (!strcmp(argv[1], "rsa-public"))
- type = HAL_KEY_TYPE_RSA_PUBLIC;
- else if (!strcmp(argv[1], "ec-private"))
- type = HAL_KEY_TYPE_EC_PRIVATE;
- else if (!strcmp(argv[1], "ec-public"))
- type = HAL_KEY_TYPE_EC_PUBLIC;
- else {
- cli_print(cli, "Key type must be \"rsa-private\", \"rsa-public\", \"ec-private\", or \"ec-public\"");
- return CLI_ERROR;
- }
-
- const hal_client_handle_t client = { HAL_HANDLE_NONE };
- const hal_session_handle_t session = { HAL_HANDLE_NONE };
- hal_pkey_handle_t pkey = { HAL_HANDLE_NONE };
-
- if ((status = hal_rpc_pkey_find(client, session, &pkey, type, &name, HAL_KEY_FLAG_TOKEN)) != LIBHAL_OK ||
+ if ((status = hal_rpc_pkey_find(client, session, &pkey, &name, HAL_KEY_FLAG_TOKEN)) != LIBHAL_OK ||
(status = hal_rpc_pkey_delete(pkey)) != LIBHAL_OK) {
cli_print(cli, "Failed deleting key: %s", hal_error_string(status));
return CLI_ERROR;
diff --git a/projects/hsm/mgmt-keystore.c b/projects/hsm/mgmt-keystore.c
index b08dc3e..3355082 100644
--- a/projects/hsm/mgmt-keystore.c
+++ b/projects/hsm/mgmt-keystore.c
@@ -139,13 +139,15 @@ static int cmd_keystore_set_pin_iterations(struct cli_def *cli, const char *comm
static int cmd_keystore_delete_key(struct cli_def *cli, const char *command, char *argv[], int argc)
{
+ const hal_client_handle_t client = { HAL_HANDLE_NONE };
+ const hal_session_handle_t session = { HAL_HANDLE_NONE };
+ hal_pkey_handle_t pkey = { HAL_HANDLE_NONE };
hal_error_t status;
hal_uuid_t name;
- hal_key_type_t type;
- if (argc != 2) {
+ if (argc != 1) {
cli_print(cli, "Wrong number of arguments (%i).", argc);
- cli_print(cli, "Syntax: keystore delete key <name> <type>");
+ cli_print(cli, "Syntax: keystore delete key <name>");
return CLI_ERROR;
}
@@ -154,24 +156,7 @@ static int cmd_keystore_delete_key(struct cli_def *cli, const char *command, cha
return CLI_ERROR;
}
- if (!strcmp(argv[1], "rsa-private"))
- type = HAL_KEY_TYPE_RSA_PRIVATE;
- else if (!strcmp(argv[1], "rsa-public"))
- type = HAL_KEY_TYPE_RSA_PUBLIC;
- else if (!strcmp(argv[1], "ec-private"))
- type = HAL_KEY_TYPE_EC_PRIVATE;
- else if (!strcmp(argv[1], "ec-public"))
- type = HAL_KEY_TYPE_EC_PUBLIC;
- else {
- cli_print(cli, "Key type must be \"rsa-private\", \"rsa-public\", \"ec-private\", or \"ec-public\"");
- return CLI_ERROR;
- }
-
- const hal_client_handle_t client = { HAL_HANDLE_NONE };
- const hal_session_handle_t session = { HAL_HANDLE_NONE };
- hal_pkey_handle_t pkey = { HAL_HANDLE_NONE };
-
- if ((status = hal_rpc_pkey_find(client, session, &pkey, type, &name, HAL_KEY_FLAG_TOKEN)) != LIBHAL_OK ||
+ if ((status = hal_rpc_pkey_find(client, session, &pkey, &name, HAL_KEY_FLAG_TOKEN)) != LIBHAL_OK ||
(status = hal_rpc_pkey_delete(pkey)) != LIBHAL_OK) {
cli_print(cli, "Failed deleting key: %s", hal_error_string(status));
return CLI_ERROR;
More information about the Commits
mailing list