aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-09-02 18:35:36 -0400
committerRob Austein <sra@hactrn.net>2015-09-02 18:35:36 -0400
commit12ed3abeb24bbd5d59b760640a35ead0874fd3fe (patch)
tree1dcc0db3d543e7b740238ea911b7f448c704e70b /tests
parent55116cc564649433cf4a8515d4a37cbf00dd6199 (diff)
Clean up excessively complicated handling of opaque types in hash and
RSA code; use simpler model (pointer to incomplete structure) used in ECDSA code. Refactor RSA code to use shared ASN.1 routines.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-ecdsa.c2
-rw-r--r--tests/test-hash.c4
-rw-r--r--tests/test-rsa.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/tests/test-ecdsa.c b/tests/test-ecdsa.c
index d57b440..d41a54d 100644
--- a/tests/test-ecdsa.c
+++ b/tests/test-ecdsa.c
@@ -227,7 +227,7 @@ static int test_keygen_sign_verify(const hal_ecdsa_curve_t curve)
{
const uint8_t plaintext[] = "So long, and thanks...";
uint8_t statebuf[hash_descriptor->hash_state_length];
- hal_hash_state_t state = { NULL };
+ hal_hash_state_t *state = NULL;
if ((err = hal_hash_initialize(hash_descriptor, &state, statebuf, sizeof(statebuf))) != HAL_OK ||
(err = hal_hash_update(state, plaintext, strlen((const char *) plaintext))) != HAL_OK ||
diff --git a/tests/test-hash.c b/tests/test-hash.c
index befdf02..144b1b9 100644
--- a/tests/test-hash.c
+++ b/tests/test-hash.c
@@ -533,7 +533,7 @@ static int _test_hash(const hal_hash_descriptor_t * const descriptor,
const char * const label)
{
uint8_t statebuf[512], digest[512];
- hal_hash_state_t state;
+ hal_hash_state_t *state = NULL;
hal_error_t err;
assert(descriptor != NULL && data != NULL && result != NULL && label != NULL);
@@ -597,7 +597,7 @@ static int _test_hmac(const hal_hash_descriptor_t * const descriptor,
const char * const label)
{
uint8_t statebuf[1024], digest[512];
- hal_hmac_state_t state;
+ hal_hmac_state_t *state = NULL;
hal_error_t err;
assert(descriptor != NULL && data != NULL && result != NULL && label != NULL);
diff --git a/tests/test-rsa.c b/tests/test-rsa.c
index 0fd2002..0751189 100644
--- a/tests/test-rsa.c
+++ b/tests/test-rsa.c
@@ -88,7 +88,7 @@ static int test_decrypt(const char * const kind, const rsa_tc_t * const tc)
printf("%s test for %lu-bit RSA key\n", kind, (unsigned long) tc->size);
uint8_t keybuf[hal_rsa_key_t_size];
- hal_rsa_key_t key = { NULL };
+ hal_rsa_key_t *key = NULL;
hal_error_t err = HAL_OK;
if ((err = hal_rsa_key_load_private(&key,
@@ -130,7 +130,7 @@ static int test_gen(const char * const kind, const rsa_tc_t * const tc)
char fn[sizeof("test-rsa-key-xxxxxx.der")];
uint8_t keybuf1[hal_rsa_key_t_size], keybuf2[hal_rsa_key_t_size];
- hal_rsa_key_t key1 = { NULL }, key2 = { NULL };
+ hal_rsa_key_t *key1 = NULL, *key2 = NULL;
hal_error_t err = HAL_OK;
FILE *f;