Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix randomization #19

Closed
robgjansen opened this issue Aug 17, 2011 · 1 comment
Closed

Fix randomization #19

robgjansen opened this issue Aug 17, 2011 · 1 comment
Milestone

Comments

@robgjansen
Copy link
Member

The simulator should produce the EXACT same results when run multiple times with the same seed. This currently is broken. Go through and make sure that we only seed the rng once, and that multiple runs produces identical output.

We may need to intercept some functions from the plug-ins to make sure the application randomness goes through our simulator. This will be required for scallion.

@robgjansen
Copy link
Member Author

It seems that tor seeds the OpenSSL random generator by first trying RAND_poll (since it knows about possible other sources of entropy), then by seeding the prng with RAND_seed by reading from /dev/srandom, /dev/urandom, and /dev/random in that order.

see crypto_seed_rng() in tor/src/common/crypto.c

Notes:
OpenSSL randomness:
RAND_seed(), RAND_add(), RAND_poll()

Other:
rand(), srand(), reading from /dev/srandom, /dev/random or /dev/urandom

robgjansen added a commit that referenced this issue Dec 15, 2011
New random class that keeps state for each worker thread and draws from
that state for randomness. Added a config option to set the seed for
each worker. Hopefully this will mean experiments can be varied by
changing the seed, but repeatable by using the same seed.

Leaving ticket open because I still have to test with a complex plugin
like scallion.

refs #19
robgjansen added a commit that referenced this issue Jan 5, 2012
These functions also affect randomness in programs.

refs #19
qincunrong pushed a commit to qincunrong/shadow that referenced this issue Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant