[openssl-users] RAND_bytes() Properly Reseeding
rschm2 at unh.newhaven.edu
Sun Oct 2 16:21:04 UTC 2016
I’m a little unsure on the recommended way to properly reseed the RAND_bytes() function. My output provides random numbers, but only the first 16 bytes. The output of byte 16 and on is just some period of the first 16 bytes and therefore has several duplicated numbers.
My inputs are four seeds, each 128 bits in size. A SEED_SIZE with a value of 16 (where I believe the periodicity to be coming from).
Then an output buffer of 256 bits containing the random bytes as well as the RAND_SIZE with a value of 64.
1: RAND_seed(s->seed1, SEED_SIZE);
2: RAND_bytes(buffer1, RAND_SIZE);
3: RAND_seed(s->seed2, SEED_SIZE);
4: RAND_bytes(buffer2, RAND_SIZE);
5: RAND_seed(s->seed3, SEED_SIZE);
6: RAND_bytes(buffer3, RAND_SIZE);
7: RAND_seed(s->seed4, SEED_SIZE);
8: RAND_bytes(buffer4, RAND_SIZE);
Any reason why four very different seeds are providing the same random numbers, but just in different orders?
Thank you for the read and any help,
More information about the openssl-users