diff options
Diffstat (limited to 'vendor/sha-1')
-rw-r--r-- | vendor/sha-1/.cargo-checksum.json | 1 | ||||
-rw-r--r-- | vendor/sha-1/CHANGELOG.md | 105 | ||||
-rw-r--r-- | vendor/sha-1/Cargo.toml | 53 | ||||
-rw-r--r-- | vendor/sha-1/LICENSE-APACHE | 201 | ||||
-rw-r--r-- | vendor/sha-1/LICENSE-MIT | 27 | ||||
-rw-r--r-- | vendor/sha-1/README.md | 65 | ||||
-rw-r--r-- | vendor/sha-1/benches/mod.rs | 14 | ||||
-rw-r--r-- | vendor/sha-1/src/compress.rs | 38 | ||||
-rw-r--r-- | vendor/sha-1/src/compress/aarch64.rs | 18 | ||||
-rw-r--r-- | vendor/sha-1/src/compress/soft.rs | 259 | ||||
-rw-r--r-- | vendor/sha-1/src/compress/x86.rs | 112 | ||||
-rw-r--r-- | vendor/sha-1/src/lib.rs | 140 | ||||
-rw-r--r-- | vendor/sha-1/tests/data/sha1.blb | bin | 234 -> 0 bytes | |||
-rw-r--r-- | vendor/sha-1/tests/mod.rs | 15 |
14 files changed, 0 insertions, 1048 deletions
diff --git a/vendor/sha-1/.cargo-checksum.json b/vendor/sha-1/.cargo-checksum.json deleted file mode 100644 index 30ed30342..000000000 --- a/vendor/sha-1/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CHANGELOG.md":"ca64c9ca42c8be8f5b6904acbaf7b764649b85f49a640e1ad7c14bc6b5477426","Cargo.toml":"64c2af944ed06cf83dad2cb07e03ee75d92e598e2b91e9574d7e84b9d54e2f76","LICENSE-APACHE":"a9040321c3712d8fd0b09cf52b17445de04a23a10165049ae187cd39e5c86be5","LICENSE-MIT":"b4eb00df6e2a4d22518fcaa6a2b4646f249b3a3c9814509b22bd2091f1392ff1","README.md":"e3e967137d854fef6c4a8c9d018c93bf35640a325a825b6a404dd3183219206c","benches/mod.rs":"2765aec429270711235d6cd4911d0c21658e2fa3dfbe24559f24e21b056b507c","src/compress.rs":"fd3f0c3905420d5380d23fd5b94c4f5adaa246f2b3e2a6567ac1874b012c3a53","src/compress/aarch64.rs":"b1e66c2df53eaf84ccf7466aed47c0718fc3dbe1d1c565b65abd60e84b6fc5d4","src/compress/soft.rs":"8ed37ffc419d9abafd5caa2b1a8b4c5b46ea9c5c323a03e956994f6edf40da74","src/compress/x86.rs":"04d800798c82796ff58821a1af6c20bef32ae6c682478cdf6958f84fce01e86f","src/lib.rs":"bc344cac1cb29136023d447ac98ce9d221ad9ca89673e8740d321fa78f3c71ba","tests/data/sha1.blb":"b9c03b9e56e0a7b08a6d6867599a33cab1a55aec3f41fef910c133fc35dc2851","tests/mod.rs":"34bb42bf4679b3f23ffc2338356c8579c872026eef9989955a29ba44a432c3b5"},"package":"028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f"}
\ No newline at end of file diff --git a/vendor/sha-1/CHANGELOG.md b/vendor/sha-1/CHANGELOG.md deleted file mode 100644 index 3e99c8436..000000000 --- a/vendor/sha-1/CHANGELOG.md +++ /dev/null @@ -1,105 +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.10.0 (2021-12-07) -### Changed -- Update to `digest` v0.10 ([#217]) - -[#217]: https://github.com/RustCrypto/hashes/pull/217 - -## 0.9.8 (2021-08-27) -### Changed -- Bump `cpufeatures` dependency to 0.2 ([#306]) - -[#306]: https://github.com/RustCrypto/hashes/pull/306 - -## 0.9.7 (2021-07-18) -### Changed -- Make `aarch64` CPU feature detection OS-independent ([#276]) -- Bump `sha1-asm` to v0.5; support ARMv8 Crypto Extensions on Apple targets ([#289]) - -[#276]: https://github.com/RustCrypto/hashes/pull/276 -[#289]: https://github.com/RustCrypto/hashes/pull/289 - -## 0.9.6 (2021-05-11) -### Changed -- Use `cpufeatures` to detect intrinsics support on `aarch64` targets ([#268]) - -[#268]: https://github.com/RustCrypto/hashes/pull/268 - -## 0.9.5 (2021-05-05) -### Changed -- Switch from `cpuid-bool` to `cpufeatures` ([#263]) - -[#263]: https://github.com/RustCrypto/hashes/pull/263 - -## 0.9.4 (2021-02-16) -### Added -- Expose compression function under the `compress` feature flag. ([#238]) - -[#238]: https://github.com/RustCrypto/hashes/pull/238 - -## 0.9.3 (2021-02-01) -### Changed -- Use SHA1 intrinsics when `asm` feature is enabled. ([#225]) - -[#225]: https://github.com/RustCrypto/hashes/pull/225 - -## 0.9.2 (2020-11-04) -### Added -- `force-soft` feature to enforce use of software implementation. ([#203]) - -### Changed -- `cfg-if` dependency updated to v1.0. ([#197]) - -[#197]: https://github.com/RustCrypto/hashes/pull/197 -[#203]: https://github.com/RustCrypto/hashes/pull/203 - -## 0.9.1 (2020-06-24) -### Added -- x86 hardware acceleration via SHA extension instrinsics. ([#167]) - -[#167]: https://github.com/RustCrypto/hashes/pull/167 - -## 0.9.0 (2020-06-09) -### Changed -- Update to `digest` v0.9 release; MSRV 1.41+ ([#155]) -- Use new `*Dirty` traits from the `digest` crate ([#153]) -- Bump `block-buffer` to v0.8 release ([#151]) -- Rename `*result*` to `finalize` ([#148]) -- Upgrade to Rust 2018 edition ([#132]) -- Use `libc` for `aarch64` consts ([#94]) -- Allow compile-time detection of crypto on `aarch64` ([#94]) - -[#155]: https://github.com/RustCrypto/hashes/pull/155 -[#153]: https://github.com/RustCrypto/hashes/pull/153 -[#151]: https://github.com/RustCrypto/hashes/pull/151 -[#148]: https://github.com/RustCrypto/hashes/pull/148 -[#132]: https://github.com/RustCrypto/hashes/pull/132 -[#94]: https://github.com/RustCrypto/hashes/pull/94 - -## 0.8.2 (2020-01-06) - -## 0.8.1 (2018-11-14) - -## 0.8.0 (2018-10-02) - -## 0.7.0 (2017-11-15) - -## 0.4.1 (2017-06-13) - -## 0.4.0 (2017-06-12) - -## 0.3.4 (2017-06-04) - -## 0.3.3 (2017-05-09) - -## 0.3.2 (2017-05-02) - -## 0.3.1 (2017-04-18) - -## 0.3.0 (2017-04-06) diff --git a/vendor/sha-1/Cargo.toml b/vendor/sha-1/Cargo.toml deleted file mode 100644 index 3d8f91621..000000000 --- a/vendor/sha-1/Cargo.toml +++ /dev/null @@ -1,53 +0,0 @@ -# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO -# -# When uploading crates to the registry Cargo will automatically -# "normalize" Cargo.toml files for maximal compatibility -# with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies. -# -# If you are reading this file be aware that the original Cargo.toml -# will likely look very different (and much more reasonable). -# See Cargo.toml.orig for the original contents. - -[package] -edition = "2018" -name = "sha-1" -version = "0.10.0" -authors = ["RustCrypto Developers"] -description = "SHA-1 hash function" -documentation = "https://docs.rs/sha-1" -readme = "README.md" -keywords = ["crypto", "sha1", "hash", "digest"] -categories = ["cryptography", "no-std"] -license = "MIT OR Apache-2.0" -repository = "https://github.com/RustCrypto/hashes" -[package.metadata.docs.rs] -all-features = true -rustdoc-args = ["--cfg", "docsrs"] - -[lib] -name = "sha1" -[dependencies.cfg-if] -version = "1.0" - -[dependencies.digest] -version = "0.10" - -[dependencies.sha1-asm] -version = "0.5" -optional = true -[dev-dependencies.digest] -version = "0.10" -features = ["dev"] - -[dev-dependencies.hex-literal] -version = "0.2" - -[features] -asm = ["sha1-asm"] -compress = [] -default = ["std"] -force-soft = [] -std = ["digest/std"] -[target."cfg(any(target_arch = \"aarch64\", target_arch = \"x86\", target_arch = \"x86_64\"))".dependencies.cpufeatures] -version = "0.2" diff --git a/vendor/sha-1/LICENSE-APACHE b/vendor/sha-1/LICENSE-APACHE deleted file mode 100644 index 78173fa2e..000000000 --- a/vendor/sha-1/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/vendor/sha-1/LICENSE-MIT b/vendor/sha-1/LICENSE-MIT deleted file mode 100644 index 66cf75563..000000000 --- a/vendor/sha-1/LICENSE-MIT +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2006-2009 Graydon Hoare -Copyright (c) 2009-2013 Mozilla Foundation -Copyright (c) 2016 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/vendor/sha-1/README.md b/vendor/sha-1/README.md deleted file mode 100644 index dc6102eb9..000000000 --- a/vendor/sha-1/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# RustCrypto: SHA-1 - -[![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] - -Pure Rust implementation of the [SHA-1 hash function][1]. - -[Documentation][docs-link] - -## 🚨 Warning: Cryptographically Broken 🚨 - -The SHA-1 hash function should be considered cryptographically broken and -unsuitable for further use in any security critical capacity, as it is -[practically vulnerable to chosen-prefix collisions][2]. - -We provide this crate for legacy interoperability purposes only. - -## 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/sha-1.svg -[crate-link]: https://crates.io/crates/sha-1 -[docs-image]: https://docs.rs/sha-1/badge.svg -[docs-link]: https://docs.rs/sha-1/ -[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/260041-hashes -[build-image]: https://github.com/RustCrypto/hashes/workflows/sha1/badge.svg?branch=master -[build-link]: https://github.com/RustCrypto/hashes/actions?query=workflow%3Asha1 - -[//]: # (general links) - -[1]: https://en.wikipedia.org/wiki/SHA-1 -[2]: https://sha-mbles.github.io/ diff --git a/vendor/sha-1/benches/mod.rs b/vendor/sha-1/benches/mod.rs deleted file mode 100644 index 5c52e954c..000000000 --- a/vendor/sha-1/benches/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(test)] -extern crate test; - -use digest::bench_update; -use sha1::Sha1; -use test::Bencher; - -bench_update!( - Sha1::default(); - sha1_10 10; - sha1_100 100; - sha1_1000 1000; - sha1_10000 10000; -); diff --git a/vendor/sha-1/src/compress.rs b/vendor/sha-1/src/compress.rs deleted file mode 100644 index feba6fd05..000000000 --- a/vendor/sha-1/src/compress.rs +++ /dev/null @@ -1,38 +0,0 @@ -use crate::{Block, BlockSizeUser, Sha1Core}; -use digest::generic_array::typenum::Unsigned; - -cfg_if::cfg_if! { - if #[cfg(feature = "force-soft")] { - mod soft; - use soft::compress as compress_inner; - } else if #[cfg(all(feature = "asm", target_arch = "aarch64"))] { - mod soft; - mod aarch64; - use aarch64::compress as compress_inner; - } else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { - #[cfg(not(feature = "asm"))] - mod soft; - #[cfg(feature = "asm")] - mod soft { - pub use sha1_asm::compress; - } - mod x86; - use x86::compress as compress_inner; - } else { - mod soft; - use soft::compress as compress_inner; - } -} - -const BLOCK_SIZE: usize = <Sha1Core as BlockSizeUser>::BlockSize::USIZE; - -/// SHA-1 compression function -#[cfg_attr(docsrs, doc(cfg(feature = "compress")))] -pub fn compress(state: &mut [u32; 5], blocks: &[Block<Sha1Core>]) { - // SAFETY: GenericArray<u8, U64> and [u8; 64] have - // exactly the same memory layout - #[allow(unsafe_code)] - let blocks: &[[u8; BLOCK_SIZE]] = - unsafe { &*(blocks as *const _ as *const [[u8; BLOCK_SIZE]]) }; - compress_inner(state, blocks); -} diff --git a/vendor/sha-1/src/compress/aarch64.rs b/vendor/sha-1/src/compress/aarch64.rs deleted file mode 100644 index 5952d1f62..000000000 --- a/vendor/sha-1/src/compress/aarch64.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! SHA-1 `aarch64` backend. - -// Per rustc target feature docs for `aarch64-unknown-linux-gnu` and -// `aarch64-apple-darwin` platforms, the `sha2` target feature enables -// SHA-1 as well: -// -// > Enable SHA1 and SHA256 support. -cpufeatures::new!(sha1_hwcap, "sha2"); - -pub fn compress(state: &mut [u32; 5], blocks: &[[u8; 64]]) { - // TODO: Replace with https://github.com/rust-lang/rfcs/pull/2725 - // after stabilization - if sha1_hwcap::get() { - sha1_asm::compress(state, blocks); - } else { - super::soft::compress(state, blocks); - } -} diff --git a/vendor/sha-1/src/compress/soft.rs b/vendor/sha-1/src/compress/soft.rs deleted file mode 100644 index f4777e7cc..000000000 --- a/vendor/sha-1/src/compress/soft.rs +++ /dev/null @@ -1,259 +0,0 @@ -#![allow(clippy::many_single_char_names)] -use super::BLOCK_SIZE; -use core::convert::TryInto; - -const K: [u32; 4] = [0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6]; - -#[inline(always)] -fn add(a: [u32; 4], b: [u32; 4]) -> [u32; 4] { - [ - a[0].wrapping_add(b[0]), - a[1].wrapping_add(b[1]), - a[2].wrapping_add(b[2]), - a[3].wrapping_add(b[3]), - ] -} - -#[inline(always)] -fn xor(a: [u32; 4], b: [u32; 4]) -> [u32; 4] { - [a[0] ^ b[0], a[1] ^ b[1], a[2] ^ b[2], a[3] ^ b[3]] -} - -#[inline] -pub fn sha1_first_add(e: u32, w0: [u32; 4]) -> [u32; 4] { - let [a, b, c, d] = w0; - [e.wrapping_add(a), b, c, d] -} - -fn sha1msg1(a: [u32; 4], b: [u32; 4]) -> [u32; 4] { - let [_, _, w2, w3] = a; - let [w4, w5, _, _] = b; - [a[0] ^ w2, a[1] ^ w3, a[2] ^ w4, a[3] ^ w5] -} - -fn sha1msg2(a: [u32; 4], b: [u32; 4]) -> [u32; 4] { - let [x0, x1, x2, x3] = a; - let [_, w13, w14, w15] = b; - - let w16 = (x0 ^ w13).rotate_left(1); - let w17 = (x1 ^ w14).rotate_left(1); - let w18 = (x2 ^ w15).rotate_left(1); - let w19 = (x3 ^ w16).rotate_left(1); - - [w16, w17, w18, w19] -} - -#[inline] -fn sha1_first_half(abcd: [u32; 4], msg: [u32; 4]) -> [u32; 4] { - sha1_first_add(abcd[0].rotate_left(30), msg) -} - -fn sha1_digest_round_x4(abcd: [u32; 4], work: [u32; 4], i: i8) -> [u32; 4] { - match i { - 0 => sha1rnds4c(abcd, add(work, [K[0]; 4])), - 1 => sha1rnds4p(abcd, add(work, [K[1]; 4])), - 2 => sha1rnds4m(abcd, add(work, [K[2]; 4])), - 3 => sha1rnds4p(abcd, add(work, [K[3]; 4])), - _ => unreachable!("unknown icosaround index"), - } -} - -fn sha1rnds4c(abcd: [u32; 4], msg: [u32; 4]) -> [u32; 4] { - let [mut a, mut b, mut c, mut d] = abcd; - let [t, u, v, w] = msg; - let mut e = 0u32; - - macro_rules! bool3ary_202 { - ($a:expr, $b:expr, $c:expr) => { - $c ^ ($a & ($b ^ $c)) - }; - } // Choose, MD5F, SHA1C - - e = e - .wrapping_add(a.rotate_left(5)) - .wrapping_add(bool3ary_202!(b, c, d)) - .wrapping_add(t); - b = b.rotate_left(30); - - d = d - .wrapping_add(e.rotate_left(5)) - .wrapping_add(bool3ary_202!(a, b, c)) - .wrapping_add(u); - a = a.rotate_left(30); - - c = c - .wrapping_add(d.rotate_left(5)) - .wrapping_add(bool3ary_202!(e, a, b)) - .wrapping_add(v); - e = e.rotate_left(30); - - b = b - .wrapping_add(c.rotate_left(5)) - .wrapping_add(bool3ary_202!(d, e, a)) - .wrapping_add(w); - d = d.rotate_left(30); - - [b, c, d, e] -} - -fn sha1rnds4p(abcd: [u32; 4], msg: [u32; 4]) -> [u32; 4] { - let [mut a, mut b, mut c, mut d] = abcd; - let [t, u, v, w] = msg; - let mut e = 0u32; - - macro_rules! bool3ary_150 { - ($a:expr, $b:expr, $c:expr) => { - $a ^ $b ^ $c - }; - } // Parity, XOR, MD5H, SHA1P - - e = e - .wrapping_add(a.rotate_left(5)) - .wrapping_add(bool3ary_150!(b, c, d)) - .wrapping_add(t); - b = b.rotate_left(30); - - d = d - .wrapping_add(e.rotate_left(5)) - .wrapping_add(bool3ary_150!(a, b, c)) - .wrapping_add(u); - a = a.rotate_left(30); - - c = c - .wrapping_add(d.rotate_left(5)) - .wrapping_add(bool3ary_150!(e, a, b)) - .wrapping_add(v); - e = e.rotate_left(30); - - b = b - .wrapping_add(c.rotate_left(5)) - .wrapping_add(bool3ary_150!(d, e, a)) - .wrapping_add(w); - d = d.rotate_left(30); - - [b, c, d, e] -} - -fn sha1rnds4m(abcd: [u32; 4], msg: [u32; 4]) -> [u32; 4] { - let [mut a, mut b, mut c, mut d] = abcd; - let [t, u, v, w] = msg; - let mut e = 0u32; - - macro_rules! bool3ary_232 { - ($a:expr, $b:expr, $c:expr) => { - ($a & $b) ^ ($a & $c) ^ ($b & $c) - }; - } // Majority, SHA1M - - e = e - .wrapping_add(a.rotate_left(5)) - .wrapping_add(bool3ary_232!(b, c, d)) - .wrapping_add(t); - b = b.rotate_left(30); - - d = d - .wrapping_add(e.rotate_left(5)) - .wrapping_add(bool3ary_232!(a, b, c)) - .wrapping_add(u); - a = a.rotate_left(30); - - c = c - .wrapping_add(d.rotate_left(5)) - .wrapping_add(bool3ary_232!(e, a, b)) - .wrapping_add(v); - e = e.rotate_left(30); - - b = b - .wrapping_add(c.rotate_left(5)) - .wrapping_add(bool3ary_232!(d, e, a)) - .wrapping_add(w); - d = d.rotate_left(30); - - [b, c, d, e] -} - -macro_rules! rounds4 { - ($h0:ident, $h1:ident, $wk:expr, $i:expr) => { - sha1_digest_round_x4($h0, sha1_first_half($h1, $wk), $i) - }; -} - -macro_rules! schedule { - ($v0:expr, $v1:expr, $v2:expr, $v3:expr) => { - sha1msg2(xor(sha1msg1($v0, $v1), $v2), $v3) - }; -} - -macro_rules! schedule_rounds4 { - ( - $h0:ident, $h1:ident, - $w0:expr, $w1:expr, $w2:expr, $w3:expr, $w4:expr, - $i:expr - ) => { - $w4 = schedule!($w0, $w1, $w2, $w3); - $h1 = rounds4!($h0, $h1, $w4, $i); - }; -} - -#[inline(always)] -fn sha1_digest_block_u32(state: &mut [u32; 5], block: &[u32; 16]) { - let mut w0 = [block[0], block[1], block[2], block[3]]; - let mut w1 = [block[4], block[5], block[6], block[7]]; - let mut w2 = [block[8], block[9], block[10], block[11]]; - let mut w3 = [block[12], block[13], block[14], block[15]]; - let mut w4; - - let mut h0 = [state[0], state[1], state[2], state[3]]; - let mut h1 = sha1_first_add(state[4], w0); - - // Rounds 0..20 - h1 = sha1_digest_round_x4(h0, h1, 0); - h0 = rounds4!(h1, h0, w1, 0); - h1 = rounds4!(h0, h1, w2, 0); - h0 = rounds4!(h1, h0, w3, 0); - schedule_rounds4!(h0, h1, w0, w1, w2, w3, w4, 0); - - // Rounds 20..40 - schedule_rounds4!(h1, h0, w1, w2, w3, w4, w0, 1); - schedule_rounds4!(h0, h1, w2, w3, w4, w0, w1, 1); - schedule_rounds4!(h1, h0, w3, w4, w0, w1, w2, 1); - schedule_rounds4!(h0, h1, w4, w0, w1, w2, w3, 1); - schedule_rounds4!(h1, h0, w0, w1, w2, w3, w4, 1); - - // Rounds 40..60 - schedule_rounds4!(h0, h1, w1, w2, w3, w4, w0, 2); - schedule_rounds4!(h1, h0, w2, w3, w4, w0, w1, 2); - schedule_rounds4!(h0, h1, w3, w4, w0, w1, w2, 2); - schedule_rounds4!(h1, h0, w4, w0, w1, w2, w3, 2); - schedule_rounds4!(h0, h1, w0, w1, w2, w3, w4, 2); - - // Rounds 60..80 - schedule_rounds4!(h1, h0, w1, w2, w3, w4, w0, 3); - schedule_rounds4!(h0, h1, w2, w3, w4, w0, w1, 3); - schedule_rounds4!(h1, h0, w3, w4, w0, w1, w2, 3); - schedule_rounds4!(h0, h1, w4, w0, w1, w2, w3, 3); - schedule_rounds4!(h1, h0, w0, w1, w2, w3, w4, 3); - - let e = h1[0].rotate_left(30); - let [a, b, c, d] = h0; - - state[0] = state[0].wrapping_add(a); - state[1] = state[1].wrapping_add(b); - state[2] = state[2].wrapping_add(c); - state[3] = state[3].wrapping_add(d); - state[4] = state[4].wrapping_add(e); -} - -pub fn compress(state: &mut [u32; 5], blocks: &[[u8; BLOCK_SIZE]]) { - let mut block_u32 = [0u32; BLOCK_SIZE / 4]; - // since LLVM can't properly use aliasing yet it will make - // unnecessary state stores without this copy - let mut state_cpy = *state; - for block in blocks.iter() { - for (o, chunk) in block_u32.iter_mut().zip(block.chunks_exact(4)) { - *o = u32::from_be_bytes(chunk.try_into().unwrap()); - } - sha1_digest_block_u32(&mut state_cpy, &block_u32); - } - *state = state_cpy; -} diff --git a/vendor/sha-1/src/compress/x86.rs b/vendor/sha-1/src/compress/x86.rs deleted file mode 100644 index dc4ca4769..000000000 --- a/vendor/sha-1/src/compress/x86.rs +++ /dev/null @@ -1,112 +0,0 @@ -//! SHA-1 `x86`/`x86_64` backend - -#![cfg(any(target_arch = "x86", target_arch = "x86_64"))] -#![allow(unsafe_code)] - -#[cfg(target_arch = "x86")] -use core::arch::x86::*; -#[cfg(target_arch = "x86_64")] -use core::arch::x86_64::*; - -macro_rules! rounds4 { - ($h0:ident, $h1:ident, $wk:expr, $i:expr) => { - _mm_sha1rnds4_epu32($h0, _mm_sha1nexte_epu32($h1, $wk), $i) - }; -} - -macro_rules! schedule { - ($v0:expr, $v1:expr, $v2:expr, $v3:expr) => { - _mm_sha1msg2_epu32(_mm_xor_si128(_mm_sha1msg1_epu32($v0, $v1), $v2), $v3) - }; -} - -macro_rules! schedule_rounds4 { - ( - $h0:ident, $h1:ident, - $w0:expr, $w1:expr, $w2:expr, $w3:expr, $w4:expr, - $i:expr - ) => { - $w4 = schedule!($w0, $w1, $w2, $w3); - $h1 = rounds4!($h0, $h1, $w4, $i); - }; -} - -#[target_feature(enable = "sha,sse2,ssse3,sse4.1")] -unsafe fn digest_blocks(state: &mut [u32; 5], blocks: &[[u8; 64]]) { - #[allow(non_snake_case)] - let MASK: __m128i = _mm_set_epi64x(0x0001_0203_0405_0607, 0x0809_0A0B_0C0D_0E0F); - - let mut state_abcd = _mm_set_epi32( - state[0] as i32, - state[1] as i32, - state[2] as i32, - state[3] as i32, - ); - let mut state_e = _mm_set_epi32(state[4] as i32, 0, 0, 0); - - for block in blocks { - // SAFETY: we use only unaligned loads with this pointer - #[allow(clippy::cast_ptr_alignment)] - let block_ptr = block.as_ptr() as *const __m128i; - - let mut w0 = _mm_shuffle_epi8(_mm_loadu_si128(block_ptr.offset(0)), MASK); - let mut w1 = _mm_shuffle_epi8(_mm_loadu_si128(block_ptr.offset(1)), MASK); - let mut w2 = _mm_shuffle_epi8(_mm_loadu_si128(block_ptr.offset(2)), MASK); - let mut w3 = _mm_shuffle_epi8(_mm_loadu_si128(block_ptr.offset(3)), MASK); - let mut w4; - - let mut h0 = state_abcd; - let mut h1 = _mm_add_epi32(state_e, w0); - - // Rounds 0..20 - h1 = _mm_sha1rnds4_epu32(h0, h1, 0); - h0 = rounds4!(h1, h0, w1, 0); - h1 = rounds4!(h0, h1, w2, 0); - h0 = rounds4!(h1, h0, w3, 0); - schedule_rounds4!(h0, h1, w0, w1, w2, w3, w4, 0); - - // Rounds 20..40 - schedule_rounds4!(h1, h0, w1, w2, w3, w4, w0, 1); - schedule_rounds4!(h0, h1, w2, w3, w4, w0, w1, 1); - schedule_rounds4!(h1, h0, w3, w4, w0, w1, w2, 1); - schedule_rounds4!(h0, h1, w4, w0, w1, w2, w3, 1); - schedule_rounds4!(h1, h0, w0, w1, w2, w3, w4, 1); - - // Rounds 40..60 - schedule_rounds4!(h0, h1, w1, w2, w3, w4, w0, 2); - schedule_rounds4!(h1, h0, w2, w3, w4, w0, w1, 2); - schedule_rounds4!(h0, h1, w3, w4, w0, w1, w2, 2); - schedule_rounds4!(h1, h0, w4, w0, w1, w2, w3, 2); - schedule_rounds4!(h0, h1, w0, w1, w2, w3, w4, 2); - - // Rounds 60..80 - schedule_rounds4!(h1, h0, w1, w2, w3, w4, w0, 3); - schedule_rounds4!(h0, h1, w2, w3, w4, w0, w1, 3); - schedule_rounds4!(h1, h0, w3, w4, w0, w1, w2, 3); - schedule_rounds4!(h0, h1, w4, w0, w1, w2, w3, 3); - schedule_rounds4!(h1, h0, w0, w1, w2, w3, w4, 3); - - state_abcd = _mm_add_epi32(state_abcd, h0); - state_e = _mm_sha1nexte_epu32(h1, state_e); - } - - state[0] = _mm_extract_epi32(state_abcd, 3) as u32; - state[1] = _mm_extract_epi32(state_abcd, 2) as u32; - state[2] = _mm_extract_epi32(state_abcd, 1) as u32; - state[3] = _mm_extract_epi32(state_abcd, 0) as u32; - state[4] = _mm_extract_epi32(state_e, 3) as u32; -} - -cpufeatures::new!(shani_cpuid, "sha", "sse2", "ssse3", "sse4.1"); - -pub fn compress(state: &mut [u32; 5], blocks: &[[u8; 64]]) { - // TODO: Replace with https://github.com/rust-lang/rfcs/pull/2725 - // after stabilization - if shani_cpuid::get() { - unsafe { - digest_blocks(state, blocks); - } - } else { - super::soft::compress(state, blocks); - } -} diff --git a/vendor/sha-1/src/lib.rs b/vendor/sha-1/src/lib.rs deleted file mode 100644 index 134108e77..000000000 --- a/vendor/sha-1/src/lib.rs +++ /dev/null @@ -1,140 +0,0 @@ -//! Pure Rust implementation of the [SHA-1][1] cryptographic hash algorithm -//! with optional hardware-specific optimizations. -//! -//! # 🚨 Warning: Cryptographically Broken! 🚨 -//! -//! The SHA-1 hash function should be considered cryptographically broken and -//! unsuitable for further use in any security critical capacity, as it is -//! [practically vulnerable to chosen-prefix collisions][2]. -//! -//! We provide this crate for legacy interoperability purposes only. -//! -//! # Usage -//! -//! ```rust -//! use hex_literal::hex; -//! use sha1::{Sha1, Digest}; -//! -//! // create a Sha1 object -//! let mut hasher = Sha1::new(); -//! -//! // process input message -//! hasher.update(b"hello world"); -//! -//! // acquire hash digest in the form of GenericArray, -//! // which in this case is equivalent to [u8; 20] -//! let result = hasher.finalize(); -//! assert_eq!(result[..], hex!("2aae6c35c94fcfb415dbe95f408b9ce91ee846ed")); -//! ``` -//! -//! Also see [RustCrypto/hashes][3] readme. -//! -//! [1]: https://en.wikipedia.org/wiki/SHA-1 -//! [2]: https://sha-mbles.github.io/ -//! [3]: https://github.com/RustCrypto/hashes - -#![no_std] -#![cfg_attr(docsrs, feature(doc_cfg))] -#![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", - html_root_url = "https://docs.rs/sha-1/0.10.0" -)] -#![warn(missing_docs, rust_2018_idioms)] - -pub use digest::{self, Digest}; - -use core::{fmt, slice::from_ref}; -use digest::{ - block_buffer::Eager, - core_api::{ - AlgorithmName, Block, BlockSizeUser, Buffer, BufferKindUser, CoreWrapper, FixedOutputCore, - OutputSizeUser, Reset, UpdateCore, - }, - generic_array::typenum::{Unsigned, U20, U64}, - HashMarker, Output, -}; - -mod compress; - -#[cfg(feature = "compress")] -pub use compress::compress; -#[cfg(not(feature = "compress"))] -use compress::compress; - -const STATE_LEN: usize = 5; - -/// Core SHA-1 hasher state. -#[derive(Clone)] -pub struct Sha1Core { - h: [u32; STATE_LEN], - block_len: u64, -} - -impl HashMarker for Sha1Core {} - -impl BlockSizeUser for Sha1Core { - type BlockSize = U64; -} - -impl BufferKindUser for Sha1Core { - type BufferKind = Eager; -} - -impl OutputSizeUser for Sha1Core { - type OutputSize = U20; -} - -impl UpdateCore for Sha1Core { - #[inline] - fn update_blocks(&mut self, blocks: &[Block<Self>]) { - self.block_len += blocks.len() as u64; - compress(&mut self.h, blocks); - } -} - -impl FixedOutputCore for Sha1Core { - #[inline] - fn finalize_fixed_core(&mut self, buffer: &mut Buffer<Self>, out: &mut Output<Self>) { - let bs = Self::BlockSize::U64; - let bit_len = 8 * (buffer.get_pos() as u64 + bs * self.block_len); - - let mut h = self.h; - buffer.len64_padding_be(bit_len, |b| compress(&mut h, from_ref(b))); - for (chunk, v) in out.chunks_exact_mut(4).zip(h.iter()) { - chunk.copy_from_slice(&v.to_be_bytes()); - } - } -} - -impl Default for Sha1Core { - #[inline] - fn default() -> Self { - Self { - h: [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0], - block_len: 0, - } - } -} - -impl Reset for Sha1Core { - #[inline] - fn reset(&mut self) { - *self = Default::default(); - } -} - -impl AlgorithmName for Sha1Core { - fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str("Sha1") - } -} - -impl fmt::Debug for Sha1Core { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str("Sha1Core { ... }") - } -} - -/// SHA-1 hasher state. -pub type Sha1 = CoreWrapper<Sha1Core>; diff --git a/vendor/sha-1/tests/data/sha1.blb b/vendor/sha-1/tests/data/sha1.blb Binary files differdeleted file mode 100644 index e8dc49163..000000000 --- a/vendor/sha-1/tests/data/sha1.blb +++ /dev/null diff --git a/vendor/sha-1/tests/mod.rs b/vendor/sha-1/tests/mod.rs deleted file mode 100644 index 04aa69f1c..000000000 --- a/vendor/sha-1/tests/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -use digest::dev::{feed_rand_16mib, fixed_reset_test}; -use hex_literal::hex; -use sha1::{Digest, Sha1}; - -digest::new_test!(sha1_main, "sha1", Sha1, fixed_reset_test); - -#[test] -fn sha1_rand() { - let mut h = Sha1::new(); - feed_rand_16mib(&mut h); - assert_eq!( - h.finalize()[..], - hex!("7e565a25a8b123e9881addbcedcd927b23377a78")[..] - ); -} |