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

Encountered test failures when randomizing tests #349

Closed
zugzwang opened this issue Feb 12, 2024 · 1 comment · Fixed by #350
Closed

Encountered test failures when randomizing tests #349

zugzwang opened this issue Feb 12, 2024 · 1 comment · Fixed by #350

Comments

@zugzwang
Copy link
Contributor

The current test RNG is deterministic:

 /// Not cryptographically secure!!! Use for testing only!!!
pub struct TestRandom(XorShiftRng);

and initialized in fn test_rng() as

TestRandom(XorShiftRng::new_unseeded())

Using a different RNG and running tests repeatedly reveals test failures:

    pk::tests::generate_ec_secp256r1
    pk::tests::generate_rsa
    pk::tests::private_from_rsa_components_sanity

(In my experiments, I replaced pub struct TestRandom(XorShiftRng); with pub type TestRandom = CtrDrbg; and initialize with OsEntropy)

@zugzwang
Copy link
Contributor Author

After further inspection, both generate_rsa and generate_ec_secp256r1 test purposedly against the fixed unseeded RNG, so this is normal behavior for these two tests. I suggest we use two test RNGs where one is deterministic and used for these type of tests.

We need investigation for private_from_rsa_components_sanity.

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

Successfully merging a pull request may close this issue.

1 participant