tech-crypto archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Patch: cprng_fast performance - please review.

Thor Lancelot Simon <> wrote:
> On Wed, Apr 16, 2014 at 09:52:22PM -0400, Thor Lancelot Simon wrote:
> > 
> > Attached is a patch which makes cprng_fast per-CPU and lockless.  *IT
> > IS NOT WELL TESTED YET (I haven't even run test vectors) AND IS ONLY
> New diff, with some missing files and incorporating some more comments
> from Taylor.
> Thor

Few notes:

- Please do not provide the interface as inline functions in the headers.
They are just not worth.  It is much more beneficial to keep the internals
abstracted within subr_cprng.c and to not expose any structures!

- Are there legitimate users of CPRNG from the interrupts above IPL_VM?
I think there should not be any and cprng_fast() should be under splvm().
In the long term, we could probably use a lockless buffer, but I am fine
with splvm() for now.

- I would still replace division/modulus using sizeof(uint32_t) with
bitwise operations, just to make sure that compiler is not silly.

- Just merge cprng_fast() macro with _cprng_fast_inexact().  Simplify,
since what we really care about it cprng_fast32().


Home | Main Index | Thread Index | Old Index