http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/zfs/sha256.c

The block padding calculation in ZFS's sha256.c (lines 114-115) appears to be 
wrong:
       for (i = 0; i < padsize; i++)
                pad[i] = ((uint8_t *)buf)[i];

The padding there is taking bytes from the start of buf, when in fact it should 
be from the end (the part not already transformed). As such, the 
zio_checksum_SHA256 function is not actually calculating the correct sha256 
digest of the passed buf. It could be corrected something like this:

        for (i = 0; i < padsize; i++)
                pad[i] = ((uint8_t *)buf)[i + size - padsize];
--
This messages posted from opensolaris.org

Reply via email to