You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Functions sha512_compute and sha256_compute generate wrong padding when message length is greater than pad block length. The bug is last param of memset (length) which should be multiple of sizeof(word_t), i.e.: sizeof(word_t) * BLOCKSIZE - sizeof(word_t) * PADBLOCKSIZE, since the result var is of type word_t and not 8-bit byte type. The sha512_compute function also has wrong condition for the case when an additional block should be generated. Should be datalength < BLOCK_SIZE - 16 due to SHA-512 padding block is 128 bit -> 16 bytes.
Functions sha512_compute and sha256_compute generate wrong padding when message length is greater than pad block length. The bug is last param of
memset
(length) which should be multiple ofsizeof(word_t)
, i.e.:sizeof(word_t) * BLOCKSIZE - sizeof(word_t) * PADBLOCKSIZE
, since theresult
var is of typeword_t
and not 8-bit byte type. The sha512_compute function also has wrong condition for the case when an additional block should be generated. Should bedatalength < BLOCK_SIZE - 16
due to SHA-512 padding block is 128 bit -> 16 bytes.Test vector for SHA384:
Here's an example fix for
sha512_compute
:The text was updated successfully, but these errors were encountered: