diff options
author | Rob Austein <sra@hactrn.net> | 2017-04-25 17:14:40 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2017-04-25 17:14:40 -0400 |
commit | 358b3803cdedad607cf649221d0b7e3ce66b45f2 (patch) | |
tree | 9bb11b6b11d9bf9d28797c36c8b161f0702d2fb0 /rpc_pkey.c | |
parent | 4ee44177c6da04e210a52528763b2c96a8f3d824 (diff) |
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.
Diffstat (limited to 'rpc_pkey.c')
-rw-r--r-- | rpc_pkey.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -138,9 +138,24 @@ hal_error_t hal_pkey_logout(const hal_client_handle_t client) return HAL_OK; hal_error_t err; + hal_ks_t *ks; - if ((err = hal_ks_logout(hal_ks_volatile_driver, client)) != HAL_OK || - (err = hal_ks_logout(hal_ks_flash_driver, client)) != HAL_OK) + if ((err = hal_ks_open(hal_ks_volatile_driver, &ks)) != HAL_OK) + return err; + if ((err = hal_ks_logout(ks, client)) == HAL_OK) + err = hal_ks_close(ks); + else + (void) hal_ks_close(ks); + if (err != HAL_OK) + return err; + + if ((err = hal_ks_open(hal_ks_token_driver, &ks)) != HAL_OK) + return err; + if ((err = hal_ks_logout(ks, client)) == HAL_OK) + err = hal_ks_close(ks); + else + (void) hal_ks_close(ks); + if (err != HAL_OK) return err; hal_critical_section_start(); |