diff options
-rw-r--r-- | hal.h | 2 | ||||
-rw-r--r-- | hal_internal.h | 4 | ||||
-rw-r--r-- | libhal.py | 6 | ||||
-rw-r--r-- | rpc_api.c | 4 | ||||
-rw-r--r-- | rpc_client.c | 10 | ||||
-rw-r--r-- | rpc_pkey.c | 4 | ||||
-rw-r--r-- | rpc_server.c | 8 | ||||
-rw-r--r-- | unit-tests.py | 6 |
8 files changed, 22 insertions, 22 deletions
@@ -710,7 +710,7 @@ extern hal_error_t hal_rpc_pkey_load(const hal_client_handle_t client, const uint8_t * const der, const size_t der_len, const hal_key_flags_t flags); -extern hal_error_t hal_rpc_pkey_find(const hal_client_handle_t client, +extern hal_error_t hal_rpc_pkey_open(const hal_client_handle_t client, const hal_session_handle_t session, hal_pkey_handle_t *pkey, const hal_uuid_t * const name, diff --git a/hal_internal.h b/hal_internal.h index 756de90..e0c7d5a 100644 --- a/hal_internal.h +++ b/hal_internal.h @@ -189,7 +189,7 @@ typedef struct { const uint8_t * const der, const size_t der_len, const hal_key_flags_t flags); - hal_error_t (*find)(const hal_client_handle_t client, + hal_error_t (*open)(const hal_client_handle_t client, const hal_session_handle_t session, hal_pkey_handle_t *pkey, const hal_uuid_t * const name, @@ -883,7 +883,7 @@ typedef enum { RPC_FUNC_HASH_UPDATE, RPC_FUNC_HASH_FINALIZE, RPC_FUNC_PKEY_LOAD, - RPC_FUNC_PKEY_FIND, + RPC_FUNC_PKEY_OPEN, RPC_FUNC_PKEY_GENERATE_RSA, RPC_FUNC_PKEY_GENERATE_EC, RPC_FUNC_PKEY_CLOSE, @@ -167,7 +167,7 @@ RPCFunc.define(''' RPC_FUNC_HASH_UPDATE, RPC_FUNC_HASH_FINALIZE, RPC_FUNC_PKEY_LOAD, - RPC_FUNC_PKEY_FIND, + RPC_FUNC_PKEY_OPEN, RPC_FUNC_PKEY_GENERATE_RSA, RPC_FUNC_PKEY_GENERATE_EC, RPC_FUNC_PKEY_CLOSE, @@ -573,8 +573,8 @@ class HSM(object): with self.rpc(RPC_FUNC_PKEY_LOAD, session, type, curve, der, flags, client = client) as r: return PKey(self, r.unpack_uint(), UUID(bytes = r.unpack_bytes())) - def pkey_find(self, uuid, flags = 0, client = 0, session = 0): - with self.rpc(RPC_FUNC_PKEY_FIND, session, uuid, flags, client = client) as r: + def pkey_open(self, uuid, flags = 0, client = 0, session = 0): + with self.rpc(RPC_FUNC_PKEY_OPEN, session, uuid, flags, client = client) as r: return PKey(self, r.unpack_uint(), uuid) def pkey_generate_rsa(self, keylen, exponent = "\x01\x00\x01", flags = 0, client = 0, session = 0): @@ -227,7 +227,7 @@ hal_error_t hal_rpc_pkey_load(const hal_client_handle_t client, return hal_rpc_pkey_dispatch->load(client, session, pkey, type, curve, name, der, der_len, flags); } -hal_error_t hal_rpc_pkey_find(const hal_client_handle_t client, +hal_error_t hal_rpc_pkey_open(const hal_client_handle_t client, const hal_session_handle_t session, hal_pkey_handle_t *pkey, const hal_uuid_t * const name, @@ -235,7 +235,7 @@ hal_error_t hal_rpc_pkey_find(const hal_client_handle_t client, { if (pkey == NULL || name == NULL) return HAL_ERROR_BAD_ARGUMENTS; - return hal_rpc_pkey_dispatch->find(client, session, pkey, name, flags); + return hal_rpc_pkey_dispatch->open(client, session, pkey, name, flags); } hal_error_t hal_rpc_pkey_generate_rsa(const hal_client_handle_t client, diff --git a/rpc_client.c b/rpc_client.c index c428cc6..ffe5e54 100644 --- a/rpc_client.c +++ b/rpc_client.c @@ -455,7 +455,7 @@ static hal_error_t pkey_remote_load(const hal_client_handle_t client, return rpc_ret; } -static hal_error_t pkey_remote_find(const hal_client_handle_t client, +static hal_error_t pkey_remote_open(const hal_client_handle_t client, const hal_session_handle_t session, hal_pkey_handle_t *pkey, const hal_uuid_t * const name, @@ -466,14 +466,14 @@ static hal_error_t pkey_remote_find(const hal_client_handle_t client, const uint8_t *iptr = inbuf, *ilimit = inbuf + sizeof(inbuf); hal_error_t rpc_ret; - check(hal_xdr_encode_int(&optr, olimit, RPC_FUNC_PKEY_FIND)); + check(hal_xdr_encode_int(&optr, olimit, RPC_FUNC_PKEY_OPEN)); check(hal_xdr_encode_int(&optr, olimit, client.handle)); check(hal_xdr_encode_int(&optr, olimit, session.handle)); check(hal_xdr_encode_buffer(&optr, olimit, name->uuid, sizeof(name->uuid))); check(hal_xdr_encode_int(&optr, olimit, flags)); check(hal_rpc_send(outbuf, optr - outbuf)); - check(read_matching_packet(RPC_FUNC_PKEY_FIND, inbuf, sizeof(inbuf), &iptr, &ilimit)); + check(read_matching_packet(RPC_FUNC_PKEY_OPEN, inbuf, sizeof(inbuf), &iptr, &ilimit)); check(hal_xdr_decode_int(&iptr, ilimit, &rpc_ret)); @@ -1072,7 +1072,7 @@ const hal_rpc_hash_dispatch_t hal_rpc_remote_hash_dispatch = { const hal_rpc_pkey_dispatch_t hal_rpc_remote_pkey_dispatch = { pkey_remote_load, - pkey_remote_find, + pkey_remote_open, pkey_remote_generate_rsa, pkey_remote_generate_ec, pkey_remote_close, @@ -1093,7 +1093,7 @@ const hal_rpc_pkey_dispatch_t hal_rpc_remote_pkey_dispatch = { #if RPC_CLIENT == RPC_CLIENT_MIXED const hal_rpc_pkey_dispatch_t hal_rpc_mixed_pkey_dispatch = { pkey_remote_load, - pkey_remote_find, + pkey_remote_open, pkey_remote_generate_rsa, pkey_remote_generate_ec, pkey_remote_close, @@ -264,7 +264,7 @@ static hal_error_t pkey_local_load(const hal_client_handle_t client, * Look up a key given its name, return a key handle. */ -static hal_error_t pkey_local_find(const hal_client_handle_t client, +static hal_error_t pkey_local_open(const hal_client_handle_t client, const hal_session_handle_t session, hal_pkey_handle_t *pkey, const hal_uuid_t * const name, @@ -1027,7 +1027,7 @@ static hal_error_t pkey_local_get_attributes(const hal_pkey_handle_t pkey, const hal_rpc_pkey_dispatch_t hal_rpc_local_pkey_dispatch = { pkey_local_load, - pkey_local_find, + pkey_local_open, pkey_local_generate_rsa, pkey_local_generate_ec, pkey_local_close, diff --git a/rpc_server.c b/rpc_server.c index 4f06e00..f96fcf1 100644 --- a/rpc_server.c +++ b/rpc_server.c @@ -350,7 +350,7 @@ static hal_error_t pkey_load(const uint8_t **iptr, const uint8_t * const ilimit, return ret; } -static hal_error_t pkey_find(const uint8_t **iptr, const uint8_t * const ilimit, +static hal_error_t pkey_open(const uint8_t **iptr, const uint8_t * const ilimit, uint8_t **optr, const uint8_t * const olimit) { hal_client_handle_t client; @@ -370,7 +370,7 @@ static hal_error_t pkey_find(const uint8_t **iptr, const uint8_t * const ilimit, return HAL_ERROR_KEY_NAME_TOO_LONG; /* call the local function */ - ret = hal_rpc_pkey_find(client, session, &pkey, (const hal_uuid_t *) name_ptr, flags); + ret = hal_rpc_pkey_open(client, session, &pkey, (const hal_uuid_t *) name_ptr, flags); if (ret == HAL_OK) check(hal_xdr_encode_int(optr, olimit, pkey.handle)); @@ -877,8 +877,8 @@ hal_error_t hal_rpc_server_dispatch(const uint8_t * const ibuf, const size_t ile case RPC_FUNC_PKEY_LOAD: handler = pkey_load; break; - case RPC_FUNC_PKEY_FIND: - handler = pkey_find; + case RPC_FUNC_PKEY_OPEN: + handler = pkey_open; break; case RPC_FUNC_PKEY_GENERATE_RSA: handler = pkey_generate_rsa; diff --git a/unit-tests.py b/unit-tests.py index 43d8944..2b2433d 100644 --- a/unit-tests.py +++ b/unit-tests.py @@ -503,7 +503,7 @@ class TestPKeyList(TestCaseLoggedIn): uuids = set() for obj in PreloadedKey.db.itervalues(): with hsm.pkey_load(obj.keytype, obj.curve, obj.der, flags) as k: - self.addCleanup(lambda uuid: hsm.pkey_find(uuid, flags = flags).delete(), k.uuid) + self.addCleanup(lambda uuid: hsm.pkey_open(uuid, flags = flags).delete(), k.uuid) uuids.add(k.uuid) k.set_attributes(dict((i, a) for i, a in enumerate((str(obj.keytype), str(obj.fn2))))) return uuids @@ -525,7 +525,7 @@ class TestPKeyList(TestCaseLoggedIn): n = 0 for uuid in hsm.pkey_match(**kwargs): if uuids is None or uuid in uuids: - with hsm.pkey_find(uuid, flags) as k: + with hsm.pkey_open(uuid, flags) as k: n += 1 yield n, k @@ -587,7 +587,7 @@ class TestPKeyAttribute(TestCaseLoggedIn): for obj in PreloadedKey.db.itervalues(): with hsm.pkey_load(obj.keytype, obj.curve, obj.der, flags) as k: pinwheel() - self.addCleanup(lambda uuid: hsm.pkey_find(uuid, flags = flags).delete(), k.uuid) + self.addCleanup(lambda uuid: hsm.pkey_open(uuid, flags = flags).delete(), k.uuid) k.set_attributes(dict((j, "Attribute {}{}".format(j, "*" * n_fill)) for j in xrange(n_attrs))) pinwheel() |