diff options
author | Paul Selkirk <paul@psgd.org> | 2019-12-02 15:38:58 -0500 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2019-12-02 15:38:58 -0500 |
commit | 4fd9d1186efed0de8e3ae1d1e2fa5a0e5c46c2fb (patch) | |
tree | 6ca093d7ca03ab8f179d23dc7fa9b001e377de65 /rpc_server.c | |
parent | 323bc8ade3eae73174961bbf604257a1b099fe55 (diff) |
After some thought, I'd rather make raw export/import a sub-function of
key export/import (kekek = none, kek_len = 0), rather than separate RPCs.
Diffstat (limited to 'rpc_server.c')
-rw-r--r-- | rpc_server.c | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/rpc_server.c b/rpc_server.c index aa7e936..9598413 100644 --- a/rpc_server.c +++ b/rpc_server.c @@ -776,60 +776,6 @@ static hal_error_t pkey_import(const uint8_t **iptr, const uint8_t * const ilimi return err; } -static hal_error_t pkey_export_raw(const uint8_t **iptr, const uint8_t * const ilimit, - uint8_t **optr, const uint8_t * const olimit) -{ - hal_client_handle_t client; - hal_pkey_handle_t pkey; - size_t der_len; - uint32_t der_max; - uint8_t *optr_orig = *optr; - hal_error_t err; - - check(hal_xdr_decode_int(iptr, ilimit, &client.handle)); - check(hal_xdr_decode_int(iptr, ilimit, &pkey.handle)); - check(hal_xdr_decode_int(iptr, ilimit, &der_max)); - - if (nargs(1) + pad(der_max) > (uint32_t)(olimit - *optr)) - return HAL_ERROR_RPC_PACKET_OVERFLOW; - - uint8_t der[der_max]; - - check(hal_rpc_pkey_export_raw(pkey, der, &der_len, sizeof(der))); - - if ((err = hal_xdr_encode_variable_opaque(optr, olimit, der, der_len)) != HAL_OK) - *optr = optr_orig; - - return err; -} - -static hal_error_t pkey_import_raw(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; - hal_pkey_handle_t pkey; - hal_uuid_t name; - const uint8_t *der; - size_t der_len; - uint8_t *optr_orig = *optr; - hal_key_flags_t flags; - hal_error_t err; - - check(hal_xdr_decode_int(iptr, ilimit, &client.handle)); - check(hal_xdr_decode_int(iptr, ilimit, &session.handle)); - check(hal_xdr_decode_variable_opaque_ptr(iptr, ilimit, &der, &der_len)); - check(hal_xdr_decode_int(iptr, ilimit, &flags)); - - check(hal_rpc_pkey_import_raw(client, session, &pkey, &name, der, der_len, flags)); - - if ((err = hal_xdr_encode_int(optr, olimit, pkey.handle)) != HAL_OK || - (err = hal_xdr_encode_variable_opaque(optr, olimit, name.uuid, sizeof(name.uuid))) != HAL_OK) - *optr = optr_orig; - - return err; -} - hal_error_t hal_rpc_server_dispatch(const uint8_t * const ibuf, const size_t ilen, uint8_t * const obuf, size_t * const olen) @@ -944,12 +890,6 @@ hal_error_t hal_rpc_server_dispatch(const uint8_t * const ibuf, const size_t ile case RPC_FUNC_PKEY_IMPORT: handler = pkey_import; break; - case RPC_FUNC_PKEY_EXPORT_RAW: - handler = pkey_export_raw; - break; - case RPC_FUNC_PKEY_IMPORT_RAW: - handler = pkey_import_raw; - break; } if (handler) |