blake2b_keyed_init (blake2b_state *S, const unsigned char *key, size_t keylen)
{
unsigned char k[BLAKE2B_BLOCKBYTES] = {0};
- if (keylen > BLAKE2B_KEYBYTES) {
- fprintf (stderr,
- "key size larger than %u passed to blake2b_keyed_init",
- BLAKE2B_KEYBYTES);
- exit (-1);
- }
- else {
- memcpy (k, key, keylen);
- }
+
+ g_assert (keylen <= BLAKE2B_KEYBYTES);
+ memcpy (k, key, keylen);
blake2b_init (S);
blake2b_update (S, k, BLAKE2B_BLOCKBYTES);
}
}
}
}
-}
\ No newline at end of file
+}
#define rspamd_cryptobox_MAX_NMBYTES 32
#define rspamd_cryptobox_SIPKEYBYTES 16
#define rspamd_cryptobox_HASHBYTES 64
+#define rspamd_cryptobox_HASHKEYBYTES 64
#define rspamd_cryptobox_HASHSTATEBYTES 256
typedef guchar rspamd_pk_t[rspamd_cryptobox_MAX_PKBYTES];