diff --git a/.github/workflows/aes-ctr.yml b/.github/workflows/aes-ctr.yml deleted file mode 100644 index 0d391a60..00000000 --- a/.github/workflows/aes-ctr.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: aes-ctr - -on: - pull_request: - paths: - - "aes-ctr/**" - - "Cargo.*" - push: - branches: master - -defaults: - run: - working-directory: aes-ctr - -env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-Dwarnings" - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - 1.41.0 # MSRV - - stable - target: - - thumbv7em-none-eabi - - wasm32-unknown-unknown - steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} - override: true - - run: cargo build --no-default-features --release --target ${{ matrix.target }} - - test: - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - 1.41.0 # MSRV - - stable - steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - override: true - - run: cargo test - - run: cargo test --release - - run: cargo test --release --lib - env: - RUSTFLAGS: "-C target-feature=+aes,+sse2,+ssse3" diff --git a/Cargo.lock b/Cargo.lock index 48279b7b..161c657b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,41 +2,10 @@ # It is not intended for manual editing. [[package]] name = "aes" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" -dependencies = [ - "aes-soft", - "aesni", - "cipher", -] - -[[package]] -name = "aes-ctr" -version = "0.6.0" -dependencies = [ - "aes-soft", - "aesni", - "cipher", - "ctr", -] - -[[package]] -name = "aes-soft" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" -dependencies = [ - "cipher", - "opaque-debug", -] - -[[package]] -name = "aesni" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +version = "0.7.0-pre" +source = "git+https://github.com/RustCrypto/block-ciphers.git#882f1f14df0112470bf972a9d0b97f3871c96880" dependencies = [ + "cfg-if", "cipher", "opaque-debug", ] @@ -49,7 +18,7 @@ checksum = "fc52553543ecb104069b0ff9e0fcc5c739ad16202935528a112d974e8f1a4ee8" [[package]] name = "cfb-mode" -version = "0.6.0" +version = "0.7.0-pre" dependencies = [ "aes", "cipher", @@ -58,16 +27,22 @@ dependencies = [ [[package]] name = "cfb8" -version = "0.6.0" +version = "0.7.0-pre" dependencies = [ "aes", "cipher", "hex-literal", ] +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "chacha20" -version = "0.6.0" +version = "0.7.0-pre" dependencies = [ "cipher", "hex-literal", @@ -77,9 +52,9 @@ dependencies = [ [[package]] name = "cipher" -version = "0.2.5" +version = "0.3.0-pre" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +checksum = "42848bd4f28c6e74641082fc3ca870cb5381ce08d8715045cc96ff4ca20c0bbe" dependencies = [ "blobby", "generic-array", @@ -87,7 +62,7 @@ dependencies = [ [[package]] name = "ctr" -version = "0.6.0" +version = "0.7.0" dependencies = [ "aes", "cipher", @@ -106,7 +81,7 @@ dependencies = [ [[package]] name = "hc-256" -version = "0.3.0" +version = "0.4.0-pre" dependencies = [ "cipher", "zeroize", @@ -133,7 +108,7 @@ dependencies = [ [[package]] name = "ofb" -version = "0.4.0" +version = "0.5.0-pre" dependencies = [ "aes", "cipher", @@ -172,7 +147,7 @@ dependencies = [ [[package]] name = "rabbit" -version = "0.2.0" +version = "0.3.0-pre" dependencies = [ "cipher", "zeroize", @@ -186,7 +161,7 @@ checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" [[package]] name = "salsa20" -version = "0.7.2" +version = "0.8.0-pre" dependencies = [ "cipher", "zeroize", diff --git a/Cargo.toml b/Cargo.toml index ede8cc9a..bd222cbc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,5 @@ [workspace] members = [ - "aes-ctr", "cfb8", "cfb-mode", "chacha20", @@ -10,3 +9,6 @@ members = [ "rabbit", "salsa20", ] + +[patch.crates-io] +aes = { git = "https://github.com/RustCrypto/block-ciphers.git" } diff --git a/README.md b/README.md index 33ffefc2..66b70417 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ received any formal cryptographic and security reviews/audits. ## Crates | Name | Crates.io | Documentation | Build Status | |--------------|-----------|---------------|--------------| -| [`aes-ctr`] | [![crates.io](https://img.shields.io/crates/v/aes-ctr.svg)](https://crates.io/crates/aes-ctr) | [![Documentation](https://docs.rs/aes-ctr/badge.svg)](https://docs.rs/aes-ctr) | ![build](https://github.com/RustCrypto/stream-ciphers/workflows/aes-ctr/badge.svg?branch=master&event=push) | [`cfb-mode`] | [![crates.io](https://img.shields.io/crates/v/cfb-mode.svg)](https://crates.io/crates/cfb-mode) | [![Documentation](https://docs.rs/cfb-mode/badge.svg)](https://docs.rs/cfb-mode) | ![build](https://github.com/RustCrypto/stream-ciphers/workflows/cfb-mode/badge.svg?branch=master&event=push) | [`cfb8`] | [![crates.io](https://img.shields.io/crates/v/cfb8.svg)](https://crates.io/crates/cfb8) | [![Documentation](https://docs.rs/cfb8/badge.svg)](https://docs.rs/cfb8) | ![build](https://github.com/RustCrypto/stream-ciphers/workflows/cfb-mode/badge.svg?branch=master&event=push) | [`chacha20`] | [![crates.io](https://img.shields.io/crates/v/chacha20.svg)](https://crates.io/crates/chacha20) | [![Documentation](https://docs.rs/chacha20/badge.svg)](https://docs.rs/chacha20) | ![build](https://github.com/RustCrypto/stream-ciphers/workflows/chacha20/badge.svg?branch=master&event=push) @@ -102,7 +101,6 @@ dual licensed as above, without any additional terms or conditions. [//]: # (crates) -[`aes-ctr`]: https://github.com/RustCrypto/stream-ciphers/tree/master/aes-ctr [`cfb-mode`]: https://github.com/RustCrypto/stream-ciphers/tree/master/cfb-mode [`cfb8`]: https://github.com/RustCrypto/stream-ciphers/tree/master/cfb8 [`chacha20`]: https://github.com/RustCrypto/stream-ciphers/tree/master/chacha20 diff --git a/aes-ctr/CHANGELOG.md b/aes-ctr/CHANGELOG.md deleted file mode 100644 index cfa6d6da..00000000 --- a/aes-ctr/CHANGELOG.md +++ /dev/null @@ -1,36 +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.6.0 (2020-10-16) -### Changed -- Replace `block-cipher`/`stream-cipher` with `cipher` crate ([#177]) - -[#177]: https://github.com/RustCrypto/stream-ciphers/pull/177 - -## 0.5.0 (2020-08-25) -### Changed -- Bump `stream-cipher` dependency to v0.7, implement the `FromBlockCipher` trait ([#161], [#164]) - -[#161]: https://github.com/RustCrypto/stream-ciphers/pull/161 -[#164]: https://github.com/RustCrypto/stream-ciphers/pull/164 - -## 0.4.0 (2020-06-08) -### Changed -- Bump `aesni` dependency to v0.7 ([#138]) -- Bump `ctr` dependency to v0.4 ([#140]) -- Bump `stream-cipher` dependency to v0.4 ([#118]) -- Upgrade to Rust 2018 edition ([#118]) - -[#140]: https://github.com/RustCrypto/stream-ciphers/pull/140 -[#138]: https://github.com/RustCrypto/stream-ciphers/pull/138 -[#118]: https://github.com/RustCrypto/stream-ciphers/pull/118 - -## 0.3.0 (2018-11-01) - -## 0.2.0 (2018-10-15) - -## 0.1.0 (2018-07-30) diff --git a/aes-ctr/Cargo.toml b/aes-ctr/Cargo.toml deleted file mode 100644 index 98a95e2f..00000000 --- a/aes-ctr/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -name = "aes-ctr" -version = "0.6.0" -description = "AES-CTR stream ciphers" -authors = ["RustCrypto Developers"] -license = "MIT OR Apache-2.0" -documentation = "https://docs.rs/aes-ctr" -repository = "https://github.com/RustCrypto/stream-ciphers" -keywords = ["crypto", "stream-cipher", "trait"] -categories = ["cryptography", "no-std"] -readme = "README.md" -edition = "2018" - -[dependencies] -cipher = "0.2" - -[target.'cfg(not(all(target_feature = "aes", target_feature = "sse2", target_feature = "ssse3", any(target_arch = "x86_64", target_arch = "x86"))))'.dependencies] -ctr = { version = "0.6", path = "../ctr" } -aes-soft = "0.6" - -[target.'cfg(all(target_feature = "aes", target_feature = "sse2", target_feature = "ssse3", any(target_arch = "x86_64", target_arch = "x86")))'.dependencies] -aesni = "0.10" - -[dev-dependencies] -cipher = { version = "0.2", features = ["dev"] } diff --git a/aes-ctr/LICENSE-APACHE b/aes-ctr/LICENSE-APACHE deleted file mode 100644 index 78173fa2..00000000 --- a/aes-ctr/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/aes-ctr/LICENSE-MIT b/aes-ctr/LICENSE-MIT deleted file mode 100644 index f5b157a6..00000000 --- a/aes-ctr/LICENSE-MIT +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2018 Artyom Pavlov - -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/aes-ctr/README.md b/aes-ctr/README.md deleted file mode 100644 index ec43cc90..00000000 --- a/aes-ctr/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# RustCrypto: AES-CTR - -[![Crate][crate-image]][crate-link] -[![Docs][docs-image]][docs-link] -![Apache2/MIT licensed][license-image] -![Rust Version][rustc-image] -[![Project Chat][chat-image]][chat-link] -[![Build Status][build-image]][build-link] -[![HAZMAT][hazmat-image]][hazmat-link] - -Pure Rust implementation of the [Advanced Encryption Standard (AES)][1] -in [Counter Mode][2]. - -Provides a high-performance implementation based on AES-NI and other x86(-64) -CPU intrinsics when available, or otherwise falls back on a bitsliced software -implementation and the [`ctr`][3] crate. - -[Documentation][docs-link] - -### ⚠️ Security Warning: [Hazmat!][hazmat-link] - -This crate does not ensure ciphertexts are authentic (i.e. by using a MAC to -verify ciphertext integrity), which can lead to serious vulnerabilities -if used incorrectly! - -To avoid this, use an [AEAD][4] mode based on AES, such as [AES-GCM][5] or -[AES-GCM-SIV][6]. - -See the [RustCrypto/AEADs][7] repository for more information. - -USE AT YOUR OWN RISK! - -## Minimum Supported Rust Version - -Rust **1.41** or higher. - -Minimum supported Rust version can be changed in the future, but it will be -done with a minor version bump. - -## SemVer Policy - -- All on-by-default features of this library are covered by SemVer -- MSRV is considered exempt from SemVer as noted above - -## 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/aes-ctr.svg -[crate-link]: https://crates.io/crates/aes-ctr -[docs-image]: https://docs.rs/aes-ctr/badge.svg -[docs-link]: https://docs.rs/aes-ctr/ -[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg -[rustc-image]: https://img.shields.io/badge/rustc-1.41+-blue.svg -[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg -[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260049-stream-ciphers -[build-image]: https://github.com/RustCrypto/stream-ciphers/workflows/aes-ctr/badge.svg?branch=master&event=push -[build-link]: https://github.com/RustCrypto/stream-ciphers/actions?query=workflow%3Aaes-ctr -[hazmat-image]: https://img.shields.io/badge/crypto-hazmat%E2%9A%A0-red.svg -[hazmat-link]: https://github.com/RustCrypto/meta/blob/master/HAZMAT.md - -[//]: # (general links) - -[1]: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard -[2]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Counter_(CTR) -[3]: https://github.com/RustCrypto/stream-ciphers/tree/master/ctr -[4]: https://en.wikipedia.org/wiki/Authenticated_encryption -[5]: https://github.com/RustCrypto/AEADs/tree/master/aes-gcm -[6]: https://github.com/RustCrypto/AEADs/tree/master/aes-gcm-siv -[7]: https://github.com/RustCrypto/AEADs diff --git a/aes-ctr/benches/aes128_ctr.rs b/aes-ctr/benches/aes128_ctr.rs deleted file mode 100644 index b0992ec4..00000000 --- a/aes-ctr/benches/aes128_ctr.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(test)] - -cipher::stream_cipher_sync_bench!(aes_ctr::Aes128Ctr); diff --git a/aes-ctr/benches/aes192_ctr.rs b/aes-ctr/benches/aes192_ctr.rs deleted file mode 100644 index 6eb6aec4..00000000 --- a/aes-ctr/benches/aes192_ctr.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(test)] - -cipher::stream_cipher_sync_bench!(aes_ctr::Aes192Ctr); diff --git a/aes-ctr/benches/aes256_ctr.rs b/aes-ctr/benches/aes256_ctr.rs deleted file mode 100644 index b0992ec4..00000000 --- a/aes-ctr/benches/aes256_ctr.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(test)] - -cipher::stream_cipher_sync_bench!(aes_ctr::Aes128Ctr); diff --git a/aes-ctr/src/lib.rs b/aes-ctr/src/lib.rs deleted file mode 100644 index 4c362f8d..00000000 --- a/aes-ctr/src/lib.rs +++ /dev/null @@ -1,76 +0,0 @@ -//! AES-CTR ciphers implementation. -//! -//! Cipher functionality is accessed using traits from re-exported -//! [`cipher`](https://docs.rs/cipher) crate. -//! -//! This crate will select appropriate implementation at compile time depending -//! on target architecture and enabled target features. For the best performance -//! on x86-64 CPUs enable `aes`, `sse2` and `ssse3` target features. You can do -//! it either by using `RUSTFLAGS="-C target-feature=+aes,+ssse3"` or by editing -//! your `.cargo/config`. (`sse2` target feature is usually enabled by default) -//! -//! # Security Warning -//! This crate does not ensure ciphertexts are authentic! Thus ciphertext integrity -//! is not verified, which can lead to serious vulnerabilities! -//! -//! # Usage example -//! ``` -//! use aes_ctr::Aes128Ctr; -//! use aes_ctr::cipher::{ -//! generic_array::GenericArray, -//! stream::{ -//! NewStreamCipher, SyncStreamCipher, SyncStreamCipherSeek -//! } -//! }; -//! -//! let mut data = [1, 2, 3, 4, 5, 6, 7]; -//! -//! let key = GenericArray::from_slice(b"very secret key."); -//! let nonce = GenericArray::from_slice(b"and secret nonce"); -//! // create cipher instance -//! let mut cipher = Aes128Ctr::new(&key, &nonce); -//! // apply keystream (encrypt) -//! cipher.apply_keystream(&mut data); -//! assert_eq!(data, [6, 245, 126, 124, 180, 146, 37]); -//! -//! // seek to the keystream beginning and apply it again to the `data` (decrypt) -//! cipher.seek(0); -//! cipher.apply_keystream(&mut data); -//! assert_eq!(data, [1, 2, 3, 4, 5, 6, 7]); -//! ``` - -#![no_std] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg", - html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg" -)] -#![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")] -#![warn(missing_docs, rust_2018_idioms)] - -pub use cipher; - -#[cfg(not(all( - target_feature = "aes", - target_feature = "sse2", - target_feature = "ssse3", - any(target_arch = "x86_64", target_arch = "x86"), -)))] -mod soft; - -#[cfg(not(all( - target_feature = "aes", - target_feature = "sse2", - target_feature = "ssse3", - any(target_arch = "x86_64", target_arch = "x86"), -)))] -use soft as aes; - -#[cfg(all( - target_feature = "aes", - target_feature = "sse2", - target_feature = "ssse3", - any(target_arch = "x86_64", target_arch = "x86"), -))] -use aesni as aes; - -pub use crate::aes::{Aes128Ctr, Aes192Ctr, Aes256Ctr}; diff --git a/aes-ctr/src/soft.rs b/aes-ctr/src/soft.rs deleted file mode 100644 index 32268bad..00000000 --- a/aes-ctr/src/soft.rs +++ /dev/null @@ -1,9 +0,0 @@ -use aes_soft::{Aes128, Aes192, Aes256}; -use ctr::Ctr128; - -/// AES-128 in CTR mode -pub type Aes128Ctr = Ctr128; -/// AES-192 in CTR mode -pub type Aes192Ctr = Ctr128; -/// AES-256 in CTR mode -pub type Aes256Ctr = Ctr128; diff --git a/aes-ctr/tests/data/aes128-ctr.blb b/aes-ctr/tests/data/aes128-ctr.blb deleted file mode 100644 index d721e4ec..00000000 Binary files a/aes-ctr/tests/data/aes128-ctr.blb and /dev/null differ diff --git a/aes-ctr/tests/data/aes256-ctr.blb b/aes-ctr/tests/data/aes256-ctr.blb deleted file mode 100644 index 47daaf84..00000000 Binary files a/aes-ctr/tests/data/aes256-ctr.blb and /dev/null differ diff --git a/aes-ctr/tests/lib.rs b/aes-ctr/tests/lib.rs deleted file mode 100644 index ad4ca436..00000000 --- a/aes-ctr/tests/lib.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![no_std] - -use aes_ctr::{Aes128Ctr, Aes256Ctr}; - -cipher::stream_cipher_sync_test!(aes128_ctr_core, Aes128Ctr, "aes128-ctr"); -cipher::stream_cipher_sync_test!(aes256_ctr_core, Aes256Ctr, "aes256-ctr"); -cipher::stream_cipher_seek_test!(aes128_ctr_seek, Aes128Ctr); -cipher::stream_cipher_seek_test!(aes256_ctr_seek, Aes256Ctr); diff --git a/cfb-mode/Cargo.toml b/cfb-mode/Cargo.toml index 31e62ee8..83fc0f0d 100644 --- a/cfb-mode/Cargo.toml +++ b/cfb-mode/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cfb-mode" -version = "0.6.0" +version = "0.7.0-pre" description = "Generic Cipher Feedback (CFB) mode implementation." authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -12,9 +12,9 @@ readme = "README.md" edition = "2018" [dependencies] -cipher = "0.2" +cipher = "0.3.0-pre" [dev-dependencies] -aes = "0.6" -cipher = { version = "0.2", features = ["dev"] } +aes = "0.7.0-pre" +cipher = { version = "0.3.0-pre", features = ["dev"] } hex-literal = "0.2" diff --git a/cfb-mode/src/lib.rs b/cfb-mode/src/lib.rs index 1d3a2d10..fa23b92a 100644 --- a/cfb-mode/src/lib.rs +++ b/cfb-mode/src/lib.rs @@ -53,14 +53,14 @@ pub use cipher; use cipher::{ - block::{BlockCipher, NewBlockCipher, ParBlocks}, + block::{BlockCipher, BlockEncrypt, NewBlockCipher, ParBlocks}, generic_array::{typenum::Unsigned, GenericArray}, stream::{FromBlockCipher, StreamCipher}, }; use core::slice; /// CFB self-synchronizing stream cipher instance. -pub struct Cfb { +pub struct Cfb { cipher: C, iv: GenericArray, pos: usize, @@ -68,7 +68,7 @@ pub struct Cfb { impl FromBlockCipher for Cfb where - C: BlockCipher + NewBlockCipher, + C: BlockCipher + BlockEncrypt + NewBlockCipher, { type BlockCipher = C; type NonceSize = C::BlockSize; @@ -80,7 +80,7 @@ where } } -impl StreamCipher for Cfb { +impl StreamCipher for Cfb { fn encrypt(&mut self, mut data: &mut [u8]) { let bs = C::BlockSize::USIZE; let n = data.len(); diff --git a/cfb8/Cargo.toml b/cfb8/Cargo.toml index 1e88a7c2..6d26cae0 100644 --- a/cfb8/Cargo.toml +++ b/cfb8/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cfb8" -version = "0.6.0" +version = "0.7.0-pre" description = "Generic 8-bit Cipher Feedback (CFB8) mode implementation." authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" @@ -12,9 +12,9 @@ readme = "README.md" edition = "2018" [dependencies] -cipher = "0.2" +cipher = "=0.3.0-pre" [dev-dependencies] -aes = "0.6" -cipher = { version = "0.2", features = ["dev"] } +aes = "=0.7.0-pre" +cipher = { version = "=0.3.0-pre", features = ["dev"] } hex-literal = "0.2" diff --git a/cfb8/src/lib.rs b/cfb8/src/lib.rs index 3a63088a..64ffa03f 100644 --- a/cfb8/src/lib.rs +++ b/cfb8/src/lib.rs @@ -54,20 +54,20 @@ pub use cipher; use cipher::{ - block::{BlockCipher, NewBlockCipher}, + block::{BlockCipher, BlockEncrypt, NewBlockCipher}, generic_array::GenericArray, stream::{FromBlockCipher, Nonce, StreamCipher}, }; /// CFB self-synchronizing stream cipher instance. -pub struct Cfb8 { +pub struct Cfb8 { cipher: C, iv: GenericArray, } impl FromBlockCipher for Cfb8 where - C: BlockCipher + NewBlockCipher, + C: BlockCipher + BlockEncrypt + NewBlockCipher, { type BlockCipher = C; type NonceSize = C::BlockSize; @@ -80,7 +80,7 @@ where } } -impl StreamCipher for Cfb8 { +impl StreamCipher for Cfb8 { fn encrypt(&mut self, data: &mut [u8]) { let mut iv = self.iv.clone(); let n = iv.len(); diff --git a/chacha20/Cargo.toml b/chacha20/Cargo.toml index b13856fd..357345c3 100644 --- a/chacha20/Cargo.toml +++ b/chacha20/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chacha20" -version = "0.6.0" +version = "0.7.0-pre" authors = ["RustCrypto Developers"] license = "Apache-2.0 OR MIT" description = """ @@ -17,12 +17,12 @@ readme = "README.md" edition = "2018" [dependencies] -cipher = { version = "0.2", optional = true } +cipher = { version = "=0.3.0-pre", optional = true } rand_core = { version = "0.5", optional = true, default-features = false } zeroize = { version = "1", optional = true, default-features = false } [dev-dependencies] -cipher = { version = "0.2", features = ["dev"] } +cipher = { version = "=0.3.0-pre", features = ["dev"] } hex-literal = "0.2" [features] diff --git a/chacha20/src/chacha.rs b/chacha20/src/chacha.rs index ed10a05b..bdca866f 100644 --- a/chacha20/src/chacha.rs +++ b/chacha20/src/chacha.rs @@ -9,9 +9,11 @@ use crate::{ rounds::{Rounds, R12, R20, R8}, BLOCK_SIZE, MAX_BLOCKS, }; -use cipher::stream::{ +use cipher::{ consts::{U12, U32}, - LoopError, NewStreamCipher, OverflowError, SeekNum, SyncStreamCipher, SyncStreamCipherSeek, + stream::{ + LoopError, NewStreamCipher, OverflowError, SeekNum, SyncStreamCipher, SyncStreamCipherSeek, + }, }; use core::{ convert::TryInto, diff --git a/chacha20/src/legacy.rs b/chacha20/src/legacy.rs index 3a7b773f..a7c8f5fd 100644 --- a/chacha20/src/legacy.rs +++ b/chacha20/src/legacy.rs @@ -1,9 +1,11 @@ //! Legacy version of ChaCha20 with a 64-bit nonce use crate::chacha::{ChaCha20, Key}; -use cipher::stream::{ +use cipher::{ consts::{U32, U8}, - LoopError, NewStreamCipher, OverflowError, SeekNum, SyncStreamCipher, SyncStreamCipherSeek, + stream::{ + LoopError, NewStreamCipher, OverflowError, SeekNum, SyncStreamCipher, SyncStreamCipherSeek, + }, }; /// Size of the nonce for the legacy ChaCha20 stream cipher diff --git a/ctr/Cargo.toml b/ctr/Cargo.toml index 04ef8da3..fadf2d0b 100644 --- a/ctr/Cargo.toml +++ b/ctr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ctr" -version = "0.6.0" +version = "0.7.0" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" description = "CTR block mode of operation" @@ -12,9 +12,9 @@ readme = "README.md" edition = "2018" [dependencies] -cipher = "0.2" +cipher = "=0.3.0-pre" [dev-dependencies] -aes = "0.6" +aes = "=0.7.0-pre" +cipher = { version = "=0.3.0-pre", features = ["dev"] } hex-literal = "0.2" -cipher = { version = "0.2", features = ["dev"] } diff --git a/ctr/src/ctr128.rs b/ctr/src/ctr128.rs index bf584f99..75ec5fa8 100644 --- a/ctr/src/ctr128.rs +++ b/ctr/src/ctr128.rs @@ -1,7 +1,7 @@ //! Generic implementation of CTR mode for block cipher with 128-bit block size. use cipher::{ - block::{Block, BlockCipher, NewBlockCipher, ParBlocks}, + block::{Block, BlockCipher, BlockEncrypt, NewBlockCipher, ParBlocks}, generic_array::{ typenum::{Unsigned, U16}, ArrayLength, GenericArray, @@ -25,7 +25,7 @@ type Nonce = GenericArray; /// CTR mode of operation for 128-bit block ciphers pub struct Ctr128 where - C: BlockCipher, + C: BlockCipher + BlockEncrypt, C::ParBlocks: ArrayLength>, { cipher: C, @@ -37,7 +37,7 @@ where impl FromBlockCipher for Ctr128 where - C: BlockCipher + NewBlockCipher, + C: BlockCipher + BlockEncrypt + NewBlockCipher, C::ParBlocks: ArrayLength>, { type BlockCipher = C; @@ -59,7 +59,7 @@ where impl SyncStreamCipher for Ctr128 where - C: BlockCipher, + C: BlockCipher + BlockEncrypt, C::ParBlocks: ArrayLength>, { fn try_apply_keystream(&mut self, mut data: &mut [u8]) -> Result<(), LoopError> { @@ -117,7 +117,7 @@ where impl SyncStreamCipherSeek for Ctr128 where - C: BlockCipher, + C: BlockCipher + BlockEncrypt, C::ParBlocks: ArrayLength>, { fn try_current_pos(&self) -> Result { @@ -137,7 +137,7 @@ where impl Ctr128 where - C: BlockCipher, + C: BlockCipher + BlockEncrypt, C::ParBlocks: ArrayLength>, { #[inline(always)] @@ -181,7 +181,7 @@ where impl fmt::Debug for Ctr128 where - C: BlockCipher + fmt::Debug, + C: BlockCipher + BlockEncrypt + fmt::Debug, C::ParBlocks: ArrayLength>, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { diff --git a/ctr/src/ctr32.rs b/ctr/src/ctr32.rs index 959b8d20..3a083911 100644 --- a/ctr/src/ctr32.rs +++ b/ctr/src/ctr32.rs @@ -2,7 +2,7 @@ //! (big or little endian), generic over block ciphers. use cipher::{ - block::{Block, BlockCipher, ParBlocks}, + block::{Block, BlockCipher, BlockEncrypt, ParBlocks}, generic_array::{typenum::Unsigned, ArrayLength, GenericArray}, stream::{FromBlockCipher, LoopError, SyncStreamCipher}, }; @@ -12,7 +12,7 @@ use core::{convert::TryInto, marker::PhantomData, mem}; /// Used by e.g. AES-GCM. pub struct Ctr32BE where - B: BlockCipher, + B: BlockCipher + BlockEncrypt, B::ParBlocks: ArrayLength>, Block: Copy, { @@ -24,7 +24,7 @@ where /// Used by e.g. AES-GCM-SIV. pub struct Ctr32LE where - B: BlockCipher, + B: BlockCipher + BlockEncrypt, B::ParBlocks: ArrayLength>, Block: Copy, { @@ -33,7 +33,7 @@ where impl FromBlockCipher for Ctr32BE where - B: BlockCipher, + B: BlockCipher + BlockEncrypt, B::ParBlocks: ArrayLength>, Block: Copy, { @@ -50,7 +50,7 @@ where impl FromBlockCipher for Ctr32LE where - B: BlockCipher, + B: BlockCipher + BlockEncrypt, B::ParBlocks: ArrayLength>, Block: Copy, { @@ -73,7 +73,7 @@ macro_rules! impl_ctr32 { ($ctr32:tt) => { impl SyncStreamCipher for $ctr32 where - B: BlockCipher, + B: BlockCipher + BlockEncrypt, B::ParBlocks: ArrayLength>, Block: Copy, { @@ -87,7 +87,7 @@ macro_rules! impl_ctr32 { impl $ctr32 where - B: BlockCipher, + B: BlockCipher + BlockEncrypt, B::ParBlocks: ArrayLength>, Block: Copy, { @@ -117,7 +117,7 @@ impl_ctr32!(Ctr32LE); /// block ciphers and endianness. struct Ctr32 where - B: BlockCipher, + B: BlockCipher + BlockEncrypt, B::ParBlocks: ArrayLength>, E: Endianness, Block: Copy, @@ -140,7 +140,7 @@ where impl Ctr32 where - B: BlockCipher, + B: BlockCipher + BlockEncrypt, B::ParBlocks: ArrayLength>, E: Endianness, Block: Copy, diff --git a/hc-256/Cargo.toml b/hc-256/Cargo.toml index a63f2fd6..d9b5e04c 100644 --- a/hc-256/Cargo.toml +++ b/hc-256/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hc-256" -version = "0.3.0" +version = "0.4.0-pre" authors = ["Eric McCorkle "] license = "MIT OR Apache-2.0" description = "HC-256 Stream Cipher" @@ -11,5 +11,5 @@ readme = "README.md" edition = "2018" [dependencies] -cipher = "0.2" +cipher = "=0.3.0-pre" zeroize = { version = "1", optional = true, default-features = false } diff --git a/hc-256/src/lib.rs b/hc-256/src/lib.rs index 767ac171..fff41837 100644 --- a/hc-256/src/lib.rs +++ b/hc-256/src/lib.rs @@ -10,9 +10,11 @@ pub use cipher; -use cipher::stream::consts::U32; -use cipher::stream::generic_array::GenericArray; -use cipher::stream::{NewStreamCipher, StreamCipher}; +use cipher::{ + consts::U32, + generic_array::GenericArray, + stream::{NewStreamCipher, StreamCipher}, +}; #[cfg(cargo_feature = "zeroize")] use std::ops::Drop; diff --git a/hc-256/tests/lib.rs b/hc-256/tests/lib.rs index 415b7e05..953e5349 100644 --- a/hc-256/tests/lib.rs +++ b/hc-256/tests/lib.rs @@ -1,4 +1,7 @@ -use cipher::stream::{generic_array::GenericArray, NewStreamCipher, StreamCipher}; +use cipher::{ + generic_array::GenericArray, + stream::{NewStreamCipher, StreamCipher}, +}; use hc_256::Hc256; #[cfg(test)] diff --git a/ofb/Cargo.toml b/ofb/Cargo.toml index 3ab7b104..93041783 100644 --- a/ofb/Cargo.toml +++ b/ofb/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ofb" -version = "0.4.0" +version = "0.5.0-pre" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" description = "Generic Output Feedback (OFB) mode implementation." @@ -12,9 +12,9 @@ readme = "README.md" edition = "2018" [dependencies] -cipher = "0.2" +cipher = "=0.3.0-pre" [dev-dependencies] -aes = "0.6" -cipher = { version = "0.2", features = ["dev"] } +aes = "=0.7.0-pre" +cipher = { version = "=0.3.0-pre", features = ["dev"] } hex-literal = "0.2" diff --git a/ofb/src/lib.rs b/ofb/src/lib.rs index 93471805..8124449a 100644 --- a/ofb/src/lib.rs +++ b/ofb/src/lib.rs @@ -56,7 +56,7 @@ pub use cipher; use cipher::{ - block::{Block, BlockCipher, NewBlockCipher}, + block::{Block, BlockCipher, BlockEncrypt, NewBlockCipher}, generic_array::typenum::Unsigned, stream::{FromBlockCipher, LoopError, Nonce, SyncStreamCipher}, }; @@ -70,7 +70,7 @@ pub struct Ofb { impl FromBlockCipher for Ofb where - C: BlockCipher + NewBlockCipher, + C: BlockCipher + BlockEncrypt + NewBlockCipher, { type BlockCipher = C; type NonceSize = C::BlockSize; @@ -86,7 +86,7 @@ where } } -impl SyncStreamCipher for Ofb { +impl SyncStreamCipher for Ofb { fn try_apply_keystream(&mut self, mut data: &mut [u8]) -> Result<(), LoopError> { let bs = C::BlockSize::to_usize(); let n = data.len(); diff --git a/rabbit/Cargo.toml b/rabbit/Cargo.toml index 4f53ebab..d4749180 100644 --- a/rabbit/Cargo.toml +++ b/rabbit/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rabbit" description = "An implementation of the Rabbit Stream Cipher Algorithm" -version = "0.2.0" +version = "0.3.0-pre" authors = ["AIkorsky "] license = "MIT OR Apache-2.0" repository = "https://github.com/RustCrypto/stream-ciphers" @@ -11,7 +11,7 @@ readme = "README.md" edition = "2018" [dependencies] -cipher = "0.2" +cipher = "=0.3.0-pre" zeroize = { version = "1", optional = true, default-features = false, features = ["zeroize_derive"] } [features] diff --git a/rabbit/src/lib.rs b/rabbit/src/lib.rs index 82e564a0..e49b692e 100644 --- a/rabbit/src/lib.rs +++ b/rabbit/src/lib.rs @@ -8,7 +8,7 @@ pub use cipher; use cipher::{ - stream::consts::{U16, U8}, + consts::{U16, U8}, stream::LoopError, NewStreamCipher, SyncStreamCipher, }; diff --git a/salsa20/Cargo.toml b/salsa20/Cargo.toml index 781c58f0..f4fc2a93 100644 --- a/salsa20/Cargo.toml +++ b/salsa20/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "salsa20" -version = "0.7.2" +version = "0.8.0-pre" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" description = "Salsa20 Stream Cipher" @@ -11,11 +11,11 @@ readme = "README.md" edition = "2018" [dependencies] -cipher = "0.2" +cipher = "=0.3.0-pre" zeroize = { version = "1", optional = true, default-features = false } [dev-dependencies] -cipher = { version = "0.2", features = ["dev"] } +cipher = { version = "=0.3.0-pre", features = ["dev"] } [features] default = ["xsalsa20"] diff --git a/salsa20/tests/lib.rs b/salsa20/tests/lib.rs index e8225ca7..157aae16 100644 --- a/salsa20/tests/lib.rs +++ b/salsa20/tests/lib.rs @@ -1,7 +1,9 @@ //! Salsa20 tests -use cipher::stream::generic_array::GenericArray; -use cipher::stream::{NewStreamCipher, StreamCipher, SyncStreamCipherSeek}; +use cipher::{ + generic_array::GenericArray, + stream::{NewStreamCipher, StreamCipher, SyncStreamCipherSeek}, +}; use salsa20::Salsa20; #[cfg(feature = "xsalsa20")] use salsa20::XSalsa20;