Skip to content

crypto/random.go: Review MixEntropy #2099

@ValarDragon

Description

@ValarDragon

There are ways to improve our current implementation of crypto.MixEntropy().

  • We should switch the Stream cipher primitive we are using. I'd recommend using Chacha20. Theres less to fear about non-constant time implementations. (Though the golang implementation is constant time I believe) #postlaunch we may even want to consider increasing the number of internal rounds used here.
  • We should use a slower hash function than Sha2 here. (Or use iterated Sha2) The reason is not due to a fear that SHA2 will be broken. Rather its that it provides defense in the case where an attacker-controlled input is being mixed into the entropy pool, and this input can read the other inputs, but can't directly broadcast its readings to the rest of the world. So instead it grinds the hash (or whatever is used for combining) to have leading zeroes or some biasing.
  • We should increase the entropy gathering period for initially seeding the CSPRNG significantly. We're generating peoples private keys out of this, they can wait for the key to take a bit to generate. We can have a seperate method for generating random privkeys for testing.
  • We should add methods for people to easily increase the entropy gathering periods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C:cryptoComponent: CryptoT:securityType: Security (specify priority)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions