aboutsummaryrefslogtreecommitdiff
path: root/rpc_server.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-10-24 15:15:51 -0400
committerRob Austein <sra@hactrn.net>2016-10-24 15:15:51 -0400
commitdcf3c671314b36285277073c0a3d3a09bf4d93e6 (patch)
treee41e68a44ce08dfd3bf976d66634daf9c8097e9b /rpc_server.c
parent87f0998afe6dc6946d01429fc74f8696f0da2f0a (diff)
Make previous_uuid an input-only argument to hal_rpc_pkey_match().
In retrospect it's obvious that this never needed to be an input/output argument, as its value will always be the same as the last value in the returned array. Doh. So simplify the RPC and call sequence slightly by removing the unnecessary output value.
Diffstat (limited to 'rpc_server.c')
-rw-r--r--rpc_server.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/rpc_server.c b/rpc_server.c
index 18f6823..6ed4959 100644
--- a/rpc_server.c
+++ b/rpc_server.c
@@ -672,7 +672,6 @@ static hal_error_t pkey_match(const uint8_t **iptr, const uint8_t * const ilimit
hal_session_handle_t session;
uint32_t type, curve, attributes_len, result_max, previous_uuid_len;
const uint8_t *previous_uuid_ptr;
- hal_uuid_t previous_uuid;
hal_key_flags_t flags;
hal_error_t ret;
@@ -696,10 +695,10 @@ static hal_error_t pkey_match(const uint8_t **iptr, const uint8_t * const ilimit
check(hal_xdr_decode_int(iptr, ilimit, &result_max));
check(hal_xdr_decode_buffer_in_place(iptr, ilimit, &previous_uuid_ptr, &previous_uuid_len));
- if (previous_uuid_len != sizeof(previous_uuid.uuid))
+ if (previous_uuid_len != sizeof(hal_uuid_t))
return HAL_ERROR_KEY_NAME_TOO_LONG;
- memcpy(previous_uuid.uuid, previous_uuid_ptr, sizeof(previous_uuid.uuid));
+ const hal_uuid_t * const previous_uuid = (const void *) previous_uuid_ptr;
hal_uuid_t result[result_max];
unsigned result_len;
@@ -707,7 +706,7 @@ static hal_error_t pkey_match(const uint8_t **iptr, const uint8_t * const ilimit
ret = hal_rpc_local_pkey_dispatch.match(client, session, type, curve, flags,
attributes, attributes_len,
result, &result_len, result_max,
- &previous_uuid);
+ previous_uuid);
if (ret == HAL_OK) {
uint8_t *optr_orig = *optr;
@@ -715,9 +714,6 @@ static hal_error_t pkey_match(const uint8_t **iptr, const uint8_t * const ilimit
for (int i = 0; ret == HAL_OK && i < result_len; ++i)
ret = hal_xdr_encode_buffer(optr, olimit, result[i].uuid,
sizeof(result[i].uuid));
- if (ret == HAL_OK)
- ret = hal_xdr_encode_buffer(optr, olimit, previous_uuid.uuid,
- sizeof(previous_uuid.uuid));
if (ret != HAL_OK)
*optr = optr_orig;
}