38 #define CX_BLAKE2B_256_SIZE 32
41 #define CX_BLAKE2B_512_SIZE 64
44 enum blake2b_constant {
45 BLAKE2B_BLOCKBYTES = 128,
46 BLAKE2B_OUTBYTES = 64,
47 BLAKE2B_KEYBYTES = 64,
48 BLAKE2B_SALTBYTES = 16,
49 BLAKE2B_PERSONALBYTES = 16
53 struct blake2b_state__ {
57 uint8_t buf[BLAKE2B_BLOCKBYTES];
63 typedef struct blake2b_state__ blake2b_state;
69 struct cx_hash_header_s header;
71 struct blake2b_state__ ctx;
74 typedef struct cx_blake2b_s cx_blake2b_t;
88 WARN_UNUSED_RESULT cx_err_t cx_blake2b_init_no_throw(cx_blake2b_t *hash,
size_t out_len);
94 DEPRECATED
static inline int cx_blake2b_init(cx_blake2b_t *hash,
unsigned int out_len)
96 CX_THROW(cx_blake2b_init_no_throw(hash, out_len));
112 cx_err_t cx_blake2b_256_hash_iovec(
const cx_iovec_t *iovec,
114 uint8_t digest[
static CX_BLAKE2B_256_SIZE]);
128 static inline cx_err_t cx_blake2b_256_hash(
const uint8_t *in,
130 uint8_t digest[
static CX_BLAKE2B_256_SIZE])
134 return cx_blake2b_256_hash_iovec(&iovec, 1, digest);
149 cx_err_t cx_blake2b_512_hash_iovec(
const cx_iovec_t *iovec,
151 uint8_t digest[
static CX_BLAKE2B_512_SIZE]);
165 static inline cx_err_t cx_blake2b_512_hash(
const uint8_t *in,
167 uint8_t digest[
static CX_BLAKE2B_512_SIZE])
171 return cx_blake2b_512_hash_iovec(&iovec, 1, digest);
195 WARN_UNUSED_RESULT cx_err_t cx_blake2b_init2_no_throw(cx_blake2b_t *hash,
206 DEPRECATED
static inline int cx_blake2b_init2(cx_blake2b_t *hash,
207 unsigned int out_len,
209 unsigned int salt_len,
210 unsigned char *perso,
211 unsigned int perso_len)
213 CX_THROW(cx_blake2b_init2_no_throw(hash, out_len, salt, salt_len, perso, perso_len));
Similar to libc iovec type.