diff options
author | Andrew Walbran <qwandor@google.com> | 2023-12-19 11:09:05 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-12-19 11:09:06 +0000 |
commit | 6f09f036e0017ea6ab68c38b3c1f30f31163af2e (patch) | |
tree | 01c86a3a6566ea4773d74003c7510a2346d5f5c3 | |
parent | a38d0cf3d89b40ac856885e135eb7b91fe8b7ff1 (diff) | |
download | const-oid-trusty-main.tar.gz |
Revert^2 "Merge branch 'tmp_auto_upgrade' into trusty-main"trusty-main
a38d0cf3d89b40ac856885e135eb7b91fe8b7ff1
Change-Id: Ia6b88ef67025f0eaa5c5e86520143e9dc33f1fe3
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 15 | ||||
-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-- | cargo2android.json | 23 | ||||
-rw-r--r-- | cargo2android_viz.bp | 1 | ||||
-rw-r--r-- | cargo2rulesmk.json | 3 | ||||
-rw-r--r-- | cargo_embargo.json | 33 | ||||
-rw-r--r-- | patches/rules.mk.diff | 11 | ||||
-rw-r--r-- | rules.mk | 2 | ||||
-rw-r--r-- | src/db.rs | 38 | ||||
-rw-r--r-- | src/db/gen.rs | 60 |
14 files changed, 197 insertions, 46 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 @@ -1,4 +1,4 @@ -// This file is generated by cargo2android.py --config cargo2android.json. +// This file is generated by cargo_embargo. // Do not modify this file as changes will be overridden on upgrade. package { @@ -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"], @@ -63,8 +63,9 @@ rust_library_rlib { product_available: true, vendor_available: true, visibility: [ - "//external/rust/crates/der:__subpackages__", - "//external/rust/crates/x509-cert:__subpackages__", - ] - , + "//external/rust/crates/der:__subpackages__", + "//external/rust/crates/x509-cert:__subpackages__", + "//packages/modules/Virtualization:__subpackages__", + ], + } 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" } } diff --git a/cargo2android.json b/cargo2android.json deleted file mode 100644 index 95cb26f..0000000 --- a/cargo2android.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "apex-available": [ - "//apex_available:platform", - "com.android.virt" - ], - "run": true, - "vendor-available": true, - "features": "db", - "variants": [ - { - }, - { - "device": true, - "alloc": true, - "no-host": true, - "add-module-block": "cargo2android_viz.bp", - "dependency_suffix": "_nostd", - "force-rlib": true, - "suffix": "_nostd", - "no-std": true - } - ] -} diff --git a/cargo2android_viz.bp b/cargo2android_viz.bp index 690c95c..2744b6f 100644 --- a/cargo2android_viz.bp +++ b/cargo2android_viz.bp @@ -1,4 +1,5 @@ visibility: [ "//external/rust/crates/der:__subpackages__", "//external/rust/crates/x509-cert:__subpackages__", + "//packages/modules/Virtualization:__subpackages__", ] diff --git a/cargo2rulesmk.json b/cargo2rulesmk.json index 06f92b1..8a464de 100644 --- a/cargo2rulesmk.json +++ b/cargo2rulesmk.json @@ -1,3 +1,4 @@ { - "features": "db" + "features": "db", + "patch": "patches/rules.mk.diff" } diff --git a/cargo_embargo.json b/cargo_embargo.json new file mode 100644 index 0000000..30a0361 --- /dev/null +++ b/cargo_embargo.json @@ -0,0 +1,33 @@ +{ + "apex_available": [ + "//apex_available:platform", + "com.android.virt" + ], + "features": [ + "db" + ], + "run_cargo": false, + "variants": [ + { + "package": { + "const-oid": { + "device_supported": false + } + } + }, + { + "module_name_overrides": { + "libconst_oid": "libconst_oid_nostd" + }, + "package": { + "const-oid": { + "add_module_block": "cargo2android_viz.bp", + "alloc": true, + "force_rlib": true, + "host_supported": false, + "no_std": true + } + } + } + ] +} diff --git a/patches/rules.mk.diff b/patches/rules.mk.diff new file mode 100644 index 0000000..b58b5b9 --- /dev/null +++ b/patches/rules.mk.diff @@ -0,0 +1,11 @@ +diff --git b/rules.mk a/rules.mk +index 0f6f56e..3443250 100644 +--- b/rules.mk ++++ a/rules.mk +@@ -12,6 +12,5 @@ MODULE_RUSTFLAGS += \ + --cfg 'feature="db"' \ + + MODULE_LIBRARY_DEPS := \ +- external/rust/crates/arbitrary \ + + include make/library.mk @@ -11,4 +11,6 @@ MODULE_RUST_EDITION := 2021 MODULE_RUSTFLAGS += \ --cfg 'feature="db"' \ +MODULE_LIBRARY_DEPS := \ + include make/library.mk @@ -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"), ]); |