diff options
author | Rob Austein <sra@hactrn.net> | 2016-11-14 18:02:07 -0500 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2016-11-14 18:02:07 -0500 |
commit | b448b28f538517556f3d35dee81dbf07d433df60 (patch) | |
tree | 42e9868767e80b2707d559fbcab442030a096e19 /rpc_server.c | |
parent | d6e9917d07ddb0a5f8218fecdcd8bda3a1104912 (diff) |
More API cleanup: remove hal_rpc_pkey_list().
hal_rpc_pkey_list() was a simplistic solution that worked when the
keystore only supported a handful of keys and we needed a quick
temporary solution in time for a workshop. It doesn't handle large
numbers of keys well, and while we could fix that, all of its
functionality is now available via more robust API functions, so
simplifying the API by deleting it seems best.
Since this change required mucking with dispatch vectors yet again, it
converts them to use C99 "designated initializer" syntax.
Diffstat (limited to 'rpc_server.c')
-rw-r--r-- | rpc_server.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/rpc_server.c b/rpc_server.c index f96fcf1..b6c755e 100644 --- a/rpc_server.c +++ b/rpc_server.c @@ -640,53 +640,6 @@ static hal_error_t pkey_verify(const uint8_t **iptr, const uint8_t * const ilimi return ret; } -static hal_error_t hal_xdr_encode_pkey_info(uint8_t **optr, const uint8_t * const olimit, const hal_pkey_info_t *info) -{ - uint8_t *optr_orig = *optr; - hal_error_t ret; - - if ((ret = hal_xdr_encode_int(optr, olimit, info->type)) != HAL_OK || - (ret = hal_xdr_encode_int(optr, olimit, info->curve)) != HAL_OK || - (ret = hal_xdr_encode_int(optr, olimit, info->flags)) != HAL_OK || - (ret = hal_xdr_encode_buffer(optr, olimit, info->name.uuid, sizeof(info->name.uuid))) != HAL_OK) - *optr = optr_orig; - return ret; -} - -static hal_error_t pkey_list(const uint8_t **iptr, const uint8_t * const ilimit, - uint8_t **optr, const uint8_t * const olimit) -{ - hal_client_handle_t client; - hal_session_handle_t session; - uint8_t *optr_orig = *optr; - uint32_t result_max; - hal_key_flags_t flags; - hal_error_t ret; - - check(hal_xdr_decode_int(iptr, ilimit, &client.handle)); - check(hal_xdr_decode_int(iptr, ilimit, &session.handle)); - check(hal_xdr_decode_int(iptr, ilimit, &result_max)); - check(hal_xdr_decode_int(iptr, ilimit, &flags)); - - hal_pkey_info_t result[result_max]; - unsigned result_len; - - /* call the local function */ - ret = hal_rpc_pkey_list(client, session, result, &result_len, result_max, flags); - - if (ret == HAL_OK) { - check(hal_xdr_encode_int(optr, olimit, result_len)); - for (int i = 0; i < result_len; ++i) { - if ((ret = hal_xdr_encode_pkey_info(optr, olimit, &result[i])) != HAL_OK) { - *optr = optr_orig; - break; - } - } - } - - return ret; -} - static hal_error_t pkey_match(const uint8_t **iptr, const uint8_t * const ilimit, uint8_t **optr, const uint8_t * const olimit) { @@ -913,9 +866,6 @@ hal_error_t hal_rpc_server_dispatch(const uint8_t * const ibuf, const size_t ile case RPC_FUNC_PKEY_VERIFY: handler = pkey_verify; break; - case RPC_FUNC_PKEY_LIST: - handler = pkey_list; - break; case RPC_FUNC_PKEY_MATCH: handler = pkey_match; break; |