diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-02-07 13:39:32 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-02-07 13:39:32 +0000 |
commit | e4646379a6fb5d1dcff71cc38db5e60802a21dcb (patch) | |
tree | 2c3d6463f773ca3faac86df6b60d4909df54dce2 /src | |
parent | pass large parameters by const ref, not value (diff) | |
download | monero-e4646379a6fb5d1dcff71cc38db5e60802a21dcb.tar.xz |
keccak: fix mdlen bounds sanity checking
found by h908714124
Diffstat (limited to 'src')
-rw-r--r-- | src/crypto/keccak.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/crypto/keccak.c b/src/crypto/keccak.c index 7386d37a3..533021af3 100644 --- a/src/crypto/keccak.c +++ b/src/crypto/keccak.c @@ -81,7 +81,8 @@ void keccak(const uint8_t *in, size_t inlen, uint8_t *md, int mdlen) uint8_t temp[144]; size_t i, rsiz, rsizw; - if (mdlen <= 0 || mdlen > 200 || sizeof(st) != 200) + static_assert(HASH_DATA_AREA <= sizeof(temp), "Bad keccak preconditions"); + if (mdlen <= 0 || (mdlen > 100 && sizeof(st) != (size_t)mdlen)) { fprintf(stderr, "Bad keccak use"); abort(); |