Page MenuHomeFreeBSD

Implement SHA-512 truncated (224 and 256 bits)

Authored by allanjude on Apr 22 2016, 1:43 PM.



This implements SHA-512/256, which generates a 256 bit hash, but using SHA-512 so is faster than SHA-256 on 64bit platforms.

The main goal of this implementation is to enable support for this faster hashing algorithm in ZFS

This is the follow on to r292782

Test Plan

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

allanjude retitled this revision from to Implement SHA-512 truncated (224 and 256 bits).
allanjude updated this object.
allanjude edited the test plan for this revision. (Show Details)
allanjude added reviewers: cperciva, jmg, delphij.

Found a typo.

87 ↗(On Diff #15494)

I this think should be "a version".

allanjude edited edge metadata.

Fix typo spotted by bcr@

cem added inline comments.
331 ↗(On Diff #15780)

what's "so are skipped" mean?

352–356 ↗(On Diff #15780)

It seems like these aren't really necessary. I'd suggest removing them and adding a comment where they were in the header to use the SHA512_Update() routine.

359 ↗(On Diff #15780)

Use digest[static ...] here :).

369 ↗(On Diff #15780)

don't need to cast here.

391–395 ↗(On Diff #15780)

Same quibble here.

398 ↗(On Diff #15780)

Use digest[static DIGEST_LEN] :)

408 ↗(On Diff #15780)

same as above

106 ↗(On Diff #15780)

[static DIGEST_LEN]

115 ↗(On Diff #15780)

[static DIGEST_LEN]

allanjude added inline comments.
331 ↗(On Diff #15780)

I didn't define the _transform function because it just uses the regular SHA512 one. I'll reword this

352–356 ↗(On Diff #15780)

Userland applications that implement this algo expect this symbol to exist in libmd.

359 ↗(On Diff #15780)


369 ↗(On Diff #15780)


allanjude marked 3 inline comments as done.
allanjude edited edge metadata.

Update with feedback from cem@

352–356 ↗(On Diff #15780)

It seems like userland-only routines and declarations should live in userland, like the _File/_Data routines. But whatever.

331 ↗(On Diff #16958)

still needs rewording

369 ↗(On Diff #16958)

cast still present

408 ↗(On Diff #16958)

This extra cast got missed :)

allanjude edited edge metadata.

Parts of the previous update did not get submitted

cem edited edge metadata.
This revision is now accepted and ready to land.May 28 2016, 2:00 PM
This revision was automatically updated to reflect the committed changes.