aboutsummaryrefslogtreecommitdiff
path: root/rpc_server.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-05-15 20:49:18 -0400
committerRob Austein <sra@hactrn.net>2016-05-15 20:49:18 -0400
commit0690aa3d48966a4b151a468fd3a0a65bb99de439 (patch)
treee88db7d7d677ea48d9bb3dbd57acc514785a44f7 /rpc_server.c
parent53b0dd22287e07ca32184c27b7ec0d75d358bde4 (diff)
Add hal_rpc_pkey_rename(); allow null string as (temporary) key name.
Temporary nature of null string as key name is not enforced by the keystore code, it's just a convention to allow callers to generate a keypair, obtain the public key, hash that to a Subject Key Identifier (SKI), and rename the key using the SKI as the new name. This is a compromise to let us use SKI-based key names in PKCS #11 while keeping the keystore code simple.
Diffstat (limited to 'rpc_server.c')
-rw-r--r--rpc_server.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/rpc_server.c b/rpc_server.c
index 7e8e036..a1bca26 100644
--- a/rpc_server.c
+++ b/rpc_server.c
@@ -415,6 +415,22 @@ static hal_error_t pkey_delete(const uint8_t **iptr, const uint8_t * const ilimi
return ret;
}
+static hal_error_t pkey_rename(const uint8_t **iptr, const uint8_t * const ilimit,
+ uint8_t **optr, const uint8_t * const olimit)
+{
+ hal_pkey_handle_t pkey;
+ const uint8_t *name;
+ uint32_t name_len;
+ hal_error_t ret;
+
+ check(hal_xdr_decode_int(iptr, ilimit, &pkey.handle));
+ check(hal_xdr_decode_buffer_in_place(iptr, ilimit, &name, &name_len));
+
+ /* call the local function */
+ ret = hal_rpc_local_pkey_dispatch.rename(pkey, name, name_len);
+ return ret;
+}
+
static hal_error_t pkey_get_key_type(const uint8_t **iptr, const uint8_t * const ilimit,
uint8_t **optr, const uint8_t * const olimit)
{
@@ -683,6 +699,9 @@ void hal_rpc_server_dispatch(const uint8_t * const ibuf, const size_t ilen,
case RPC_FUNC_PKEY_LIST:
ret = pkey_list(&iptr, ilimit, &optr, olimit);
break;
+ case RPC_FUNC_PKEY_RENAME:
+ ret = pkey_rename(&iptr, ilimit, &optr, olimit);
+ break;
default:
ret = HAL_ERROR_RPC_BAD_FUNCTION;
break;