From febb5279f7bf3c86ec872c1b2ed1e024f73e64c5 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 24 Aug 2024 20:13:01 +0200 Subject: Add BLAKE via libblake>=1.1 (this version introduced libblake_init()) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libhashsum_init_blakeb_hasher.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 libhashsum_init_blakeb_hasher.c (limited to 'libhashsum_init_blakeb_hasher.c') diff --git a/libhashsum_init_blakeb_hasher.c b/libhashsum_init_blakeb_hasher.c new file mode 100644 index 0000000..417553b --- /dev/null +++ b/libhashsum_init_blakeb_hasher.c @@ -0,0 +1,28 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifdef SUPPORT_BLAKEB + + +int +libhashsum_init_blakeb_hasher(struct libhashsum_hasher *this, size_t hashbits) +{ + if (hashbits == 384U) + return libhashsum_init_blake384_hasher(this); + if (hashbits == 512U) + return libhashsum_init_blake512_hasher(this); + + errno = EINVAL; + return -1; +} + + +#else +int +libhashsum_init_blakeb_hasher(struct libhashsum_hasher *this, size_t hashbits) +{ + (void) this; + (void) hashbits; + errno = ENOSYS; + return -1; +} +#endif -- cgit v1.2.3-70-g09d2