diff options
-rw-r--r-- | hal_internal.h | 16 | ||||
-rw-r--r-- | ks_volatile.c | 6 | ||||
-rw-r--r-- | rpc_misc.c | 2 | ||||
-rw-r--r-- | rpc_pkey.c | 10 |
4 files changed, 16 insertions, 18 deletions
diff --git a/hal_internal.h b/hal_internal.h index b20bff2..f6c31fe 100644 --- a/hal_internal.h +++ b/hal_internal.h @@ -428,10 +428,10 @@ extern hal_error_t hal_mkm_flash_erase(const size_t len); #endif /* - * Clean up pkey stuff that's tied to a particular client. + * Clean up pkey stuff that's tied to a particular client on logout. */ -extern hal_error_t hal_pkey_client_cleanup(const hal_client_handle_t client); +extern hal_error_t hal_pkey_logout(const hal_client_handle_t client); /* * Keystore API for use by the pkey implementation. @@ -526,8 +526,8 @@ struct hal_ks_driver { uint8_t *attributes_buffer, const size_t attributes_buffer_len); - hal_error_t (*client_cleanup)(hal_ks_t *ks, - const hal_client_handle_t client); + hal_error_t (*logout)(hal_ks_t *ks, + const hal_client_handle_t client); }; @@ -690,16 +690,16 @@ static inline hal_error_t hal_ks_get_attributes(hal_ks_t *ks, attributes_buffer, attributes_buffer_len); } -static inline hal_error_t hal_ks_client_cleanup(hal_ks_t *ks, - const hal_client_handle_t client) +static inline hal_error_t hal_ks_logout(hal_ks_t *ks, + const hal_client_handle_t client) { if (ks == NULL) return HAL_ERROR_BAD_ARGUMENTS; - if (ks->client_cleanup == NULL || client.handle == HAL_HANDLE_NONE) + if (ks->logout == NULL || client.handle == HAL_HANDLE_NONE) return HAL_OK; - return ks->driver->client_cleanup(ks, client); + return ks->driver->logout(ks, client); } /* diff --git a/ks_volatile.c b/ks_volatile.c index 363441a..29c3576 100644 --- a/ks_volatile.c +++ b/ks_volatile.c @@ -614,8 +614,8 @@ static hal_error_t ks_get_attributes(hal_ks_t *ks, return err; } -static void ks_client_cleanup(hal_ks_t *ks, - hal_client_handle_t client) +static void ks_logout(hal_ks_t *ks, + hal_client_handle_t client) { if (ks == NULL || client.handle = HAL_HANDLE_NONE) return HAL_ERROR_BAD_ARGUMENTS; @@ -652,7 +652,7 @@ const hal_ks_driver_t hal_ks_volatile_driver[1] = {{ .match = ks_match, .set_attributes = ks_set_attributes, .get_attributes = ks_get_attributes, - .client_cleanup = ks_client_cleanup + .logout = ks_logout }}; #endif /* STATIC_KS_VOLATILE_SLOTS > 0 */ @@ -133,7 +133,7 @@ static inline void clear_slot(client_slot_t *slot) if (slot == NULL) return; - hal_pkey_client_cleanup(slot->handle); + hal_pkey_logout(slot->handle); hal_critical_section_start(); @@ -129,20 +129,18 @@ static inline hal_pkey_slot_t *find_handle(const hal_pkey_handle_t handle) } /* - * Clean up key state associated with a client. + * Clean up key state associated with a client when logging out. */ -hal_error_t hal_pkey_client_cleanup(const hal_client_handle_t client) +hal_error_t hal_pkey_logout(const hal_client_handle_t client) { if (client.handle == HAL_HANDLE_NONE) return HAL_OK; hal_error_t err; - if ((err = hal_ks_client_cleanup(hal_ks_volatile_driver, client)) != HAL_OK) - return err; - - if ((err = hal_ks_client_cleanup(hal_ks_flash_driver, client)) != HAL_OK) + if ((err = hal_ks_logout(hal_ks_volatile_driver, client)) != HAL_OK || + (err = hal_ks_logout(hal_ks_flash_driver, client)) != HAL_OK) return err; hal_critical_section_start(); |