xaptum / ecdaa

A C implementation of elliptic-curve-based Direct Anonymous Attestation (DAA) signatures. Created to support the Xaptum Edge Network Fabric, an IoT Network Solution.
https://www.xaptum.com
Apache License 2.0
45 stars 8 forks source link

Examine how to take randomness #96

Closed zanebeckwith closed 6 years ago

zanebeckwith commented 6 years ago

Currently, we obtain a random seed from a call to libsodium's randombytes_buf, or allow the user to supply the random seed, then use that to seed a userspace csprng which is then used for all subsequent randomness.

It may be wise to eschew the userspace csprng and just take randomness from some user-specified system source (e.g. getrandom or arc4random or just reading from /dev/urandom).

This is currently a commonly-recommended practice from many crypto experts (eg. DJB on urandom.

Some of the perils of using a userspace csprng include (to my knowledge):

Libsodium's randombytes_buf handles all that for us, but we just use it for seeding. We could just use randombytes_buf, but we also want to support platforms that may not be supported by libsodium.

So, maybe just be totally agnostic to this decision, and allow the user to specify this (and indicate that the common best answer will be, on recent-enough Linux, to use getrandom). That's putting a lot of power in the hands of the user, but may be the best way forward.