[Cryptech-Commits] [sw/libhal] 02/03: Call a portable entrenching tool a portable entrenching tool.

git at cryptech.is git at cryptech.is
Tue May 23 04:27:02 UTC 2017


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch logout
in repository sw/libhal.

commit 4ee44177c6da04e210a52528763b2c96a8f3d824
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Mon Apr 24 17:23:17 2017 -0400

    Call a portable entrenching tool a portable entrenching tool.
---
 hal_internal.h | 16 ++++++++--------
 ks_volatile.c  |  6 +++---
 rpc_misc.c     |  2 +-
 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 */
diff --git a/rpc_misc.c b/rpc_misc.c
index 2fd743a..4db6ed3 100644
--- a/rpc_misc.c
+++ b/rpc_misc.c
@@ -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();
 
diff --git a/rpc_pkey.c b/rpc_pkey.c
index 0da2410..165419e 100644
--- a/rpc_pkey.c
+++ b/rpc_pkey.c
@@ -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();



More information about the Commits mailing list