1

I read that cryprographic secure PRNG (CSPRNG) need a random seed to provide random output. Looking at OpenSSL that seems to be archived by RAND_poll() and random data is fetched with RAND_bytes(buf, length).

But I'm quite not sure if I get everything right that is stated in the documentation here. I know that RAND_bytes will call RAND_poll() itself if it was not called before at least once.

I also read (somewhere else) that a seed should not be reused for a CSPRNG. Now my question is: Does RAND_bytes reuse any seed? Do I have to manually reseed OpenSSL for distinct RAND_bytes calls by using RAND_bytes(buf, length) again and again if i do not want reuse the seed?

Or does RAND_bytes manage this by itself?

0

Does RAND_bytes reuse any seed?

Kindof.
Re-using a seed is bad, because it will give you the exact same random numbers again. OpenSSL doesn't do this. However, you're allowed to use the one seed obtained by the first RAND_poll as long as you want (which is not advisable) as the PRNG will generate a steady stream of (unpredictable) bytes based on this one seed and you will just be served "later" parts in the stream if you don't reseed.

You should re-seed the PRNG as often as possible if you have entropy rich data, but it will also work (quite securely) if you don't do this.

Final answer: RAND_bytes (kindof) manages this itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.