Search code examples
c++cryptographycrypto++

Is the AutoSeededRandomPool in crypto++ actually random? What does fork() in the documentation mean?


I was reading the documentation of AutoSeededRandomPool in crypto++ and I came across the detailed description as follow.
You should reseed the generator after a fork() to avoid multiple generators with the same internal state.
Does this mean AutoSeededRandomPool is actually not random? And also when is fork() called? I can't find it anywhere in the documentation. And when do I need to reseed avoiding the same internal state? Here is the link of the documentation: https://cryptopp.com/docs/ref/class_auto_seeded_random_pool.html


Solution

  • There is a posix API called fork() which is used for creating internal child process. The forked process is sometimes used in exchange of thread. When you use fork(), a lot of internal memory of process is copied. That's why they say that you need to call reseed. Because if you don't, this copied internal memory creates a similar seed for both main and child process, so generated randoms will be similar.

    About complete randomness, I really don't know. Because I don't know what are sources for seeding in this class. If you want a real random, you need some hardware source to create real random. It is really based on your usage. In some cases, like random numbers for RSA, you need an almost real random, but in a lot of cases, a pseudorandom will be enough.