aboutsummaryrefslogtreecommitdiff
path: root/tests/test-hash.c
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2016-07-05 22:45:35 -0400
committerPaul Selkirk <paul@psgd.org>2016-07-05 22:45:35 -0400
commit30f8e4e85b6a337291b09d55d8edc15e422b6341 (patch)
tree19199dd47bb98e18a96281d34e35d1971565fc72 /tests/test-hash.c
parente1c57eff41a57b8a3f16e5d652b5598d75887a21 (diff)
Attempt to add resource management, for multiple cores of the same type.
Find a suitable core, and mark it busy. Don't forget to release it as soon as you're done. This has a knock-on effect of un-const'ing core arguments and struct fields in a lot of places, and it moves some core checks around.
Diffstat (limited to 'tests/test-hash.c')
-rw-r--r--tests/test-hash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/test-hash.c b/tests/test-hash.c
index 65ddf15..4e78243 100644
--- a/tests/test-hash.c
+++ b/tests/test-hash.c
@@ -540,7 +540,7 @@ static const uint8_t hmac_sha2_tc_7_result_sha512[] = { /* 64 bytes */
0xfa, 0x8c, 0x6a, 0x58
};
-static int _test_hash(const hal_core_t *core,
+static int _test_hash(hal_core_t *core,
const hal_hash_descriptor_t * const descriptor,
const uint8_t * const data, const size_t data_len,
const uint8_t * const result, const size_t result_len,
@@ -588,7 +588,7 @@ static int _test_hash(const hal_core_t *core,
return 1;
}
-static int _test_hmac(const hal_core_t *core,
+static int _test_hmac(hal_core_t *core,
const hal_hash_descriptor_t * const descriptor,
const uint8_t * const key, const size_t key_len,
const uint8_t * const data, const size_t data_len,
@@ -643,7 +643,7 @@ static int _test_hmac(const hal_core_t *core,
#define test_hmac(_core_, _desc_, _key_, _data_, _result_, _label_) \
_test_hmac(_core_, _desc_, _key_, sizeof(_key_), _data_, sizeof(_data_), _result_, sizeof(_result_), _label_)
-static void show_core(const hal_core_t *core, const char *whinge)
+static void show_core(hal_core_t *core, const char *whinge)
{
const hal_core_info_t *core_info = hal_core_info(core);
if (core_info != NULL)
@@ -654,9 +654,9 @@ static void show_core(const hal_core_t *core, const char *whinge)
int main (int argc, char *argv[])
{
- const hal_core_t * const sha1_core = hal_core_find(SHA1_NAME, NULL);
- const hal_core_t * const sha256_core = hal_core_find(SHA256_NAME, NULL);
- const hal_core_t * const sha512_core = hal_core_find(SHA512_NAME, NULL);
+ hal_core_t * const sha1_core = hal_core_find(SHA1_NAME, NULL);
+ hal_core_t * const sha256_core = hal_core_find(SHA256_NAME, NULL);
+ hal_core_t * const sha512_core = hal_core_find(SHA512_NAME, NULL);
show_core(sha1_core, "sha-1");
show_core(sha256_core, "sha-256");