Page MenuHomeFreeBSD

Implement SHA-512 truncated (224 and 256 bits)
ClosedPublic

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

Details

Summary

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

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

allanjude updated this revision to Diff 15494.Apr 22 2016, 1:43 PM
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.
bcr added a subscriber: bcr.Apr 22 2016, 1:49 PM

Found a typo.

sbin/md5/md5.1
87 ↗(On Diff #15494)

I this think should be "a version".

allanjude updated this revision to Diff 15780.Apr 30 2016, 9:40 PM
allanjude edited edge metadata.

Fix typo spotted by bcr@

cem added a subscriber: cem.May 26 2016, 6:35 PM
cem added inline comments.
sys/crypto/sha2/sha512c.c
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

sys/crypto/sha2/sha512t.h
106 ↗(On Diff #15780)

[static DIGEST_LEN]

115 ↗(On Diff #15780)

[static DIGEST_LEN]

cem added a reviewer: cem.May 26 2016, 6:35 PM
allanjude marked 7 inline comments as done.May 27 2016, 1:30 AM
allanjude added inline comments.
sys/crypto/sha2/sha512c.c
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)

ok

369 ↗(On Diff #15780)

right

allanjude updated this revision to Diff 16958.May 27 2016, 1:37 AM
allanjude marked 3 inline comments as done.
allanjude edited edge metadata.

Update with feedback from cem@

cem added inline comments.May 27 2016, 4:03 PM
sys/crypto/sha2/sha512c.c
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 updated this revision to Diff 17023.May 28 2016, 4:40 AM
allanjude edited edge metadata.

Parts of the previous update did not get submitted

allanjude marked 10 inline comments as done.May 28 2016, 4:41 AM
cem accepted this revision.May 28 2016, 2:00 PM
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.