You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
+ SPDX-License-Identifier: AGPL3.0-or-later
+
*/
/**
* @file util/crypto_hash.c
#include "platform.h"
#include "gnunet_crypto_lib.h"
#include "gnunet_strings_lib.h"
+#include "benchmark.h"
#include <gcrypt.h>
#define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-hash", __VA_ARGS__)
size_t size,
struct GNUNET_HashCode *ret)
{
+ BENCHMARK_START (hash);
gcry_md_hash_buffer (GCRY_MD_SHA512, ret, block, size);
+ BENCHMARK_END (hash);
}
{
struct GNUNET_HashContext *hc;
+ BENCHMARK_START (hash_context_start);
+
hc = GNUNET_new (struct GNUNET_HashContext);
GNUNET_assert (0 ==
gcry_md_open (&hc->hd,
GCRY_MD_SHA512,
0));
+
+ BENCHMARK_END (hash_context_start);
+
return hc;
}
const void *buf,
size_t size)
{
+ BENCHMARK_START (hash_context_read);
gcry_md_write (hc->hd, buf, size);
+ BENCHMARK_END (hash_context_read);
}
{
const void *res = gcry_md_read (hc->hd, 0);
+ BENCHMARK_START (hash_context_finish);
+
GNUNET_assert (NULL != res);
if (NULL != r_hash)
GNUNET_memcpy (r_hash,
res,
sizeof (struct GNUNET_HashCode));
GNUNET_CRYPTO_hash_context_abort (hc);
+ BENCHMARK_END (hash_context_finish);
}