Page MenuHomeFreeBSD

Import Bruce Schneier's Skein hashing algorithm
ClosedPublic

Authored by allanjude on Apr 30 2016, 9:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 25, 4:44 PM
Unknown Object (File)
Sun, Mar 24, 2:41 PM
Unknown Object (File)
Fri, Mar 22, 7:56 AM
Unknown Object (File)
Wed, Mar 20, 3:01 PM
Unknown Object (File)
Sun, Mar 17, 6:39 AM
Unknown Object (File)
Feb 25 2024, 2:15 AM
Unknown Object (File)
Feb 22 2024, 11:46 PM
Unknown Object (File)
Feb 21 2024, 7:01 PM
Subscribers

Details

Summary

Connects it up to username (libmd, libcrypt, sbin/md5), and the kernel (crypto.ko).
Will be connected to ZFS in a separate commit.

Test Plan

Verified against the test files

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

allanjude retitled this revision from to Import Bruce Schneier's Skein hashing algorithm.
allanjude updated this object.
allanjude edited the test plan for this revision. (Show Details)
allanjude edited edge metadata.

Don't link sbin/md5 against both libmd and libcrypt, this was just a test to make sure it didn't break

My intention was for the copy of skein in sys/crypto to only show the differences from the unmodified import, but it didn't actually work that way.

allanjude edited edge metadata.

Remove some future changes to sbin/md5 that slipped in

Found a small nit in the man page.

lib/libmd/skein.3
94 ↗(On Diff #15781)

Does this single "a" have to be on an line of its own?

I don't think it's useful to drop the skein reference files in both sys/contrib and sys/crypto. Leave them in contrib and add sys/contrib/skein to $PATH in the sys/crypto Makefile.

Does anything in the kernel use Skein? Do you intend to add anything using Skein? Skein didn't win the SHA3 contest and I don't know how much real world use it gets or will get. If we don't need it for anything, I don't think we need to import it.

lib/libmd/Makefile
96–98 ↗(On Diff #15781)

Does this need to be conditional on actually compiling assembly? Does it hurt to always add these to the assembler flags?

lib/libmd/skein.3
3–6 ↗(On Diff #15781)

No he didn't. Correct the copyright header. :)

90–92 ↗(On Diff #15781)

Not true for short inputs or inputs where a dictionary attack is feasible, e.g. 64-bit values, first names, etc. I would just drop that sentence.

93–96 ↗(On Diff #15781)

I would drop this sentence too. It's not quite a magic bullet.

sys/contrib/skein/asm/skein_block_x64.asm
1 ↗(On Diff #15781)

I thought this was supposed to go in machine/ per the Makefiles earlier.

sys/contrib/skein/asm/skein_block_x64.s
1 ↗(On Diff #15781)

Is this identical to skein_block_x64.asm? Why have both?

sys/contrib/skein/asm/skein_block_xmm32.s
1 ↗(On Diff #15781)

Identical to skein_block_xmm32.asm?

sys/crypto/skein/amd64/skein_block_asm.s
1–3 ↗(On Diff #15781)

Another copy of this file?!

sys/crypto/skein/brg_endian.h
2–3 ↗(On Diff #15781)

I really don't think we need a second copy of this file. We have endian defines already from sys/endian.h. For the non-contrib/ directory, IMO simplify to just what is needed for FreeBSD.

sys/crypto/skein/brg_types.h
2–4 ↗(On Diff #15781)

Same comment as for brg_endian.

sys/crypto/skein/skein.h
103–105 ↗(On Diff #15781)

I'd prefer array-style output, e.g.,

int Skein_256_Final(Skein_256_Ctxt_t *, u08b_t[static SKEIN256_DIGEST_LENGTH]);
sys/crypto/skein/skein_freebsd.h
28–30 ↗(On Diff #15781)

Drop space between * and ctx.

32–34 ↗(On Diff #15781)

Use static, drop excess space between * and ctx.

I think the contrib stuff should probably go in the vendor tree instead, and then just have the one copy in sys/crypto

lib/libmd/Makefile
96–98 ↗(On Diff #15781)

I am not sure, I just went with what was already there.

lib/libmd/skein.3
93–96 ↗(On Diff #15781)

Should change these in the md5,sha* pages too then

sys/contrib/skein/asm/skein_block_xmm32.s
1 ↗(On Diff #15781)

different assembly dialect. Probably don't need the unused ones I guess. This was just everything from the directories that made sense in the original distribution package.

sys/crypto/skein/brg_endian.h
2–3 ↗(On Diff #15781)

ok

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

Refactor the skein import via ^/vendor-sys/skein

Much cleaner, and easier to see my local changes

allanjude edited edge metadata.

Fix missing manual pages for skein{256,512,1024}(1)

bump HEX_DIGEST_LENGTH

allanjude edited edge metadata.

Fix a mismerge

There are a bunch of seemingly arbitrary changes to vendor/contrib code in this revision, and I don't know why.

lib/libcrypt/Makefile
43–44 ↗(On Diff #17040)

Is this just a rebase, or are you including this in the Skein commit? I'd keep them separate.

lib/libmd/Makefile
12–16 ↗(On Diff #17040)

same

49–52 ↗(On Diff #17040)

same

lib/libmd/skein.3
93–96 ↗(On Diff #15781)

Yes.

sbin/md5/md5.c
305–306 ↗(On Diff #17040)

Why'd you revert this?

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

Reduce vendor diff

lib/libcrypt/Makefile
43–44 ↗(On Diff #17040)

it is a rebase, the sha512t256 commit went in earlier today, which had some merge conflicts with this patch since it adds to the same makefiles.

sbin/md5/Makefile
22 ↗(On Diff #17040)

mismerge

sbin/md5/md5.c
305–306 ↗(On Diff #17040)

I didn't know if it was a good idea to change the output of all of the hashing commands.
I guess this specific bit, the benchmark, likely isn't depended upon by many scripts.

Do you think it is ok to change it to the more readable format?

sbin/md5/md5.c
305–306 ↗(On Diff #17040)

I don't think anything should depend on it... but now's the time to "break" it anyway, before 11 freezes.

allanjude edited edge metadata.

restore md5(1) improvements

Improve the skein(3) man page

cem added inline comments.
lib/libmd/skein.3
109 ↗(On Diff #17049)

This should be a dash, not a hyphen. Does troff have a good way to format dash? Paging @wblock :).

110 ↗(On Diff #17049)

This one too.

111 ↗(On Diff #17049)

This one is (correctly) a hyphen!

215 ↗(On Diff #17049)

Should have a newline at end of file.

allanjude edited edge metadata.

Switch the skein(3) man page to use em-dashes

allanjude marked 3 inline comments as done.
allanjude added inline comments.
lib/libmd/skein.3
109 ↗(On Diff #17049)

switched to using the proper mandoc em-dash markup

cem edited edge metadata.

Flawless ;-).

This revision is now accepted and ready to land.May 29 2016, 12:54 AM
This revision was automatically updated to reflect the committed changes.
allanjude marked an inline comment as done.