Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

classify RNG "randomness" in code #5659

Open
kaspar030 opened this issue Jul 19, 2016 · 3 comments
Open

classify RNG "randomness" in code #5659

kaspar030 opened this issue Jul 19, 2016 · 3 comments
Assignees
Labels
Area: security Area: Security-related libraries and subsystems Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR
Projects

Comments

@kaspar030
Copy link
Contributor

In order to make discussion about RNG initialization etc. more effective, I've tried to classify the requirements to our random number generators for different applications:

  1. just spit out some numbers
    Simple. Even rand() does that. It's always the same sequence, but ok for some applications. This is the current state of affairs.
    Enough for (boring) Tetris.
    Insufficient for networking (breaks random backoff, ...).
  2. per-node different sequence
    This would need seeding of PRNGs with something more or less unique per node. CPUID would mybe do. See sys/auto_init: cpuid as seed for random_init #5321.
    Solves the "random backoff" problem.
    Totally insufficient for any kind of cryptography.
  3. secret per-node different sequence
    Depending on the seeding of a prng, this would make it possible to create initial secret crypto keys (I think.).
    For this the CPUID needs to be sufficiently large, and the PRNG needs support for large seed values.
    (An uint32_t seed value would only lead to 2**32 different seed values, making it unusable again)
    CPUID may or may not be secret (e.g., only known to the person who flashed the node), as it might be derived from a serial number or MAC address.

So on the seeding, used PRNG and crypto algorithms, this might be a (suboptimal) baseline for cryptography.

Solves the "create initial crypto key" problem.

  1. properly seeded PRNG with injected entropy
    Random events are used to somehow inject entropy into the PRNG output.
    While there are many ways to implement this, if done well is probably as good as it gets without a HWRNG.

Solves the "barely enough for crypto" and "make tetris less boring" problems.

  1. HWRNG enhanced PRNG
    HWRNG's promise "truly random numbers", but are often slow. So usually they're just used to improve randomness of PRNGs.

Solves the "hopefully good enough for crypto" problem.

  1. high-quality HWRNG
    whatever that means.
@kaspar030 kaspar030 added the Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR label Jul 19, 2016
@kaspar030
Copy link
Contributor Author

IMHO we should make this classification available for code, so e.g., crypto code can at least spit out a warning when used with no or a bad random source.

@OlegHahm
Copy link
Member

I just realized: it's probably not such a good sign, that we don't even have a label "security" in the issue tracker. ;)

@jia200x
Copy link
Member

jia200x commented Jul 22, 2016

Some radio drivers (e.g at86rf2xx) provide a "true" RNG based on transceiver events. Should be fast enough for most applications :)

@kaspar030 kaspar030 added the Area: security Area: Security-related libraries and subsystems label Oct 27, 2017
@kYc0o kYc0o mentioned this issue Oct 29, 2017
9 tasks
@kYc0o kYc0o added this to To Do - Issues in Security Oct 30, 2017
@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 22, 2021
@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: security Area: Security-related libraries and subsystems Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR
Projects
Security
  
To Do - Issues
Development

No branches or pull requests

5 participants