1 /* Copyright (c) 2023, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
5 * \file compat_blake2.h
7 * \brief Compatibility adapter providing blake2b using ext/equix/hashx
10 #ifndef TOR_COMPAT_BLAKE2_H
11 #define TOR_COMPAT_BLAKE2_H
15 #include "lib/cc/compat_compiler.h"
16 #include "ext/equix/hashx/src/blake2.h"
19 blake2b_init_param(blake2b_state
*S
, const blake2b_param
*P
)
21 return hashx_blake2b_init_param(S
, P
);
25 blake2b_init(blake2b_state
*S
, const uint8_t digest_length
)
28 memset(&P
, 0, sizeof P
);
29 P
.digest_length
= digest_length
;
32 return blake2b_init_param(S
, &P
);
36 blake2b_update(blake2b_state
*S
, const uint8_t *in
, uint64_t inlen
)
38 return hashx_blake2b_update(S
, in
, inlen
);
42 blake2b_final(blake2b_state
*S
, uint8_t *out
, uint8_t outlen
)
44 return hashx_blake2b_final(S
, out
, outlen
);
47 #endif /* !defined(TOR_COMPAT_BLAKE2_H) */