aboutsummaryrefslogtreecommitdiff
path: root/tests/test-hash.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-10-04 22:31:47 -0400
committerRob Austein <sra@hactrn.net>2015-10-04 22:31:47 -0400
commitb3bbd3dbccef8c499e980490203cd5085dd13a98 (patch)
tree68091332d4e2429fcc9a8533bf2e26b2d49ab791 /tests/test-hash.c
parente164eecc55dd96efc98d2c723e96aaaecdcfda13 (diff)
Whack libhal API to use current configure_core_selector mechanism.
Compiles, not yet tested.
Diffstat (limited to 'tests/test-hash.c')
-rw-r--r--tests/test-hash.c34
1 files changed, 8 insertions, 26 deletions
diff --git a/tests/test-hash.c b/tests/test-hash.c
index 144b1b9..b6001e0 100644
--- a/tests/test-hash.c
+++ b/tests/test-hash.c
@@ -542,23 +542,14 @@ static int _test_hash(const hal_hash_descriptor_t * const descriptor,
printf("Starting %s test\n", label);
- err = hal_hash_core_present(descriptor);
+ const hal_core_t *core = hal_core_find(descriptor->core_name, NULL);
- switch (err) {
-
- case HAL_OK:
- break;
-
- case HAL_ERROR_IO_UNEXPECTED:
- printf("Core not present, skipping test\n");
+ if (core == NULL) {
+ printf("Core not found, skipping test\n");
return 1;
-
- default:
- printf("Failed while checking for core: %s\n", hal_error_string(err));
- return 0;
}
- if ((err = hal_hash_initialize(descriptor, &state, statebuf, sizeof(statebuf))) != HAL_OK) {
+ if ((err = hal_hash_initialize(core, descriptor, &state, statebuf, sizeof(statebuf))) != HAL_OK) {
printf("Failed while initializing hash: %s\n", hal_error_string(err));
return 0;
}
@@ -606,23 +597,14 @@ static int _test_hmac(const hal_hash_descriptor_t * const descriptor,
printf("Starting %s test\n", label);
- err = hal_hash_core_present(descriptor);
+ const hal_core_t *core = hal_core_find(descriptor->core_name, NULL);
- switch (err) {
-
- case HAL_OK:
- break;
-
- case HAL_ERROR_IO_UNEXPECTED:
- printf("Core not present, skipping test\n");
+ if (core == NULL) {
+ printf("Core not found, skipping test\n");
return 1;
-
- default:
- printf("Failed while checking for core: %s\n", hal_error_string(err));
- return 0;
}
- if ((err = hal_hmac_initialize(descriptor, &state, statebuf, sizeof(statebuf), key, key_len)) != HAL_OK) {
+ if ((err = hal_hmac_initialize(core, descriptor, &state, statebuf, sizeof(statebuf), key, key_len)) != HAL_OK) {
printf("Failed while initializing HMAC: %s\n", hal_error_string(err));
return 0;
}