Page MenuHomeFreeBSD

convert random to ChaCha and use PCPU structures
AbandonedPublic

Authored by jmg on Mar 5 2015, 6:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 5 2024, 3:38 PM
Unknown Object (File)
Oct 5 2024, 8:50 AM
Unknown Object (File)
Oct 2 2024, 7:17 PM
Unknown Object (File)
Oct 2 2024, 5:00 PM
Unknown Object (File)
Oct 2 2024, 8:12 AM
Unknown Object (File)
Oct 1 2024, 10:14 PM
Unknown Object (File)
Sep 30 2024, 8:11 AM
Unknown Object (File)
Sep 8 2024, 12:12 PM
Subscribers

Details

Reviewers
markm
jhb
delphij
Summary

I couldn't use arc to generate this patch, when I did arc diff <list of files to include> it would say:
Usage Exception: There are no changes to generate a diff from!

This is a sample of usage of PCPU by random instead of the current mtx
lock...

NB: This is ONLY for commenting on what things may look like.
This patch is not ready to even remotely go into the tree. I want to get
D1956 into the tree first, though if people would prefer the reverse
order, I could do that... This patch conflicts w/ D1956.

Depends on D1956

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

jmg retitled this revision from to convert random to ChaCha and use PCPU structures.
jmg updated this object.
jmg edited the test plan for this revision. (Show Details)
jmg added reviewers: markm, jhb, delphij.
jmg set the repository for this revision to rS FreeBSD src repository - subversion.
jmg added a parent revision: D1956: Unify kernel randomness API.
jmg added subscribers: kib, op, emaste.

Is the code at https://github.com/bitwiseshiftleft/crandom freely redistributable? I didn't find a license there, but it's okay if there is a license allows us to do it.

(I think it's probably a good idea to move cpu_random() and friends to the MD code and create a MI interface for them, as some other platforms may offer similar features in the future).

In D2012#6, @delphij wrote:

Is the code at https://github.com/bitwiseshiftleft/crandom freely redistributable? I didn't find a license there, but it's okay if there is a license allows us to do it.

(I think it's probably a good idea to move cpu_random() and friends to the MD code and create a MI interface for them, as some other platforms may offer similar features in the future).

Mike imported the code into:
http://sourceforge.net/p/ed448goldilocks/code/ci/master/tree/src/crandom.c

I talked w/ Mike, and I'll use the MIT License copyright that applies via ed448goldilocks. I'm not really sure where I got the code from, either ed448goldilocks or crandom, but MIT license seems fine.. I've also modified it, and may or may not be used as I'm also working on an internal library to provide cpu_feature* to userland, and currently for the kernel, none of the accelerations for chacha are enabled.

In D2012#7, @jmg wrote:

Mike imported the code into:
http://sourceforge.net/p/ed448goldilocks/code/ci/master/tree/src/crandom.c

I talked w/ Mike, and I'll use the MIT License copyright that applies via ed448goldilocks. I'm not really sure where I got the code from, either ed448goldilocks or crandom, but MIT license seems fine.. I've also modified it, and may or may not be used as I'm also working on an internal library to provide cpu_feature* to userland, and currently for the kernel, none of the accelerations for chacha are enabled.

I see, as long as your code is derived from MIT licensed code and the author have agreed to use MIT license for that piece of code, we should be good to go.

(The original reference implementation from D. J. Bernstein is explicitly placed in the public domain, at http://cr.yp.to/chacha.html. IANL but I think it's Okay if someone derived the code and then license under a MIT license assuming all changes are his/her original work).

First pass review.

crypto/chacha.c
1

Please put an appropriate license or license disclaimer here.

crypto/chacha_private.h
1

OK.

crypto/intrinsics.c
1

Please put an appropriate license or license disclaimer here.

crypto/intrinsics.h
4

Please put an appropriate license or license disclaimer here.

crypto/rnd.h
1

Please put an appropriate license or license disclaimer here.

crypto/rnd_chacha.c
1

Please put an appropriate license or license disclaimer here.

crypto/rnd_core.c
1

Please put an appropriate license or license disclaimer here.

dev/random/random_adaptors.c
369

(Sort of) good riddance! As long as there is some crud making it through to the cryptographic bits of random(9).

libkern/arc4random.c
1

This file no longer has anything to do with RC4 or arcfour. Please rename.

crypto/intrinsics.c
78

This needs a lot more fleshing out. Too many failing ifs, and this returns nothing of value.

Note: No comments will be addressed till it is decided the correct path forward. If others would like a single final patch, make the decision, but I won't break it up again after doing the work to make a single patch.

As D1956 says, no point in working on this.