From d008267960337e9e44b270b26555a7a894808746 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 24 Apr 2017 08:33:11 -0400 Subject: Clean up pkey slots and volatile keys on client logout. --- hal_internal.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'hal_internal.h') diff --git a/hal_internal.h b/hal_internal.h index 56d0936..b20bff2 100644 --- a/hal_internal.h +++ b/hal_internal.h @@ -427,6 +427,12 @@ extern hal_error_t hal_mkm_flash_erase(const size_t len); #endif +/* + * Clean up pkey stuff that's tied to a particular client. + */ + +extern hal_error_t hal_pkey_client_cleanup(const hal_client_handle_t client); + /* * Keystore API for use by the pkey implementation. * @@ -520,6 +526,9 @@ 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); + }; @@ -681,6 +690,18 @@ 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) +{ + if (ks == NULL) + return HAL_ERROR_BAD_ARGUMENTS; + + if (ks->client_cleanup == NULL || client.handle == HAL_HANDLE_NONE) + return HAL_OK; + + return ks->driver->client_cleanup(ks, client); +} + /* * Keystore index. This is intended to be usable by both memory-based * (in-memory, mmap(), ...) keystores and keystores based on raw flash. -- cgit v1.2.3 From 4ee44177c6da04e210a52528763b2c96a8f3d824 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 24 Apr 2017 17:23:17 -0400 Subject: Call a portable entrenching tool a portable entrenching tool. --- hal_internal.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'hal_internal.h') 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); } /* -- cgit v1.2.3 From 358b3803cdedad607cf649221d0b7e3ce66b45f2 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Tue, 25 Apr 2017 17:14:40 -0400 Subject: Shake dumb compile-time bugs out of new logout code. What I get for writing code while build and test environment is tied up with a multi-day run testing something else. --- hal_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hal_internal.h') diff --git a/hal_internal.h b/hal_internal.h index f6c31fe..13c79e9 100644 --- a/hal_internal.h +++ b/hal_internal.h @@ -696,7 +696,7 @@ static inline hal_error_t hal_ks_logout(hal_ks_t *ks, if (ks == NULL) return HAL_ERROR_BAD_ARGUMENTS; - if (ks->logout == NULL || client.handle == HAL_HANDLE_NONE) + if (ks->driver->logout == NULL || client.handle == HAL_HANDLE_NONE) return HAL_OK; return ks->driver->logout(ks, client); -- cgit v1.2.3