Debian Codegraph @

debian/rust-vendor/aws-lc-sys/aws-lc/include/openssl/blake2.h

raw
1 // Copyright (c) 2021, Google Inc.
2 // SPDX-License-Identifier: ISC
3
4 #ifndef OPENSSL_HEADER_BLAKE2_H
5 #define OPENSSL_HEADER_BLAKE2_H
6
7 #include <openssl/base.h>
8
9 #if defined(__cplusplus)
10 extern "C" {
11 #endif
12
13
14 #define BLAKE2B256_DIGEST_LENGTH (256 / 8)
15 #define BLAKE2B_CBLOCK 128
16
17 struct blake2b_state_st {
18 uint64_t h[8];
19 uint64_t t_low, t_high;
20 uint8_t block[BLAKE2B_CBLOCK];
21 size_t block_used;
22 };
23
24 // BLAKE2B256_Init initialises |b2b| to perform a BLAKE2b-256 hash. There are no
25 // pointers inside |b2b| thus release of |b2b| is purely managed by the caller.
26 OPENSSL_EXPORT void BLAKE2B256_Init(BLAKE2B_CTX *b2b);
27
28 // BLAKE2B256_Update appends |len| bytes from |data| to the digest being
29 // calculated by |b2b|.
30 OPENSSL_EXPORT void BLAKE2B256_Update(BLAKE2B_CTX *b2b, const void *data,
31 size_t len);
32
33 // BLAKE2B256_Final completes the digest calculated by |b2b| and writes
34 // |BLAKE2B256_DIGEST_LENGTH| bytes to |out|.
35 OPENSSL_EXPORT void BLAKE2B256_Final(uint8_t out[BLAKE2B256_DIGEST_LENGTH],
36 BLAKE2B_CTX *b2b);
37
38 // BLAKE2B256 writes the BLAKE2b-256 digset of |len| bytes from |data| to
39 // |out|.
40 OPENSSL_EXPORT void BLAKE2B256(const uint8_t *data, size_t len,
41 uint8_t out[BLAKE2B256_DIGEST_LENGTH]);
42
43
44 #if defined(__cplusplus)
45 } // extern C
46 #endif
47
48 #endif // OPENSSL_HEADER_BLAKE2_H