From 015eefa32f54f84c56bb7c6d36c0edcc104a69e8 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 9 Oct 2016 23:02:03 -0400 Subject: Per-session objects in ks_volatile; more untested ks_attribute code. Mostly this is another checkpoint (still passes PKCS #11 "make test"). ks_volatile.c now contains support for per-session object visibility; this may need more work to support things like a CLI view of all objects regardless of session. Adding this required minor changes to the keystore and pkey APIs, mostly because sessions are per-client. ks_volatile.c also contains an untested first cut at attribute support. Attribute support in ks_flash.c still under construction. --- rpc_pkey.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'rpc_pkey.c') diff --git a/rpc_pkey.c b/rpc_pkey.c index 22ad197..0a53221 100644 --- a/rpc_pkey.c +++ b/rpc_pkey.c @@ -55,7 +55,7 @@ static hal_pkey_slot_t pkey_handle[HAL_STATIC_PKEY_STATE_BLOCKS]; * soon, to help identify use-after-free bugs in calling code. * * The high order bit of the pkey handle is left free for - * HAL_PKEY_HANDLE_PROXIMATE_FLAG, which is used by the mixed-mode + * HAL_PKEY_HANDLE_TOKEN_FLAG, which is used by the mixed-mode * handlers to route calls to the appropriate destination. */ @@ -76,6 +76,7 @@ static inline hal_pkey_slot_t *alloc_slot(const hal_key_flags_t flags) continue; memset(&pkey_handle[i], 0, sizeof(pkey_handle[i])); pkey_handle[i].pkey_handle.handle = i | glop; + pkey_handle[i].hint = -1; return &pkey_handle[i]; } #endif @@ -848,7 +849,8 @@ static hal_error_t pkey_local_verify(const hal_pkey_handle_t pkey, * List keys in the key store. */ -static hal_error_t pkey_local_list(const hal_session_handle_t session, +static hal_error_t pkey_local_list(const hal_client_handle_t client, + const hal_session_handle_t session, hal_pkey_info_t *result, unsigned *result_len, const unsigned result_max, @@ -858,7 +860,7 @@ static hal_error_t pkey_local_list(const hal_session_handle_t session, hal_error_t err; if ((err = ks_open_from_flags(&ks, flags)) == HAL_OK && - (err = hal_ks_list(ks, session, result, result_len, result_max)) == HAL_OK) + (err = hal_ks_list(ks, client, session, result, result_len, result_max)) == HAL_OK) err = hal_ks_close(ks); else if (ks != NULL) (void) hal_ks_close(ks); @@ -866,7 +868,8 @@ static hal_error_t pkey_local_list(const hal_session_handle_t session, return err; } -static hal_error_t pkey_local_match(const hal_session_handle_t session, +static hal_error_t pkey_local_match(const hal_client_handle_t client, + const hal_session_handle_t session, const hal_key_type_t type, const hal_curve_name_t curve, const hal_key_flags_t flags, @@ -881,7 +884,7 @@ static hal_error_t pkey_local_match(const hal_session_handle_t session, hal_error_t err; if ((err = ks_open_from_flags(&ks, flags)) == HAL_OK && - (err = hal_ks_match(ks, session, type, curve, flags, attributes, attributes_len, + (err = hal_ks_match(ks, client, session, type, curve, flags, attributes, attributes_len, result, result_len, result_max, previous_uuid)) == HAL_OK) err = hal_ks_close(ks); else if (ks != NULL) -- cgit v1.2.3