From 0690aa3d48966a4b151a468fd3a0a65bb99de439 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 15 May 2016 20:49:18 -0400 Subject: 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. --- hal.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'hal.h') diff --git a/hal.h b/hal.h index 6fbfb9f..ee97e8a 100644 --- a/hal.h +++ b/hal.h @@ -129,6 +129,7 @@ DEFINE_HAL_ERROR(HAL_ERROR_RPC_TRANSPORT, "RPC transport error") \ DEFINE_HAL_ERROR(HAL_ERROR_RPC_PACKET_OVERFLOW, "RPC packet overflow") \ DEFINE_HAL_ERROR(HAL_ERROR_RPC_BAD_FUNCTION, "Bad RPC function number") \ + DEFINE_HAL_ERROR(HAL_ERROR_KEY_NAME_TOO_LONG, "Key name too long") \ END_OF_HAL_ERROR_LIST /* Marker to forestall silly line continuation errors */ @@ -350,7 +351,7 @@ extern hal_error_t hal_modexp(const hal_core_t *core, */ typedef enum { - HAL_KEY_TYPE_NONE, + HAL_KEY_TYPE_NONE = 0, HAL_KEY_TYPE_RSA_PRIVATE, HAL_KEY_TYPE_RSA_PUBLIC, HAL_KEY_TYPE_EC_PRIVATE, @@ -685,6 +686,9 @@ extern hal_error_t hal_rpc_pkey_close(const hal_pkey_handle_t pkey); extern hal_error_t hal_rpc_pkey_delete(const hal_pkey_handle_t pkey); +extern hal_error_t hal_rpc_pkey_rename(const hal_pkey_handle_t pkey, + const uint8_t * const name, const size_t name_len); + extern hal_error_t hal_rpc_pkey_get_key_type(const hal_pkey_handle_t pkey, hal_key_type_t *type); -- cgit v1.2.3