diff options
author | Andrew Walbran <qwandor@google.com> | 2023-12-19 15:13:41 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-12-19 15:13:41 +0000 |
commit | 07e5f0d0bbee8b7bae7233c8838bec8b4bdd57fb (patch) | |
tree | 01c86a3a6566ea4773d74003c7510a2346d5f5c3 | |
parent | 75de5eaf32d60a8ab02dd37080526fe67d6b2cab (diff) | |
parent | 9d7302fc5d058e890df172c44564ad6f9168e290 (diff) | |
download | const-oid-07e5f0d0bbee8b7bae7233c8838bec8b4bdd57fb.tar.gz |
Revert^2 "Upgrade const-oid to 0.9.6" am: 9b34283323 am: 9d7302fc5d
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/const-oid/+/2881159
Change-Id: Ibaf2b74252709c5c4f8b81aa901c8dae5007e2bb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 4 | ||||
-rw-r--r-- | CHANGELOG.md | 30 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | Cargo.toml.orig | 2 | ||||
-rw-r--r-- | METADATA | 21 | ||||
-rw-r--r-- | src/db.rs | 38 | ||||
-rw-r--r-- | src/db/gen.rs | 60 |
8 files changed, 142 insertions, 17 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 9b0b48f..a460abc 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,6 @@ { "git": { - "sha1": "6489ca88e5d26fd2f754679ed5d511b817eb20d1" + "sha1": "4432bcc0b2b721865740517e609e166e01726ccc" }, "path_in_vcs": "const-oid" }
\ No newline at end of file @@ -35,7 +35,7 @@ rust_library_host { name: "libconst_oid", crate_name: "const_oid", cargo_env_compat: true, - cargo_pkg_version: "0.9.2", + cargo_pkg_version: "0.9.6", srcs: ["src/lib.rs"], edition: "2021", features: ["db"], @@ -45,7 +45,7 @@ rust_library_rlib { name: "libconst_oid_nostd", crate_name: "const_oid", cargo_env_compat: true, - cargo_pkg_version: "0.9.2", + cargo_pkg_version: "0.9.6", srcs: ["src/lib.rs"], edition: "2021", features: ["db"], diff --git a/CHANGELOG.md b/CHANGELOG.md index f6ea7d3..f47c0c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,36 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.9.6 (2023-12-14) +### Added +- RFC 6962 OID ([#1282]) + +[#1282]: https://github.com/RustCrypto/formats/pull/1282 + +## 0.9.5 (2023-08-02) +### Added +- rfc8410 (curve25519) OIDS. ([#867]) + +[#867]: https://github.com/RustCrypto/formats/pull/867 + +## 0.9.4 (2023-07-10) +### Added +- rfc8894 (SCEP) OIDs. ([#1114]) + +[#1114]: https://github.com/RustCrypto/formats/pull/1114 + +## 0.9.3 (2023-06-29) +### Added +- `Database::find_names_for_oid` ([#1129]) + +[#1129]: https://github.com/RustCrypto/formats/pull/1129 + +## 0.9.2 (2023-02-26) +### Added +- Implement `Arbitrary` trait ([#761]) + +[#761]: https://github.com/RustCrypto/formats/pull/761 + ## 0.9.1 (2022-11-12) ### Added - clippy lints for checked arithmetic and panics ([#561]) @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.57" name = "const-oid" -version = "0.9.2" +version = "0.9.6" authors = ["RustCrypto Developers"] description = """ Const-friendly implementation of the ISO/IEC Object Identifier (OID) standard diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 93f81dd..368373d 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "const-oid" -version = "0.9.2" +version = "0.9.6" authors = ["RustCrypto Developers"] license = "Apache-2.0 OR MIT" description = """ @@ -1,23 +1,20 @@ # This project was upgraded with external_updater. # Usage: tools/external_updater/updater.sh update rust/crates/const-oid -# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md +# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md name: "const-oid" description: "Const-friendly implementation of the ISO/IEC Object Identifier (OID) standard as defined in ITU X.660, with support for BER/DER encoding/decoding as well as heapless no_std (i.e. embedded) support" third_party { - url { - type: HOMEPAGE - value: "https://crates.io/crates/const-oid" - } - url { - type: ARCHIVE - value: "https://static.crates.io/crates/const-oid/const-oid-0.9.2.crate" - } - version: "0.9.2" license_type: NOTICE last_upgrade_date { year: 2023 - month: 3 - day: 6 + month: 12 + day: 15 + } + homepage: "https://crates.io/crates/const-oid" + identifier { + type: "Archive" + value: "https://static.crates.io/crates/const-oid/const-oid-0.9.6.crate" + version: "0.9.6" } } @@ -54,6 +54,7 @@ const fn eq_case(lhs: &[u8], rhs: &[u8]) -> bool { } /// A query interface for OIDs/Names. +#[derive(Copy, Clone)] pub struct Database<'a>(&'a [(&'a ObjectIdentifier, &'a str)]); impl<'a> Database<'a> { @@ -99,6 +100,43 @@ impl<'a> Database<'a> { None } + + /// Return the list of matched name for the OID. + pub const fn find_names_for_oid(&self, oid: ObjectIdentifier) -> Names<'a> { + Names { + database: *self, + oid, + position: 0, + } + } +} + +/// Iterator returning the multiple names that may be associated with an OID. +pub struct Names<'a> { + database: Database<'a>, + oid: ObjectIdentifier, + position: usize, +} + +impl<'a> Iterator for Names<'a> { + type Item = &'a str; + + fn next(&mut self) -> Option<&'a str> { + let mut i = self.position; + + while i < self.database.0.len() { + let lhs = self.database.0[i].0; + + if lhs.as_bytes().eq(self.oid.as_bytes()) { + self.position = i + 1; + return Some(self.database.0[i].1); + } + + i += 1; + } + + None + } } #[cfg(test)] diff --git a/src/db/gen.rs b/src/db/gen.rs index 74945a4..9c603d8 100644 --- a/src/db/gen.rs +++ b/src/db/gen.rs @@ -2044,6 +2044,16 @@ pub mod rfc6960 { pub const ID_PKIX_OCSP_EXTENDED_REVOKE: crate::ObjectIdentifier = crate::ObjectIdentifier::new_unwrap("1.3.6.1.5.5.7.48.1.9"); } +pub mod rfc6962 { + pub const GOOGLE: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("1.3.6.1.4.1.11129"); + pub const CT_PRECERT_SCTS: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("1.3.6.1.4.1.11129.2.4.2"); + pub const CT_PRECERT_POISON: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("1.3.6.1.4.1.11129.2.4.3"); + pub const CT_PRECERT_SIGNING_CERT: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("1.3.6.1.4.1.11129.2.4.4"); +} pub mod rfc7107 { pub const ID_SMIME: crate::ObjectIdentifier = crate::ObjectIdentifier::new_unwrap("1.2.840.113549.1.9.16"); @@ -2245,6 +2255,38 @@ pub mod rfc8284 { crate::ObjectIdentifier::new_unwrap("1.3.6.1.1.23.1"); pub const JID: crate::ObjectIdentifier = crate::ObjectIdentifier::new_unwrap("1.3.6.1.1.23.2"); } +pub mod rfc8410 { + pub const ID_EDWARDS_CURVE_ALGS: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("1.3.101"); + pub const ID_X_25519: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("1.3.101.110"); + pub const ID_X_448: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("1.3.101.111"); + pub const ID_ED_25519: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("1.3.101.112"); + pub const ID_ED_448: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("1.3.101.113"); +} +pub mod rfc8894 { + pub const ID_VERI_SIGN: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("2.16.840.1.113733"); + pub const ID_PKI: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("2.16.840.1.113733.1"); + pub const ID_ATTRIBUTES: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("2.16.840.1.113733.1.9"); + pub const ID_MESSAGE_TYPE: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("2.16.840.1.113733.1.9.2"); + pub const ID_PKI_STATUS: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("2.16.840.1.113733.1.9.3"); + pub const ID_FAIL_INFO: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("2.16.840.1.113733.1.9.4"); + pub const ID_SENDER_NONCE: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("2.16.840.1.113733.1.9.5"); + pub const ID_RECIPIENT_NONCE: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("2.16.840.1.113733.1.9.6"); + pub const ID_TRANSACTION_ID: crate::ObjectIdentifier = + crate::ObjectIdentifier::new_unwrap("2.16.840.1.113733.1.9.7"); +} pub const DB: super::Database<'static> = super::Database(&[ (&rfc1274::TEXT_ENCODED_OR_ADDRESS, "textEncodedORAddress"), (&rfc1274::OTHER_MAILBOX, "otherMailbox"), @@ -4077,6 +4119,10 @@ pub const DB: super::Database<'static> = super::Database(&[ &rfc6960::ID_PKIX_OCSP_EXTENDED_REVOKE, "id-pkix-ocsp-extended-revoke", ), + (&rfc6962::GOOGLE, "google"), + (&rfc6962::CT_PRECERT_SCTS, "ct-precert-scts"), + (&rfc6962::CT_PRECERT_POISON, "ct-precert-poison"), + (&rfc6962::CT_PRECERT_SIGNING_CERT, "ct-precert-signing-cert"), (&rfc7107::ID_SMIME, "id-smime"), (&rfc7107::ID_MOD, "id-mod"), (&rfc7107::ID_CT, "id-ct"), @@ -4185,4 +4231,18 @@ pub const DB: super::Database<'static> = super::Database(&[ ), (&rfc8284::JID_OBJECT, "JIDObject"), (&rfc8284::JID, "jid"), + (&rfc8410::ID_EDWARDS_CURVE_ALGS, "id-edwards-curve-algs"), + (&rfc8410::ID_X_25519, "id-X25519"), + (&rfc8410::ID_X_448, "id-X448"), + (&rfc8410::ID_ED_25519, "id-Ed25519"), + (&rfc8410::ID_ED_448, "id-Ed448"), + (&rfc8894::ID_VERI_SIGN, "id-VeriSign"), + (&rfc8894::ID_PKI, "id-pki"), + (&rfc8894::ID_ATTRIBUTES, "id-attributes"), + (&rfc8894::ID_MESSAGE_TYPE, "id-messageType"), + (&rfc8894::ID_PKI_STATUS, "id-pkiStatus"), + (&rfc8894::ID_FAIL_INFO, "id-failInfo"), + (&rfc8894::ID_SENDER_NONCE, "id-senderNonce"), + (&rfc8894::ID_RECIPIENT_NONCE, "id-recipientNonce"), + (&rfc8894::ID_TRANSACTION_ID, "id-transactionID"), ]); |