diff options
Diffstat (limited to 'vendor/const-oid')
-rw-r--r-- | vendor/const-oid/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/const-oid/Cargo.toml | 7 | ||||
-rw-r--r-- | vendor/const-oid/src/lib.rs | 26 |
3 files changed, 33 insertions, 2 deletions
diff --git a/vendor/const-oid/.cargo-checksum.json b/vendor/const-oid/.cargo-checksum.json index e74edd340..0434d372b 100644 --- a/vendor/const-oid/.cargo-checksum.json +++ b/vendor/const-oid/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"b9f606f28c74a305a4f3367d130719645dccdef64c56e31f36a2959fa405bbb4","Cargo.toml":"58129346653dd7029e20973aa9c87e4960361fa105247d6b959202d6d28fdd30","LICENSE-APACHE":"a9040321c3712d8fd0b09cf52b17445de04a23a10165049ae187cd39e5c86be5","LICENSE-MIT":"bada9e7ed8dc00d63502053c455d7c8d7575dfb7e8277a2a832531844d900682","README.md":"4a5cdde312d22ca0e6f8c6d4786af313e2a34c06fb572b7ccaef2f1ad19d781d","src/arcs.rs":"997f319f8ff5a3ffc448900993f2bf056c05f1092d48a6a592760bf261468e3d","src/checked.rs":"c3de8e43c638de4766550accb1b73cc7f37765f1779d3e572bfbd908bdb1003f","src/db.rs":"c8312e8688071c262e134f91bb296d34e98389ca1fb1cbc59d144d160a8851ea","src/db/gen.rs":"1746c05380b1162c76594d5b54d754a5bcb6275387358fe031f8701a1d263b12","src/encoder.rs":"cd799ff208a8a7a7a128c422ad3a5535e6ee6b800ad5e7087da55e27e23e84b3","src/error.rs":"0101b991fe689fd2b20c3144e3cfcca3a6628c6892f1ced4c2ba84d6788d72c9","src/lib.rs":"01b7f6165c277656adb6a8740d9da6805367a49d602a53450e30b472edc6a298","src/parser.rs":"9fe5c4114dad22631e63fd1afa832b2c0ed3b4b28f04587dd2148956ced98768","tests/lib.rs":"d7881ad1388e4c907d5392429927d299042dbd5eaaacfd27cef9e1d692fd5aee"},"package":"cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b"}
\ No newline at end of file +{"files":{"CHANGELOG.md":"b9f606f28c74a305a4f3367d130719645dccdef64c56e31f36a2959fa405bbb4","Cargo.toml":"1d0b18b721404ad885aa66bf164ac6a92f487e31fac0d5e8ec8ca4621875773d","LICENSE-APACHE":"a9040321c3712d8fd0b09cf52b17445de04a23a10165049ae187cd39e5c86be5","LICENSE-MIT":"bada9e7ed8dc00d63502053c455d7c8d7575dfb7e8277a2a832531844d900682","README.md":"4a5cdde312d22ca0e6f8c6d4786af313e2a34c06fb572b7ccaef2f1ad19d781d","src/arcs.rs":"997f319f8ff5a3ffc448900993f2bf056c05f1092d48a6a592760bf261468e3d","src/checked.rs":"c3de8e43c638de4766550accb1b73cc7f37765f1779d3e572bfbd908bdb1003f","src/db.rs":"c8312e8688071c262e134f91bb296d34e98389ca1fb1cbc59d144d160a8851ea","src/db/gen.rs":"1746c05380b1162c76594d5b54d754a5bcb6275387358fe031f8701a1d263b12","src/encoder.rs":"cd799ff208a8a7a7a128c422ad3a5535e6ee6b800ad5e7087da55e27e23e84b3","src/error.rs":"0101b991fe689fd2b20c3144e3cfcca3a6628c6892f1ced4c2ba84d6788d72c9","src/lib.rs":"7476a1feb706595867f6e01e16113e167e03420344708c1a0b3a455549c5f82c","src/parser.rs":"9fe5c4114dad22631e63fd1afa832b2c0ed3b4b28f04587dd2148956ced98768","tests/lib.rs":"d7881ad1388e4c907d5392429927d299042dbd5eaaacfd27cef9e1d692fd5aee"},"package":"520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913"}
\ No newline at end of file diff --git a/vendor/const-oid/Cargo.toml b/vendor/const-oid/Cargo.toml index 0080b6fc7..8c4dbfb0b 100644 --- a/vendor/const-oid/Cargo.toml +++ b/vendor/const-oid/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.57" name = "const-oid" -version = "0.9.1" +version = "0.9.2" authors = ["RustCrypto Developers"] description = """ Const-friendly implementation of the ISO/IEC Object Identifier (OID) standard @@ -45,6 +45,11 @@ rustdoc-args = [ "docsrs", ] +[dependencies.arbitrary] +version = "1.2" +features = ["derive"] +optional = true + [dev-dependencies.hex-literal] version = "0.3" diff --git a/vendor/const-oid/src/lib.rs b/vendor/const-oid/src/lib.rs index b00d4e2e7..5bdef085d 100644 --- a/vendor/const-oid/src/lib.rs +++ b/vendor/const-oid/src/lib.rs @@ -252,3 +252,29 @@ impl fmt::Display for ObjectIdentifier { Ok(()) } } + +// Implement by hand because the derive would create invalid values. +// Use the constructor to create a valid oid with at least 3 arcs. +#[cfg(feature = "arbitrary")] +impl<'a> arbitrary::Arbitrary<'a> for ObjectIdentifier { + fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> { + let first = u.int_in_range(0..=arcs::ARC_MAX_FIRST)?; + let second = u.int_in_range(0..=arcs::ARC_MAX_SECOND)?; + let third = u.arbitrary()?; + + let mut oid = Self::from_arcs([first, second, third]) + .map_err(|_| arbitrary::Error::IncorrectFormat)?; + + for arc in u.arbitrary_iter()? { + oid = oid + .push_arc(arc?) + .map_err(|_| arbitrary::Error::IncorrectFormat)?; + } + + Ok(oid) + } + + fn size_hint(depth: usize) -> (usize, Option<usize>) { + (Arc::size_hint(depth).0.saturating_mul(3), None) + } +} |