diff options
author | Paul Selkirk <paul@psgd.org> | 2016-07-05 22:45:35 -0400 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2016-07-05 22:45:35 -0400 |
commit | 30f8e4e85b6a337291b09d55d8edc15e422b6341 (patch) | |
tree | 19199dd47bb98e18a96281d34e35d1971565fc72 /pbkdf2.c | |
parent | e1c57eff41a57b8a3f16e5d652b5598d75887a21 (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 'pbkdf2.c')
-rw-r--r-- | pbkdf2.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -46,7 +46,7 @@ * if and when we get clever about reusing HMAC state for speed. */ -static hal_error_t do_hmac(const hal_core_t *core, +static hal_error_t do_hmac(hal_core_t *core, const hal_hash_descriptor_t * const d, const uint8_t * const pw, const size_t pw_len, const uint8_t * const data, const size_t data_len, @@ -78,7 +78,7 @@ static hal_error_t do_hmac(const hal_core_t *core, * Derive a key from a passphrase using the PBKDF2 algorithm. */ -hal_error_t hal_pbkdf2(const hal_core_t *core, +hal_error_t hal_pbkdf2(hal_core_t *core, const hal_hash_descriptor_t * const descriptor, const uint8_t * const password, const size_t password_length, const uint8_t * const salt, const size_t salt_length, @@ -108,6 +108,13 @@ hal_error_t hal_pbkdf2(const hal_core_t *core, memset(result, 0, sizeof(result)); memset(mac, 0, sizeof(mac)); +#if 1 + /* HACK - find the second sha256 core, to avoid interfering with rpc. + */ + core = hal_core_find(descriptor->core_name, NULL); + core = hal_core_find(descriptor->core_name, core); +#endif + /* * We probably should check here to see whether the password is * longer than the HMAC block size, and, if so, we should hash the |