Make rng in TestEnv deterministic and seedable (#461)

* Move three dependent customizations into new file

* default_min_pin_length(_rp_ids) and max_rp_ids_length

* Did some backing store tricks to make the list configurable in
  TestCustomization.

* Add testing for TestCustomization

* Change assert comparison to assert_eq

* Separate tests

* Move 3 pure constants to new file

* Return Vec<String> for rp_ids()

* Make rng in TestEnv deterministic and seedable

* Move seed method to TestRng256

* Change some constant name in comments to snake case

* Move seed rng of env to the start

* Fix unused warning

* Make rng in TestEnv deterministic and seedable

* Move seed method to TestRng256

* Move seed rng of env to the start

* Fix unused warning

* Seed rng in all fuzz targets

* Fix error introduced when merging

Co-authored-by: Julien Cretin <cretin@google.com>
This commit is contained in:
hcyang
2022-04-20 15:49:17 +08:00
committed by GitHub
parent 1e123ab3c3
commit aca1f35170
11 changed files with 71 additions and 20 deletions

View File

@@ -726,10 +726,10 @@ mod test {
use super::*;
use crate::ctap::data_formats::{PublicKeyCredentialSource, PublicKeyCredentialType};
use crate::env::test::TestEnv;
use crypto::rng256::{Rng256, ThreadRng256};
use crypto::rng256::Rng256;
fn create_credential_source(
rng: &mut ThreadRng256,
rng: &mut impl Rng256,
rp_id: &str,
user_handle: Vec<u8>,
) -> PublicKeyCredentialSource {