diff options
author | Mattias Andrée <maandree@kth.se> | 2022-02-20 11:24:18 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2022-02-20 11:24:18 +0100 |
commit | 36beac7f7077ed94d3c1c0f46733b4f54a3b05b1 (patch) | |
tree | 308c1a98b1060e23f8db657bec3f18dcdb3f9333 /libblake.h | |
parent | Documentation (diff) | |
download | libblake-36beac7f7077ed94d3c1c0f46733b4f54a3b05b1.tar.gz libblake-36beac7f7077ed94d3c1c0f46733b4f54a3b05b1.tar.bz2 libblake-36beac7f7077ed94d3c1c0f46733b4f54a3b05b1.tar.xz |
Add more tests for BLAKE2b and BLAKE2s and update init functions (breaks API; were broken for keyed mode with zero-length message)
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libblake.h')
-rw-r--r-- | libblake.h | 38 |
1 files changed, 18 insertions, 20 deletions
@@ -806,20 +806,19 @@ struct libblake_blake2b_state { /** * Initialise a state for hashing with BLAKE2s * + * For keyed mode, which is used for MAC and PRF, + * after calling this function, the 64 first bytes + * input to the hash function shall be the key + * with NUL bytes appended to it (such that the + * length is 64 bytes, which is double the maximum + * allowed length of the key, but is the size + * block size used by BLAKE2s) + * * @param state The state to initialise * @param params Hashing parameters - * @param key Key to use. The key's length is set in - * `params->key_len`, but unless this value - * is 0 (hash in unkeyed mode), this buffer - * must be padded with NUL bytes, to the end, - * such that it's length is at least 64 bytes. - * (The maximum allowed key length is 32, the - * buffer's size shall be twice this.) The - * key is used for MAC and PRF. */ LIBBLAKE_PUBLIC__ void -libblake_blake2s_init(struct libblake_blake2s_state *state, const struct libblake_blake2s_params *params, - const unsigned char *key /* append null bytes until 64 bytes; if key is used */); +libblake_blake2s_init(struct libblake_blake2s_state *state, const struct libblake_blake2s_params *params); /** * Process data for hashing with BLAKE2s @@ -908,20 +907,19 @@ libblake_blake2s_digest(struct libblake_blake2s_state *state, void *data, size_t /** * Initialise a state for hashing with BLAKE2b * + * For keyed mode, which is used for MAC and PRF, + * after calling this function, the 128 first bytes + * input to the hash function shall be the key + * with NUL bytes appended to it (such that the + * length is 128 bytes, which is double the maximum + * allowed length of the key, but is the size + * block size used by BLAKE2b) + * * @param state The state to initialise * @param params Hashing parameters - * @param key Key to use. The key's length is set in - * `params->key_len`, but unless this value - * is 0 (hash in unkeyed mode), this buffer - * must be padded with NUL bytes, to the end, - * such that it's length is at least 128 bytes. - * (The maximum allowed key length is 64, the - * buffer's size shall be twice this.) The - * key is used for MAC and PRF. */ LIBBLAKE_PUBLIC__ void -libblake_blake2b_init(struct libblake_blake2b_state *state, const struct libblake_blake2b_params *params, - const unsigned char *key /* append null bytes until 128 bytes; if key is used */); +libblake_blake2b_init(struct libblake_blake2b_state *state, const struct libblake_blake2b_params *params); /** * Process data for hashing with BLAKE2b |