diff --git a/.github/workflows/hex-literal.yml b/.github/workflows/hex-literal.yml index 5d61be0a..0d65e5fb 100644 --- a/.github/workflows/hex-literal.yml +++ b/.github/workflows/hex-literal.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: rust: - - 1.31.0 # MSRV + - 1.41.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -41,7 +41,7 @@ jobs: strategy: matrix: rust: - - 1.31.0 # MSRV + - 1.41.0 # MSRV - stable steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/opaque-debug.yml b/.github/workflows/opaque-debug.yml index a7cf16d4..775d5de3 100644 --- a/.github/workflows/opaque-debug.yml +++ b/.github/workflows/opaque-debug.yml @@ -22,7 +22,7 @@ jobs: strategy: matrix: rust: - - 1.31.0 # MSRV + - 1.41.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -41,7 +41,7 @@ jobs: strategy: matrix: rust: - - 1.31.0 # MSRV + - 1.41.0 # MSRV - stable steps: - uses: actions/checkout@v1 diff --git a/Cargo.lock b/Cargo.lock index 17c16793..eebc77af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,10 +19,6 @@ dependencies = [ name = "block-padding" version = "0.2.0" -[[package]] -name = "byte-tools" -version = "0.3.1" - [[package]] name = "collectable" version = "0.0.2" @@ -38,10 +34,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "fake-simd" -version = "0.1.2" - [[package]] name = "generic-array" version = "0.14.2" diff --git a/Cargo.toml b/Cargo.toml index 20773ce5..60448eae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,11 +3,9 @@ members = [ "blobby", "block-buffer", "block-padding", - "byte-tools", "collectable", "cpuid-bool", "dbl", - "fake-simd", "hex-literal", "hex-literal/hex-literal-impl", "opaque-debug", diff --git a/byte-tools/Cargo.toml b/byte-tools/Cargo.toml deleted file mode 100644 index 3b3a3705..00000000 --- a/byte-tools/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "byte-tools" -version = "0.3.1" -authors = ["RustCrypto Developers"] -license = "MIT OR Apache-2.0" -description = "Bytes related utility functions" -documentation = "https://docs.rs/byte-tools" -repository = "https://github.com/RustCrypto/utils" -keywords = ["bytes"] diff --git a/byte-tools/LICENSE-APACHE b/byte-tools/LICENSE-APACHE deleted file mode 100644 index 78173fa2..00000000 --- a/byte-tools/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/byte-tools/LICENSE-MIT b/byte-tools/LICENSE-MIT deleted file mode 100644 index 502cee6e..00000000 --- a/byte-tools/LICENSE-MIT +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2018-2019 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/byte-tools/src/lib.rs b/byte-tools/src/lib.rs deleted file mode 100644 index 0c29f964..00000000 --- a/byte-tools/src/lib.rs +++ /dev/null @@ -1,29 +0,0 @@ -#![no_std] -use core::ptr; - -/// Copy bytes from `src` to `dst` -/// -/// Panics if the size of `src` is bigger than the size of `dst` -#[inline(always)] -pub fn copy(src: &[u8], dst: &mut [u8]) { - assert!(dst.len() >= src.len()); - unsafe { - ptr::copy_nonoverlapping(src.as_ptr(), dst.as_mut_ptr(), src.len()); - } -} - -/// Zero all bytes in `dst` -#[inline(always)] -pub fn zero(dst: &mut [u8]) { - unsafe { - ptr::write_bytes(dst.as_mut_ptr(), 0, dst.len()); - } -} - -/// Sets all bytes in `dst` equal to `value` -#[inline(always)] -pub fn set(dst: &mut [u8], value: u8) { - unsafe { - ptr::write_bytes(dst.as_mut_ptr(), value, dst.len()); - } -} diff --git a/crypto-ops/Cargo.toml b/crypto-ops/Cargo.toml deleted file mode 100644 index ca6ff5da..00000000 --- a/crypto-ops/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "crypto-ops" -version = "0.1.1" -authors = ["The Rust-Crypto Project Developers"] -license = "MIT/Apache-2.0" -description = "Set of low-level functions useful for cryptography" -documentation = "https://docs.rs/crypto-ops" -repository = "https://github.com/RustCrypto/utils" -keywords = ["crypto"] -build = "build.rs" - -[dependencies] -libc = {version = "^0.2", default-features = false} - -[build-dependencies] -gcc = "^0.3" diff --git a/crypto-ops/LICENSE-APACHE b/crypto-ops/LICENSE-APACHE deleted file mode 100644 index 78173fa2..00000000 --- a/crypto-ops/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/crypto-ops/LICENSE-MIT b/crypto-ops/LICENSE-MIT deleted file mode 100644 index 1da3a5f6..00000000 --- a/crypto-ops/LICENSE-MIT +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2006-2009 Graydon Hoare -Copyright (c) 2009-2013 Mozilla Foundation - -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/crypto-ops/build.rs b/crypto-ops/build.rs deleted file mode 100644 index 8abec3a8..00000000 --- a/crypto-ops/build.rs +++ /dev/null @@ -1,35 +0,0 @@ -extern crate gcc; - -use std::env; -use std::path::Path; - -fn main() { - let target = env::var("TARGET").unwrap(); - let host = env::var("HOST").unwrap(); - if target.contains("msvc") && host.contains("windows") { - let mut config = gcc::Config::new(); - config.file("src/helpers.asm"); - config.file("src/helpers.asm"); - if target.contains("x86_64") { - config.define("X64", None); - } - config.compile("lib_constant_op_helpers.a"); - } - else { - let mut cfg = gcc::Config::new(); - cfg.file("src/helpers.c"); - cfg.file("src/helpers.c"); - if env::var_os("CC").is_none() { - if host.contains("openbsd") { - // Use clang on openbsd since there have been reports that - // GCC doesn't like some of the assembly that we use on that - // platform. - cfg.compiler(Path::new("clang")); - } else if target == host { - cfg.compiler(Path::new("cc")); - } - } - cfg.compile("lib_constant_op_helpers.a"); - } -} - diff --git a/crypto-ops/src/helpers.asm b/crypto-ops/src/helpers.asm deleted file mode 100644 index 7dd5b5dd..00000000 --- a/crypto-ops/src/helpers.asm +++ /dev/null @@ -1,125 +0,0 @@ -ifndef X64 -.686p -.XMM -.model flat, C -endif - -.code - -rust_crypto_util_supports_aesni PROC public - ; Return false since the AES-NI function have not been - ; converted to assembly - xor eax, eax - ret -rust_crypto_util_supports_aesni ENDP - -; The rust_crypto_util_fixed_time_eq_asm for X86-64 -ifdef X64 -rust_crypto_util_fixed_time_eq_asm PROC public lhs:QWORD, rhs:QWORD, count:QWORD - ; lhs is in RCX - ; rhs is in RDX - ; count is in R8 - - ; set the return value initially to 0 - xor eax, eax - - test r8, r8 - jz DONE - - BEGIN: - - mov r10b, [rcx] - xor r10b, [rdx] - or al, r10b - - inc rcx - inc rdx - dec r8 - jnz BEGIN - - DONE: - - ret -rust_crypto_util_fixed_time_eq_asm ENDP -endif - -; The rust_crypto_util_fixed_time_eq_asm for X86 (32-bit) -ifndef X64 -rust_crypto_util_fixed_time_eq_asm PROC public lhs:DWORD, rhs:DWORD, count:DWORD - push ebx - push esi - - mov ecx, lhs - mov edx, rhs - mov esi, count - - xor eax, eax - - test esi, esi - jz DONE - - BEGIN: - - mov bl, [ecx] - xor bl, [edx] - or al, bl - - inc ecx - inc edx - dec esi - jnz BEGIN - - DONE: - - pop esi - pop ebx - - ret -rust_crypto_util_fixed_time_eq_asm ENDP -endif - -ifdef X64 -rust_crypto_util_secure_memset PROC public dst:QWORD, val:BYTE, count:QWORD - ; dst is in RCX - ; val is in RDX - ; count is in R8 - - test r8, r8 - jz DONE - - BEGIN: - - mov [rcx], dl - inc rcx - dec r8 - jnz BEGIN - - DONE: - - ret -rust_crypto_util_secure_memset ENDP -endif - -ifndef X64 -rust_crypto_util_secure_memset PROC public dst:DWORD, val:BYTE, count:DWORD - mov eax, dst - mov cl, val - mov edx, count - - test edx, edx - jz DONE - - BEGIN: - - mov [eax], cl - inc eax - dec edx - jnz BEGIN - - DONE: - - ret -rust_crypto_util_secure_memset ENDP -endif - -end diff --git a/crypto-ops/src/helpers.c b/crypto-ops/src/helpers.c deleted file mode 100644 index 1a3b04ff..00000000 --- a/crypto-ops/src/helpers.c +++ /dev/null @@ -1,101 +0,0 @@ -#include -#include -#include - -#if defined(__i386__) -uint32_t rust_crypto_util_supports_aesni() { - #ifdef __SSE__ - uint32_t flags; - asm( - "pushl %%ebx; \ - mov $1, %%eax; cpuid; \ - popl %%ebx;" - : "=c" (flags) // output - : // input - : "eax", "edx" // clobbers - ); - return flags & 0x02000000; - #else - return 0; - #endif -} -#endif - -#if defined(__x86_64__) -uint32_t rust_crypto_util_supports_aesni() { - #ifdef __SSE__ - uint32_t flags; - asm( - "mov $1, %%eax; cpuid;" - : "=c" (flags) // output - : // input - : "eax", "ebx", "edx" // clobbers - ); - return flags & 0x02000000; - #else - return 0; - #endif -} -#endif - -#if defined(__i386__) || defined(__x86_64__) -uint32_t rust_crypto_util_fixed_time_eq_asm(uint8_t* lhsp, uint8_t* rhsp, size_t count) { - if (count == 0) { - return 1; - } - uint8_t result = 0; - asm( - " \ - 1: \ - \ - mov (%1), %%cl; \ - xor (%2), %%cl; \ - or %%cl, %0; \ - \ - inc %1; \ - inc %2; \ - dec %3; \ - jnz 1b; \ - " - : "+&r" (result), "+&r" (lhsp), "+&r" (rhsp), "+&r" (count) // all input and output - : // input - : "cl", "cc" // clobbers - ); - - return result; -} -#endif - -#ifdef __arm__ -uint32_t rust_crypto_util_fixed_time_eq_asm(uint8_t* lhsp, uint8_t* rhsp, size_t count) { - if (count == 0) { - return 1; - } - uint8_t result = 0; - asm( - " \ - 1: \ - \ - ldrb r4, [%1]; \ - ldrb r5, [%2]; \ - eor r4, r4, r5; \ - orr %0, %0, r4; \ - \ - add %1, %1, #1; \ - add %2, %2, #1; \ - subs %3, %3, #1; \ - bne 1b; \ - " - : "+&r" (result), "+&r" (lhsp), "+&r" (rhsp), "+&r" (count) // all input and output - : // input - : "r4", "r5", "cc" // clobbers - ); - - return result; -} -#endif - -void rust_crypto_util_secure_memset(uint8_t* dst, uint8_t val, size_t count) { - memset(dst, val, count); - asm volatile("" : : "g" (dst) : "memory"); -} diff --git a/crypto-ops/src/lib.rs b/crypto-ops/src/lib.rs deleted file mode 100644 index b7a7689f..00000000 --- a/crypto-ops/src/lib.rs +++ /dev/null @@ -1,75 +0,0 @@ -#![no_std] -extern crate libc; - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -extern { - pub fn rust_crypto_util_supports_aesni() -> u32; -} - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -pub fn supports_aesni() -> bool { - unsafe { - rust_crypto_util_supports_aesni() != 0 - } -} - -extern { - pub fn rust_crypto_util_fixed_time_eq_asm( - lhsp: *const u8, - rhsp: *const u8, - count: libc::size_t) -> u32; - pub fn rust_crypto_util_secure_memset( - dst: *mut u8, - val: libc::uint8_t, - count: libc::size_t); -} - -pub fn secure_memset(dst: &mut [u8], val: u8) { - unsafe { - rust_crypto_util_secure_memset( - dst.as_mut_ptr(), - val, - dst.len() as libc::size_t); - } -} - -/// Compare two vectors using a fixed number of operations. If the two vectors -/// are not of equal length, the function returns false immediately. -pub fn fixed_time_eq(lhs: &[u8], rhs: &[u8]) -> bool { - if lhs.len() != rhs.len() { - false - } else { - let count = lhs.len() as libc::size_t; - - unsafe { - let lhsp = lhs.get_unchecked(0); - let rhsp = rhs.get_unchecked(0); - rust_crypto_util_fixed_time_eq_asm(lhsp, rhsp, count) == 0 - } - } -} - -#[cfg(test)] -mod test { - use super::fixed_time_eq; - - #[test] - pub fn test_fixed_time_eq() { - let a = [0, 1, 2]; - let b = [0, 1, 2]; - let c = [0, 1, 9]; - let d = [9, 1, 2]; - let e = [2, 1, 0]; - let f = [2, 2, 2]; - let g = [0, 0, 0]; - - assert!(fixed_time_eq(&a, &a)); - assert!(fixed_time_eq(&a, &b)); - - assert!(!fixed_time_eq(&a, &c)); - assert!(!fixed_time_eq(&a, &d)); - assert!(!fixed_time_eq(&a, &e)); - assert!(!fixed_time_eq(&a, &f)); - assert!(!fixed_time_eq(&a, &g)); - } -} diff --git a/crypto-tests/Cargo.toml b/crypto-tests/Cargo.toml deleted file mode 100644 index 93029ae8..00000000 --- a/crypto-tests/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "crypto-tests" -version = "0.6.0" -authors = ["The Rust-Crypto Project Developers"] -license = "MIT/Apache-2.0" -description = "Test helpers for cryptographic algorithms" -documentation = "https://docs.rs/crypto-tests" -repository = "https://github.com/RustCrypto/utils" -keywords = ["crypto", "tests"] - -[dependencies] -digest = "0.7" -crypto-mac = "0.5" -block-cipher-trait = "0.5" diff --git a/crypto-tests/LICENSE-APACHE b/crypto-tests/LICENSE-APACHE deleted file mode 100644 index 78173fa2..00000000 --- a/crypto-tests/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/crypto-tests/LICENSE-MIT b/crypto-tests/LICENSE-MIT deleted file mode 100644 index 1da3a5f6..00000000 --- a/crypto-tests/LICENSE-MIT +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2006-2009 Graydon Hoare -Copyright (c) 2009-2013 Mozilla Foundation - -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/crypto-tests/src/block_cipher.rs b/crypto-tests/src/block_cipher.rs deleted file mode 100644 index bfb11e98..00000000 --- a/crypto-tests/src/block_cipher.rs +++ /dev/null @@ -1,76 +0,0 @@ -use block_cipher_trait::NewVarKey; -use block_cipher_trait::generic_array::GenericArray; - -pub struct BlockCipherTest { - pub name: &'static str, - pub key: &'static [u8], - pub input: &'static [u8], - pub output: &'static [u8], -} - -#[macro_export] -macro_rules! new_block_cipher_tests { - ( $( $name:expr ),* ) => { - [$( - BlockCipherTest { - name: $name, - key: include_bytes!(concat!("data/", $name, ".key.bin")), - input: include_bytes!(concat!("data/", $name, ".input.bin")), - output: include_bytes!(concat!("data/", $name, ".output.bin")), - }, - )*] - }; -} - -pub fn encrypt_decrypt(tests: &[BlockCipherTest]) { - // test encryption - for test in tests { - let state = B::new(test.key).unwrap(); - let mut block = GenericArray::clone_from_slice(test.input); - state.encrypt_block(&mut block); - assert_eq!(test.output, block.as_slice()); - } - - // test decription - for test in tests { - let state = B::new(test.key).unwrap(); - let mut block = GenericArray::clone_from_slice(test.output); - state.decrypt_block(&mut block); - assert_eq!(test.input, block.as_slice()); - } -} - -#[macro_export] -macro_rules! bench_block_cipher { - ($cipher:path, $key_len:expr) => { - extern crate test; - extern crate block_cipher_trait; - - use test::Bencher; - use block_cipher_trait::{BlockCipher, NewVarKey}; - - #[bench] - pub fn encrypt(bh: &mut Bencher) { - let state = <$cipher>::new(&[1u8; $key_len]).unwrap(); - let mut block = Default::default(); - - bh.iter(|| { - state.encrypt_block(&mut block); - test::black_box(&block); - }); - bh.bytes = block.len() as u64; - } - - #[bench] - pub fn decrypt(bh: &mut Bencher) { - let state = <$cipher>::new(&[1u8; $key_len]).unwrap(); - let mut block = Default::default(); - - bh.iter(|| { - state.decrypt_block(&mut block); - test::black_box(&block); - }); - bh.bytes = block.len() as u64; - } - } -} diff --git a/crypto-tests/src/hash.rs b/crypto-tests/src/hash.rs deleted file mode 100644 index aa358aa6..00000000 --- a/crypto-tests/src/hash.rs +++ /dev/null @@ -1,158 +0,0 @@ -use digest::{Digest, Input, VariableOutput, ExtendableOutput, XofReader}; -use core::fmt::Debug; - -pub struct Test { - pub name: &'static str, - pub input: &'static [u8], - pub output: &'static [u8], -} - -#[macro_export] -macro_rules! new_tests { - ( $( $name:expr ),* ) => { - [$( - Test { - name: $name, - input: include_bytes!(concat!("data/", $name, ".input.bin")), - output: include_bytes!(concat!("data/", $name, ".output.bin")), - }, - )*] - }; - ( $( $name:expr ),+, ) => (new_tests!($($name),+)) -} - -pub fn main_test(tests: &[Test]) { - // Test that it works when accepting the message all at once - for t in tests.iter() { - let mut sh = D::default(); - sh.input(t.input); - - let out = sh.result(); - - assert_eq!(out[..], t.output[..]); - } - - // Test that it works when accepting the message in pieces - for t in tests.iter() { - let mut sh = D::default(); - let len = t.input.len(); - let mut left = len; - while left > 0 { - let take = (left + 1) / 2; - sh.input(&t.input[len - left..take + len - left]); - left = left - take; - } - - let out = sh.result(); - - assert_eq!(out[..], t.output[..]); - } -} - -pub fn variable_test(tests: &[Test]) - where D: Input + VariableOutput + Clone + Debug -{ - let mut buf = [0u8; 1024]; - // Test that it works when accepting the message all at once - for t in tests.iter() { - let mut sh = D::new(t.output.len()).unwrap(); - sh.process(t.input); - - let out = sh.variable_result(&mut buf[..t.output.len()]).unwrap(); - - assert_eq!(out[..], t.output[..]); - } - - // Test that it works when accepting the message in pieces - for t in tests.iter() { - let mut sh = D::new(t.output.len()).unwrap(); - let len = t.input.len(); - let mut left = len; - while left > 0 { - let take = (left + 1) / 2; - sh.process(&t.input[len - left..take + len - left]); - left = left - take; - } - - let out = sh.variable_result(&mut buf[..t.output.len()]).unwrap(); - - assert_eq!(out[..], t.output[..]); - } -} - - -pub fn xof_test(tests: &[Test]) - where D: Input + ExtendableOutput + Default + Debug + Clone -{ - let mut buf = [0u8; 1024]; - // Test that it works when accepting the message all at once - for t in tests.iter() { - let mut sh = D::default(); - sh.process(t.input); - - let out = &mut buf[..t.output.len()]; - sh.xof_result().read(out); - - assert_eq!(out[..], t.output[..]); - } - - // Test that it works when accepting the message in pieces - for t in tests.iter() { - let mut sh = D::default(); - let len = t.input.len(); - let mut left = len; - while left > 0 { - let take = (left + 1) / 2; - sh.process(&t.input[len - left..take + len - left]); - left = left - take; - } - - let out = &mut buf[..t.output.len()]; - sh.xof_result().read(out); - - assert_eq!(out[..], t.output[..]); - } -} - -pub fn one_million_a(expected: &[u8]) { - let mut sh = D::default(); - for _ in 0..50000 { - sh.input(&[b'a'; 10]); - } - sh.input(&[b'a'; 500000]); - let out = sh.result(); - assert_eq!(out[..], expected[..]); -} - - -#[macro_export] -macro_rules! bench_digest { - ($name:ident, $engine:path, $bs:expr) => { - #[bench] - fn $name(b: &mut Bencher) { - let mut d = <$engine>::default(); - let data = [0; $bs]; - - b.iter(|| { - d.input(&data); - }); - - b.bytes = $bs; - } - }; - - ($engine:path) => { - extern crate test; - extern crate digest; - - use test::Bencher; - use digest::Digest; - - bench_digest!(bench1_16, $engine, 1<<4); - bench_digest!(bench2_64, $engine, 1<<6); - bench_digest!(bench3_256, $engine, 1<<8); - bench_digest!(bench4_1k, $engine, 1<<10); - bench_digest!(bench5_4k, $engine, 1<<12); - bench_digest!(bench6_16k, $engine, 1<<14); - } -} diff --git a/crypto-tests/src/lib.rs b/crypto-tests/src/lib.rs deleted file mode 100644 index 45f06186..00000000 --- a/crypto-tests/src/lib.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![no_std] -extern crate digest; -extern crate crypto_mac; -extern crate block_cipher_trait; - -pub mod hash; -pub mod mac; -pub mod block_cipher; \ No newline at end of file diff --git a/crypto-tests/src/mac.rs b/crypto-tests/src/mac.rs deleted file mode 100644 index 8b4ae179..00000000 --- a/crypto-tests/src/mac.rs +++ /dev/null @@ -1,39 +0,0 @@ -use crypto_mac::Mac; - -pub struct MacTest { - pub name: &'static str, - pub key: &'static [u8], - pub input: &'static [u8], - pub output: &'static [u8], -} - -#[macro_export] -macro_rules! new_mac_tests { - ( $( $name:expr ),* ) => { - [$( - MacTest { - name: $name, - key: include_bytes!(concat!("data/", $name, ".key.bin")), - input: include_bytes!(concat!("data/", $name, ".input.bin")), - output: include_bytes!(concat!("data/", $name, ".output.bin")), - }, - )*] - }; -} - -pub fn mac_test(tests: &[MacTest]) { - for test in tests.iter() { - let mut mac = M::new(test.key).unwrap(); - mac.input(&test.input[..]); - mac.verify(test.output).unwrap(); - } - - // incremental test - for test in tests.iter() { - let mut mac = M::new(test.key).unwrap(); - for i in 0..test.input.len() { - mac.input(&test.input[i..i + 1]); - } - mac.verify(test.output).unwrap(); - } -} diff --git a/ctgrind/.travis.yml b/ctgrind/.travis.yml deleted file mode 100644 index d3b8a0b5..00000000 --- a/ctgrind/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: rust - -rust: - - nightly diff --git a/ctgrind/Cargo.toml b/ctgrind/Cargo.toml deleted file mode 100644 index 2732765a..00000000 --- a/ctgrind/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "ctgrind" -version = "0.1.0" -authors = ["The Rust-Crypto Project Developers"] -license = "MIT/Apache-2.0" -description = "Tool for checking that functions are constant time using Valgrind" -documentation = "https://docs.rs/ctgrind" -repository = "https://github.com/RustCrypto/utils" -keywords = ["utils", "crypto", "constant-time"] - -[dependencies] -vgrs = {git = "https://github.com/kmcallister/vgrs"} - -[workspace] diff --git a/ctgrind/LICENSE-APACHE b/ctgrind/LICENSE-APACHE deleted file mode 100644 index 78173fa2..00000000 --- a/ctgrind/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/ctgrind/LICENSE-MIT b/ctgrind/LICENSE-MIT deleted file mode 100644 index 3953e26a..00000000 --- a/ctgrind/LICENSE-MIT +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2015 Michael Gehring - -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/ctgrind/README.md b/ctgrind/README.md deleted file mode 100644 index c6cf3872..00000000 --- a/ctgrind/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# ctgrind [![Documentation](https://docs.rs/ctgrind/badge.svg)](https://docs.rs/ctgrind) -Tool for checking that functions are constant time using Valgrind. Based on -the work of [Adam Langley](https://github.com/agl/ctgrind) and -[Michael Gehring](https://github.com/ebfe/rust-ctgrind). diff --git a/ctgrind/examples/test.rs b/ctgrind/examples/test.rs deleted file mode 100644 index 36dff962..00000000 --- a/ctgrind/examples/test.rs +++ /dev/null @@ -1,36 +0,0 @@ -extern crate ctgrind; - -fn check16_bad(a: &[u8], b: &[u8]) -> bool { - for i in 0..a.len() { - if a[i] != b[i] { - return false; - } - } - true -} - -fn check16_good(a: &[u8], b: &[u8]) -> bool { - let mut r = 0u8; - for i in 0..a.len() { - r |= a[i] ^ b[i]; - } - return r == 0; -} - -fn bad_memory_access(a: &[u8]) -> u8 { - let r = [1u8, 0]; - r[(a[0] & 1) as usize] -} - -pub fn main() { - let a : [u8; 16] = [0; 16]; - let b : [u8; 16] = [0; 16]; - - ctgrind::poison(a.as_ref().as_ptr() as *const (), a.len()); - println!("check16_bad"); - check16_bad(a.as_ref(), b.as_ref()); - println!("check16_good"); - check16_good(a.as_ref(), b.as_ref()); - println!("bad_memory_access"); - bad_memory_access(a.as_ref()); -} diff --git a/ctgrind/src/lib.rs b/ctgrind/src/lib.rs deleted file mode 100644 index 6e4d997e..00000000 --- a/ctgrind/src/lib.rs +++ /dev/null @@ -1,15 +0,0 @@ -extern crate vgrs; - -use vgrs::memcheck::{make_mem_undefined, make_mem_defined}; - -pub fn poison(addr: *const (), len: usize) { - unsafe { - make_mem_undefined(addr, len); - } -} - -pub fn unpoison(addr: *const (), len: usize) { - unsafe { - make_mem_defined(addr, len); - } -} diff --git a/digest-buffer/Cargo.toml b/digest-buffer/Cargo.toml deleted file mode 100644 index 230e794c..00000000 --- a/digest-buffer/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "digest-buffer" -version = "0.3.1" -authors = ["The Rust-Crypto Project Developers"] -license = "MIT/Apache-2.0" -description = "Fixed size buffer for use in cryptographic hash functions" -documentation = "https://docs.rs/digest-buffer" -repository = "https://github.com/RustCrypto/hashes" -keywords = ["buffer", "digest"] - -[dependencies] -byte-tools = "0.1" -generic-array = "0.7" diff --git a/digest-buffer/LICENSE-APACHE b/digest-buffer/LICENSE-APACHE deleted file mode 100644 index 78173fa2..00000000 --- a/digest-buffer/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/digest-buffer/LICENSE-MIT b/digest-buffer/LICENSE-MIT deleted file mode 100644 index 502cee6e..00000000 --- a/digest-buffer/LICENSE-MIT +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2018-2019 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/digest-buffer/src/lib.rs b/digest-buffer/src/lib.rs deleted file mode 100644 index 53c8197b..00000000 --- a/digest-buffer/src/lib.rs +++ /dev/null @@ -1,110 +0,0 @@ -#![no_std] -extern crate byte_tools; -extern crate generic_array; -use generic_array::{GenericArray, ArrayLength}; -use byte_tools::zero; - -type Block = GenericArray; - -#[derive(Clone, Copy)] -pub struct DigestBuffer> where N::ArrayType: Copy { - buffer: GenericArray, - pos: usize, -} - -impl > DigestBuffer where N::ArrayType: Copy { - pub fn new() -> DigestBuffer { - DigestBuffer:: { - buffer: Default::default(), - pos: 0, - } - } - - pub fn input)>(&mut self, mut input: &[u8], mut func: F) { - // If there is already data in the buffer, copy as much as we can - // into it and process the data if the buffer becomes full. - if self.pos != 0 { - let rem = N::to_usize() - self.pos; - - if input.len() >= rem { - let (l, r) = input.split_at(rem); - input = r; - self.buffer[self.pos..].copy_from_slice(l); - self.pos = 0; - func(&self.buffer); - } else { - let end = self.pos + input.len(); - self.buffer[self.pos..end].copy_from_slice(input); - self.pos = end; - return; - } - } - - // While we have at least a full buffer size chunks's worth of data, - // process that data without copying it into the buffer - while input.len() >= N::to_usize() { - let (l, r) = input.split_at(N::to_usize()); - input = r; - let block = GenericArray::from_slice(&l); - func(block); - } - - // Copy any input data into the buffer. At this point in the method, - // the ammount of data left in the input vector will be less than - // the buffer size and the buffer will be empty. - self.buffer[..input.len()].copy_from_slice(input); - self.pos += input.len(); - } - - pub fn reset(&mut self) { - self.pos = 0; - } - - pub fn zero_until(&mut self, idx: usize) { - assert!(idx >= self.pos); - zero(&mut self.buffer[self.pos..idx]); - self.pos = idx; - } - - pub fn next(&mut self, len: usize) -> &mut [u8] { - self.pos += len; - &mut self.buffer[self.pos - len..self.pos] - } - - pub fn full_buffer(& mut self) -> &Block { - assert!(self.pos == self.size()); - self.pos = 0; - &self.buffer - } - - pub fn current_buffer(&mut self) -> &[u8] { - let tmp = self.pos; - self.pos = 0; - &self.buffer[..tmp] - } - - pub fn position(&self) -> usize { self.pos } - - pub fn remaining(&self) -> usize { self.size() - self.pos } - - pub fn standard_padding)>(&mut self, rem: usize, mut func: F) { - let size = self.size(); - - self.next(1)[0] = 128; - - if self.remaining() < rem { - self.zero_until(size); - func(self.full_buffer()); - } - - self.zero_until(size - rem); - } - - pub fn size(&self) -> usize { - N::to_usize() - } -} - -impl > Default for DigestBuffer where N::ArrayType: Copy { - fn default() -> Self { Self::new() } -} diff --git a/fake-simd/Cargo.toml b/fake-simd/Cargo.toml deleted file mode 100644 index 135c6609..00000000 --- a/fake-simd/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "fake-simd" -version = "0.1.2" -authors = ["The Rust-Crypto Project Developers"] -license = "MIT/Apache-2.0" -description = "Crate for mimicking simd crate on stable Rust" -documentation = "https://docs.rs/fake-simd" -repository = "https://github.com/RustCrypto/utils" -keywords = ["simd"] diff --git a/fake-simd/LICENSE-APACHE b/fake-simd/LICENSE-APACHE deleted file mode 100644 index 78173fa2..00000000 --- a/fake-simd/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/fake-simd/LICENSE-MIT b/fake-simd/LICENSE-MIT deleted file mode 100644 index 1da3a5f6..00000000 --- a/fake-simd/LICENSE-MIT +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2006-2009 Graydon Hoare -Copyright (c) 2009-2013 Mozilla Foundation - -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/fake-simd/src/lib.rs b/fake-simd/src/lib.rs deleted file mode 100644 index e10f490e..00000000 --- a/fake-simd/src/lib.rs +++ /dev/null @@ -1,135 +0,0 @@ -#![no_std] -use core::ops::{Add, BitAnd, BitOr, BitXor, Shl, Shr, Sub}; - -#[derive(Clone, Copy, PartialEq, Eq)] -#[allow(non_camel_case_types)] -pub struct u32x4(pub u32, pub u32, pub u32, pub u32); - -impl Add for u32x4 { - type Output = u32x4; - - #[inline(always)] - fn add(self, rhs: u32x4) -> u32x4 { - u32x4( - self.0.wrapping_add(rhs.0), - self.1.wrapping_add(rhs.1), - self.2.wrapping_add(rhs.2), - self.3.wrapping_add(rhs.3), - ) - } -} - -impl Sub for u32x4 { - type Output = u32x4; - - #[inline(always)] - fn sub(self, rhs: u32x4) -> u32x4 { - u32x4( - self.0.wrapping_sub(rhs.0), - self.1.wrapping_sub(rhs.1), - self.2.wrapping_sub(rhs.2), - self.3.wrapping_sub(rhs.3), - ) - } -} - -impl BitAnd for u32x4 { - type Output = u32x4; - - #[inline(always)] - fn bitand(self, rhs: u32x4) -> u32x4 { - u32x4( - self.0 & rhs.0, - self.1 & rhs.1, - self.2 & rhs.2, - self.3 & rhs.3, - ) - } -} - -impl BitOr for u32x4 { - type Output = u32x4; - - #[inline(always)] - fn bitor(self, rhs: u32x4) -> u32x4 { - u32x4( - self.0 | rhs.0, - self.1 | rhs.1, - self.2 | rhs.2, - self.3 | rhs.3, - ) - } -} - -impl BitXor for u32x4 { - type Output = u32x4; - - #[inline(always)] - fn bitxor(self, rhs: u32x4) -> u32x4 { - u32x4( - self.0 ^ rhs.0, - self.1 ^ rhs.1, - self.2 ^ rhs.2, - self.3 ^ rhs.3, - ) - } -} - -impl Shl for u32x4 { - type Output = u32x4; - - #[inline(always)] - fn shl(self, amt: usize) -> u32x4 { - u32x4(self.0 << amt, self.1 << amt, self.2 << amt, self.3 << amt) - } -} - -impl Shl for u32x4 { - type Output = u32x4; - - #[inline(always)] - fn shl(self, rhs: u32x4) -> u32x4 { - u32x4( - self.0 << rhs.0, - self.1 << rhs.1, - self.2 << rhs.2, - self.3 << rhs.3, - ) - } -} - -impl Shr for u32x4 { - type Output = u32x4; - - #[inline(always)] - fn shr(self, amt: usize) -> u32x4 { - u32x4(self.0 >> amt, self.1 >> amt, self.2 >> amt, self.3 >> amt) - } -} - -impl Shr for u32x4 { - type Output = u32x4; - - #[inline(always)] - fn shr(self, rhs: u32x4) -> u32x4 { - u32x4( - self.0 >> rhs.0, - self.1 >> rhs.1, - self.2 >> rhs.2, - self.3 >> rhs.3, - ) - } -} - -#[derive(Clone, Copy)] -#[allow(non_camel_case_types)] -pub struct u64x2(pub u64, pub u64); - -impl Add for u64x2 { - type Output = u64x2; - - #[inline(always)] - fn add(self, rhs: u64x2) -> u64x2 { - u64x2(self.0.wrapping_add(rhs.0), self.1.wrapping_add(rhs.1)) - } -}