Snap for 9699536 from e4b817d20d3a7e0053d8b04b10c3837b6456ac7b to udc-d1-release
Change-Id: I94d0d4a754ca890c7c47adcf5e8190d3c007b6b3
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 80de78a..9b0b48f 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
{
"git": {
- "sha1": "252671f5828a6df3c1a31222519cd278c8704e4b"
+ "sha1": "6489ca88e5d26fd2f754679ed5d511b817eb20d1"
},
"path_in_vcs": "const-oid"
}
\ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 334199c..1127b58 100644
--- a/Android.bp
+++ b/Android.bp
@@ -35,13 +35,9 @@
name: "libconst_oid",
crate_name: "const_oid",
cargo_env_compat: true,
- cargo_pkg_version: "0.9.1",
+ cargo_pkg_version: "0.9.2",
srcs: ["src/lib.rs"],
edition: "2021",
features: ["db"],
- apex_available: [
- "//apex_available:platform",
- "com.android.virt",
- ],
vendor_available: true,
}
diff --git a/Cargo.toml b/Cargo.toml
index 0080b6f..8c4dbfb 100644
--- a/Cargo.toml
+++ b/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 @@
"docsrs",
]
+[dependencies.arbitrary]
+version = "1.2"
+features = ["derive"]
+optional = true
+
[dev-dependencies.hex-literal]
version = "0.3"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index ffc05e6..93f81dd 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "const-oid"
-version = "0.9.1"
+version = "0.9.2"
authors = ["RustCrypto Developers"]
license = "Apache-2.0 OR MIT"
description = """
@@ -16,6 +16,9 @@
edition = "2021"
rust-version = "1.57"
+[dependencies]
+arbitrary = { version = "1.2", optional = true, features = ["derive"] }
+
[dev-dependencies]
hex-literal = "0.3"
diff --git a/METADATA b/METADATA
index c994f5c..9223647 100644
--- a/METADATA
+++ b/METADATA
@@ -11,13 +11,13 @@
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/const-oid/const-oid-0.9.1.crate"
+ value: "https://static.crates.io/crates/const-oid/const-oid-0.9.2.crate"
}
- version: "0.9.1"
+ version: "0.9.2"
license_type: NOTICE
last_upgrade_date {
- year: 2022
- month: 12
- day: 8
+ year: 2023
+ month: 3
+ day: 6
}
}
diff --git a/src/lib.rs b/src/lib.rs
index d847065..9e360f4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -256,3 +256,29 @@
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)
+ }
+}