RAND_add just treats those structs as bunches of bytes (count = sizeof(struct)) and meanwhile 'guestimates' that the entropy ~ unpredictability of said content is about 1 byte per field. The latter is a guestimate, nothing more. And it's probably an optimisitc guestimate at that too, but that's in the eye of the beholder. Bottom line is that RAND_add tries to add the randomness from your communications sequences (think public webserver: you can't predict who's going to visit first, second, etc. once the server inits and comes on line) to the random pool.
Again, it does not treat those structs as structs, but merely as bunches of more-or-less semi-random data. The amount of actual entropy in there depends a lot on context (public or private machine, i.e. how much control do you have over the clients connecting to it and the time, etc. the connect and what they [wish to] communicate with you, the server, etc.etc.) but it can be argued that there's always a bit of unpredictability in there, which translates to a bit (or more) of entropy being available in that data. In the whole story, field padding, etc. doesn't feature. ;-) On Wed, Jun 30, 2010 at 4:11 PM, Brian Makin <[email protected]> wrote: > Could someone explain this to me? > > In various places RAND_add is called with sizeof a struct and the number > of fields. Each of the fields is used to gather a byte of entropy. I > don't understand how this works seeing that, due to field padding, we > can't quite tell where the fields begin. > > Is this a bug or do I just not understand that bit of code? > > -- > BRIAN MAKIN > Senior Software Engineer > [email protected] > > Vivisimo [Search Done Rightâ„¢] > 1710 Murray Avenue > Pittsburgh, PA 15217 USA > tel: +1.412.422.2499 > vivisimo.com > > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List [email protected] > Automated List Manager [email protected] > -- Met vriendelijke groeten / Best regards, Ger Hobbelt -------------------------------------------------- web: http://www.hobbelt.com/ http://www.hebbut.net/ mail: [email protected] mobile: +31-6-11 120 978 --------------------------------------------------
