From d844d764a4f0614bf378331b007467de288f74eb Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Tue, 1 Nov 2016 19:47:50 -0400 Subject: Add hal_rpc_pkey_get_key_curve(). Incidental minor refactoring of hal_rpc_server_dispatch(). --- rpc_pkey.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'rpc_pkey.c') diff --git a/rpc_pkey.c b/rpc_pkey.c index 268f1b4..88b6248 100644 --- a/rpc_pkey.c +++ b/rpc_pkey.c @@ -493,6 +493,26 @@ static hal_error_t pkey_local_get_key_type(const hal_pkey_handle_t pkey, return HAL_OK; } +/* + * 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, -- cgit v1.2.3