aboutsummaryrefslogtreecommitdiff
path: root/rpc_pkey.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-11-01 19:47:50 -0400
committerRob Austein <sra@hactrn.net>2016-11-01 19:47:50 -0400
commitd844d764a4f0614bf378331b007467de288f74eb (patch)
tree57b8645d338f1549d2b06c4bc3b22c0a6ef950bc /rpc_pkey.c
parentd3301ac269431c5aa45061abdb2d4400793b1eee (diff)
Add hal_rpc_pkey_get_key_curve().
Incidental minor refactoring of hal_rpc_server_dispatch().
Diffstat (limited to 'rpc_pkey.c')
-rw-r--r--rpc_pkey.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/rpc_pkey.c b/rpc_pkey.c
index 268f1b4..88b6248 100644
--- a/rpc_pkey.c
+++ b/rpc_pkey.c
@@ -494,6 +494,26 @@ static hal_error_t pkey_local_get_key_type(const hal_pkey_handle_t pkey,
}
/*
+ * Get curve of key associated with handle.
+ */
+
+static hal_error_t pkey_local_get_key_curve(const hal_pkey_handle_t pkey,
+ hal_curve_name_t *curve)
+{
+ if (curve == NULL)
+ return HAL_ERROR_BAD_ARGUMENTS;
+
+ hal_pkey_slot_t *slot = find_handle(pkey);
+
+ if (slot == NULL)
+ return HAL_ERROR_KEY_NOT_FOUND;
+
+ *curve = slot->curve;
+
+ return HAL_OK;
+}
+
+/*
* Get flags of key associated with handle.
*/
@@ -1036,6 +1056,7 @@ const hal_rpc_pkey_dispatch_t hal_rpc_local_pkey_dispatch = {
pkey_local_close,
pkey_local_delete,
pkey_local_get_key_type,
+ pkey_local_get_key_curve,
pkey_local_get_key_flags,
pkey_local_get_public_key_len,
pkey_local_get_public_key,