aboutsummaryrefslogtreecommitdiff
path: root/projects
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-09-09 00:38:07 -0400
committerRob Austein <sra@hactrn.net>2016-09-09 00:38:07 -0400
commite8efb628278e025e5d922b00c3386d444e9d92f4 (patch)
tree1fcfb4c27500c1689985768f6c314d630528585b /projects
parentfe98998e92e10deac6df9e482152bb4722439e1e (diff)
Track removal of `type` argument from hal_rpc_pkey_find().
Diffstat (limited to 'projects')
-rw-r--r--projects/cli-test/mgmt-keystore.c27
-rw-r--r--projects/hsm/mgmt-keystore.c27
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;