From d1bec2a8ed2608ebba41a46907dbb7315c14cbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Sat, 7 Feb 2026 00:25:14 +0300 Subject: [PATCH 1/2] Remove `opaque-debug` crate --- .github/workflows/opaque-debug.yml | 60 --------- .github/workflows/publish.yml | 1 - README.md | 2 - opaque-debug/CHANGELOG.md | 19 --- opaque-debug/Cargo.toml | 14 -- opaque-debug/LICENSE-APACHE | 201 ----------------------------- opaque-debug/LICENSE-MIT | 25 ---- opaque-debug/README.md | 40 ------ opaque-debug/src/lib.rs | 81 ------------ opaque-debug/tests/mod.rs | 57 -------- 10 files changed, 500 deletions(-) delete mode 100644 .github/workflows/opaque-debug.yml delete mode 100644 opaque-debug/CHANGELOG.md delete mode 100644 opaque-debug/Cargo.toml delete mode 100644 opaque-debug/LICENSE-APACHE delete mode 100644 opaque-debug/LICENSE-MIT delete mode 100644 opaque-debug/README.md delete mode 100644 opaque-debug/src/lib.rs delete mode 100644 opaque-debug/tests/mod.rs diff --git a/.github/workflows/opaque-debug.yml b/.github/workflows/opaque-debug.yml deleted file mode 100644 index f5f2ac97..00000000 --- a/.github/workflows/opaque-debug.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: opaque-debug - -on: - pull_request: - paths: - - "opaque-debug/**" - - "Cargo.*" - push: - branches: master - -permissions: - contents: read - -defaults: - run: - working-directory: opaque-debug - -env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-Dwarnings" - -# Cancels CI jobs when new commits are pushed to a PR branch -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - 1.85.0 # MSRV - - stable - target: - - thumbv7em-none-eabi - - wasm32-unknown-unknown - steps: - - uses: actions/checkout@v6 - - uses: RustCrypto/actions/cargo-cache@master - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ matrix.rust }} - targets: ${{ matrix.target }} - - run: cargo build --target ${{ matrix.target }} - - test: - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - 1.85.0 # MSRV - - stable - steps: - - uses: actions/checkout@v6 - - uses: RustCrypto/actions/cargo-cache@master - - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ matrix.rust }} - - run: cargo test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c6f76c87..a90f7a62 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,6 @@ on: 'digest-io-v*', 'hex-literal-v*', 'inout-v*', - 'opaque-debug-v*', 'zeroize-v*' ] diff --git a/README.md b/README.md index dbbd0fc4..e65a84d6 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ This repository contains various utility crates used in the RustCrypto project. | [`digest-io`] | [![crates.io](https://img.shields.io/crates/v/digest-io.svg)](https://crates.io/crates/digest-io) | [![Documentation](https://docs.rs/digest-io/badge.svg)](https://docs.rs/digest-io) | `std::io`-compatibility wrappers for traits defined in the `digest` crate | | [`hex-literal`] | [![crates.io](https://img.shields.io/crates/v/hex-literal.svg)](https://crates.io/crates/hex-literal) | [![Documentation](https://docs.rs/hex-literal/badge.svg)](https://docs.rs/hex-literal) | A macro for converting hexadecimal strings to a byte array at compile time | | [`inout`] | [![crates.io](https://img.shields.io/crates/v/inout.svg)](https://crates.io/crates/inout) | [![Documentation](https://docs.rs/inout/badge.svg)](https://docs.rs/inout) | Custom reference types for code generic over in-place and buffer-to-buffer modes of operation. | -| [`opaque-debug`] | [![crates.io](https://img.shields.io/crates/v/opaque-debug.svg)](https://crates.io/crates/opaque-debug) | [![Documentation](https://docs.rs/opaque-debug/badge.svg)](https://docs.rs/opaque-debug) | Macro for opaque `Debug` trait implementation | | [`wycheproof2blb`] | | | | Utility for converting [Wycheproof] test vectors to the blobby format | | [`zeroize`] | [![crates.io](https://img.shields.io/crates/v/zeroize.svg)](https://crates.io/crates/zeroize) | [![Documentation](https://docs.rs/zeroize/badge.svg)](https://docs.rs/zeroize) | Securely zero memory while avoiding compiler optimizations | @@ -63,7 +62,6 @@ Unless you explicitly state otherwise, any contribution intentionally submitted [`digest-io`]: ./digest-io [`hex-literal`]: ./hex-literal [`inout`]: ./inout -[`opaque-debug`]: ./opaque-debug [`wycheproof2blb`]: ./wycheproof2blb [`zeroize`]: ./zeroize diff --git a/opaque-debug/CHANGELOG.md b/opaque-debug/CHANGELOG.md deleted file mode 100644 index 905a4a66..00000000 --- a/opaque-debug/CHANGELOG.md +++ /dev/null @@ -1,19 +0,0 @@ -# Changelog -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.4.0 (unreleased) -### Changed -- Edition changed to 2024 and MSRV bumped to 1.85 ([#1149]) - -[#1149]: https://github.com/RustCrypto/utils/pull/1149 - -## 0.3.1 (2024-03-01) -### Added -- Support for generic parameters ([#1053]) - -[#1053]: https://github.com/RustCrypto/utils/pull/1053 - -## 0.3.0 (2020-06-11) diff --git a/opaque-debug/Cargo.toml b/opaque-debug/Cargo.toml deleted file mode 100644 index a4f15622..00000000 --- a/opaque-debug/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "opaque-debug" -version = "0.4.0-pre" -authors = ["RustCrypto Developers"] -edition = "2024" -rust-version = "1.85" -documentation = "https://docs.rs/opaque-debug" -readme = "README.md" -repository = "https://github.com/RustCrypto/utils" -license = "MIT OR Apache-2.0" -description = "Macro for opaque Debug trait implementation" - -[lints] -workspace = true diff --git a/opaque-debug/LICENSE-APACHE b/opaque-debug/LICENSE-APACHE deleted file mode 100644 index 78173fa2..00000000 --- a/opaque-debug/LICENSE-APACHE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/opaque-debug/LICENSE-MIT b/opaque-debug/LICENSE-MIT deleted file mode 100644 index ecb2ee5c..00000000 --- a/opaque-debug/LICENSE-MIT +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2018-2025 The RustCrypto Project Developers - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/opaque-debug/README.md b/opaque-debug/README.md deleted file mode 100644 index 6bfcfb91..00000000 --- a/opaque-debug/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# [RustCrypto]: Opaque Debug - -[![crate][crate-image]][crate-link] -[![Docs][docs-image]][docs-link] -[![Build Status][build-image]][build-link] -![Apache2/MIT licensed][license-image] -![Rust Version][rustc-image] -[![Project Chat][chat-image]][chat-link] - -Macro for opaque Debug trait implementation. - -## License - -Licensed under either of: - - * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) - * [MIT license](http://opensource.org/licenses/MIT) - -at your option. - -### Contribution - -Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. - -[//]: # (badges) - -[crate-image]: https://img.shields.io/crates/v/opaque-debug.svg -[crate-link]: https://crates.io/crates/opaque-debug -[docs-image]: https://docs.rs/opaque-debug/badge.svg -[docs-link]: https://docs.rs/opaque-debug/ -[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg -[rustc-image]: https://img.shields.io/badge/rustc-1.85+-blue.svg -[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg -[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260052-utils -[build-image]: https://github.com/RustCrypto/utils/actions/workflows/opaque-debug.yml/badge.svg?branch=master -[build-link]: https://github.com/RustCrypto/utils/actions/workflows/opaque-debug.yml?query=branch:master - -[//]: # (general links) - -[RustCrypto]: https://github.com/rustcrypto diff --git a/opaque-debug/src/lib.rs b/opaque-debug/src/lib.rs deleted file mode 100644 index e1a697d8..00000000 --- a/opaque-debug/src/lib.rs +++ /dev/null @@ -1,81 +0,0 @@ -//! Macro for opaque [`Debug`] trait implementation. -//! -//! In many cases it's convenient to have `Debug` implementation for all crate types, -//! e.g. to allow deriving of `Debug` in user-defined structs. But at the same time, using -//! the default derive macro can be a security hazard since it cause leaking of sensitive -//! information, for example, through uncareful logging. -//! -//! This crate introduces the [`implement!`] macro which creates an opaque [`Debug`] -//! implementation, which does not expose any internal type data. -//! -//! # Examples -//! ``` -//! pub struct CryptoStuff { -//! key: [u8; 16], -//! } -//! -//! opaque_debug::implement!(CryptoStuff); -//! -//! let val = CryptoStuff { key: [42; 16] }; -//! assert_eq!(format!("{:?}", val), "CryptoStuff { ... }") -//! ``` -//! -//! The macro also support generic parameters: -//! ``` -//! pub struct GenericCryptoStuff { -//! key: K, -//! } -//! -//! opaque_debug::implement!(GenericCryptoStuff); -//! -//! let val = GenericCryptoStuff { key: [42u8; 16] }; -//! assert_eq!(format!("{:?}", val), "GenericCryptoStuff<[u8; 16]> { ... }") -//! ``` -#![no_std] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", - html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg" -)] - -#[doc(hidden)] -pub extern crate core as __core; - -#[macro_export] -#[doc(hidden)] -macro_rules! format_params { - ($single:ident) => { - "{}" - }; - ($first:ident, $($rest:ident),+) => { - concat!("{}", ", ", $crate::format_params!($($rest),+)) - }; -} - -/// Macro for implementing an opaque `Debug` implementation. -#[macro_export] -macro_rules! implement { - ($struct:ident <$($params:ident),+>) => { - impl <$($params),+> $crate::__core::fmt::Debug for $struct <$($params),+> { - fn fmt( - &self, - f: &mut $crate::__core::fmt::Formatter, - ) -> Result<(), $crate::__core::fmt::Error> { - write!( - f, - concat!(stringify!($struct), "<", $crate::format_params!($($params),+), "> {{ ... }}"), - $($crate::__core::any::type_name::<$params>()),+ - ) - } - } - }; - ($struct:ty) => { - impl $crate::__core::fmt::Debug for $struct { - fn fmt( - &self, - f: &mut $crate::__core::fmt::Formatter, - ) -> Result<(), $crate::__core::fmt::Error> { - write!(f, concat!(stringify!($struct), " {{ ... }}")) - } - } - }; -} diff --git a/opaque-debug/tests/mod.rs b/opaque-debug/tests/mod.rs deleted file mode 100644 index 4db2b5ac..00000000 --- a/opaque-debug/tests/mod.rs +++ /dev/null @@ -1,57 +0,0 @@ -//! `opaque-debug` tests - -#![allow(dead_code)] - -struct Foo { - secret: u64, -} - -opaque_debug::implement!(Foo); - -struct FooGeneric { - secret: u64, - generic: T, -} - -opaque_debug::implement!(FooGeneric); - -struct FooManyGenerics { - secret: u64, - generic1: T, - generic2: U, - generic3: V, -} - -opaque_debug::implement!(FooManyGenerics); - -#[test] -fn debug_formatting() { - let s = format!("{:?}", Foo { secret: 42 }); - assert_eq!(s, "Foo { ... }"); -} - -#[test] -fn debug_formatting_generic() { - let s = format!( - "{:?}", - FooGeneric::<()> { - secret: 42, - generic: () - } - ); - assert_eq!(s, "FooGeneric<()> { ... }"); -} - -#[test] -fn debug_formatting_many_generics() { - let s = format!( - "{:?}", - FooManyGenerics::<(), u8, &str> { - secret: 42, - generic1: (), - generic2: 0u8, - generic3: "hello", - } - ); - assert_eq!(s, "FooManyGenerics<(), u8, &str> { ... }"); -} From 135976119bfaee39d6cfd000e9d4313f79064b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Sat, 7 Feb 2026 00:44:07 +0300 Subject: [PATCH 2/2] Remove `collectable` --- Cargo.lock | 48 ++++----- Cargo.toml | 2 - README.md | 2 - collectable/CHANGELOG.md | 25 ----- collectable/Cargo.toml | 18 ---- collectable/LICENSE-APACHE | 201 ------------------------------------- collectable/LICENSE-MIT | 25 ----- collectable/src/lib.rs | 148 --------------------------- 8 files changed, 20 insertions(+), 449 deletions(-) delete mode 100644 collectable/CHANGELOG.md delete mode 100644 collectable/Cargo.toml delete mode 100644 collectable/LICENSE-APACHE delete mode 100644 collectable/LICENSE-MIT delete mode 100644 collectable/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index a637a2fd..7cfc17ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,10 +62,6 @@ dependencies = [ "proptest", ] -[[package]] -name = "collectable" -version = "0.1.0" - [[package]] name = "cpubits" version = "0.1.0" @@ -168,9 +164,9 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "libc" -version = "0.2.179" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "linux-raw-sys" @@ -180,9 +176,9 @@ checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "num-traits" @@ -199,10 +195,6 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" -[[package]] -name = "opaque-debug" -version = "0.4.0-pre" - [[package]] name = "ppv-lite86" version = "0.2.21" @@ -214,18 +206,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.105" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +checksum = "37566cb3fdacef14c0737f9546df7cfeadbfbc9fef10991038bf5015d0c80532" dependencies = [ "bit-set", "bit-vec", @@ -248,9 +240,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] @@ -283,9 +275,9 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ "getrandom", ] @@ -301,9 +293,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" [[package]] name = "rustix" @@ -472,18 +464,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.33" +version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.33" +version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" dependencies = [ "proc-macro2", "quote", @@ -515,6 +507,6 @@ dependencies = [ [[package]] name = "zmij" -version = "1.0.12" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc5a66a20078bf1251bde995aa2fdcc4b800c70b5d92dd2c62abc5c60f679f8" +checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445" diff --git a/Cargo.toml b/Cargo.toml index 4c6f7a64..4916feea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,6 @@ members = [ "blobby", "block-buffer", "block-padding", - "collectable", "cmov", "cpubits", "ctutils", @@ -12,7 +11,6 @@ members = [ "dbl", "hex-literal", "inout", - "opaque-debug", "wycheproof2blb", "zeroize", "zeroize_derive", diff --git a/README.md b/README.md index e65a84d6..f864a75c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ This repository contains various utility crates used in the RustCrypto project. | [`block-buffer`] | [![crates.io](https://img.shields.io/crates/v/block-buffer.svg)](https://crates.io/crates/block-buffer) | [![Documentation](https://docs.rs/block-buffer/badge.svg)](https://docs.rs/block-buffer) | Fixed size buffer for block processing of data | | [`block‑padding`] | [![crates.io](https://img.shields.io/crates/v/block-padding.svg)](https://crates.io/crates/block-padding) | [![Documentation](https://docs.rs/block-padding/badge.svg)](https://docs.rs/block-padding) | Padding and unpadding of messages divided into blocks | | [`cmov`] | [![crates.io](https://img.shields.io/crates/v/cmov.svg)](https://crates.io/crates/cmov) | [![Documentation](https://docs.rs/cmov/badge.svg)](https://docs.rs/cmov) | Conditional move intrinsics | -| [`collectable`] | [![crates.io](https://img.shields.io/crates/v/collectable.svg)](https://crates.io/crates/collectable) | [![Documentation](https://docs.rs/collectable/badge.svg)](https://docs.rs/collectable) | Fallible, `no_std`-friendly collection traits | | [`cpubits`] | [![crates.io](https://img.shields.io/crates/v/cpubits.svg)](https://crates.io/crates/cpubits) | [![Documentation](https://docs.rs/cpubits/badge.svg)](https://docs.rs/cpubits) | Compile-time detection heuristics for the optimal word size to use for the target CPU | | [`cpufeatures`] | [![crates.io](https://img.shields.io/crates/v/cpufeatures.svg)](https://crates.io/crates/cpufeatures) | [![Documentation](https://docs.rs/cpufeatures/badge.svg)](https://docs.rs/cpufeatures) | Lightweight and efficient alternative to the `is_x86_feature_detected!` macro | | [`ctutils`] | [![crates.io](https://img.shields.io/crates/v/ctutils.svg)](https://crates.io/crates/ctutils) | [![Documentation](https://docs.rs/ctutils/badge.svg)](https://docs.rs/ctutils) | Constant-time utility library with selection and equality testing support targeting cryptographic applications | @@ -54,7 +53,6 @@ Unless you explicitly state otherwise, any contribution intentionally submitted [`block-buffer`]: ./block-buffer [`block‑padding`]: ./block-padding [`cmov`]: ./cmov -[`collectable`]: ./collectable [`cpubits`]: ./cpubits [`cpufeatures`]: ./cpufeatures [`ctutils`]: ./ctutils diff --git a/collectable/CHANGELOG.md b/collectable/CHANGELOG.md deleted file mode 100644 index afa83832..00000000 --- a/collectable/CHANGELOG.md +++ /dev/null @@ -1,25 +0,0 @@ -# Changelog -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.1.0 (unreleased) -### Changed -- Edition changed to 2024 and MSRV bumped to 1.85 ([#1149]) - -[#1149]: https://github.com/RustCrypto/utils/pull/1149 - -## 0.0.2 (2020-05-24) -### Added -- `TryPush` trait ([#45]) - -### Changed -- Borrow iterators rather than consume them ([#44], [#46]) - -[#46]: https://github.com/RustCrypto/utils/pull/46 -[#45]: https://github.com/RustCrypto/utils/pull/45 -[#44]: https://github.com/RustCrypto/utils/pull/44 - -## 0.0.1 (2020-05-24) -- Initial release diff --git a/collectable/Cargo.toml b/collectable/Cargo.toml deleted file mode 100644 index c246cd39..00000000 --- a/collectable/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "collectable" -version = "0.1.0" -authors = ["RustCrypto Developers"] -edition = "2024" -rust-version = "1.85" -documentation = "https://docs.rs/collectable" -repository = "https://github.com/RustCrypto/utils" -license = "Apache-2.0 OR MIT" -keywords = ["arrayvec", "heapless"] -categories = ["data-structures", "no-std"] -description = "Fallible, no_std-friendly collection traits" - -[features] -alloc = [] - -[lints] -workspace = true diff --git a/collectable/LICENSE-APACHE b/collectable/LICENSE-APACHE deleted file mode 100644 index 78173fa2..00000000 --- a/collectable/LICENSE-APACHE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/collectable/LICENSE-MIT b/collectable/LICENSE-MIT deleted file mode 100644 index 2726e14a..00000000 --- a/collectable/LICENSE-MIT +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2020 The RustCrypto Project Developers - -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/collectable/src/lib.rs b/collectable/src/lib.rs deleted file mode 100644 index a942411a..00000000 --- a/collectable/src/lib.rs +++ /dev/null @@ -1,148 +0,0 @@ -//! This crate provides a set of traits that can be used to abstract over -//! various collection types. In particular, it supports traits for fallible -//! operations (such as [`TryExtend`]) which are useful for supporting -//! fixed-capacity containers, such as `heapless::Vec` or `tinyvec::Array`. - -#![no_std] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", - html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg" -)] -#![allow(clippy::missing_errors_doc)] - -#[cfg(feature = "alloc")] -extern crate alloc; - -/// Collection types implement all of the traits in this crate. -pub trait Collection: - AsRef<[T]> + AsMut<[T]> + Default + Length + Truncate + TryExtend + TryPush -{ -} - -/// Obtain the length of a collection. -pub trait Length { - /// Get the length of this collection. - fn len(&self) -> usize; - - /// Is the collection empty? - fn is_empty(&self) -> bool { - self.len() == 0 - } -} - -/// Truncate the collection to the provided length. -pub trait Truncate { - /// Truncate this buffer to the given number of elements. - /// - /// If `len` is bigger than the current number of elements (or the total - /// capacity of the buffer) no changes are made to the contents. - fn truncate(&mut self, len: usize); -} - -/// Fallible equivalent of [`core::iter::Extend`] - extends a collection -/// with the contents of an iterator, but with the option to return an error -/// in the event the container's capacity has been exceeded. -/// -/// [`core::iter::Extend`]: https://doc.rust-lang.org/core/iter/trait.Extend.html -pub trait TryExtend { - /// Error type. - type Error; - - /// Try to extend the collection from the given iterator. - fn try_extend(&mut self, iter: T) -> Result<(), Self::Error> - where - T: IntoIterator; - - /// Try to extend the collection from the given slice. - fn try_extend_from_slice(&mut self, slice: &[A]) -> Result<(), Self::Error> - where - A: Clone, - { - self.try_extend(slice.iter().cloned()) - } -} - -/// Try to build a collection type from an [`Iterator`]. -/// -/// Fallible in the event the capacity of the underlying container type is -/// exceeded. -pub trait TryFromIterator: Sized { - /// Error type. - type Error; - - /// Try to create a new collection from the given iterator, potentially - /// returning an error if the underlying collection's capacity is exceeded. - fn try_from_iter(iter: T) -> Result - where - T: IntoIterator; -} - -impl> TryFromIterator for C { - type Error = >::Error; - - fn try_from_iter(iter: T) -> Result - where - T: IntoIterator, - { - let mut collection = Self::default(); - collection.try_extend(iter)?; - Ok(collection) - } -} - -/// Try to push an element onto a collection -pub trait TryPush { - /// Try to push an element onto a collection. - /// - /// Returns the original element if it's full. - fn try_push(&mut self, item: T) -> Result<(), T>; -} - -/// [`TryCollect`] is an extension to [`Iterator`] which allows for performing -/// a fallible collection into a collection type. -pub trait TryCollect { - /// Attempt to collect into the given type. - fn try_collect(&mut self) -> Result - where - B: TryFromIterator; -} - -impl TryCollect for T -where - T: Iterator, -{ - fn try_collect(&mut self) -> Result - where - B: TryFromIterator, - { - B::try_from_iter(self) - } -} - -#[cfg(feature = "alloc")] -mod vec_impls { - use super::{Length, Truncate, TryExtend}; - use alloc::vec::Vec; - use core::convert::Infallible; - - impl Length for Vec { - fn len(&self) -> usize { - Vec::len(self) - } - } - - impl Truncate for Vec { - fn truncate(&mut self, len: usize) { - Vec::truncate(self, len); - } - } - - impl TryExtend for Vec { - type Error = Infallible; - - fn try_extend>(&mut self, iter: T) -> Result<(), Infallible> { - Vec::extend(self, iter); - Ok(()) - } - } -}