aboutsummaryrefslogtreecommitdiff
path: root/rpc_pkey.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-11-21 23:36:36 -0500
committerRob Austein <sra@hactrn.net>2016-11-21 23:36:36 -0500
commit15efcdb3e2ebe20c35818447537728c9de2f089f (patch)
tree3dffa84f8e69254043ad088350e13c6010a16382 /rpc_pkey.c
parent834924b3e4d827f6db03d307a88e23bf95dc4624 (diff)
Whack attribute code with a club until it works with PKCS #11.
PKCS #11 supports zero-length attributes (eg, CKA_LABEL) so hack of using zero length attribute as NIL value won't work, instead we use a slightly more portable version of the hack PKCS #11 uses (PKCS #11 stuffs -1 into a CK_ULONG, we stuff 0xFFFFFFFF into a uint32_t). ks_attribute.c code was trying too hard and tripping over its own socks. Instead of trying to maintain attributes[] in place during modification, we now perform the minimum necessary change then re-scan the block. This is (very slightly) slower but more robust, both because the scan code has better error checking and because it's the scan code that we want to be sure is happy before committing a change. Rename hal_rpc_pkey_attribute_t to hal_pkey_attribute_t.
Diffstat (limited to 'rpc_pkey.c')
-rw-r--r--rpc_pkey.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/rpc_pkey.c b/rpc_pkey.c
index 98b0ba1..e2e42c9 100644
--- a/rpc_pkey.c
+++ b/rpc_pkey.c
@@ -935,7 +935,7 @@ static hal_error_t pkey_local_match(const hal_client_handle_t client,
const hal_key_type_t type,
const hal_curve_name_t curve,
const hal_key_flags_t flags,
- const hal_rpc_pkey_attribute_t *attributes,
+ const hal_pkey_attribute_t *attributes,
const unsigned attributes_len,
hal_uuid_t *result,
unsigned *result_len,
@@ -967,7 +967,7 @@ static hal_error_t pkey_local_match(const hal_client_handle_t client,
}
static hal_error_t pkey_local_set_attributes(const hal_pkey_handle_t pkey,
- const hal_rpc_pkey_attribute_t *attributes,
+ const hal_pkey_attribute_t *attributes,
const unsigned attributes_len)
{
hal_pkey_slot_t *slot = find_handle(pkey);
@@ -991,7 +991,7 @@ static hal_error_t pkey_local_set_attributes(const hal_pkey_handle_t pkey,
}
static hal_error_t pkey_local_get_attributes(const hal_pkey_handle_t pkey,
- hal_rpc_pkey_attribute_t *attributes,
+ hal_pkey_attribute_t *attributes,
const unsigned attributes_len,
uint8_t *attributes_buffer,
const size_t attributes_buffer_len)