aboutsummaryrefslogtreecommitdiff
path: root/pbkdf2.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2018-05-20 18:18:40 -0400
committerRob Austein <sra@hactrn.net>2018-05-20 18:18:40 -0400
commite6bdf57820121b6eac9f35c8ef53a4e7a76205e1 (patch)
treeb8701157fa06ea8f873b1c330d9599e4eb7384cf /pbkdf2.c
parent76edd86d940956eb42ced93ccd4ee5f1d95bd01f (diff)
Better hal_core_alloc() semantics, assert() and printf() cleanup.
Various fixes extracted from the abandoned(-for-now?) reuse-cores branch, principally: * Change hal_core_alloc*() to support core reuse and to pick the least-recently-used core of a particular type otherwise; * Replace assert() and printf() calls with hal_assert() and hal_log(), respectively. assert() is particularly useless on the HSM, since it sends its error message into hyperspace then hangs the HSM.
Diffstat (limited to 'pbkdf2.c')
-rw-r--r--pbkdf2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pbkdf2.c b/pbkdf2.c
index 0a1e57e..607a0fb 100644
--- a/pbkdf2.c
+++ b/pbkdf2.c
@@ -53,7 +53,7 @@ static hal_error_t do_hmac(hal_core_t *core,
const uint32_t block,
uint8_t * mac, const size_t mac_len)
{
- assert(d != NULL && pw != NULL && data != NULL && mac != NULL);
+ hal_assert(d != NULL && pw != NULL && data != NULL && mac != NULL);
uint8_t sb[d->hmac_state_length];
hal_hmac_state_t *s;
@@ -96,9 +96,9 @@ hal_error_t hal_pbkdf2(hal_core_t *core,
iterations_desired == 0)
return HAL_ERROR_BAD_ARGUMENTS;
- assert(sizeof(statebuf) >= descriptor->hmac_state_length);
- assert(sizeof(result) >= descriptor->digest_length);
- assert(sizeof(mac) >= descriptor->digest_length);
+ hal_assert(sizeof(statebuf) >= descriptor->hmac_state_length);
+ hal_assert(sizeof(result) >= descriptor->digest_length);
+ hal_assert(sizeof(mac) >= descriptor->digest_length);
/* Output length check per RFC 2989 5.2. */
if ((uint64_t) derived_key_length > ((uint64_t) 0xFFFFFFFF) * descriptor->block_length)