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_api.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_api.c')
-rw-r--r-- | rpc_api.c | 26 |
1 files changed, 4 insertions, 22 deletions
@@ -413,7 +413,8 @@ hal_error_t hal_rpc_pkey_export(const hal_pkey_handle_t pkey, uint8_t *pkcs8, size_t *pkcs8_len, const size_t pkcs8_max, uint8_t *kek, size_t *kek_len, const size_t kek_max) { - if (pkcs8 == NULL || pkcs8_len == NULL || kek == NULL || kek_len == NULL || kek_max <= KEK_LENGTH) + if (pkcs8 == NULL || pkcs8_len == NULL || + (kekek.handle != HAL_HANDLE_NONE && (kek == NULL || kek_len == NULL || kek_max <= KEK_LENGTH))) return HAL_ERROR_BAD_ARGUMENTS; return hal_rpc_pkey_dispatch->export(pkey, kekek, pkcs8, pkcs8_len, pkcs8_max, kek, kek_len, kek_max); } @@ -427,31 +428,12 @@ hal_error_t hal_rpc_pkey_import(const hal_client_handle_t client, const uint8_t * const kek, const size_t kek_len, const hal_key_flags_t flags) { - if (pkey == NULL || name == NULL || pkcs8 == NULL || kek == NULL || kek_len <= 2) + if (pkey == NULL || name == NULL || pkcs8 == NULL || + (kekek.handle != HAL_HANDLE_NONE && (kek == NULL || kek_len <= 2))) return HAL_ERROR_BAD_ARGUMENTS; return hal_rpc_pkey_dispatch->import(client, session, pkey, name, kekek, pkcs8, pkcs8_len, kek, kek_len, flags); } -hal_error_t hal_rpc_pkey_export_raw(const hal_pkey_handle_t pkey, - uint8_t *der, size_t *der_len, const size_t der_max) -{ - if (der == NULL || der_len == NULL) - return HAL_ERROR_BAD_ARGUMENTS; - return hal_rpc_pkey_dispatch->export_raw(pkey, der, der_len, der_max); -} - -hal_error_t hal_rpc_pkey_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) -{ - if (pkey == NULL || name == NULL || der == NULL) - return HAL_ERROR_BAD_ARGUMENTS; - return hal_rpc_pkey_dispatch->import_raw(client, session, pkey, name, der, der_len, flags); -} - /* * Local variables: * indent-tabs-mode: nil |