]> git.codecow.com Git - Monocypher.git/commit
Fixed undefined behaviour in Blake2b
authorLoup Vaillant <loup@loup-vaillant.fr>
Sat, 16 Jun 2018 09:35:52 +0000 (11:35 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Sat, 16 Jun 2018 19:52:09 +0000 (21:52 +0200)
commit9c41ee5360b81b41ffd071d3a9bc7bf6096b73a5
treeea5aadd09098550436add9c950b28fc1d0b68f34
parentcace24fd4506b5c236c98b3f29129d4ad79ef50a
Fixed undefined behaviour in Blake2b

Fixes #96

The function blake2b_set_input() was reading uninitialised memory.
While this didn't matter in practice (most platforms don't have trap
representations for unsigned integers), it is undefined behaviour under
the C and C++ standards.  To fix it, we reset the whole input buffer
before setting its first byte.

The fix introduces a conditional, but that conditional only depend
on an index, which itself depends on the size of the input, which is not
secret.  We're still "constant time" with respect to secrets.
src/monocypher.c