From e6bdf57820121b6eac9f35c8ef53a4e7a76205e1 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 20 May 2018 18:18:40 -0400 Subject: 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. --- rpc_pkcs1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'rpc_pkcs1.c') diff --git a/rpc_pkcs1.c b/rpc_pkcs1.c index 2dcf9dd..96bd296 100644 --- a/rpc_pkcs1.c +++ b/rpc_pkcs1.c @@ -46,7 +46,7 @@ hal_error_t hal_rpc_pkcs1_construct_digestinfo(const hal_hash_handle_t handle, uint8_t *digest_info, size_t *digest_info_len, const size_t digest_info_max) { - assert(digest_info != NULL && digest_info_len != NULL); + hal_assert(digest_info != NULL && digest_info_len != NULL); hal_digest_algorithm_t alg; size_t len, alg_len; @@ -62,7 +62,7 @@ hal_error_t hal_rpc_pkcs1_construct_digestinfo(const hal_hash_handle_t handle, if (*digest_info_len >= digest_info_max) return HAL_ERROR_RESULT_TOO_LONG; - assert(*digest_info_len < 130); + hal_assert(*digest_info_len < 130); uint8_t *d = digest_info; @@ -76,7 +76,7 @@ hal_error_t hal_rpc_pkcs1_construct_digestinfo(const hal_hash_handle_t handle, *d++ = 0x04; /* OCTET STRING */ *d++ = (uint8_t) len; - assert(digest_info + *digest_info_len == d + len); + hal_assert(digest_info + *digest_info_len == d + len); return hal_rpc_hash_finalize(handle, d, len); } -- cgit v1.2.3