Skip to content

Commit

Permalink
HASH_PROCESS: fix overflow test
Browse files Browse the repository at this point in the history
state_var.length counts bits, inlen is in bytes.
  • Loading branch information
pattop committed Aug 16, 2020
1 parent 3f1b687 commit 40b9560
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/headers/tomcrypt_private.h
Expand Up @@ -90,7 +90,7 @@ int func_name (hash_state * md, const unsigned char *in, unsigned long inlen)
if (md-> state_var .curlen > sizeof(md-> state_var .buf)) { \
return CRYPT_INVALID_ARG; \
} \
if ((md-> state_var .length + inlen) < md-> state_var .length) { \
if ((md-> state_var .length + inlen * 8) < md-> state_var .length) { \
return CRYPT_HASH_OVERFLOW; \
} \
while (inlen > 0) { \
Expand Down

0 comments on commit 40b9560

Please sign in to comment.