aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-rpc_pkey.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/tests/test-rpc_pkey.c b/tests/test-rpc_pkey.c
index c07a318..1f00fb8 100644
--- a/tests/test-rpc_pkey.c
+++ b/tests/test-rpc_pkey.c
@@ -98,25 +98,27 @@ static int test_attributes(const hal_pkey_handle_t pkey,
const hal_client_handle_t client = {HAL_HANDLE_NONE};
const hal_session_handle_t session = {HAL_HANDLE_NONE};
hal_uuid_t result[10], previous_uuid = {{0}};
- unsigned result_len;
+ unsigned result_len, state;
- if ((err = hal_rpc_pkey_match(client, session, HAL_KEY_TYPE_NONE, HAL_CURVE_NONE, flags, NULL, 0,
- result, &result_len, sizeof(result)/sizeof(*result),
+ state = 0;
+ if ((err = hal_rpc_pkey_match(client, session, HAL_KEY_TYPE_NONE, HAL_CURVE_NONE, 0, 0, NULL, 0,
+ &state, result, &result_len, sizeof(result)/sizeof(*result),
&previous_uuid)) != HAL_OK)
lose("Unrestricted match() failed: %s\n", hal_error_string(err));
if (result_len == 0)
lose("Unrestricted match found no results\n");
+ state = 0;
for (const size_t *size = sizes; *size; size++) {
uint8_t buf[*size];
memset(buf, 0x55, sizeof(buf));
snprintf((char *) buf, sizeof(buf), format, (unsigned long) *size);
hal_pkey_attribute_t attribute[1] = {{ *size, sizeof(buf), buf }};
- if ((err = hal_rpc_pkey_match(client, session, HAL_KEY_TYPE_NONE, HAL_CURVE_NONE, flags,
+ if ((err = hal_rpc_pkey_match(client, session, HAL_KEY_TYPE_NONE, HAL_CURVE_NONE, 0, 0,
attribute, sizeof(attribute)/sizeof(*attribute),
- result, &result_len, sizeof(result)/sizeof(*result),
+ &state, result, &result_len, sizeof(result)/sizeof(*result),
&previous_uuid)) != HAL_OK)
lose("Restricted match() for attribute %lu failed: %s\n",
(unsigned long) *size, hal_error_string(err));
@@ -177,8 +179,8 @@ static int test_rsa_testvec(const rsa_tc_t * const tc, hal_key_flags_t flags)
assert(len == sizeof(private_der));
- if ((err = hal_rpc_pkey_load(client, session, &private_key, HAL_KEY_TYPE_RSA_PRIVATE, HAL_CURVE_NONE,
- &private_name, private_der, sizeof(private_der), flags)) != HAL_OK)
+ if ((err = hal_rpc_pkey_load(client, session, &private_key, &private_name,
+ private_der, sizeof(private_der), flags)) != HAL_OK)
lose("Could not load private key into RPC: %s\n", hal_error_string(err));
if ((err = hal_rsa_public_key_to_der(tc_key, public_der, &len, sizeof(public_der))) != HAL_OK)
@@ -186,8 +188,8 @@ static int test_rsa_testvec(const rsa_tc_t * const tc, hal_key_flags_t flags)
assert(len == sizeof(public_der));
- if ((err = hal_rpc_pkey_load(client, session, &public_key, HAL_KEY_TYPE_RSA_PUBLIC, HAL_CURVE_NONE,
- &public_name, public_der, sizeof(public_der), flags)) != HAL_OK)
+ if ((err = hal_rpc_pkey_load(client, session, &public_key, &public_name,
+ public_der, sizeof(public_der), flags)) != HAL_OK)
lose("Could not load public key into RPC: %s\n", hal_error_string(err));
uint8_t sig[tc->s.len];
@@ -271,8 +273,8 @@ static int test_ecdsa_testvec(const ecdsa_tc_t * const tc, hal_key_flags_t flags
assert(len == sizeof(private_der));
- if ((err = hal_rpc_pkey_load(client, session, &private_key, HAL_KEY_TYPE_EC_PRIVATE, tc->curve,
- &private_name, private_der, sizeof(private_der), flags)) != HAL_OK)
+ if ((err = hal_rpc_pkey_load(client, session, &private_key, &private_name,
+ private_der, sizeof(private_der), flags)) != HAL_OK)
lose("Could not load private key into RPC: %s\n", hal_error_string(err));
if ((err = hal_ecdsa_public_key_to_der(tc_key, public_der, &len, sizeof(public_der))) != HAL_OK)
@@ -280,8 +282,8 @@ static int test_ecdsa_testvec(const ecdsa_tc_t * const tc, hal_key_flags_t flags
assert(len == sizeof(public_der));
- if ((err = hal_rpc_pkey_load(client, session, &public_key, HAL_KEY_TYPE_EC_PUBLIC, tc->curve,
- &public_name, public_der, sizeof(public_der), flags)) != HAL_OK)
+ if ((err = hal_rpc_pkey_load(client, session, &public_key, &public_name,
+ public_der, sizeof(public_der), flags)) != HAL_OK)
lose("Could not load public key into RPC: %s\n", hal_error_string(err));
if ((err = hal_rpc_pkey_verify(public_key, hal_hash_handle_none,
@@ -353,8 +355,8 @@ static int test_rsa_generate(const rsa_tc_t * const tc, hal_key_flags_t flags)
assert(len == sizeof(public_der));
- if ((err = hal_rpc_pkey_load(client, session, &public_key, HAL_KEY_TYPE_RSA_PUBLIC, HAL_CURVE_NONE,
- &public_name, public_der, sizeof(public_der), flags)) != HAL_OK)
+ if ((err = hal_rpc_pkey_load(client, session, &public_key, &public_name,
+ public_der, sizeof(public_der), flags)) != HAL_OK)
lose("Could not load public key into RPC: %s\n", hal_error_string(err));
uint8_t sig[tc->s.len];
@@ -429,8 +431,8 @@ static int test_ecdsa_generate(const ecdsa_tc_t * const tc, hal_key_flags_t flag
assert(len == sizeof(public_der));
- if ((err = hal_rpc_pkey_load(client, session, &public_key, HAL_KEY_TYPE_EC_PUBLIC, tc->curve,
- &public_name, public_der, sizeof(public_der), flags)) != HAL_OK)
+ if ((err = hal_rpc_pkey_load(client, session, &public_key, &public_name,
+ public_der, sizeof(public_der), flags)) != HAL_OK)
lose("Could not load public key into RPC: %s\n", hal_error_string(err));
uint8_t sig[tc->sig_len + 4];