diff options
Diffstat (limited to 'rpc_client.c')
-rw-r--r-- | rpc_client.c | 66 |
1 files changed, 2 insertions, 64 deletions
diff --git a/rpc_client.c b/rpc_client.c index face70f..c9ac9b7 100644 --- a/rpc_client.c +++ b/rpc_client.c @@ -1018,64 +1018,6 @@ static hal_error_t pkey_remote_import(const hal_client_handle_t client, return rpc_ret; } -static hal_error_t pkey_remote_export_raw(const hal_pkey_handle_t pkey, - uint8_t *der, size_t *der_len, const size_t der_max) -{ - uint8_t outbuf[nargs(4)], *optr = outbuf, *olimit = outbuf + sizeof(outbuf); - uint8_t inbuf[nargs(3) + pad(der_max)]; - const uint8_t *iptr = inbuf, *ilimit = inbuf + sizeof(inbuf); - hal_client_handle_t dummy_client = {0}; - hal_error_t rpc_ret; - - check(hal_xdr_encode_int(&optr, olimit, RPC_FUNC_PKEY_EXPORT_RAW)); - check(hal_xdr_encode_int(&optr, olimit, dummy_client.handle)); - check(hal_xdr_encode_int(&optr, olimit, pkey.handle)); - check(hal_xdr_encode_int(&optr, olimit, der_max)); - check(hal_rpc_send(outbuf, optr - outbuf)); - - check(read_matching_packet(RPC_FUNC_PKEY_EXPORT_RAW, inbuf, sizeof(inbuf), &iptr, &ilimit)); - - check(hal_xdr_decode_int(&iptr, ilimit, &rpc_ret)); - if (rpc_ret == HAL_OK) { - check(hal_xdr_decode_variable_opaque(&iptr, ilimit, der, der_len, der_max)); - } - return rpc_ret; -} - -static hal_error_t pkey_remote_import_raw(const hal_client_handle_t client, - const hal_session_handle_t session, - hal_pkey_handle_t *pkey, - hal_uuid_t *name, - const uint8_t * const der, const size_t der_len, - const hal_key_flags_t flags) -{ - uint8_t outbuf[nargs(5) + pad(der_len)], *optr = outbuf, *olimit = outbuf + sizeof(outbuf); - uint8_t inbuf[nargs(5) + pad(sizeof(name->uuid))]; - const uint8_t *iptr = inbuf, *ilimit = inbuf + sizeof(inbuf); - size_t name_len; - hal_error_t rpc_ret; - - check(hal_xdr_encode_int(&optr, olimit, RPC_FUNC_PKEY_IMPORT_RAW)); - check(hal_xdr_encode_int(&optr, olimit, client.handle)); - check(hal_xdr_encode_int(&optr, olimit, session.handle)); - check(hal_xdr_encode_variable_opaque(&optr, olimit, der, der_len)); - check(hal_xdr_encode_int(&optr, olimit, flags)); - check(hal_rpc_send(outbuf, optr - outbuf)); - - check(read_matching_packet(RPC_FUNC_PKEY_IMPORT_RAW, inbuf, sizeof(inbuf), &iptr, &ilimit)); - - check(hal_xdr_decode_int(&iptr, ilimit, &rpc_ret)); - - if (rpc_ret == HAL_OK) { - check(hal_xdr_decode_int(&iptr, ilimit, &pkey->handle)); - check(hal_xdr_decode_variable_opaque(&iptr, ilimit, name->uuid, &name_len, sizeof(name->uuid))); - if (name_len != sizeof(name->uuid)) - return HAL_ERROR_KEY_NAME_TOO_LONG; - } - - return rpc_ret; -} - #if RPC_CLIENT == RPC_CLIENT_MIXED /* @@ -1207,9 +1149,7 @@ const hal_rpc_pkey_dispatch_t hal_rpc_remote_pkey_dispatch = { .set_attributes = pkey_remote_set_attributes, .get_attributes = pkey_remote_get_attributes, .export = pkey_remote_export, - .import = pkey_remote_import, - .export_raw = pkey_remote_export_raw, - .import_raw = pkey_remote_import_raw + .import = pkey_remote_import }; #if RPC_CLIENT == RPC_CLIENT_MIXED @@ -1232,9 +1172,7 @@ const hal_rpc_pkey_dispatch_t hal_rpc_mixed_pkey_dispatch = { .set_attributes = pkey_remote_set_attributes, .get_attributes = pkey_remote_get_attributes, .export = pkey_remote_export, - .import = pkey_remote_import, - .export_raw = pkey_remote_export_raw, - .import_raw = pkey_remote_import_raw + .import = pkey_remote_import }; #endif /* RPC_CLIENT == RPC_CLIENT_MIXED */ |