diff --git a/Cargo.toml b/Cargo.toml index 3d5196a..7ef31bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,16 +8,13 @@ name = "sodiumoxide" readme = "README.md" repository = "https://github.com/sodiumoxide/sodiumoxide" categories = ["cryptography"] -version = "0.2.4" +version = "0.3.0" exclude = [ "**/.gitignore", ".travis.yml", "bors.toml" ] -[workspace] -members = ["libsodium-sys", "testcrate"] - [badges] travis-ci = { repository = "sodiumoxide/sodiumoxide" } appveyor = { repository = "Dylan-DPC/sodiumoxide", id = "u05iy6wufw9ncdi7" } @@ -25,7 +22,7 @@ coveralls = { repository = "sodiumoxide/sodiumoxide" } [dependencies] libc = { version = "^0.2.41" , default-features = false } -libsodium-sys = { version = "0.2.4", path = "libsodium-sys" } +libsodium-sys = { package = "libsodium-sys-stable", version = "1.20.4" } serde = { version = "^1.0.59", default-features = false, optional = true } [dev-dependencies] diff --git a/libsodium-sys/.gitignore b/libsodium-sys/.gitignore deleted file mode 100644 index 46d6bed..0000000 --- a/libsodium-sys/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -#### IDEs #### -### CLion ### -# CMake -cmake-build-debug/ - -### IntelliJ ### -.idea -*.iws -*.iml -*.ipr - -### Vim ### -.sw[a-p] -.*.sw[a-p] -Session.vim -.netrwhist -*~ - -### Visual Studio Code ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -.history - -#### Languages #### -### Rust ### -/target/ -Cargo.lock diff --git a/libsodium-sys/Cargo.toml b/libsodium-sys/Cargo.toml deleted file mode 100644 index c76c41c..0000000 --- a/libsodium-sys/Cargo.toml +++ /dev/null @@ -1,36 +0,0 @@ -[package] -authors = ["dnaq"] -build = "build.rs" -description = "FFI binding to libsodium" -documentation = "https://sodiumoxide.github.io/sodiumoxide" -keywords = ["libsodium", "NaCl", "crypto"] -license = "MIT OR Apache-2.0" -links = "sodium" -name = "libsodium-sys" -repository = "https://github.com/sodiumoxide/sodiumoxide.git" -categories = ["cryptography", "api-bindings"] -version = "0.2.4" - -[badges] -travis-ci = { repository = "sodiumoxide/sodiumoxide" } - -[build-dependencies] -pkg-config = "0.3" -tar = "0.4" -libflate = "0.1" - -[target.'cfg(target_env = "msvc")'.build-dependencies] -libc = { version = "0.2" , default-features = false } -vcpkg = "0.2" - -[target.'cfg(not(target_env = "msvc"))'.build-dependencies] -cc = "1.0" - -[dependencies] -libc = { version = "0.2" , default-features = false } - -[lib] -name = "libsodium_sys" - -[features] -use-pkg-config = [] diff --git a/libsodium-sys/LICENSE-APACHE b/libsodium-sys/LICENSE-APACHE deleted file mode 100644 index 11069ed..0000000 --- a/libsodium-sys/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/libsodium-sys/LICENSE-MIT b/libsodium-sys/LICENSE-MIT deleted file mode 100644 index a8baa98..0000000 --- a/libsodium-sys/LICENSE-MIT +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2015 The sodiumoxide 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/libsodium-sys/README.md b/libsodium-sys/README.md deleted file mode 100644 index f10c8cc..0000000 --- a/libsodium-sys/README.md +++ /dev/null @@ -1,12 +0,0 @@ -> libsodium-sys - -# Build output ENV Variables -This is the possible build metadata for the crate. -* `DEP_SODIUM_INCLUDE` is the directory which contains the `sodium.h` header. - It is only available if the header was installed and `SODIUM_LIB_DIR` was not set. -* `DEP_SODIUM_LIB` is the directory containing the compiled library. - It is only available if `SODIUM_LIB_DIR` was not set. - -See [`link build metadata`] for more information about build metadata. - -[`link build metadata`]: https://doc.rust-lang.org/cargo/reference/build-scripts.html#the-links-manifest-key diff --git a/libsodium-sys/build.rs b/libsodium-sys/build.rs deleted file mode 100644 index 26d7878..0000000 --- a/libsodium-sys/build.rs +++ /dev/null @@ -1,444 +0,0 @@ -#[cfg(not(windows))] -extern crate cc; - -#[cfg(target_env = "msvc")] -extern crate libc; -#[cfg(target_env = "msvc")] -extern crate vcpkg; - -extern crate libflate; -extern crate pkg_config; -extern crate tar; - -use std::{ - env, - path::{Path, PathBuf}, -}; - -static VERSION: &'static str = "1.0.18"; - -fn main() { - println!("cargo:rerun-if-env-changed=SODIUM_LIB_DIR"); - println!("cargo:rerun-if-env-changed=SODIUM_SHARED"); - println!("cargo:rerun-if-env-changed=SODIUM_USE_PKG_CONFIG"); - - if cfg!(target_env = "msvc") { - // vcpkg requires to set env VCPKGRS_DYNAMIC - println!("cargo:rerun-if-env-changed=VCPKGRS_DYNAMIC"); - } - if cfg!(not(windows)) { - println!("cargo:rerun-if-env-changed=SODIUM_DISABLE_PIE"); - } - - if env::var("SODIUM_STATIC").is_ok() { - panic!("SODIUM_STATIC is deprecated. Use SODIUM_SHARED instead."); - } - - let lib_dir_isset = env::var("SODIUM_LIB_DIR").is_ok(); - let use_pkg_isset = if cfg!(feature = "use-pkg-config") { - true - } else { - env::var("SODIUM_USE_PKG_CONFIG").is_ok() - }; - let shared_isset = env::var("SODIUM_SHARED").is_ok(); - - if lib_dir_isset && use_pkg_isset { - panic!("SODIUM_LIB_DIR is incompatible with SODIUM_USE_PKG_CONFIG. Set the only one env variable"); - } - - if lib_dir_isset { - find_libsodium_env(); - } else if use_pkg_isset { - if shared_isset { - println!("cargo:warning=SODIUM_SHARED has no effect with SODIUM_USE_PKG_CONFIG"); - } - - find_libsodium_pkg(); - } else { - if shared_isset { - println!( - "cargo:warning=SODIUM_SHARED has no effect for building libsodium from source" - ); - } - - build_libsodium(); - } -} - -/* Must be called when SODIUM_LIB_DIR is set to any value -This function will set `cargo` flags. -*/ -fn find_libsodium_env() { - let lib_dir = env::var("SODIUM_LIB_DIR").unwrap(); // cannot fail - - println!("cargo:rustc-link-search=native={}", lib_dir); - let mode = if env::var("SODIUM_SHARED").is_ok() { - "dylib" - } else { - "static" - }; - let name = if cfg!(target_env = "msvc") { - "libsodium" - } else { - "sodium" - }; - println!("cargo:rustc-link-lib={}={}", mode, name); - println!( - "cargo:warning=Using unknown libsodium version. This crate is tested against \ - {} and may not be fully compatible with other versions.", - VERSION - ); -} - -/* Must be called when no SODIUM_USE_PKG_CONFIG env var is set -This function will set `cargo` flags. -*/ -#[cfg(target_env = "msvc")] -fn find_libsodium_pkg() { - match vcpkg::probe_package("libsodium") { - Ok(lib) => { - println!( - "cargo:warning=Using unknown libsodium version. This crate is tested against \ - {} and may not be fully compatible with other versions.", - VERSION - ); - for lib_dir in &lib.link_paths { - println!("cargo:lib={}", lib_dir.to_str().unwrap()); - } - for include_dir in &lib.include_paths { - println!("cargo:include={}", include_dir.to_str().unwrap()); - } - } - Err(e) => { - panic!(format!("Error: {:?}", e)); - } - }; -} - -/* Must be called when SODIUM_USE_PKG_CONFIG env var is set -This function will set `cargo` flags. -*/ -#[cfg(not(target_env = "msvc"))] -fn find_libsodium_pkg() { - match pkg_config::Config::new().probe("libsodium") { - Ok(lib) => { - if lib.version != VERSION { - println!( - "cargo:warning=Using libsodium version {}. This crate is tested against {} \ - and may not be fully compatible with {}.", - lib.version, VERSION, lib.version - ); - } - for lib_dir in &lib.link_paths { - println!("cargo:lib={}", lib_dir.to_str().unwrap()); - } - for include_dir in &lib.include_paths { - println!("cargo:include={}", include_dir.to_str().unwrap()); - } - } - Err(e) => { - panic!(format!("Error: {:?}", e)); - } - } -} - -#[cfg(windows)] -fn make_libsodium(_: &str, _: &Path, _: &Path) -> PathBuf { - // We don't build anything on windows, we simply linked to precompiled - // libs. - get_lib_dir() -} - -#[cfg(not(windows))] -fn make_libsodium(target: &str, source_dir: &Path, install_dir: &Path) -> PathBuf { - use std::{fs, process::Command, str}; - - // Decide on CC, CFLAGS and the --host configure argument - let build = cc::Build::new(); - let mut compiler = build.get_compiler().path().to_str().unwrap().to_string(); - let mut cflags = env::var("CFLAGS").unwrap_or(String::default()); - cflags += " -O2"; - let host_arg; - let cross_compiling; - let help; - if target.contains("-ios") { - // Determine Xcode directory path - let xcode_select_output = Command::new("xcode-select").arg("-p").output().unwrap(); - if !xcode_select_output.status.success() { - panic!("Failed to run xcode-select -p"); - } - let xcode_dir = str::from_utf8(&xcode_select_output.stdout) - .unwrap() - .trim() - .to_string(); - - // Determine SDK directory paths - let sdk_dir_simulator = Path::new(&xcode_dir) - .join("Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk") - .to_str() - .unwrap() - .to_string(); - let sdk_dir_ios = Path::new(&xcode_dir) - .join("Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk") - .to_str() - .unwrap() - .to_string(); - - // Min versions - let ios_simulator_version_min = "6.0.0"; - let ios_version_min = "6.0.0"; - - // Roughly based on `dist-build/ios.sh` in the libsodium sources - match &*target { - "aarch64-apple-ios" => { - cflags += " -arch arm64"; - cflags += &format!(" -isysroot {}", sdk_dir_ios); - cflags += &format!(" -mios-version-min={}", ios_version_min); - cflags += " -fembed-bitcode"; - host_arg = "--host=arm-apple-darwin10".to_string(); - } - "armv7-apple-ios" => { - cflags += " -arch armv7"; - cflags += &format!(" -isysroot {}", sdk_dir_ios); - cflags += &format!(" -mios-version-min={}", ios_version_min); - cflags += " -mthumb"; - host_arg = "--host=arm-apple-darwin10".to_string(); - } - "armv7s-apple-ios" => { - cflags += " -arch armv7s"; - cflags += &format!(" -isysroot {}", sdk_dir_ios); - cflags += &format!(" -mios-version-min={}", ios_version_min); - cflags += " -mthumb"; - host_arg = "--host=arm-apple-darwin10".to_string(); - } - "i386-apple-ios" => { - cflags += " -arch i386"; - cflags += &format!(" -isysroot {}", sdk_dir_simulator); - cflags += &format!(" -mios-simulator-version-min={}", ios_simulator_version_min); - host_arg = "--host=i686-apple-darwin10".to_string(); - } - "x86_64-apple-ios" => { - cflags += " -arch x86_64"; - cflags += &format!(" -isysroot {}", sdk_dir_simulator); - cflags += &format!(" -mios-simulator-version-min={}", ios_simulator_version_min); - host_arg = "--host=x86_64-apple-darwin10".to_string(); - } - _ => panic!("Unknown iOS build target: {}", target), - } - cross_compiling = true; - help = ""; - } else { - if target.contains("i686") { - compiler += " -m32 -maes"; - cflags += " -march=i686"; - } - let host = env::var("HOST").unwrap(); - host_arg = format!("--host={}", target); - cross_compiling = target != host; - help = if cross_compiling { - "***********************************************************\n\ - Possible missing dependencies.\n\ - See https://github.com/sodiumoxide/sodiumoxide#cross-compiling\n\ - ***********************************************************\n\n" - } else { - "" - }; - } - - // Run `./configure` - let prefix_arg = format!("--prefix={}", install_dir.to_str().unwrap()); - let mut configure_cmd = Command::new(fs::canonicalize(source_dir.join("configure")).unwrap()); - if !compiler.is_empty() { - configure_cmd.env("CC", &compiler); - } - if !cflags.is_empty() { - configure_cmd.env("CFLAGS", &cflags); - } - if env::var("SODIUM_DISABLE_PIE").is_ok() { - configure_cmd.arg("--disable-pie"); - } - let configure_output = configure_cmd - .current_dir(&source_dir) - .arg(&prefix_arg) - .arg(&host_arg) - .arg("--enable-shared=no") - .output() - .unwrap_or_else(|error| { - panic!("Failed to run './configure': {}\n{}", error, help); - }); - if !configure_output.status.success() { - panic!( - "\n{:?}\nCFLAGS={}\nCC={}\n{}\n{}\n{}\n", - configure_cmd, - cflags, - compiler, - String::from_utf8_lossy(&configure_output.stdout), - String::from_utf8_lossy(&configure_output.stderr), - help - ); - } - - // Run `make check`, or `make all` if we're cross-compiling - let j_arg = format!("-j{}", env::var("NUM_JOBS").unwrap()); - let make_arg = if cross_compiling { "all" } else { "check" }; - let mut make_cmd = Command::new("make"); - let make_output = make_cmd - .current_dir(&source_dir) - .env("V", "1") - .arg(make_arg) - .arg(&j_arg) - .output() - .unwrap_or_else(|error| { - panic!("Failed to run 'make {}': {}\n{}", make_arg, error, help); - }); - if !make_output.status.success() { - panic!( - "\n{:?}\n{}\n{}\n{}\n{}", - make_cmd, - String::from_utf8_lossy(&configure_output.stdout), - String::from_utf8_lossy(&make_output.stdout), - String::from_utf8_lossy(&make_output.stderr), - help - ); - } - - // Run `make install` - let mut install_cmd = Command::new("make"); - let install_output = install_cmd - .current_dir(&source_dir) - .arg("install") - .output() - .unwrap_or_else(|error| { - panic!("Failed to run 'make install': {}", error); - }); - if !install_output.status.success() { - panic!( - "\n{:?}\n{}\n{}\n{}\n{}\n", - install_cmd, - String::from_utf8_lossy(&configure_output.stdout), - String::from_utf8_lossy(&make_output.stdout), - String::from_utf8_lossy(&install_output.stdout), - String::from_utf8_lossy(&install_output.stderr) - ); - } - - install_dir.join("lib") -} - -#[cfg(any(windows, target_env = "msvc"))] -fn get_crate_dir() -> PathBuf { - env::var("CARGO_MANIFEST_DIR").unwrap().into() -} - -#[cfg(target_env = "msvc")] -fn is_release_profile() -> bool { - env::var("PROFILE").unwrap() == "release" -} - -#[cfg(all(target_env = "msvc", target_pointer_width = "32"))] -fn get_lib_dir() -> PathBuf { - if is_release_profile() { - get_crate_dir().join("msvc/Win32/Release/v140/") - } else { - get_crate_dir().join("msvc/Win32/Debug/v140/") - } -} - -#[cfg(all(target_env = "msvc", target_pointer_width = "64"))] -fn get_lib_dir() -> PathBuf { - if is_release_profile() { - get_crate_dir().join("msvc/x64/Release/v140/") - } else { - get_crate_dir().join("msvc/x64/Debug/v140/") - } -} - -#[cfg(all(windows, not(target_env = "msvc"), target_pointer_width = "32"))] -fn get_lib_dir() -> PathBuf { - get_crate_dir().join("mingw/win32/") -} - -#[cfg(all(windows, not(target_env = "msvc"), target_pointer_width = "64"))] -fn get_lib_dir() -> PathBuf { - get_crate_dir().join("mingw/win64/") -} - -fn get_archive(filename: &str) -> std::io::Cursor> { - use std::fs::File; - use std::io::{BufReader, Read}; - - let f = File::open(filename).expect(&format!("Failed to open {}", filename)); - let mut reader = BufReader::new(f); - let mut content = Vec::new(); - reader - .read_to_end(&mut content) - .expect(&format!("Failed to read {}", filename)); - - std::io::Cursor::new(content) -} - -fn get_install_dir() -> PathBuf { - PathBuf::from(env::var("OUT_DIR").unwrap()).join("installed") -} - -fn build_libsodium() { - use libflate::gzip::Decoder; - use std::fs; - use tar::Archive; - - // Determine build target triple - let target = env::var("TARGET").unwrap(); - - // Determine filenames - let basename = format!("libsodium-{}", VERSION); - let filename = format!("{}.tar.gz", basename); - - // Determine source and install dir - let mut install_dir = get_install_dir(); - let mut source_dir = PathBuf::from(env::var("OUT_DIR").unwrap()).join("source"); - - // Avoid issues with paths containing spaces by falling back to using a tempfile. - // See https://github.com/jedisct1/libsodium/issues/207 - if install_dir.to_str().unwrap().contains(" ") { - let fallback_path = PathBuf::from("/tmp/").join(&basename).join(&target); - install_dir = fallback_path.clone().join("installed"); - source_dir = fallback_path.clone().join("/source"); - println!( - "cargo:warning=The path to the usual build directory contains spaces and hence \ - can't be used to build libsodium. Falling back to use {}. If running `cargo \ - clean`, ensure you also delete this fallback directory", - fallback_path.to_str().unwrap() - ); - } - - // Create directories - fs::create_dir_all(&install_dir).unwrap(); - fs::create_dir_all(&source_dir).unwrap(); - - // Get sources - let compressed_file = get_archive(&filename); - - // Unpack the tarball - let gz_decoder = Decoder::new(compressed_file).unwrap(); - let mut archive = Archive::new(gz_decoder); - archive.unpack(&source_dir).unwrap(); - source_dir.push(basename); - - let lib_dir = make_libsodium(&target, &source_dir, &install_dir); - - if target.contains("msvc") { - println!("cargo:rustc-link-lib=static=libsodium"); - } else { - println!("cargo:rustc-link-lib=static=sodium"); - } - - println!( - "cargo:rustc-link-search=native={}", - lib_dir.to_str().unwrap() - ); - - let include_dir = source_dir.join("src/libsodium/include"); - - println!("cargo:include={}", include_dir.to_str().unwrap()); - println!("cargo:lib={}", lib_dir.to_str().unwrap()); -} diff --git a/libsodium-sys/libsodium-1.0.18.tar.gz b/libsodium-sys/libsodium-1.0.18.tar.gz deleted file mode 100644 index ca816de..0000000 Binary files a/libsodium-sys/libsodium-1.0.18.tar.gz and /dev/null differ diff --git a/libsodium-sys/mingw/win32/libsodium.a b/libsodium-sys/mingw/win32/libsodium.a deleted file mode 100644 index 4837472..0000000 Binary files a/libsodium-sys/mingw/win32/libsodium.a and /dev/null differ diff --git a/libsodium-sys/mingw/win64/libsodium.a b/libsodium-sys/mingw/win64/libsodium.a deleted file mode 100644 index b286e01..0000000 Binary files a/libsodium-sys/mingw/win64/libsodium.a and /dev/null differ diff --git a/libsodium-sys/msvc/Win32/Debug/v140/libsodium.lib b/libsodium-sys/msvc/Win32/Debug/v140/libsodium.lib deleted file mode 100644 index 4f56277..0000000 Binary files a/libsodium-sys/msvc/Win32/Debug/v140/libsodium.lib and /dev/null differ diff --git a/libsodium-sys/msvc/Win32/Release/v140/libsodium.lib b/libsodium-sys/msvc/Win32/Release/v140/libsodium.lib deleted file mode 100644 index b220532..0000000 Binary files a/libsodium-sys/msvc/Win32/Release/v140/libsodium.lib and /dev/null differ diff --git a/libsodium-sys/msvc/x64/Debug/v140/libsodium.lib b/libsodium-sys/msvc/x64/Debug/v140/libsodium.lib deleted file mode 100644 index 16c3c5d..0000000 Binary files a/libsodium-sys/msvc/x64/Debug/v140/libsodium.lib and /dev/null differ diff --git a/libsodium-sys/msvc/x64/Release/v140/libsodium.lib b/libsodium-sys/msvc/x64/Release/v140/libsodium.lib deleted file mode 100644 index be61e11..0000000 Binary files a/libsodium-sys/msvc/x64/Release/v140/libsodium.lib and /dev/null differ diff --git a/libsodium-sys/sodium_wrapper.h b/libsodium-sys/sodium_wrapper.h deleted file mode 100644 index 968ee21..0000000 --- a/libsodium-sys/sodium_wrapper.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/libsodium-sys/src/gen.sh b/libsodium-sys/src/gen.sh deleted file mode 100755 index b0639c2..0000000 --- a/libsodium-sys/src/gen.sh +++ /dev/null @@ -1,12 +0,0 @@ -# call this script manually to regen bindings from a new version of libsodium -# make sure that you have up-to-date bindgen (at least 0.48.0 to avoid problems with alignments) - -# a whitelist regex to generate entities -REGEX="(SODIUM|sodium|crypto|randombytes)_.*" - -bindgen PATH_TO/libsodium-1.0.18/src/libsodium/include/sodium.h -o sodium_bindings.rs \ - --ctypes-prefix=libc --use-core \ - --generate=functions,types,vars \ - --whitelist-function=$REGEX \ - --whitelist-type=$REGEX \ - --whitelist-var=$REGEX diff --git a/libsodium-sys/src/lib.rs b/libsodium-sys/src/lib.rs deleted file mode 100644 index 07e88b7..0000000 --- a/libsodium-sys/src/lib.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![no_std] -#![allow(non_upper_case_globals)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(clippy::all)] // we can't control bindgen output to make clippy happy - -extern crate libc; - -mod sodium_bindings; -pub use sodium_bindings::*; diff --git a/libsodium-sys/src/sodium_bindings.rs b/libsodium-sys/src/sodium_bindings.rs deleted file mode 100644 index c3d2e2f..0000000 --- a/libsodium-sys/src/sodium_bindings.rs +++ /dev/null @@ -1,3823 +0,0 @@ -/* automatically generated by rust-bindgen */ - -pub const SODIUM_VERSION_STRING: &'static [u8; 7usize] = b"1.0.18\0"; -pub const SODIUM_LIBRARY_VERSION_MAJOR: u32 = 10; -pub const SODIUM_LIBRARY_VERSION_MINOR: u32 = 3; -pub const crypto_aead_aes256gcm_KEYBYTES: u32 = 32; -pub const crypto_aead_aes256gcm_NSECBYTES: u32 = 0; -pub const crypto_aead_aes256gcm_NPUBBYTES: u32 = 12; -pub const crypto_aead_aes256gcm_ABYTES: u32 = 16; -pub const crypto_aead_chacha20poly1305_ietf_KEYBYTES: u32 = 32; -pub const crypto_aead_chacha20poly1305_ietf_NSECBYTES: u32 = 0; -pub const crypto_aead_chacha20poly1305_ietf_NPUBBYTES: u32 = 12; -pub const crypto_aead_chacha20poly1305_ietf_ABYTES: u32 = 16; -pub const crypto_aead_chacha20poly1305_KEYBYTES: u32 = 32; -pub const crypto_aead_chacha20poly1305_NSECBYTES: u32 = 0; -pub const crypto_aead_chacha20poly1305_NPUBBYTES: u32 = 8; -pub const crypto_aead_chacha20poly1305_ABYTES: u32 = 16; -pub const crypto_aead_chacha20poly1305_IETF_KEYBYTES: u32 = 32; -pub const crypto_aead_chacha20poly1305_IETF_NSECBYTES: u32 = 0; -pub const crypto_aead_chacha20poly1305_IETF_NPUBBYTES: u32 = 12; -pub const crypto_aead_chacha20poly1305_IETF_ABYTES: u32 = 16; -pub const crypto_aead_xchacha20poly1305_ietf_KEYBYTES: u32 = 32; -pub const crypto_aead_xchacha20poly1305_ietf_NSECBYTES: u32 = 0; -pub const crypto_aead_xchacha20poly1305_ietf_NPUBBYTES: u32 = 24; -pub const crypto_aead_xchacha20poly1305_ietf_ABYTES: u32 = 16; -pub const crypto_aead_xchacha20poly1305_IETF_KEYBYTES: u32 = 32; -pub const crypto_aead_xchacha20poly1305_IETF_NSECBYTES: u32 = 0; -pub const crypto_aead_xchacha20poly1305_IETF_NPUBBYTES: u32 = 24; -pub const crypto_aead_xchacha20poly1305_IETF_ABYTES: u32 = 16; -pub const crypto_hash_sha512_BYTES: u32 = 64; -pub const crypto_auth_hmacsha512_BYTES: u32 = 64; -pub const crypto_auth_hmacsha512_KEYBYTES: u32 = 32; -pub const crypto_auth_hmacsha512256_BYTES: u32 = 32; -pub const crypto_auth_hmacsha512256_KEYBYTES: u32 = 32; -pub const crypto_auth_BYTES: u32 = 32; -pub const crypto_auth_KEYBYTES: u32 = 32; -pub const crypto_auth_PRIMITIVE: &'static [u8; 14usize] = b"hmacsha512256\0"; -pub const crypto_hash_sha256_BYTES: u32 = 32; -pub const crypto_auth_hmacsha256_BYTES: u32 = 32; -pub const crypto_auth_hmacsha256_KEYBYTES: u32 = 32; -pub const crypto_stream_xsalsa20_KEYBYTES: u32 = 32; -pub const crypto_stream_xsalsa20_NONCEBYTES: u32 = 24; -pub const crypto_box_curve25519xsalsa20poly1305_SEEDBYTES: u32 = 32; -pub const crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES: u32 = 32; -pub const crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES: u32 = 32; -pub const crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES: u32 = 32; -pub const crypto_box_curve25519xsalsa20poly1305_NONCEBYTES: u32 = 24; -pub const crypto_box_curve25519xsalsa20poly1305_MACBYTES: u32 = 16; -pub const crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES: u32 = 16; -pub const crypto_box_curve25519xsalsa20poly1305_ZEROBYTES: u32 = 32; -pub const crypto_box_SEEDBYTES: u32 = 32; -pub const crypto_box_PUBLICKEYBYTES: u32 = 32; -pub const crypto_box_SECRETKEYBYTES: u32 = 32; -pub const crypto_box_NONCEBYTES: u32 = 24; -pub const crypto_box_MACBYTES: u32 = 16; -pub const crypto_box_PRIMITIVE: &'static [u8; 27usize] = b"curve25519xsalsa20poly1305\0"; -pub const crypto_box_BEFORENMBYTES: u32 = 32; -pub const crypto_box_SEALBYTES: u32 = 48; -pub const crypto_box_ZEROBYTES: u32 = 32; -pub const crypto_box_BOXZEROBYTES: u32 = 16; -pub const crypto_core_hsalsa20_OUTPUTBYTES: u32 = 32; -pub const crypto_core_hsalsa20_INPUTBYTES: u32 = 16; -pub const crypto_core_hsalsa20_KEYBYTES: u32 = 32; -pub const crypto_core_hsalsa20_CONSTBYTES: u32 = 16; -pub const crypto_core_hchacha20_OUTPUTBYTES: u32 = 32; -pub const crypto_core_hchacha20_INPUTBYTES: u32 = 16; -pub const crypto_core_hchacha20_KEYBYTES: u32 = 32; -pub const crypto_core_hchacha20_CONSTBYTES: u32 = 16; -pub const crypto_core_salsa20_OUTPUTBYTES: u32 = 64; -pub const crypto_core_salsa20_INPUTBYTES: u32 = 16; -pub const crypto_core_salsa20_KEYBYTES: u32 = 32; -pub const crypto_core_salsa20_CONSTBYTES: u32 = 16; -pub const crypto_core_salsa2012_OUTPUTBYTES: u32 = 64; -pub const crypto_core_salsa2012_INPUTBYTES: u32 = 16; -pub const crypto_core_salsa2012_KEYBYTES: u32 = 32; -pub const crypto_core_salsa2012_CONSTBYTES: u32 = 16; -pub const crypto_core_salsa208_OUTPUTBYTES: u32 = 64; -pub const crypto_core_salsa208_INPUTBYTES: u32 = 16; -pub const crypto_core_salsa208_KEYBYTES: u32 = 32; -pub const crypto_core_salsa208_CONSTBYTES: u32 = 16; -pub const crypto_generichash_blake2b_BYTES_MIN: u32 = 16; -pub const crypto_generichash_blake2b_BYTES_MAX: u32 = 64; -pub const crypto_generichash_blake2b_BYTES: u32 = 32; -pub const crypto_generichash_blake2b_KEYBYTES_MIN: u32 = 16; -pub const crypto_generichash_blake2b_KEYBYTES_MAX: u32 = 64; -pub const crypto_generichash_blake2b_KEYBYTES: u32 = 32; -pub const crypto_generichash_blake2b_SALTBYTES: u32 = 16; -pub const crypto_generichash_blake2b_PERSONALBYTES: u32 = 16; -pub const crypto_generichash_BYTES_MIN: u32 = 16; -pub const crypto_generichash_BYTES_MAX: u32 = 64; -pub const crypto_generichash_BYTES: u32 = 32; -pub const crypto_generichash_KEYBYTES_MIN: u32 = 16; -pub const crypto_generichash_KEYBYTES_MAX: u32 = 64; -pub const crypto_generichash_KEYBYTES: u32 = 32; -pub const crypto_generichash_PRIMITIVE: &'static [u8; 8usize] = b"blake2b\0"; -pub const crypto_hash_BYTES: u32 = 64; -pub const crypto_hash_PRIMITIVE: &'static [u8; 7usize] = b"sha512\0"; -pub const crypto_kdf_blake2b_BYTES_MIN: u32 = 16; -pub const crypto_kdf_blake2b_BYTES_MAX: u32 = 64; -pub const crypto_kdf_blake2b_CONTEXTBYTES: u32 = 8; -pub const crypto_kdf_blake2b_KEYBYTES: u32 = 32; -pub const crypto_kdf_BYTES_MIN: u32 = 16; -pub const crypto_kdf_BYTES_MAX: u32 = 64; -pub const crypto_kdf_CONTEXTBYTES: u32 = 8; -pub const crypto_kdf_KEYBYTES: u32 = 32; -pub const crypto_kdf_PRIMITIVE: &'static [u8; 8usize] = b"blake2b\0"; -pub const crypto_kx_PUBLICKEYBYTES: u32 = 32; -pub const crypto_kx_SECRETKEYBYTES: u32 = 32; -pub const crypto_kx_SEEDBYTES: u32 = 32; -pub const crypto_kx_SESSIONKEYBYTES: u32 = 32; -pub const crypto_kx_PRIMITIVE: &'static [u8; 14usize] = b"x25519blake2b\0"; -pub const crypto_onetimeauth_poly1305_BYTES: u32 = 16; -pub const crypto_onetimeauth_poly1305_KEYBYTES: u32 = 32; -pub const crypto_onetimeauth_BYTES: u32 = 16; -pub const crypto_onetimeauth_KEYBYTES: u32 = 32; -pub const crypto_onetimeauth_PRIMITIVE: &'static [u8; 9usize] = b"poly1305\0"; -pub const crypto_pwhash_argon2i_ALG_ARGON2I13: u32 = 1; -pub const crypto_pwhash_argon2i_BYTES_MIN: u32 = 16; -pub const crypto_pwhash_argon2i_PASSWD_MIN: u32 = 0; -pub const crypto_pwhash_argon2i_PASSWD_MAX: u32 = 4294967295; -pub const crypto_pwhash_argon2i_SALTBYTES: u32 = 16; -pub const crypto_pwhash_argon2i_STRBYTES: u32 = 128; -pub const crypto_pwhash_argon2i_STRPREFIX: &'static [u8; 10usize] = b"$argon2i$\0"; -pub const crypto_pwhash_argon2i_OPSLIMIT_MIN: u32 = 3; -pub const crypto_pwhash_argon2i_OPSLIMIT_MAX: u32 = 4294967295; -pub const crypto_pwhash_argon2i_MEMLIMIT_MIN: u32 = 8192; -pub const crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE: u32 = 4; -pub const crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE: u32 = 33554432; -pub const crypto_pwhash_argon2i_OPSLIMIT_MODERATE: u32 = 6; -pub const crypto_pwhash_argon2i_MEMLIMIT_MODERATE: u32 = 134217728; -pub const crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE: u32 = 8; -pub const crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE: u32 = 536870912; -pub const crypto_pwhash_argon2id_ALG_ARGON2ID13: u32 = 2; -pub const crypto_pwhash_argon2id_BYTES_MIN: u32 = 16; -pub const crypto_pwhash_argon2id_PASSWD_MIN: u32 = 0; -pub const crypto_pwhash_argon2id_PASSWD_MAX: u32 = 4294967295; -pub const crypto_pwhash_argon2id_SALTBYTES: u32 = 16; -pub const crypto_pwhash_argon2id_STRBYTES: u32 = 128; -pub const crypto_pwhash_argon2id_STRPREFIX: &'static [u8; 11usize] = b"$argon2id$\0"; -pub const crypto_pwhash_argon2id_OPSLIMIT_MIN: u32 = 1; -pub const crypto_pwhash_argon2id_OPSLIMIT_MAX: u32 = 4294967295; -pub const crypto_pwhash_argon2id_MEMLIMIT_MIN: u32 = 8192; -pub const crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE: u32 = 2; -pub const crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE: u32 = 67108864; -pub const crypto_pwhash_argon2id_OPSLIMIT_MODERATE: u32 = 3; -pub const crypto_pwhash_argon2id_MEMLIMIT_MODERATE: u32 = 268435456; -pub const crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE: u32 = 4; -pub const crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE: u32 = 1073741824; -pub const crypto_pwhash_ALG_ARGON2I13: u32 = 1; -pub const crypto_pwhash_ALG_ARGON2ID13: u32 = 2; -pub const crypto_pwhash_ALG_DEFAULT: u32 = 2; -pub const crypto_pwhash_BYTES_MIN: u32 = 16; -pub const crypto_pwhash_PASSWD_MIN: u32 = 0; -pub const crypto_pwhash_PASSWD_MAX: u32 = 4294967295; -pub const crypto_pwhash_SALTBYTES: u32 = 16; -pub const crypto_pwhash_STRBYTES: u32 = 128; -pub const crypto_pwhash_STRPREFIX: &'static [u8; 11usize] = b"$argon2id$\0"; -pub const crypto_pwhash_OPSLIMIT_MIN: u32 = 1; -pub const crypto_pwhash_OPSLIMIT_MAX: u32 = 4294967295; -pub const crypto_pwhash_MEMLIMIT_MIN: u32 = 8192; -pub const crypto_pwhash_OPSLIMIT_INTERACTIVE: u32 = 2; -pub const crypto_pwhash_MEMLIMIT_INTERACTIVE: u32 = 67108864; -pub const crypto_pwhash_OPSLIMIT_MODERATE: u32 = 3; -pub const crypto_pwhash_MEMLIMIT_MODERATE: u32 = 268435456; -pub const crypto_pwhash_OPSLIMIT_SENSITIVE: u32 = 4; -pub const crypto_pwhash_MEMLIMIT_SENSITIVE: u32 = 1073741824; -pub const crypto_pwhash_PRIMITIVE: &'static [u8; 8usize] = b"argon2i\0"; -pub const crypto_scalarmult_curve25519_BYTES: u32 = 32; -pub const crypto_scalarmult_curve25519_SCALARBYTES: u32 = 32; -pub const crypto_scalarmult_BYTES: u32 = 32; -pub const crypto_scalarmult_SCALARBYTES: u32 = 32; -pub const crypto_scalarmult_PRIMITIVE: &'static [u8; 11usize] = b"curve25519\0"; -pub const crypto_secretbox_xsalsa20poly1305_KEYBYTES: u32 = 32; -pub const crypto_secretbox_xsalsa20poly1305_NONCEBYTES: u32 = 24; -pub const crypto_secretbox_xsalsa20poly1305_MACBYTES: u32 = 16; -pub const crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES: u32 = 16; -pub const crypto_secretbox_xsalsa20poly1305_ZEROBYTES: u32 = 32; -pub const crypto_secretbox_KEYBYTES: u32 = 32; -pub const crypto_secretbox_NONCEBYTES: u32 = 24; -pub const crypto_secretbox_MACBYTES: u32 = 16; -pub const crypto_secretbox_PRIMITIVE: &'static [u8; 17usize] = b"xsalsa20poly1305\0"; -pub const crypto_secretbox_ZEROBYTES: u32 = 32; -pub const crypto_secretbox_BOXZEROBYTES: u32 = 16; -pub const crypto_stream_chacha20_KEYBYTES: u32 = 32; -pub const crypto_stream_chacha20_NONCEBYTES: u32 = 8; -pub const crypto_stream_chacha20_ietf_KEYBYTES: u32 = 32; -pub const crypto_stream_chacha20_ietf_NONCEBYTES: u32 = 12; -pub const crypto_stream_chacha20_IETF_KEYBYTES: u32 = 32; -pub const crypto_stream_chacha20_IETF_NONCEBYTES: u32 = 12; -pub const crypto_secretstream_xchacha20poly1305_ABYTES: u32 = 17; -pub const crypto_secretstream_xchacha20poly1305_HEADERBYTES: u32 = 24; -pub const crypto_secretstream_xchacha20poly1305_KEYBYTES: u32 = 32; -pub const crypto_secretstream_xchacha20poly1305_TAG_MESSAGE: u32 = 0; -pub const crypto_secretstream_xchacha20poly1305_TAG_PUSH: u32 = 1; -pub const crypto_secretstream_xchacha20poly1305_TAG_REKEY: u32 = 2; -pub const crypto_secretstream_xchacha20poly1305_TAG_FINAL: u32 = 3; -pub const crypto_shorthash_siphash24_BYTES: u32 = 8; -pub const crypto_shorthash_siphash24_KEYBYTES: u32 = 16; -pub const crypto_shorthash_siphashx24_BYTES: u32 = 16; -pub const crypto_shorthash_siphashx24_KEYBYTES: u32 = 16; -pub const crypto_shorthash_BYTES: u32 = 8; -pub const crypto_shorthash_KEYBYTES: u32 = 16; -pub const crypto_shorthash_PRIMITIVE: &'static [u8; 10usize] = b"siphash24\0"; -pub const crypto_sign_ed25519_BYTES: u32 = 64; -pub const crypto_sign_ed25519_SEEDBYTES: u32 = 32; -pub const crypto_sign_ed25519_PUBLICKEYBYTES: u32 = 32; -pub const crypto_sign_ed25519_SECRETKEYBYTES: u32 = 64; -pub const crypto_sign_BYTES: u32 = 64; -pub const crypto_sign_SEEDBYTES: u32 = 32; -pub const crypto_sign_PUBLICKEYBYTES: u32 = 32; -pub const crypto_sign_SECRETKEYBYTES: u32 = 64; -pub const crypto_sign_PRIMITIVE: &'static [u8; 8usize] = b"ed25519\0"; -pub const crypto_stream_KEYBYTES: u32 = 32; -pub const crypto_stream_NONCEBYTES: u32 = 24; -pub const crypto_stream_PRIMITIVE: &'static [u8; 9usize] = b"xsalsa20\0"; -pub const crypto_stream_salsa20_KEYBYTES: u32 = 32; -pub const crypto_stream_salsa20_NONCEBYTES: u32 = 8; -pub const crypto_verify_16_BYTES: u32 = 16; -pub const crypto_verify_32_BYTES: u32 = 32; -pub const crypto_verify_64_BYTES: u32 = 64; -pub const randombytes_SEEDBYTES: u32 = 32; -pub const sodium_base64_VARIANT_ORIGINAL: u32 = 1; -pub const sodium_base64_VARIANT_ORIGINAL_NO_PADDING: u32 = 3; -pub const sodium_base64_VARIANT_URLSAFE: u32 = 5; -pub const sodium_base64_VARIANT_URLSAFE_NO_PADDING: u32 = 7; -pub const crypto_stream_xchacha20_KEYBYTES: u32 = 32; -pub const crypto_stream_xchacha20_NONCEBYTES: u32 = 24; -pub const crypto_box_curve25519xchacha20poly1305_SEEDBYTES: u32 = 32; -pub const crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES: u32 = 32; -pub const crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES: u32 = 32; -pub const crypto_box_curve25519xchacha20poly1305_BEFORENMBYTES: u32 = 32; -pub const crypto_box_curve25519xchacha20poly1305_NONCEBYTES: u32 = 24; -pub const crypto_box_curve25519xchacha20poly1305_MACBYTES: u32 = 16; -pub const crypto_box_curve25519xchacha20poly1305_SEALBYTES: u32 = 48; -pub const crypto_core_ed25519_BYTES: u32 = 32; -pub const crypto_core_ed25519_UNIFORMBYTES: u32 = 32; -pub const crypto_core_ed25519_HASHBYTES: u32 = 64; -pub const crypto_core_ed25519_SCALARBYTES: u32 = 32; -pub const crypto_core_ed25519_NONREDUCEDSCALARBYTES: u32 = 64; -pub const crypto_core_ristretto255_BYTES: u32 = 32; -pub const crypto_core_ristretto255_HASHBYTES: u32 = 64; -pub const crypto_core_ristretto255_SCALARBYTES: u32 = 32; -pub const crypto_core_ristretto255_NONREDUCEDSCALARBYTES: u32 = 64; -pub const crypto_scalarmult_ed25519_BYTES: u32 = 32; -pub const crypto_scalarmult_ed25519_SCALARBYTES: u32 = 32; -pub const crypto_scalarmult_ristretto255_BYTES: u32 = 32; -pub const crypto_scalarmult_ristretto255_SCALARBYTES: u32 = 32; -pub const crypto_secretbox_xchacha20poly1305_KEYBYTES: u32 = 32; -pub const crypto_secretbox_xchacha20poly1305_NONCEBYTES: u32 = 24; -pub const crypto_secretbox_xchacha20poly1305_MACBYTES: u32 = 16; -pub const crypto_pwhash_scryptsalsa208sha256_BYTES_MIN: u32 = 16; -pub const crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN: u32 = 0; -pub const crypto_pwhash_scryptsalsa208sha256_SALTBYTES: u32 = 32; -pub const crypto_pwhash_scryptsalsa208sha256_STRBYTES: u32 = 102; -pub const crypto_pwhash_scryptsalsa208sha256_STRPREFIX: &'static [u8; 4usize] = b"$7$\0"; -pub const crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN: u32 = 32768; -pub const crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX: u32 = 4294967295; -pub const crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN: u32 = 16777216; -pub const crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE: u32 = 524288; -pub const crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE: u32 = 16777216; -pub const crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE: u32 = 33554432; -pub const crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE: u32 = 1073741824; -pub const crypto_stream_salsa2012_KEYBYTES: u32 = 32; -pub const crypto_stream_salsa2012_NONCEBYTES: u32 = 8; -pub const crypto_stream_salsa208_KEYBYTES: u32 = 32; -pub const crypto_stream_salsa208_NONCEBYTES: u32 = 8; -pub type __uint8_t = libc::c_uchar; -pub type __uint32_t = libc::c_uint; -pub type __uint64_t = libc::c_ulong; -extern "C" { - pub fn sodium_version_string() -> *const libc::c_char; -} -extern "C" { - pub fn sodium_library_version_major() -> libc::c_int; -} -extern "C" { - pub fn sodium_library_version_minor() -> libc::c_int; -} -extern "C" { - pub fn sodium_library_minimal() -> libc::c_int; -} -extern "C" { - pub fn sodium_init() -> libc::c_int; -} -extern "C" { - pub fn sodium_set_misuse_handler( - handler: ::core::option::Option, - ) -> libc::c_int; -} -extern "C" { - pub fn sodium_misuse(); -} -extern "C" { - pub fn crypto_aead_aes256gcm_is_available() -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_aes256gcm_keybytes() -> usize; -} -extern "C" { - pub fn crypto_aead_aes256gcm_nsecbytes() -> usize; -} -extern "C" { - pub fn crypto_aead_aes256gcm_npubbytes() -> usize; -} -extern "C" { - pub fn crypto_aead_aes256gcm_abytes() -> usize; -} -extern "C" { - pub fn crypto_aead_aes256gcm_messagebytes_max() -> usize; -} -#[repr(C)] -#[repr(align(16))] -#[derive(Copy, Clone)] -pub struct crypto_aead_aes256gcm_state_ { - pub opaque: [libc::c_uchar; 512usize], -} -#[test] -fn bindgen_test_layout_crypto_aead_aes256gcm_state_() { - assert_eq!( - ::core::mem::size_of::(), - 512usize, - concat!("Size of: ", stringify!(crypto_aead_aes256gcm_state_)) - ); - assert_eq!( - ::core::mem::align_of::(), - 16usize, - concat!("Alignment of ", stringify!(crypto_aead_aes256gcm_state_)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).opaque as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(crypto_aead_aes256gcm_state_), - "::", - stringify!(opaque) - ) - ); -} -pub type crypto_aead_aes256gcm_state = crypto_aead_aes256gcm_state_; -extern "C" { - pub fn crypto_aead_aes256gcm_statebytes() -> usize; -} -extern "C" { - pub fn crypto_aead_aes256gcm_encrypt( - c: *mut libc::c_uchar, - clen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - nsec: *const libc::c_uchar, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_aes256gcm_decrypt( - m: *mut libc::c_uchar, - mlen_p: *mut libc::c_ulonglong, - nsec: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_aes256gcm_encrypt_detached( - c: *mut libc::c_uchar, - mac: *mut libc::c_uchar, - maclen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - nsec: *const libc::c_uchar, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_aes256gcm_decrypt_detached( - m: *mut libc::c_uchar, - nsec: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - mac: *const libc::c_uchar, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_aes256gcm_beforenm( - ctx_: *mut crypto_aead_aes256gcm_state, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_aes256gcm_encrypt_afternm( - c: *mut libc::c_uchar, - clen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - nsec: *const libc::c_uchar, - npub: *const libc::c_uchar, - ctx_: *const crypto_aead_aes256gcm_state, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_aes256gcm_decrypt_afternm( - m: *mut libc::c_uchar, - mlen_p: *mut libc::c_ulonglong, - nsec: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - npub: *const libc::c_uchar, - ctx_: *const crypto_aead_aes256gcm_state, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_aes256gcm_encrypt_detached_afternm( - c: *mut libc::c_uchar, - mac: *mut libc::c_uchar, - maclen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - nsec: *const libc::c_uchar, - npub: *const libc::c_uchar, - ctx_: *const crypto_aead_aes256gcm_state, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_aes256gcm_decrypt_detached_afternm( - m: *mut libc::c_uchar, - nsec: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - mac: *const libc::c_uchar, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - npub: *const libc::c_uchar, - ctx_: *const crypto_aead_aes256gcm_state, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_aes256gcm_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_ietf_keybytes() -> usize; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_ietf_nsecbytes() -> usize; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_ietf_npubbytes() -> usize; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_ietf_abytes() -> usize; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_ietf_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_ietf_encrypt( - c: *mut libc::c_uchar, - clen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - nsec: *const libc::c_uchar, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_ietf_decrypt( - m: *mut libc::c_uchar, - mlen_p: *mut libc::c_ulonglong, - nsec: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_ietf_encrypt_detached( - c: *mut libc::c_uchar, - mac: *mut libc::c_uchar, - maclen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - nsec: *const libc::c_uchar, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_ietf_decrypt_detached( - m: *mut libc::c_uchar, - nsec: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - mac: *const libc::c_uchar, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_ietf_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_keybytes() -> usize; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_nsecbytes() -> usize; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_npubbytes() -> usize; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_abytes() -> usize; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_encrypt( - c: *mut libc::c_uchar, - clen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - nsec: *const libc::c_uchar, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_decrypt( - m: *mut libc::c_uchar, - mlen_p: *mut libc::c_ulonglong, - nsec: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_encrypt_detached( - c: *mut libc::c_uchar, - mac: *mut libc::c_uchar, - maclen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - nsec: *const libc::c_uchar, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_decrypt_detached( - m: *mut libc::c_uchar, - nsec: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - mac: *const libc::c_uchar, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_chacha20poly1305_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_aead_xchacha20poly1305_ietf_keybytes() -> usize; -} -extern "C" { - pub fn crypto_aead_xchacha20poly1305_ietf_nsecbytes() -> usize; -} -extern "C" { - pub fn crypto_aead_xchacha20poly1305_ietf_npubbytes() -> usize; -} -extern "C" { - pub fn crypto_aead_xchacha20poly1305_ietf_abytes() -> usize; -} -extern "C" { - pub fn crypto_aead_xchacha20poly1305_ietf_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_aead_xchacha20poly1305_ietf_encrypt( - c: *mut libc::c_uchar, - clen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - nsec: *const libc::c_uchar, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_xchacha20poly1305_ietf_decrypt( - m: *mut libc::c_uchar, - mlen_p: *mut libc::c_ulonglong, - nsec: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_xchacha20poly1305_ietf_encrypt_detached( - c: *mut libc::c_uchar, - mac: *mut libc::c_uchar, - maclen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - nsec: *const libc::c_uchar, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_xchacha20poly1305_ietf_decrypt_detached( - m: *mut libc::c_uchar, - nsec: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - mac: *const libc::c_uchar, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - npub: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_aead_xchacha20poly1305_ietf_keygen(k: *mut libc::c_uchar); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct crypto_hash_sha512_state { - pub state: [u64; 8usize], - pub count: [u64; 2usize], - pub buf: [u8; 128usize], -} -#[test] -fn bindgen_test_layout_crypto_hash_sha512_state() { - assert_eq!( - ::core::mem::size_of::(), - 208usize, - concat!("Size of: ", stringify!(crypto_hash_sha512_state)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(crypto_hash_sha512_state)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).state as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(crypto_hash_sha512_state), - "::", - stringify!(state) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).count as *const _ as usize }, - 64usize, - concat!( - "Offset of field: ", - stringify!(crypto_hash_sha512_state), - "::", - stringify!(count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).buf as *const _ as usize }, - 80usize, - concat!( - "Offset of field: ", - stringify!(crypto_hash_sha512_state), - "::", - stringify!(buf) - ) - ); -} -extern "C" { - pub fn crypto_hash_sha512_statebytes() -> usize; -} -extern "C" { - pub fn crypto_hash_sha512_bytes() -> usize; -} -extern "C" { - pub fn crypto_hash_sha512( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_hash_sha512_init(state: *mut crypto_hash_sha512_state) -> libc::c_int; -} -extern "C" { - pub fn crypto_hash_sha512_update( - state: *mut crypto_hash_sha512_state, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_hash_sha512_final( - state: *mut crypto_hash_sha512_state, - out: *mut libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha512_bytes() -> usize; -} -extern "C" { - pub fn crypto_auth_hmacsha512_keybytes() -> usize; -} -extern "C" { - pub fn crypto_auth_hmacsha512( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha512_verify( - h: *const libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct crypto_auth_hmacsha512_state { - pub ictx: crypto_hash_sha512_state, - pub octx: crypto_hash_sha512_state, -} -#[test] -fn bindgen_test_layout_crypto_auth_hmacsha512_state() { - assert_eq!( - ::core::mem::size_of::(), - 416usize, - concat!("Size of: ", stringify!(crypto_auth_hmacsha512_state)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(crypto_auth_hmacsha512_state)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).ictx as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(crypto_auth_hmacsha512_state), - "::", - stringify!(ictx) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).octx as *const _ as usize - }, - 208usize, - concat!( - "Offset of field: ", - stringify!(crypto_auth_hmacsha512_state), - "::", - stringify!(octx) - ) - ); -} -extern "C" { - pub fn crypto_auth_hmacsha512_statebytes() -> usize; -} -extern "C" { - pub fn crypto_auth_hmacsha512_init( - state: *mut crypto_auth_hmacsha512_state, - key: *const libc::c_uchar, - keylen: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha512_update( - state: *mut crypto_auth_hmacsha512_state, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha512_final( - state: *mut crypto_auth_hmacsha512_state, - out: *mut libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha512_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_auth_hmacsha512256_bytes() -> usize; -} -extern "C" { - pub fn crypto_auth_hmacsha512256_keybytes() -> usize; -} -extern "C" { - pub fn crypto_auth_hmacsha512256( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha512256_verify( - h: *const libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -pub type crypto_auth_hmacsha512256_state = crypto_auth_hmacsha512_state; -extern "C" { - pub fn crypto_auth_hmacsha512256_statebytes() -> usize; -} -extern "C" { - pub fn crypto_auth_hmacsha512256_init( - state: *mut crypto_auth_hmacsha512256_state, - key: *const libc::c_uchar, - keylen: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha512256_update( - state: *mut crypto_auth_hmacsha512256_state, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha512256_final( - state: *mut crypto_auth_hmacsha512256_state, - out: *mut libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha512256_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_auth_bytes() -> usize; -} -extern "C" { - pub fn crypto_auth_keybytes() -> usize; -} -extern "C" { - pub fn crypto_auth_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_auth( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_verify( - h: *const libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_keygen(k: *mut libc::c_uchar); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct crypto_hash_sha256_state { - pub state: [u32; 8usize], - pub count: u64, - pub buf: [u8; 64usize], -} -#[test] -fn bindgen_test_layout_crypto_hash_sha256_state() { - assert_eq!( - ::core::mem::size_of::(), - 104usize, - concat!("Size of: ", stringify!(crypto_hash_sha256_state)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(crypto_hash_sha256_state)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).state as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(crypto_hash_sha256_state), - "::", - stringify!(state) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).count as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(crypto_hash_sha256_state), - "::", - stringify!(count) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).buf as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(crypto_hash_sha256_state), - "::", - stringify!(buf) - ) - ); -} -extern "C" { - pub fn crypto_hash_sha256_statebytes() -> usize; -} -extern "C" { - pub fn crypto_hash_sha256_bytes() -> usize; -} -extern "C" { - pub fn crypto_hash_sha256( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_hash_sha256_init(state: *mut crypto_hash_sha256_state) -> libc::c_int; -} -extern "C" { - pub fn crypto_hash_sha256_update( - state: *mut crypto_hash_sha256_state, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_hash_sha256_final( - state: *mut crypto_hash_sha256_state, - out: *mut libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha256_bytes() -> usize; -} -extern "C" { - pub fn crypto_auth_hmacsha256_keybytes() -> usize; -} -extern "C" { - pub fn crypto_auth_hmacsha256( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha256_verify( - h: *const libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct crypto_auth_hmacsha256_state { - pub ictx: crypto_hash_sha256_state, - pub octx: crypto_hash_sha256_state, -} -#[test] -fn bindgen_test_layout_crypto_auth_hmacsha256_state() { - assert_eq!( - ::core::mem::size_of::(), - 208usize, - concat!("Size of: ", stringify!(crypto_auth_hmacsha256_state)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(crypto_auth_hmacsha256_state)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).ictx as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(crypto_auth_hmacsha256_state), - "::", - stringify!(ictx) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).octx as *const _ as usize - }, - 104usize, - concat!( - "Offset of field: ", - stringify!(crypto_auth_hmacsha256_state), - "::", - stringify!(octx) - ) - ); -} -extern "C" { - pub fn crypto_auth_hmacsha256_statebytes() -> usize; -} -extern "C" { - pub fn crypto_auth_hmacsha256_init( - state: *mut crypto_auth_hmacsha256_state, - key: *const libc::c_uchar, - keylen: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha256_update( - state: *mut crypto_auth_hmacsha256_state, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha256_final( - state: *mut crypto_auth_hmacsha256_state, - out: *mut libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_auth_hmacsha256_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_stream_xsalsa20_keybytes() -> usize; -} -extern "C" { - pub fn crypto_stream_xsalsa20_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_stream_xsalsa20_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_stream_xsalsa20( - c: *mut libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_xsalsa20_xor( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_xsalsa20_xor_ic( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - ic: u64, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_xsalsa20_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_seedbytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_publickeybytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_secretkeybytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_beforenmbytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_macbytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_seed_keypair( - pk: *mut libc::c_uchar, - sk: *mut libc::c_uchar, - seed: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_keypair( - pk: *mut libc::c_uchar, - sk: *mut libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_beforenm( - k: *mut libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_boxzerobytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_zerobytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_open( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_afternm( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xsalsa20poly1305_open_afternm( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_seedbytes() -> usize; -} -extern "C" { - pub fn crypto_box_publickeybytes() -> usize; -} -extern "C" { - pub fn crypto_box_secretkeybytes() -> usize; -} -extern "C" { - pub fn crypto_box_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_box_macbytes() -> usize; -} -extern "C" { - pub fn crypto_box_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_box_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_box_seed_keypair( - pk: *mut libc::c_uchar, - sk: *mut libc::c_uchar, - seed: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_keypair(pk: *mut libc::c_uchar, sk: *mut libc::c_uchar) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_easy( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_open_easy( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_detached( - c: *mut libc::c_uchar, - mac: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_open_detached( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - mac: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_beforenmbytes() -> usize; -} -extern "C" { - pub fn crypto_box_beforenm( - k: *mut libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_easy_afternm( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_open_easy_afternm( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_detached_afternm( - c: *mut libc::c_uchar, - mac: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_open_detached_afternm( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - mac: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_sealbytes() -> usize; -} -extern "C" { - pub fn crypto_box_seal( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - pk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_seal_open( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_zerobytes() -> usize; -} -extern "C" { - pub fn crypto_box_boxzerobytes() -> usize; -} -extern "C" { - pub fn crypto_box( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_open( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_afternm( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_open_afternm( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_hsalsa20_outputbytes() -> usize; -} -extern "C" { - pub fn crypto_core_hsalsa20_inputbytes() -> usize; -} -extern "C" { - pub fn crypto_core_hsalsa20_keybytes() -> usize; -} -extern "C" { - pub fn crypto_core_hsalsa20_constbytes() -> usize; -} -extern "C" { - pub fn crypto_core_hsalsa20( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - k: *const libc::c_uchar, - c: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_hchacha20_outputbytes() -> usize; -} -extern "C" { - pub fn crypto_core_hchacha20_inputbytes() -> usize; -} -extern "C" { - pub fn crypto_core_hchacha20_keybytes() -> usize; -} -extern "C" { - pub fn crypto_core_hchacha20_constbytes() -> usize; -} -extern "C" { - pub fn crypto_core_hchacha20( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - k: *const libc::c_uchar, - c: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_salsa20_outputbytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa20_inputbytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa20_keybytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa20_constbytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa20( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - k: *const libc::c_uchar, - c: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_salsa2012_outputbytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa2012_inputbytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa2012_keybytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa2012_constbytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa2012( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - k: *const libc::c_uchar, - c: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_salsa208_outputbytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa208_inputbytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa208_keybytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa208_constbytes() -> usize; -} -extern "C" { - pub fn crypto_core_salsa208( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - k: *const libc::c_uchar, - c: *const libc::c_uchar, - ) -> libc::c_int; -} -#[repr(C)] -#[repr(align(64))] -#[derive(Copy, Clone)] -pub struct crypto_generichash_blake2b_state { - pub opaque: [libc::c_uchar; 384usize], -} -#[test] -fn bindgen_test_layout_crypto_generichash_blake2b_state() { - assert_eq!( - ::core::mem::size_of::(), - 384usize, - concat!("Size of: ", stringify!(crypto_generichash_blake2b_state)) - ); - assert_eq!( - ::core::mem::align_of::(), - 64usize, - concat!( - "Alignment of ", - stringify!(crypto_generichash_blake2b_state) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).opaque as *const _ - as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(crypto_generichash_blake2b_state), - "::", - stringify!(opaque) - ) - ); -} -extern "C" { - pub fn crypto_generichash_blake2b_bytes_min() -> usize; -} -extern "C" { - pub fn crypto_generichash_blake2b_bytes_max() -> usize; -} -extern "C" { - pub fn crypto_generichash_blake2b_bytes() -> usize; -} -extern "C" { - pub fn crypto_generichash_blake2b_keybytes_min() -> usize; -} -extern "C" { - pub fn crypto_generichash_blake2b_keybytes_max() -> usize; -} -extern "C" { - pub fn crypto_generichash_blake2b_keybytes() -> usize; -} -extern "C" { - pub fn crypto_generichash_blake2b_saltbytes() -> usize; -} -extern "C" { - pub fn crypto_generichash_blake2b_personalbytes() -> usize; -} -extern "C" { - pub fn crypto_generichash_blake2b_statebytes() -> usize; -} -extern "C" { - pub fn crypto_generichash_blake2b( - out: *mut libc::c_uchar, - outlen: usize, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - key: *const libc::c_uchar, - keylen: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_generichash_blake2b_salt_personal( - out: *mut libc::c_uchar, - outlen: usize, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - key: *const libc::c_uchar, - keylen: usize, - salt: *const libc::c_uchar, - personal: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_generichash_blake2b_init( - state: *mut crypto_generichash_blake2b_state, - key: *const libc::c_uchar, - keylen: usize, - outlen: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_generichash_blake2b_init_salt_personal( - state: *mut crypto_generichash_blake2b_state, - key: *const libc::c_uchar, - keylen: usize, - outlen: usize, - salt: *const libc::c_uchar, - personal: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_generichash_blake2b_update( - state: *mut crypto_generichash_blake2b_state, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_generichash_blake2b_final( - state: *mut crypto_generichash_blake2b_state, - out: *mut libc::c_uchar, - outlen: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_generichash_blake2b_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_generichash_bytes_min() -> usize; -} -extern "C" { - pub fn crypto_generichash_bytes_max() -> usize; -} -extern "C" { - pub fn crypto_generichash_bytes() -> usize; -} -extern "C" { - pub fn crypto_generichash_keybytes_min() -> usize; -} -extern "C" { - pub fn crypto_generichash_keybytes_max() -> usize; -} -extern "C" { - pub fn crypto_generichash_keybytes() -> usize; -} -extern "C" { - pub fn crypto_generichash_primitive() -> *const libc::c_char; -} -pub type crypto_generichash_state = crypto_generichash_blake2b_state; -extern "C" { - pub fn crypto_generichash_statebytes() -> usize; -} -extern "C" { - pub fn crypto_generichash( - out: *mut libc::c_uchar, - outlen: usize, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - key: *const libc::c_uchar, - keylen: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_generichash_init( - state: *mut crypto_generichash_state, - key: *const libc::c_uchar, - keylen: usize, - outlen: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_generichash_update( - state: *mut crypto_generichash_state, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_generichash_final( - state: *mut crypto_generichash_state, - out: *mut libc::c_uchar, - outlen: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_generichash_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_hash_bytes() -> usize; -} -extern "C" { - pub fn crypto_hash( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_hash_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_kdf_blake2b_bytes_min() -> usize; -} -extern "C" { - pub fn crypto_kdf_blake2b_bytes_max() -> usize; -} -extern "C" { - pub fn crypto_kdf_blake2b_contextbytes() -> usize; -} -extern "C" { - pub fn crypto_kdf_blake2b_keybytes() -> usize; -} -extern "C" { - pub fn crypto_kdf_blake2b_derive_from_key( - subkey: *mut libc::c_uchar, - subkey_len: usize, - subkey_id: u64, - ctx: *const libc::c_char, - key: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_kdf_bytes_min() -> usize; -} -extern "C" { - pub fn crypto_kdf_bytes_max() -> usize; -} -extern "C" { - pub fn crypto_kdf_contextbytes() -> usize; -} -extern "C" { - pub fn crypto_kdf_keybytes() -> usize; -} -extern "C" { - pub fn crypto_kdf_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_kdf_derive_from_key( - subkey: *mut libc::c_uchar, - subkey_len: usize, - subkey_id: u64, - ctx: *const libc::c_char, - key: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_kdf_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_kx_publickeybytes() -> usize; -} -extern "C" { - pub fn crypto_kx_secretkeybytes() -> usize; -} -extern "C" { - pub fn crypto_kx_seedbytes() -> usize; -} -extern "C" { - pub fn crypto_kx_sessionkeybytes() -> usize; -} -extern "C" { - pub fn crypto_kx_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_kx_seed_keypair( - pk: *mut libc::c_uchar, - sk: *mut libc::c_uchar, - seed: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_kx_keypair(pk: *mut libc::c_uchar, sk: *mut libc::c_uchar) -> libc::c_int; -} -extern "C" { - pub fn crypto_kx_client_session_keys( - rx: *mut libc::c_uchar, - tx: *mut libc::c_uchar, - client_pk: *const libc::c_uchar, - client_sk: *const libc::c_uchar, - server_pk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_kx_server_session_keys( - rx: *mut libc::c_uchar, - tx: *mut libc::c_uchar, - server_pk: *const libc::c_uchar, - server_sk: *const libc::c_uchar, - client_pk: *const libc::c_uchar, - ) -> libc::c_int; -} -#[repr(C)] -#[repr(align(16))] -#[derive(Copy, Clone)] -pub struct crypto_onetimeauth_poly1305_state { - pub opaque: [libc::c_uchar; 256usize], -} -#[test] -fn bindgen_test_layout_crypto_onetimeauth_poly1305_state() { - assert_eq!( - ::core::mem::size_of::(), - 256usize, - concat!("Size of: ", stringify!(crypto_onetimeauth_poly1305_state)) - ); - assert_eq!( - ::core::mem::align_of::(), - 16usize, - concat!( - "Alignment of ", - stringify!(crypto_onetimeauth_poly1305_state) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).opaque as *const _ - as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(crypto_onetimeauth_poly1305_state), - "::", - stringify!(opaque) - ) - ); -} -extern "C" { - pub fn crypto_onetimeauth_poly1305_statebytes() -> usize; -} -extern "C" { - pub fn crypto_onetimeauth_poly1305_bytes() -> usize; -} -extern "C" { - pub fn crypto_onetimeauth_poly1305_keybytes() -> usize; -} -extern "C" { - pub fn crypto_onetimeauth_poly1305( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_onetimeauth_poly1305_verify( - h: *const libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_onetimeauth_poly1305_init( - state: *mut crypto_onetimeauth_poly1305_state, - key: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_onetimeauth_poly1305_update( - state: *mut crypto_onetimeauth_poly1305_state, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_onetimeauth_poly1305_final( - state: *mut crypto_onetimeauth_poly1305_state, - out: *mut libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_onetimeauth_poly1305_keygen(k: *mut libc::c_uchar); -} -pub type crypto_onetimeauth_state = crypto_onetimeauth_poly1305_state; -extern "C" { - pub fn crypto_onetimeauth_statebytes() -> usize; -} -extern "C" { - pub fn crypto_onetimeauth_bytes() -> usize; -} -extern "C" { - pub fn crypto_onetimeauth_keybytes() -> usize; -} -extern "C" { - pub fn crypto_onetimeauth_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_onetimeauth( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_onetimeauth_verify( - h: *const libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_onetimeauth_init( - state: *mut crypto_onetimeauth_state, - key: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_onetimeauth_update( - state: *mut crypto_onetimeauth_state, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_onetimeauth_final( - state: *mut crypto_onetimeauth_state, - out: *mut libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_onetimeauth_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_pwhash_argon2i_alg_argon2i13() -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_argon2i_bytes_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_bytes_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_passwd_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_passwd_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_saltbytes() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_strbytes() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_strprefix() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_pwhash_argon2i_opslimit_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_opslimit_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_memlimit_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_memlimit_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_opslimit_interactive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_memlimit_interactive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_opslimit_moderate() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_memlimit_moderate() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_opslimit_sensitive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i_memlimit_sensitive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2i( - out: *mut libc::c_uchar, - outlen: libc::c_ulonglong, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - salt: *const libc::c_uchar, - opslimit: libc::c_ulonglong, - memlimit: usize, - alg: libc::c_int, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_argon2i_str( - out: *mut libc::c_char, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - opslimit: libc::c_ulonglong, - memlimit: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_argon2i_str_verify( - str: *const libc::c_char, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_argon2i_str_needs_rehash( - str: *const libc::c_char, - opslimit: libc::c_ulonglong, - memlimit: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_argon2id_alg_argon2id13() -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_argon2id_bytes_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_bytes_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_passwd_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_passwd_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_saltbytes() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_strbytes() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_strprefix() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_pwhash_argon2id_opslimit_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_opslimit_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_memlimit_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_memlimit_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_opslimit_interactive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_memlimit_interactive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_opslimit_moderate() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_memlimit_moderate() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_opslimit_sensitive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id_memlimit_sensitive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_argon2id( - out: *mut libc::c_uchar, - outlen: libc::c_ulonglong, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - salt: *const libc::c_uchar, - opslimit: libc::c_ulonglong, - memlimit: usize, - alg: libc::c_int, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_argon2id_str( - out: *mut libc::c_char, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - opslimit: libc::c_ulonglong, - memlimit: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_argon2id_str_verify( - str: *const libc::c_char, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_argon2id_str_needs_rehash( - str: *const libc::c_char, - opslimit: libc::c_ulonglong, - memlimit: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_alg_argon2i13() -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_alg_argon2id13() -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_alg_default() -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_bytes_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_bytes_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_passwd_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_passwd_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_saltbytes() -> usize; -} -extern "C" { - pub fn crypto_pwhash_strbytes() -> usize; -} -extern "C" { - pub fn crypto_pwhash_strprefix() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_pwhash_opslimit_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_opslimit_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_memlimit_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_memlimit_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_opslimit_interactive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_memlimit_interactive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_opslimit_moderate() -> usize; -} -extern "C" { - pub fn crypto_pwhash_memlimit_moderate() -> usize; -} -extern "C" { - pub fn crypto_pwhash_opslimit_sensitive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_memlimit_sensitive() -> usize; -} -extern "C" { - pub fn crypto_pwhash( - out: *mut libc::c_uchar, - outlen: libc::c_ulonglong, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - salt: *const libc::c_uchar, - opslimit: libc::c_ulonglong, - memlimit: usize, - alg: libc::c_int, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_str( - out: *mut libc::c_char, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - opslimit: libc::c_ulonglong, - memlimit: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_str_alg( - out: *mut libc::c_char, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - opslimit: libc::c_ulonglong, - memlimit: usize, - alg: libc::c_int, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_str_verify( - str: *const libc::c_char, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_str_needs_rehash( - str: *const libc::c_char, - opslimit: libc::c_ulonglong, - memlimit: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_scalarmult_curve25519_bytes() -> usize; -} -extern "C" { - pub fn crypto_scalarmult_curve25519_scalarbytes() -> usize; -} -extern "C" { - pub fn crypto_scalarmult_curve25519( - q: *mut libc::c_uchar, - n: *const libc::c_uchar, - p: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_scalarmult_curve25519_base( - q: *mut libc::c_uchar, - n: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_scalarmult_bytes() -> usize; -} -extern "C" { - pub fn crypto_scalarmult_scalarbytes() -> usize; -} -extern "C" { - pub fn crypto_scalarmult_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_scalarmult_base(q: *mut libc::c_uchar, n: *const libc::c_uchar) -> libc::c_int; -} -extern "C" { - pub fn crypto_scalarmult( - q: *mut libc::c_uchar, - n: *const libc::c_uchar, - p: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_xsalsa20poly1305_keybytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_xsalsa20poly1305_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_xsalsa20poly1305_macbytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_xsalsa20poly1305_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_secretbox_xsalsa20poly1305( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_xsalsa20poly1305_open( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_xsalsa20poly1305_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_secretbox_xsalsa20poly1305_boxzerobytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_xsalsa20poly1305_zerobytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_keybytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_macbytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_secretbox_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_secretbox_easy( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_open_easy( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_detached( - c: *mut libc::c_uchar, - mac: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_open_detached( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - mac: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_secretbox_zerobytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_boxzerobytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_open( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_chacha20_keybytes() -> usize; -} -extern "C" { - pub fn crypto_stream_chacha20_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_stream_chacha20_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_stream_chacha20( - c: *mut libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_chacha20_xor( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_chacha20_xor_ic( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - ic: u64, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_chacha20_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_stream_chacha20_ietf_keybytes() -> usize; -} -extern "C" { - pub fn crypto_stream_chacha20_ietf_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_stream_chacha20_ietf_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_stream_chacha20_ietf( - c: *mut libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_chacha20_ietf_xor( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_chacha20_ietf_xor_ic( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - ic: u32, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_chacha20_ietf_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_abytes() -> usize; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_headerbytes() -> usize; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_keybytes() -> usize; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_tag_message() -> libc::c_uchar; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_tag_push() -> libc::c_uchar; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_tag_rekey() -> libc::c_uchar; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_tag_final() -> libc::c_uchar; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct crypto_secretstream_xchacha20poly1305_state { - pub k: [libc::c_uchar; 32usize], - pub nonce: [libc::c_uchar; 12usize], - pub _pad: [libc::c_uchar; 8usize], -} -#[test] -fn bindgen_test_layout_crypto_secretstream_xchacha20poly1305_state() { - assert_eq!( - ::core::mem::size_of::(), - 52usize, - concat!( - "Size of: ", - stringify!(crypto_secretstream_xchacha20poly1305_state) - ) - ); - assert_eq!( - ::core::mem::align_of::(), - 1usize, - concat!( - "Alignment of ", - stringify!(crypto_secretstream_xchacha20poly1305_state) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).k as *const _ - as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(crypto_secretstream_xchacha20poly1305_state), - "::", - stringify!(k) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).nonce - as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(crypto_secretstream_xchacha20poly1305_state), - "::", - stringify!(nonce) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::()))._pad - as *const _ as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(crypto_secretstream_xchacha20poly1305_state), - "::", - stringify!(_pad) - ) - ); -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_statebytes() -> usize; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_init_push( - state: *mut crypto_secretstream_xchacha20poly1305_state, - header: *mut libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_push( - state: *mut crypto_secretstream_xchacha20poly1305_state, - c: *mut libc::c_uchar, - clen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - tag: libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_init_pull( - state: *mut crypto_secretstream_xchacha20poly1305_state, - header: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_pull( - state: *mut crypto_secretstream_xchacha20poly1305_state, - m: *mut libc::c_uchar, - mlen_p: *mut libc::c_ulonglong, - tag_p: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - ad: *const libc::c_uchar, - adlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretstream_xchacha20poly1305_rekey( - state: *mut crypto_secretstream_xchacha20poly1305_state, - ); -} -extern "C" { - pub fn crypto_shorthash_siphash24_bytes() -> usize; -} -extern "C" { - pub fn crypto_shorthash_siphash24_keybytes() -> usize; -} -extern "C" { - pub fn crypto_shorthash_siphash24( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_shorthash_siphashx24_bytes() -> usize; -} -extern "C" { - pub fn crypto_shorthash_siphashx24_keybytes() -> usize; -} -extern "C" { - pub fn crypto_shorthash_siphashx24( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_shorthash_bytes() -> usize; -} -extern "C" { - pub fn crypto_shorthash_keybytes() -> usize; -} -extern "C" { - pub fn crypto_shorthash_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_shorthash( - out: *mut libc::c_uchar, - in_: *const libc::c_uchar, - inlen: libc::c_ulonglong, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_shorthash_keygen(k: *mut libc::c_uchar); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct crypto_sign_ed25519ph_state { - pub hs: crypto_hash_sha512_state, -} -#[test] -fn bindgen_test_layout_crypto_sign_ed25519ph_state() { - assert_eq!( - ::core::mem::size_of::(), - 208usize, - concat!("Size of: ", stringify!(crypto_sign_ed25519ph_state)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(crypto_sign_ed25519ph_state)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).hs as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(crypto_sign_ed25519ph_state), - "::", - stringify!(hs) - ) - ); -} -extern "C" { - pub fn crypto_sign_ed25519ph_statebytes() -> usize; -} -extern "C" { - pub fn crypto_sign_ed25519_bytes() -> usize; -} -extern "C" { - pub fn crypto_sign_ed25519_seedbytes() -> usize; -} -extern "C" { - pub fn crypto_sign_ed25519_publickeybytes() -> usize; -} -extern "C" { - pub fn crypto_sign_ed25519_secretkeybytes() -> usize; -} -extern "C" { - pub fn crypto_sign_ed25519_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_sign_ed25519( - sm: *mut libc::c_uchar, - smlen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519_open( - m: *mut libc::c_uchar, - mlen_p: *mut libc::c_ulonglong, - sm: *const libc::c_uchar, - smlen: libc::c_ulonglong, - pk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519_detached( - sig: *mut libc::c_uchar, - siglen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519_verify_detached( - sig: *const libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - pk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519_keypair( - pk: *mut libc::c_uchar, - sk: *mut libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519_seed_keypair( - pk: *mut libc::c_uchar, - sk: *mut libc::c_uchar, - seed: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519_pk_to_curve25519( - curve25519_pk: *mut libc::c_uchar, - ed25519_pk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519_sk_to_curve25519( - curve25519_sk: *mut libc::c_uchar, - ed25519_sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519_sk_to_seed( - seed: *mut libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519_sk_to_pk( - pk: *mut libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519ph_init(state: *mut crypto_sign_ed25519ph_state) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519ph_update( - state: *mut crypto_sign_ed25519ph_state, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519ph_final_create( - state: *mut crypto_sign_ed25519ph_state, - sig: *mut libc::c_uchar, - siglen_p: *mut libc::c_ulonglong, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_ed25519ph_final_verify( - state: *mut crypto_sign_ed25519ph_state, - sig: *const libc::c_uchar, - pk: *const libc::c_uchar, - ) -> libc::c_int; -} -pub type crypto_sign_state = crypto_sign_ed25519ph_state; -extern "C" { - pub fn crypto_sign_statebytes() -> usize; -} -extern "C" { - pub fn crypto_sign_bytes() -> usize; -} -extern "C" { - pub fn crypto_sign_seedbytes() -> usize; -} -extern "C" { - pub fn crypto_sign_publickeybytes() -> usize; -} -extern "C" { - pub fn crypto_sign_secretkeybytes() -> usize; -} -extern "C" { - pub fn crypto_sign_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_sign_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_sign_seed_keypair( - pk: *mut libc::c_uchar, - sk: *mut libc::c_uchar, - seed: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_keypair(pk: *mut libc::c_uchar, sk: *mut libc::c_uchar) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign( - sm: *mut libc::c_uchar, - smlen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_open( - m: *mut libc::c_uchar, - mlen_p: *mut libc::c_ulonglong, - sm: *const libc::c_uchar, - smlen: libc::c_ulonglong, - pk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_detached( - sig: *mut libc::c_uchar, - siglen_p: *mut libc::c_ulonglong, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_verify_detached( - sig: *const libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - pk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_init(state: *mut crypto_sign_state) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_update( - state: *mut crypto_sign_state, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_final_create( - state: *mut crypto_sign_state, - sig: *mut libc::c_uchar, - siglen_p: *mut libc::c_ulonglong, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_sign_final_verify( - state: *mut crypto_sign_state, - sig: *const libc::c_uchar, - pk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_keybytes() -> usize; -} -extern "C" { - pub fn crypto_stream_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_stream_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_stream_primitive() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_stream( - c: *mut libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_xor( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_stream_salsa20_keybytes() -> usize; -} -extern "C" { - pub fn crypto_stream_salsa20_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_stream_salsa20_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_stream_salsa20( - c: *mut libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_salsa20_xor( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_salsa20_xor_ic( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - ic: u64, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_salsa20_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_verify_16_bytes() -> usize; -} -extern "C" { - pub fn crypto_verify_16(x: *const libc::c_uchar, y: *const libc::c_uchar) -> libc::c_int; -} -extern "C" { - pub fn crypto_verify_32_bytes() -> usize; -} -extern "C" { - pub fn crypto_verify_32(x: *const libc::c_uchar, y: *const libc::c_uchar) -> libc::c_int; -} -extern "C" { - pub fn crypto_verify_64_bytes() -> usize; -} -extern "C" { - pub fn crypto_verify_64(x: *const libc::c_uchar, y: *const libc::c_uchar) -> libc::c_int; -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct randombytes_implementation { - pub implementation_name: ::core::option::Option *const libc::c_char>, - pub random: ::core::option::Option u32>, - pub stir: ::core::option::Option, - pub uniform: ::core::option::Option u32>, - pub buf: ::core::option::Option, - pub close: ::core::option::Option libc::c_int>, -} -#[test] -fn bindgen_test_layout_randombytes_implementation() { - assert_eq!( - ::core::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(randombytes_implementation)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(randombytes_implementation)) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).implementation_name as *const _ - as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(randombytes_implementation), - "::", - stringify!(implementation_name) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).random as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(randombytes_implementation), - "::", - stringify!(random) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).stir as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(randombytes_implementation), - "::", - stringify!(stir) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).uniform as *const _ as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(randombytes_implementation), - "::", - stringify!(uniform) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).buf as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(randombytes_implementation), - "::", - stringify!(buf) - ) - ); - assert_eq!( - unsafe { - &(*(::core::ptr::null::())).close as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(randombytes_implementation), - "::", - stringify!(close) - ) - ); -} -extern "C" { - pub fn randombytes_seedbytes() -> usize; -} -extern "C" { - pub fn randombytes_buf(buf: *mut libc::c_void, size: usize); -} -extern "C" { - pub fn randombytes_buf_deterministic( - buf: *mut libc::c_void, - size: usize, - seed: *const libc::c_uchar, - ); -} -extern "C" { - pub fn randombytes_random() -> u32; -} -extern "C" { - pub fn randombytes_uniform(upper_bound: u32) -> u32; -} -extern "C" { - pub fn randombytes_stir(); -} -extern "C" { - pub fn randombytes_close() -> libc::c_int; -} -extern "C" { - pub fn randombytes_set_implementation(impl_: *mut randombytes_implementation) -> libc::c_int; -} -extern "C" { - pub fn randombytes_implementation_name() -> *const libc::c_char; -} -extern "C" { - pub static mut randombytes_internal_implementation: randombytes_implementation; -} -extern "C" { - pub static mut randombytes_sysrandom_implementation: randombytes_implementation; -} -extern "C" { - pub fn sodium_runtime_has_neon() -> libc::c_int; -} -extern "C" { - pub fn sodium_runtime_has_sse2() -> libc::c_int; -} -extern "C" { - pub fn sodium_runtime_has_sse3() -> libc::c_int; -} -extern "C" { - pub fn sodium_runtime_has_ssse3() -> libc::c_int; -} -extern "C" { - pub fn sodium_runtime_has_sse41() -> libc::c_int; -} -extern "C" { - pub fn sodium_runtime_has_avx() -> libc::c_int; -} -extern "C" { - pub fn sodium_runtime_has_avx2() -> libc::c_int; -} -extern "C" { - pub fn sodium_runtime_has_avx512f() -> libc::c_int; -} -extern "C" { - pub fn sodium_runtime_has_pclmul() -> libc::c_int; -} -extern "C" { - pub fn sodium_runtime_has_aesni() -> libc::c_int; -} -extern "C" { - pub fn sodium_runtime_has_rdrand() -> libc::c_int; -} -extern "C" { - pub fn sodium_memzero(pnt: *mut libc::c_void, len: usize); -} -extern "C" { - pub fn sodium_stackzero(len: usize); -} -extern "C" { - pub fn sodium_memcmp( - b1_: *const libc::c_void, - b2_: *const libc::c_void, - len: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn sodium_compare( - b1_: *const libc::c_uchar, - b2_: *const libc::c_uchar, - len: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn sodium_is_zero(n: *const libc::c_uchar, nlen: usize) -> libc::c_int; -} -extern "C" { - pub fn sodium_increment(n: *mut libc::c_uchar, nlen: usize); -} -extern "C" { - pub fn sodium_add(a: *mut libc::c_uchar, b: *const libc::c_uchar, len: usize); -} -extern "C" { - pub fn sodium_sub(a: *mut libc::c_uchar, b: *const libc::c_uchar, len: usize); -} -extern "C" { - pub fn sodium_bin2hex( - hex: *mut libc::c_char, - hex_maxlen: usize, - bin: *const libc::c_uchar, - bin_len: usize, - ) -> *mut libc::c_char; -} -extern "C" { - pub fn sodium_hex2bin( - bin: *mut libc::c_uchar, - bin_maxlen: usize, - hex: *const libc::c_char, - hex_len: usize, - ignore: *const libc::c_char, - bin_len: *mut usize, - hex_end: *mut *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - pub fn sodium_base64_encoded_len(bin_len: usize, variant: libc::c_int) -> usize; -} -extern "C" { - pub fn sodium_bin2base64( - b64: *mut libc::c_char, - b64_maxlen: usize, - bin: *const libc::c_uchar, - bin_len: usize, - variant: libc::c_int, - ) -> *mut libc::c_char; -} -extern "C" { - pub fn sodium_base642bin( - bin: *mut libc::c_uchar, - bin_maxlen: usize, - b64: *const libc::c_char, - b64_len: usize, - ignore: *const libc::c_char, - bin_len: *mut usize, - b64_end: *mut *const libc::c_char, - variant: libc::c_int, - ) -> libc::c_int; -} -extern "C" { - pub fn sodium_mlock(addr: *mut libc::c_void, len: usize) -> libc::c_int; -} -extern "C" { - pub fn sodium_munlock(addr: *mut libc::c_void, len: usize) -> libc::c_int; -} -extern "C" { - pub fn sodium_malloc(size: usize) -> *mut libc::c_void; -} -extern "C" { - pub fn sodium_allocarray(count: usize, size: usize) -> *mut libc::c_void; -} -extern "C" { - pub fn sodium_free(ptr: *mut libc::c_void); -} -extern "C" { - pub fn sodium_mprotect_noaccess(ptr: *mut libc::c_void) -> libc::c_int; -} -extern "C" { - pub fn sodium_mprotect_readonly(ptr: *mut libc::c_void) -> libc::c_int; -} -extern "C" { - pub fn sodium_mprotect_readwrite(ptr: *mut libc::c_void) -> libc::c_int; -} -extern "C" { - pub fn sodium_pad( - padded_buflen_p: *mut usize, - buf: *mut libc::c_uchar, - unpadded_buflen: usize, - blocksize: usize, - max_buflen: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn sodium_unpad( - unpadded_buflen_p: *mut usize, - buf: *const libc::c_uchar, - padded_buflen: usize, - blocksize: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_xchacha20_keybytes() -> usize; -} -extern "C" { - pub fn crypto_stream_xchacha20_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_stream_xchacha20_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_stream_xchacha20( - c: *mut libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_xchacha20_xor( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_xchacha20_xor_ic( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - ic: u64, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_xchacha20_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_seedbytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_publickeybytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_secretkeybytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_beforenmbytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_macbytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_seed_keypair( - pk: *mut libc::c_uchar, - sk: *mut libc::c_uchar, - seed: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_keypair( - pk: *mut libc::c_uchar, - sk: *mut libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_easy( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_open_easy( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_detached( - c: *mut libc::c_uchar, - mac: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_open_detached( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - mac: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_beforenm( - k: *mut libc::c_uchar, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_easy_afternm( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_open_easy_afternm( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_detached_afternm( - c: *mut libc::c_uchar, - mac: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_open_detached_afternm( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - mac: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_sealbytes() -> usize; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_seal( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - pk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_box_curve25519xchacha20poly1305_seal_open( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - pk: *const libc::c_uchar, - sk: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ed25519_bytes() -> usize; -} -extern "C" { - pub fn crypto_core_ed25519_uniformbytes() -> usize; -} -extern "C" { - pub fn crypto_core_ed25519_hashbytes() -> usize; -} -extern "C" { - pub fn crypto_core_ed25519_scalarbytes() -> usize; -} -extern "C" { - pub fn crypto_core_ed25519_nonreducedscalarbytes() -> usize; -} -extern "C" { - pub fn crypto_core_ed25519_is_valid_point(p: *const libc::c_uchar) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ed25519_add( - r: *mut libc::c_uchar, - p: *const libc::c_uchar, - q: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ed25519_sub( - r: *mut libc::c_uchar, - p: *const libc::c_uchar, - q: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ed25519_from_uniform( - p: *mut libc::c_uchar, - r: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ed25519_from_hash( - p: *mut libc::c_uchar, - h: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ed25519_random(p: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_core_ed25519_scalar_random(r: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_core_ed25519_scalar_invert( - recip: *mut libc::c_uchar, - s: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ed25519_scalar_negate(neg: *mut libc::c_uchar, s: *const libc::c_uchar); -} -extern "C" { - pub fn crypto_core_ed25519_scalar_complement(comp: *mut libc::c_uchar, s: *const libc::c_uchar); -} -extern "C" { - pub fn crypto_core_ed25519_scalar_add( - z: *mut libc::c_uchar, - x: *const libc::c_uchar, - y: *const libc::c_uchar, - ); -} -extern "C" { - pub fn crypto_core_ed25519_scalar_sub( - z: *mut libc::c_uchar, - x: *const libc::c_uchar, - y: *const libc::c_uchar, - ); -} -extern "C" { - pub fn crypto_core_ed25519_scalar_mul( - z: *mut libc::c_uchar, - x: *const libc::c_uchar, - y: *const libc::c_uchar, - ); -} -extern "C" { - pub fn crypto_core_ed25519_scalar_reduce(r: *mut libc::c_uchar, s: *const libc::c_uchar); -} -extern "C" { - pub fn crypto_core_ristretto255_bytes() -> usize; -} -extern "C" { - pub fn crypto_core_ristretto255_hashbytes() -> usize; -} -extern "C" { - pub fn crypto_core_ristretto255_scalarbytes() -> usize; -} -extern "C" { - pub fn crypto_core_ristretto255_nonreducedscalarbytes() -> usize; -} -extern "C" { - pub fn crypto_core_ristretto255_is_valid_point(p: *const libc::c_uchar) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ristretto255_add( - r: *mut libc::c_uchar, - p: *const libc::c_uchar, - q: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ristretto255_sub( - r: *mut libc::c_uchar, - p: *const libc::c_uchar, - q: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ristretto255_from_hash( - p: *mut libc::c_uchar, - r: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ristretto255_random(p: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_core_ristretto255_scalar_random(r: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_core_ristretto255_scalar_invert( - recip: *mut libc::c_uchar, - s: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_core_ristretto255_scalar_negate(neg: *mut libc::c_uchar, s: *const libc::c_uchar); -} -extern "C" { - pub fn crypto_core_ristretto255_scalar_complement( - comp: *mut libc::c_uchar, - s: *const libc::c_uchar, - ); -} -extern "C" { - pub fn crypto_core_ristretto255_scalar_add( - z: *mut libc::c_uchar, - x: *const libc::c_uchar, - y: *const libc::c_uchar, - ); -} -extern "C" { - pub fn crypto_core_ristretto255_scalar_sub( - z: *mut libc::c_uchar, - x: *const libc::c_uchar, - y: *const libc::c_uchar, - ); -} -extern "C" { - pub fn crypto_core_ristretto255_scalar_mul( - z: *mut libc::c_uchar, - x: *const libc::c_uchar, - y: *const libc::c_uchar, - ); -} -extern "C" { - pub fn crypto_core_ristretto255_scalar_reduce(r: *mut libc::c_uchar, s: *const libc::c_uchar); -} -extern "C" { - pub fn crypto_scalarmult_ed25519_bytes() -> usize; -} -extern "C" { - pub fn crypto_scalarmult_ed25519_scalarbytes() -> usize; -} -extern "C" { - pub fn crypto_scalarmult_ed25519( - q: *mut libc::c_uchar, - n: *const libc::c_uchar, - p: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_scalarmult_ed25519_noclamp( - q: *mut libc::c_uchar, - n: *const libc::c_uchar, - p: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_scalarmult_ed25519_base( - q: *mut libc::c_uchar, - n: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_scalarmult_ed25519_base_noclamp( - q: *mut libc::c_uchar, - n: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_scalarmult_ristretto255_bytes() -> usize; -} -extern "C" { - pub fn crypto_scalarmult_ristretto255_scalarbytes() -> usize; -} -extern "C" { - pub fn crypto_scalarmult_ristretto255( - q: *mut libc::c_uchar, - n: *const libc::c_uchar, - p: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_scalarmult_ristretto255_base( - q: *mut libc::c_uchar, - n: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_xchacha20poly1305_keybytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_xchacha20poly1305_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_xchacha20poly1305_macbytes() -> usize; -} -extern "C" { - pub fn crypto_secretbox_xchacha20poly1305_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_secretbox_xchacha20poly1305_easy( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_xchacha20poly1305_open_easy( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_xchacha20poly1305_detached( - c: *mut libc::c_uchar, - mac: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_secretbox_xchacha20poly1305_open_detached( - m: *mut libc::c_uchar, - c: *const libc::c_uchar, - mac: *const libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_bytes_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_bytes_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_passwd_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_passwd_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_saltbytes() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_strbytes() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_strprefix() -> *const libc::c_char; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_opslimit_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_opslimit_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_memlimit_min() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_memlimit_max() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_opslimit_interactive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_memlimit_interactive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive() -> usize; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256( - out: *mut libc::c_uchar, - outlen: libc::c_ulonglong, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - salt: *const libc::c_uchar, - opslimit: libc::c_ulonglong, - memlimit: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_str( - out: *mut libc::c_char, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - opslimit: libc::c_ulonglong, - memlimit: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_str_verify( - str: *const libc::c_char, - passwd: *const libc::c_char, - passwdlen: libc::c_ulonglong, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_ll( - passwd: *const u8, - passwdlen: usize, - salt: *const u8, - saltlen: usize, - N: u64, - r: u32, - p: u32, - buf: *mut u8, - buflen: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_pwhash_scryptsalsa208sha256_str_needs_rehash( - str: *const libc::c_char, - opslimit: libc::c_ulonglong, - memlimit: usize, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_salsa2012_keybytes() -> usize; -} -extern "C" { - pub fn crypto_stream_salsa2012_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_stream_salsa2012_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_stream_salsa2012( - c: *mut libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_salsa2012_xor( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_salsa2012_keygen(k: *mut libc::c_uchar); -} -extern "C" { - pub fn crypto_stream_salsa208_keybytes() -> usize; -} -extern "C" { - pub fn crypto_stream_salsa208_noncebytes() -> usize; -} -extern "C" { - pub fn crypto_stream_salsa208_messagebytes_max() -> usize; -} -extern "C" { - pub fn crypto_stream_salsa208( - c: *mut libc::c_uchar, - clen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_salsa208_xor( - c: *mut libc::c_uchar, - m: *const libc::c_uchar, - mlen: libc::c_ulonglong, - n: *const libc::c_uchar, - k: *const libc::c_uchar, - ) -> libc::c_int; -} -extern "C" { - pub fn crypto_stream_salsa208_keygen(k: *mut libc::c_uchar); -} diff --git a/libsodium-sys/tests/crypto/crypto_aead_chacha20poly1305.rs b/libsodium-sys/tests/crypto/crypto_aead_chacha20poly1305.rs deleted file mode 100644 index 60a56ce..0000000 --- a/libsodium-sys/tests/crypto/crypto_aead_chacha20poly1305.rs +++ /dev/null @@ -1,67 +0,0 @@ -// crypto_aead_chacha20poly1305.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_aead_chacha20poly1305_keybytes() { - assert!( - unsafe { crypto_aead_chacha20poly1305_keybytes() as usize } - == crypto_aead_chacha20poly1305_KEYBYTES as usize - ) -} - -#[test] -fn test_crypto_aead_chacha20poly1305_nsecbytes() { - assert!( - unsafe { crypto_aead_chacha20poly1305_nsecbytes() as usize } - == crypto_aead_chacha20poly1305_NSECBYTES as usize - ) -} - -#[test] -fn test_crypto_aead_chacha20poly1305_npubbytes() { - assert!( - unsafe { crypto_aead_chacha20poly1305_npubbytes() as usize } - == crypto_aead_chacha20poly1305_NPUBBYTES as usize - ) -} - -#[test] -fn test_crypto_aead_chacha20poly1305_abytes() { - assert!( - unsafe { crypto_aead_chacha20poly1305_abytes() as usize } - == crypto_aead_chacha20poly1305_ABYTES as usize - ) -} - -#[test] -fn test_crypto_aead_chacha20poly1305_ietf_keybytes() { - assert!( - unsafe { crypto_aead_chacha20poly1305_ietf_keybytes() } - == crypto_aead_chacha20poly1305_ietf_KEYBYTES as usize - ) -} - -#[test] -fn test_crypto_aead_chacha20poly1305_ietf_nsecbytes() { - assert!( - unsafe { crypto_aead_chacha20poly1305_ietf_nsecbytes() } - == crypto_aead_chacha20poly1305_ietf_NSECBYTES as usize - ) -} - -#[test] -fn test_crypto_aead_chacha20poly1305_ietf_npubbytes() { - assert!( - unsafe { crypto_aead_chacha20poly1305_ietf_npubbytes() } - == crypto_aead_chacha20poly1305_ietf_NPUBBYTES as usize - ) -} - -#[test] -fn test_crypto_aead_chacha20poly1305_ietf_abytes() { - assert!( - unsafe { crypto_aead_chacha20poly1305_ietf_abytes() } - == crypto_aead_chacha20poly1305_ietf_ABYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_aead_xchacha20poly1305_ietf.rs b/libsodium-sys/tests/crypto/crypto_aead_xchacha20poly1305_ietf.rs deleted file mode 100644 index 77c6517..0000000 --- a/libsodium-sys/tests/crypto/crypto_aead_xchacha20poly1305_ietf.rs +++ /dev/null @@ -1,24 +0,0 @@ -// crypto_aead_xchacha20poly1305.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_aead_xchacha20poly1305_ietf_keybytes() { - assert!(unsafe { crypto_aead_xchacha20poly1305_ietf_keybytes() as usize } == - crypto_aead_xchacha20poly1305_ietf_KEYBYTES) -} -#[test] -fn test_crypto_aead_xchacha20poly1305_ietf_nsecbytes() { - assert!(unsafe { crypto_aead_xchacha20poly1305_ietf_nsecbytes() as usize } == - crypto_aead_xchacha20poly1305_ietf_NSECBYTES) -} -#[test] -fn test_crypto_aead_xchacha20poly1305_ietf_npubbytes() { - assert!(unsafe { crypto_aead_xchacha20poly1305_ietf_npubbytes() as usize } == - crypto_aead_xchacha20poly1305_ietf_NPUBBYTES) -} -#[test] -fn test_crypto_aead_xchacha20poly1305_ietf_abytes() { - assert!(unsafe { crypto_aead_xchacha20poly1305_ietf_abytes() as usize } == - crypto_aead_xchacha20poly1305_ietf_ABYTES) -} diff --git a/libsodium-sys/tests/crypto/crypto_auth.rs b/libsodium-sys/tests/crypto/crypto_auth.rs deleted file mode 100644 index a57935f..0000000 --- a/libsodium-sys/tests/crypto/crypto_auth.rs +++ /dev/null @@ -1,24 +0,0 @@ -// crypto_auth.h - -use libsodium_sys::*; -use std::ffi::CStr; - -#[test] -fn test_crypto_auth_bytes() { - assert!(unsafe { crypto_auth_bytes() } == crypto_auth_BYTES as usize) -} - -#[test] -fn test_crypto_auth_keybytes() { - assert!(unsafe { crypto_auth_keybytes() } == crypto_auth_KEYBYTES as usize) -} - -#[test] -fn test_crypto_auth_primitive() { - unsafe { - let s = crypto_auth_primitive(); - let s = CStr::from_ptr(s); - let p = CStr::from_bytes_with_nul(crypto_auth_PRIMITIVE).unwrap(); - assert_eq!(s, p); - } -} diff --git a/libsodium-sys/tests/crypto/crypto_auth_hmacsha256.rs b/libsodium-sys/tests/crypto/crypto_auth_hmacsha256.rs deleted file mode 100644 index 2698043..0000000 --- a/libsodium-sys/tests/crypto/crypto_auth_hmacsha256.rs +++ /dev/null @@ -1,16 +0,0 @@ -// crypto_auth_hmacsha256.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_auth_hmacsha256_bytes() { - assert!(unsafe { crypto_auth_hmacsha256_bytes() } == crypto_auth_hmacsha256_BYTES as usize) -} - -#[test] -fn test_crypto_auth_hmacsha256_keybytes() { - assert!( - unsafe { crypto_auth_hmacsha256_keybytes() as usize } - == crypto_auth_hmacsha256_KEYBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_auth_hmacsha512.rs b/libsodium-sys/tests/crypto/crypto_auth_hmacsha512.rs deleted file mode 100644 index 817cf39..0000000 --- a/libsodium-sys/tests/crypto/crypto_auth_hmacsha512.rs +++ /dev/null @@ -1,15 +0,0 @@ -// crypto_auth_hmacsha512.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_auth_hmacsha512_bytes() { - assert!(unsafe { crypto_auth_hmacsha512_bytes() } == crypto_auth_hmacsha512_BYTES as usize) -} - -#[test] -fn test_crypto_auth_hmacsha512_keybytes() { - assert!( - unsafe { crypto_auth_hmacsha512_keybytes() } == crypto_auth_hmacsha512_KEYBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_auth_hmacsha512256.rs b/libsodium-sys/tests/crypto/crypto_auth_hmacsha512256.rs deleted file mode 100644 index c32ff1b..0000000 --- a/libsodium-sys/tests/crypto/crypto_auth_hmacsha512256.rs +++ /dev/null @@ -1,18 +0,0 @@ -// crypto_auth_hmacsha512256.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_auth_hmacsha512256_bytes() { - assert!( - unsafe { crypto_auth_hmacsha512256_bytes() } == crypto_auth_hmacsha512256_BYTES as usize - ) -} - -#[test] -fn test_crypto_auth_hmacsha512256_keybytes() { - assert!( - unsafe { crypto_auth_hmacsha512256_keybytes() } - == crypto_auth_hmacsha512256_KEYBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_box.rs b/libsodium-sys/tests/crypto/crypto_box.rs deleted file mode 100644 index d071948..0000000 --- a/libsodium-sys/tests/crypto/crypto_box.rs +++ /dev/null @@ -1,58 +0,0 @@ -// crypto_box.h - -use libsodium_sys::*; -use std::ffi::CStr; -#[test] -fn test_crypto_box_seedbytes() { - assert!(unsafe { crypto_box_seedbytes() } == crypto_box_SEEDBYTES as usize) -} - -#[test] -fn test_crypto_box_publickeybytes() { - assert!(unsafe { crypto_box_publickeybytes() } == crypto_box_PUBLICKEYBYTES as usize) -} - -#[test] -fn test_crypto_box_secretkeybytes() { - assert!(unsafe { crypto_box_secretkeybytes() } == crypto_box_SECRETKEYBYTES as usize) -} - -#[test] -fn test_crypto_box_beforenmbytes() { - assert!(unsafe { crypto_box_beforenmbytes() } == crypto_box_BEFORENMBYTES as usize) -} - -#[test] -fn test_crypto_box_noncebytes() { - assert!(unsafe { crypto_box_noncebytes() } == crypto_box_NONCEBYTES as usize) -} - -#[test] -fn test_crypto_box_zerobytes() { - assert!(unsafe { crypto_box_zerobytes() } == crypto_box_ZEROBYTES as usize) -} - -#[test] -fn test_crypto_box_boxzerobytes() { - assert!(unsafe { crypto_box_boxzerobytes() } == crypto_box_BOXZEROBYTES as usize) -} - -#[test] -fn test_crypto_box_macbytes() { - assert!(unsafe { crypto_box_macbytes() } == crypto_box_MACBYTES as usize) -} - -#[test] -fn test_crypto_box_primitive() { - unsafe { - let s = crypto_box_primitive(); - let s = CStr::from_ptr(s); - let p = CStr::from_bytes_with_nul(crypto_box_PRIMITIVE).unwrap(); - assert_eq!(s, p); - } -} - -#[test] -fn test_crypto_box_sealbytes() { - assert!(unsafe { crypto_box_sealbytes() } == crypto_box_SEALBYTES as usize) -} diff --git a/libsodium-sys/tests/crypto/crypto_box_curve25519xsalsa20poly1305.rs b/libsodium-sys/tests/crypto/crypto_box_curve25519xsalsa20poly1305.rs deleted file mode 100644 index a2fe156..0000000 --- a/libsodium-sys/tests/crypto/crypto_box_curve25519xsalsa20poly1305.rs +++ /dev/null @@ -1,67 +0,0 @@ -// crypto_box_curve25519xsalsa20poly1305.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_box_curve25519xsalsa20poly1305_seedbytes() { - assert!( - unsafe { crypto_box_curve25519xsalsa20poly1305_seedbytes() } - == crypto_box_curve25519xsalsa20poly1305_SEEDBYTES as usize - ) -} - -#[test] -fn test_crypto_box_curve25519xsalsa20poly1305_publickeybytes() { - assert!( - unsafe { crypto_box_curve25519xsalsa20poly1305_publickeybytes() } - == crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES as usize - ) -} - -#[test] -fn test_crypto_box_curve25519xsalsa20poly1305_secretkeybytes() { - assert!( - unsafe { crypto_box_curve25519xsalsa20poly1305_secretkeybytes() } - == crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES as usize - ) -} - -#[test] -fn test_crypto_box_curve25519xsalsa20poly1305_beforenmbytes() { - assert!( - unsafe { crypto_box_curve25519xsalsa20poly1305_beforenmbytes() } - == crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES as usize - ) -} - -#[test] -fn test_crypto_box_curve25519xsalsa20poly1305_noncebytes() { - assert!( - unsafe { crypto_box_curve25519xsalsa20poly1305_noncebytes() } - == crypto_box_curve25519xsalsa20poly1305_NONCEBYTES as usize - ) -} - -#[test] -fn test_crypto_box_curve25519xsalsa20poly1305_zerobytes() { - assert!( - unsafe { crypto_box_curve25519xsalsa20poly1305_zerobytes() } - == crypto_box_curve25519xsalsa20poly1305_ZEROBYTES as usize - ) -} - -#[test] -fn test_crypto_box_curve25519xsalsa20poly1305_boxzerobytes() { - assert!( - unsafe { crypto_box_curve25519xsalsa20poly1305_boxzerobytes() } - == crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES as usize - ) -} - -#[test] -fn test_crypto_box_curve25519xsalsa20poly1305_macbytes() { - assert!( - unsafe { crypto_box_curve25519xsalsa20poly1305_macbytes() } - == crypto_box_curve25519xsalsa20poly1305_MACBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_core_hsalsa20.rs b/libsodium-sys/tests/crypto/crypto_core_hsalsa20.rs deleted file mode 100644 index 416c7cc..0000000 --- a/libsodium-sys/tests/crypto/crypto_core_hsalsa20.rs +++ /dev/null @@ -1,29 +0,0 @@ -// crypto_core_hsalsa20.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_core_hsalsa20_outputbytes() { - assert!( - unsafe { crypto_core_hsalsa20_outputbytes() } == crypto_core_hsalsa20_OUTPUTBYTES as usize - ) -} - -#[test] -fn test_crypto_core_hsalsa20_inputbytes() { - assert!( - unsafe { crypto_core_hsalsa20_inputbytes() } == crypto_core_hsalsa20_INPUTBYTES as usize - ) -} - -#[test] -fn test_crypto_core_hsalsa20_keybytes() { - assert!(unsafe { crypto_core_hsalsa20_keybytes() } == crypto_core_hsalsa20_KEYBYTES as usize) -} - -#[test] -fn test_crypto_core_hsalsa20_constbytes() { - assert!( - unsafe { crypto_core_hsalsa20_constbytes() } == crypto_core_hsalsa20_CONSTBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_core_salsa20.rs b/libsodium-sys/tests/crypto/crypto_core_salsa20.rs deleted file mode 100644 index 9a16005..0000000 --- a/libsodium-sys/tests/crypto/crypto_core_salsa20.rs +++ /dev/null @@ -1,25 +0,0 @@ -// crypto_core_salsa20.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_core_salsa20_outputbytes() { - assert!( - unsafe { crypto_core_salsa20_outputbytes() } == crypto_core_salsa20_OUTPUTBYTES as usize - ) -} - -#[test] -fn test_crypto_core_salsa20_inputbytes() { - assert!(unsafe { crypto_core_salsa20_inputbytes() } == crypto_core_salsa20_INPUTBYTES as usize) -} - -#[test] -fn test_crypto_core_salsa20_keybytes() { - assert!(unsafe { crypto_core_salsa20_keybytes() } == crypto_core_salsa20_KEYBYTES as usize) -} - -#[test] -fn test_crypto_core_salsa20_constbytes() { - assert!(unsafe { crypto_core_salsa20_constbytes() } == crypto_core_salsa20_CONSTBYTES as usize) -} diff --git a/libsodium-sys/tests/crypto/crypto_core_salsa2012.rs b/libsodium-sys/tests/crypto/crypto_core_salsa2012.rs deleted file mode 100644 index ab50794..0000000 --- a/libsodium-sys/tests/crypto/crypto_core_salsa2012.rs +++ /dev/null @@ -1,30 +0,0 @@ -// crypto_core_salsa2012.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_core_salsa2012_outputbytes() { - assert!( - unsafe { crypto_core_salsa2012_outputbytes() } - == crypto_core_salsa2012_OUTPUTBYTES as usize - ) -} - -#[test] -fn test_crypto_core_salsa2012_inputbytes() { - assert!( - unsafe { crypto_core_salsa2012_inputbytes() } == crypto_core_salsa2012_INPUTBYTES as usize - ) -} - -#[test] -fn test_crypto_core_salsa2012_keybytes() { - assert!(unsafe { crypto_core_salsa2012_keybytes() } == crypto_core_salsa2012_KEYBYTES as usize) -} - -#[test] -fn test_crypto_core_salsa2012_constbytes() { - assert!( - unsafe { crypto_core_salsa2012_constbytes() } == crypto_core_salsa2012_CONSTBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_core_salsa208.rs b/libsodium-sys/tests/crypto/crypto_core_salsa208.rs deleted file mode 100644 index 703b922..0000000 --- a/libsodium-sys/tests/crypto/crypto_core_salsa208.rs +++ /dev/null @@ -1,29 +0,0 @@ -// crypto_core_salsa208.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_core_salsa208_outputbytes() { - assert!( - unsafe { crypto_core_salsa208_outputbytes() } == crypto_core_salsa208_OUTPUTBYTES as usize - ) -} - -#[test] -fn test_crypto_core_salsa208_inputbytes() { - assert!( - unsafe { crypto_core_salsa208_inputbytes() } == crypto_core_salsa208_INPUTBYTES as usize - ) -} - -#[test] -fn test_crypto_core_salsa208_keybytes() { - assert!(unsafe { crypto_core_salsa208_keybytes() } == crypto_core_salsa208_KEYBYTES as usize) -} - -#[test] -fn test_crypto_core_salsa208_constbytes() { - assert!( - unsafe { crypto_core_salsa208_constbytes() } == crypto_core_salsa208_CONSTBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_generichash.rs b/libsodium-sys/tests/crypto/crypto_generichash.rs deleted file mode 100644 index 6a489fd..0000000 --- a/libsodium-sys/tests/crypto/crypto_generichash.rs +++ /dev/null @@ -1,121 +0,0 @@ -// crypto_generichash.h - -use libsodium_sys::*; -use std::ffi::CStr; - -#[test] -fn test_crypto_generichash_bytes_min() { - assert_eq!( - unsafe { crypto_generichash_bytes_min() }, - crypto_generichash_BYTES_MIN as usize - ) -} - -#[test] -fn test_crypto_generichash_bytes_max() { - assert_eq!( - unsafe { crypto_generichash_bytes_max() }, - crypto_generichash_BYTES_MAX as usize - ) -} - -#[test] -fn test_crypto_generichash_bytes() { - assert_eq!( - unsafe { crypto_generichash_bytes() }, - crypto_generichash_BYTES as usize - ) -} - -#[test] -fn test_crypto_generichash_keybytes_min() { - assert_eq!( - unsafe { crypto_generichash_keybytes_min() }, - crypto_generichash_KEYBYTES_MIN as usize - ) -} - -#[test] -fn test_crypto_generichash_keybytes_max() { - assert_eq!( - unsafe { crypto_generichash_keybytes_max() }, - crypto_generichash_KEYBYTES_MAX as usize - ) -} - -#[test] -fn test_crypto_generichash_keybytes() { - assert_eq!( - unsafe { crypto_generichash_keybytes() }, - crypto_generichash_KEYBYTES as usize - ) -} -#[test] -fn test_crypto_generichash_primitive() { - unsafe { - let s = crypto_generichash_primitive(); - let s = CStr::from_ptr(s); - let p = CStr::from_bytes_with_nul(crypto_generichash_PRIMITIVE).unwrap(); - assert_eq!(s, p); - } -} - -#[test] -fn test_crypto_generichash_statebytes() { - assert!(unsafe { crypto_generichash_statebytes() } > 0); -} - -#[test] -fn test_crypto_generichash() { - let mut out = [0u8; crypto_generichash_BYTES as usize]; - let m = [0u8; 64]; - let key = [0u8; crypto_generichash_KEYBYTES as usize]; - - assert_eq!( - unsafe { - crypto_generichash( - out.as_mut_ptr(), - out.len(), - m.as_ptr(), - m.len() as u64, - key.as_ptr(), - key.len(), - ) - }, - 0 - ); -} - -#[cfg(test)] -use std::mem; - -#[test] -fn test_crypto_generichash_multipart() { - let mut out = [0u8; crypto_generichash_BYTES as usize]; - let m = [0u8; 64]; - let key = [0u8; crypto_generichash_KEYBYTES as usize]; - - let mut pst = mem::MaybeUninit::::uninit(); - - assert_eq!( - unsafe { crypto_generichash_init(pst.as_mut_ptr(), key.as_ptr(), key.len(), out.len()) }, - 0 - ); - - let mut pst = unsafe { pst.assume_init() }; - - assert_eq!( - unsafe { crypto_generichash_update(&mut pst, m.as_ptr(), m.len() as u64) }, - 0 - ); - - assert_eq!( - unsafe { crypto_generichash_update(&mut pst, m.as_ptr(), m.len() as u64) }, - 0 - ); - - assert_eq!( - unsafe { crypto_generichash_final(&mut pst, out.as_mut_ptr(), out.len()) }, - 0 - ); -} diff --git a/libsodium-sys/tests/crypto/crypto_generichash_blake2b.rs b/libsodium-sys/tests/crypto/crypto_generichash_blake2b.rs deleted file mode 100644 index f921a07..0000000 --- a/libsodium-sys/tests/crypto/crypto_generichash_blake2b.rs +++ /dev/null @@ -1,120 +0,0 @@ -// crypto_generichash_blake2b.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_generichash_blake2b_state_alignment() { - // this asserts the alignment applied that was broken with old - // versions of bindgen - assert_eq!(64, std::mem::align_of::()); -} - -#[test] -fn test_crypto_generichash_blake2b_bytes_min() { - assert_eq!( - unsafe { crypto_generichash_blake2b_bytes_min() }, - crypto_generichash_blake2b_BYTES_MIN as usize - ) -} - -#[test] -fn test_crypto_generichash_blake2b_bytes_max() { - assert_eq!( - unsafe { crypto_generichash_blake2b_bytes_max() }, - crypto_generichash_blake2b_BYTES_MAX as usize - ) -} - -#[test] -fn test_crypto_generichash_blake2b_bytes() { - assert_eq!( - unsafe { crypto_generichash_blake2b_bytes() }, - crypto_generichash_blake2b_BYTES as usize - ) -} - -#[test] -fn test_crypto_generichash_blake2b_keybytes_min() { - assert_eq!( - unsafe { crypto_generichash_blake2b_keybytes_min() }, - crypto_generichash_blake2b_KEYBYTES_MIN as usize - ) -} - -#[test] -fn test_crypto_generichash_blake2b_keybytes_max() { - assert_eq!( - unsafe { crypto_generichash_blake2b_keybytes_max() }, - crypto_generichash_blake2b_KEYBYTES_MAX as usize - ) -} - -#[test] -fn test_crypto_generichash_blake2b_keybytes() { - assert_eq!( - unsafe { crypto_generichash_blake2b_keybytes() }, - crypto_generichash_blake2b_KEYBYTES as usize - ) -} - -#[test] -fn test_crypto_generichash_blake2b_saltbytes() { - assert_eq!( - unsafe { crypto_generichash_blake2b_saltbytes() }, - crypto_generichash_blake2b_SALTBYTES as usize - ) -} - -#[test] -fn test_crypto_generichash_blake2b_personalbytes() { - assert_eq!( - unsafe { crypto_generichash_blake2b_personalbytes() }, - crypto_generichash_blake2b_PERSONALBYTES as usize - ) -} - -#[test] -fn test_crypto_generichash_blake2b() { - let mut out = [0u8; crypto_generichash_blake2b_BYTES as usize]; - let m = [0u8; 64]; - let key = [0u8; crypto_generichash_blake2b_KEYBYTES as usize]; - - assert_eq!( - unsafe { - crypto_generichash_blake2b( - out.as_mut_ptr(), - out.len(), - m.as_ptr(), - m.len() as u64, - key.as_ptr(), - key.len(), - ) - }, - 0 - ); -} - -#[test] -fn test_crypto_generichash_blake2b_salt_personal() { - let mut out = [0u8; crypto_generichash_blake2b_BYTES as usize]; - let m = [0u8; 64]; - let key = [0u8; crypto_generichash_blake2b_KEYBYTES as usize]; - let salt = [0u8; crypto_generichash_blake2b_SALTBYTES as usize]; - let personal = [0u8; crypto_generichash_blake2b_PERSONALBYTES as usize]; - - assert_eq!( - unsafe { - crypto_generichash_blake2b_salt_personal( - out.as_mut_ptr(), - out.len(), - m.as_ptr(), - m.len() as u64, - key.as_ptr(), - key.len(), - salt.as_ptr(), - personal.as_ptr(), - ) - }, - 0 - ); -} diff --git a/libsodium-sys/tests/crypto/crypto_hash.rs b/libsodium-sys/tests/crypto/crypto_hash.rs deleted file mode 100644 index 3c2556f..0000000 --- a/libsodium-sys/tests/crypto/crypto_hash.rs +++ /dev/null @@ -1,19 +0,0 @@ -// crypto_hash.h - -use libsodium_sys::*; -use std::ffi::CStr; - -#[test] -fn test_crypto_hash_bytes() { - assert!(unsafe { crypto_hash_bytes() } == crypto_hash_BYTES as usize) -} - -#[test] -fn test_crypto_hash_primitive() { - unsafe { - let s = crypto_hash_primitive(); - let s = CStr::from_ptr(s); - let p = CStr::from_bytes_with_nul(crypto_hash_PRIMITIVE).unwrap(); - assert_eq!(s, p); - } -} diff --git a/libsodium-sys/tests/crypto/crypto_hash_sha256.rs b/libsodium-sys/tests/crypto/crypto_hash_sha256.rs deleted file mode 100644 index 9022fb7..0000000 --- a/libsodium-sys/tests/crypto/crypto_hash_sha256.rs +++ /dev/null @@ -1,8 +0,0 @@ -// crypto_hash_sha256.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_hash_sha256_bytes() { - assert!(unsafe { crypto_hash_sha256_bytes() } == crypto_hash_sha256_BYTES as usize) -} diff --git a/libsodium-sys/tests/crypto/crypto_hash_sha512.rs b/libsodium-sys/tests/crypto/crypto_hash_sha512.rs deleted file mode 100644 index d30dab5..0000000 --- a/libsodium-sys/tests/crypto/crypto_hash_sha512.rs +++ /dev/null @@ -1,8 +0,0 @@ -// crypto_hash_sha512.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_hash_sha512_bytes() { - assert!(unsafe { crypto_hash_sha512_bytes() } == crypto_hash_sha512_BYTES as usize) -} diff --git a/libsodium-sys/tests/crypto/crypto_kx.rs b/libsodium-sys/tests/crypto/crypto_kx.rs deleted file mode 100644 index 3aba13f..0000000 --- a/libsodium-sys/tests/crypto/crypto_kx.rs +++ /dev/null @@ -1,34 +0,0 @@ -// crypto_kx.h - -use libsodium_sys::*; -use std::ffi::CStr; - -#[test] -fn test_crypto_kx_publickeybytes() { - assert!(unsafe { crypto_kx_publickeybytes() } == crypto_kx_PUBLICKEYBYTES as usize) -} - -#[test] -fn test_crypto_kx_secretkeybytes() { - assert!(unsafe { crypto_kx_secretkeybytes() } == crypto_kx_SECRETKEYBYTES as usize) -} - -#[test] -fn test_crypto_kx_seedbytes() { - assert!(unsafe { crypto_kx_seedbytes() } == crypto_kx_SEEDBYTES as usize) -} - -#[test] -fn test_crypto_kx_sessionkeybytes() { - assert!(unsafe { crypto_kx_sessionkeybytes() } == crypto_kx_SESSIONKEYBYTES as usize) -} - -#[test] -fn test_crypto_kx_primitive() { - unsafe { - let s = crypto_kx_primitive(); - let s = CStr::from_ptr(s); - let p = CStr::from_bytes_with_nul(crypto_kx_PRIMITIVE).unwrap(); - assert_eq!(s, p); - } -} diff --git a/libsodium-sys/tests/crypto/crypto_onetimeauth.rs b/libsodium-sys/tests/crypto/crypto_onetimeauth.rs deleted file mode 100644 index a6b6fa7..0000000 --- a/libsodium-sys/tests/crypto/crypto_onetimeauth.rs +++ /dev/null @@ -1,24 +0,0 @@ -// crypto_onetimeauth.h - -use libsodium_sys::*; -use std::ffi::CStr; - -#[test] -fn test_crypto_onetimeauth_bytes() { - assert!(unsafe { crypto_onetimeauth_bytes() } == crypto_onetimeauth_BYTES as usize) -} - -#[test] -fn test_crypto_onetimeauth_keybytes() { - assert!(unsafe { crypto_onetimeauth_keybytes() } == crypto_onetimeauth_KEYBYTES as usize) -} - -#[test] -fn test_crypto_onetimeauth_primitive() { - unsafe { - let s = crypto_onetimeauth_primitive(); - let s = CStr::from_ptr(s); - let p = CStr::from_bytes_with_nul(crypto_onetimeauth_PRIMITIVE).unwrap(); - assert_eq!(s, p); - } -} diff --git a/libsodium-sys/tests/crypto/crypto_onetimeauth_poly1305.rs b/libsodium-sys/tests/crypto/crypto_onetimeauth_poly1305.rs deleted file mode 100644 index bfe309a..0000000 --- a/libsodium-sys/tests/crypto/crypto_onetimeauth_poly1305.rs +++ /dev/null @@ -1,28 +0,0 @@ -// crypto_onetimeauth_poly1305.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_onetimeauth_poly1305_state_alignment() { - // this asserts the alignment applied that was broken with old - // versions of bindgen - assert_eq!( - 16, - std::mem::align_of::() - ); -} - -#[test] -fn test_crypto_onetimeauth_poly1305_bytes() { - assert!( - unsafe { crypto_onetimeauth_poly1305_bytes() } - == crypto_onetimeauth_poly1305_BYTES as usize - ) -} -#[test] -fn test_crypto_onetimeauth_poly1305_keybytes() { - assert!( - unsafe { crypto_onetimeauth_poly1305_keybytes() } - == crypto_onetimeauth_poly1305_KEYBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_pwhash_scryptsalsa208sha256.rs b/libsodium-sys/tests/crypto/crypto_pwhash_scryptsalsa208sha256.rs deleted file mode 100644 index c7463c1..0000000 --- a/libsodium-sys/tests/crypto/crypto_pwhash_scryptsalsa208sha256.rs +++ /dev/null @@ -1,219 +0,0 @@ -// crypto_pwhash_scryptsalsa208sha256.h - -use libc::{c_ulonglong, size_t}; -use libsodium_sys::*; -use std::ffi::CStr; - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_saltbytes() { - assert!( - unsafe { crypto_pwhash_scryptsalsa208sha256_saltbytes() } - == crypto_pwhash_scryptsalsa208sha256_SALTBYTES as usize - ) -} - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_strbytes() { - assert!( - unsafe { crypto_pwhash_scryptsalsa208sha256_strbytes() } - == crypto_pwhash_scryptsalsa208sha256_STRBYTES as usize - ) -} - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_opslimit_interactive() { - assert!( - unsafe { crypto_pwhash_scryptsalsa208sha256_opslimit_interactive() } - == crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE as usize - ) -} - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_memlimit_interactive() { - assert!( - unsafe { crypto_pwhash_scryptsalsa208sha256_memlimit_interactive() } - == crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE as usize - ) -} - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive() { - assert!( - unsafe { crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive() } - == crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE as usize - ) -} - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive() { - assert!( - unsafe { crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive() } - == crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE as usize - ) -} - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_strprefix() { - unsafe { - let s = crypto_pwhash_scryptsalsa208sha256_strprefix(); - let s = CStr::from_ptr(s); - let p = CStr::from_bytes_with_nul(crypto_pwhash_scryptsalsa208sha256_STRPREFIX).unwrap(); - assert_eq!(s, p); - } -} - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_str() { - let password = "Correct Horse Battery Staple"; - let mut hashed_password = [0; crypto_pwhash_scryptsalsa208sha256_STRBYTES as usize]; - let ret_hash = unsafe { - crypto_pwhash_scryptsalsa208sha256_str( - hashed_password.as_mut_ptr(), - password.as_ptr() as *const _, - password.len() as c_ulonglong, - u64::from(crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE), - crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE as size_t, - ) - }; - assert!(ret_hash == 0); - let ret_verify = unsafe { - crypto_pwhash_scryptsalsa208sha256_str_verify( - hashed_password.as_ptr(), - password.as_ptr() as *const _, - password.len() as c_ulonglong, - ) - }; - assert!(ret_verify == 0); -} - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_ll_1() { - // See https://www.tarsnap.com/scrypt/scrypt.pdf Page 16 - let password = ""; - let salt = ""; - let n = 16; - let r = 1; - let p = 1; - let mut buf = [0u8; 64]; - let expected = [ - 0x77, 0xd6, 0x57, 0x62, 0x38, 0x65, 0x7b, 0x20, 0x3b, 0x19, 0xca, 0x42, 0xc1, 0x8a, 0x04, - 0x97, 0xf1, 0x6b, 0x48, 0x44, 0xe3, 0x07, 0x4a, 0xe8, 0xdf, 0xdf, 0xfa, 0x3f, 0xed, 0xe2, - 0x14, 0x42, 0xfc, 0xd0, 0x06, 0x9d, 0xed, 0x09, 0x48, 0xf8, 0x32, 0x6a, 0x75, 0x3a, 0x0f, - 0xc8, 0x1f, 0x17, 0xe8, 0xd3, 0xe0, 0xfb, 0x2e, 0x0d, 0x36, 0x28, 0xcf, 0x35, 0xe2, 0x0c, - 0x38, 0xd1, 0x89, 0x06, - ]; - let ret = unsafe { - crypto_pwhash_scryptsalsa208sha256_ll( - password.as_ptr(), - password.len() as size_t, - salt.as_ptr(), - salt.len() as size_t, - n, - r, - p, - buf.as_mut_ptr(), - buf.len() as size_t, - ) - }; - assert!(ret == 0); - assert!(buf[0..] == expected[0..]); -} - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_ll_2() { - // See https://www.tarsnap.com/scrypt/scrypt.pdf Page 16 - let password = "password"; - let salt = "NaCl"; - let n = 1024; - let r = 8; - let p = 16; - let mut buf = [0u8; 64]; - let expected = [ - 0xfd, 0xba, 0xbe, 0x1c, 0x9d, 0x34, 0x72, 0x00, 0x78, 0x56, 0xe7, 0x19, 0x0d, 0x01, 0xe9, - 0xfe, 0x7c, 0x6a, 0xd7, 0xcb, 0xc8, 0x23, 0x78, 0x30, 0xe7, 0x73, 0x76, 0x63, 0x4b, 0x37, - 0x31, 0x62, 0x2e, 0xaf, 0x30, 0xd9, 0x2e, 0x22, 0xa3, 0x88, 0x6f, 0xf1, 0x09, 0x27, 0x9d, - 0x98, 0x30, 0xda, 0xc7, 0x27, 0xaf, 0xb9, 0x4a, 0x83, 0xee, 0x6d, 0x83, 0x60, 0xcb, 0xdf, - 0xa2, 0xcc, 0x06, 0x40, - ]; - let ret = unsafe { - crypto_pwhash_scryptsalsa208sha256_ll( - password.as_ptr(), - password.len() as size_t, - salt.as_ptr(), - salt.len() as size_t, - n, - r, - p, - buf.as_mut_ptr(), - buf.len() as size_t, - ) - }; - assert!(ret == 0); - assert!(buf[0..] == expected[0..]); -} - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_ll_3() { - // See https://www.tarsnap.com/scrypt/scrypt.pdf Page 16 - let password = "pleaseletmein"; - let salt = "SodiumChloride"; - let n = 16384; - let r = 8; - let p = 1; - let mut buf = [0u8; 64]; - let expected = [ - 0x70, 0x23, 0xbd, 0xcb, 0x3a, 0xfd, 0x73, 0x48, 0x46, 0x1c, 0x06, 0xcd, 0x81, 0xfd, 0x38, - 0xeb, 0xfd, 0xa8, 0xfb, 0xba, 0x90, 0x4f, 0x8e, 0x3e, 0xa9, 0xb5, 0x43, 0xf6, 0x54, 0x5d, - 0xa1, 0xf2, 0xd5, 0x43, 0x29, 0x55, 0x61, 0x3f, 0x0f, 0xcf, 0x62, 0xd4, 0x97, 0x05, 0x24, - 0x2a, 0x9a, 0xf9, 0xe6, 0x1e, 0x85, 0xdc, 0x0d, 0x65, 0x1e, 0x40, 0xdf, 0xcf, 0x01, 0x7b, - 0x45, 0x57, 0x58, 0x87, - ]; - let ret = unsafe { - crypto_pwhash_scryptsalsa208sha256_ll( - password.as_ptr(), - password.len() as size_t, - salt.as_ptr(), - salt.len() as size_t, - n, - r, - p, - buf.as_mut_ptr(), - buf.len() as size_t, - ) - }; - assert!(ret == 0); - assert!(buf[0..] == expected[0..]); -} - -#[test] -fn test_crypto_pwhash_scryptsalsa208sha256_ll_4() { - // See https://www.tarsnap.com/scrypt/scrypt.pdf Page 16 - let password = "pleaseletmein"; - let salt = "SodiumChloride"; - let n = 1_048_576; - let r = 8; - let p = 1; - let mut buf = [0u8; 64]; - let expected = [ - 0x21, 0x01, 0xcb, 0x9b, 0x6a, 0x51, 0x1a, 0xae, 0xad, 0xdb, 0xbe, 0x09, 0xcf, 0x70, 0xf8, - 0x81, 0xec, 0x56, 0x8d, 0x57, 0x4a, 0x2f, 0xfd, 0x4d, 0xab, 0xe5, 0xee, 0x98, 0x20, 0xad, - 0xaa, 0x47, 0x8e, 0x56, 0xfd, 0x8f, 0x4b, 0xa5, 0xd0, 0x9f, 0xfa, 0x1c, 0x6d, 0x92, 0x7c, - 0x40, 0xf4, 0xc3, 0x37, 0x30, 0x40, 0x49, 0xe8, 0xa9, 0x52, 0xfb, 0xcb, 0xf4, 0x5c, 0x6f, - 0xa7, 0x7a, 0x41, 0xa4, - ]; - let ret = unsafe { - crypto_pwhash_scryptsalsa208sha256_ll( - password.as_ptr(), - password.len() as size_t, - salt.as_ptr(), - salt.len() as size_t, - n, - r, - p, - buf.as_mut_ptr(), - buf.len() as size_t, - ) - }; - assert!(ret == 0); - assert!(buf[0..] == expected[0..]); -} diff --git a/libsodium-sys/tests/crypto/crypto_scalarmult.rs b/libsodium-sys/tests/crypto/crypto_scalarmult.rs deleted file mode 100644 index 488cda6..0000000 --- a/libsodium-sys/tests/crypto/crypto_scalarmult.rs +++ /dev/null @@ -1,30 +0,0 @@ -// crypto_scalarmult.h - -use libsodium_sys::*; -use std::ffi::CStr; - -#[test] -fn test_crypto_scalarmult_bytes() { - assert_eq!( - unsafe { crypto_scalarmult_bytes() }, - crypto_scalarmult_BYTES as usize - ); -} - -#[test] -fn test_crypto_scalarmult_scalarbytes() { - assert_eq!( - unsafe { crypto_scalarmult_scalarbytes() }, - crypto_scalarmult_SCALARBYTES as usize - ); -} - -#[test] -fn test_crypto_scalarmult_primitive() { - unsafe { - let s = crypto_scalarmult_primitive(); - let s = CStr::from_ptr(s); - let p = CStr::from_bytes_with_nul(crypto_scalarmult_PRIMITIVE).unwrap(); - assert_eq!(s, p); - } -} diff --git a/libsodium-sys/tests/crypto/crypto_scalarmult_curve25519.rs b/libsodium-sys/tests/crypto/crypto_scalarmult_curve25519.rs deleted file mode 100644 index 6f69918..0000000 --- a/libsodium-sys/tests/crypto/crypto_scalarmult_curve25519.rs +++ /dev/null @@ -1,19 +0,0 @@ -// crypto_scalarmult_curve25519.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_scalarmult_curve25519_bytes() { - assert_eq!( - unsafe { crypto_scalarmult_curve25519_bytes() }, - crypto_scalarmult_curve25519_BYTES as usize - ); -} - -#[test] -fn test_crypto_scalarmult_curve25519_scalarbytes() { - assert_eq!( - unsafe { crypto_scalarmult_curve25519_scalarbytes() }, - crypto_scalarmult_curve25519_SCALARBYTES as usize - ); -} diff --git a/libsodium-sys/tests/crypto/crypto_secretbox.rs b/libsodium-sys/tests/crypto/crypto_secretbox.rs deleted file mode 100644 index feaad53..0000000 --- a/libsodium-sys/tests/crypto/crypto_secretbox.rs +++ /dev/null @@ -1,29 +0,0 @@ -// crypto_secretbox.h - -use libsodium_sys::*; -use std::ffi::CStr; - -#[test] -fn test_crypto_secretbox_keybytes() { - assert!(unsafe { crypto_secretbox_keybytes() } == crypto_secretbox_KEYBYTES as usize) -} - -#[test] -fn test_crypto_secretbox_noncebytes() { - assert!(unsafe { crypto_secretbox_noncebytes() } == crypto_secretbox_NONCEBYTES as usize) -} - -#[test] -fn test_crypto_secretbox_macbytes() { - assert!(unsafe { crypto_secretbox_macbytes() } == crypto_secretbox_MACBYTES as usize) -} - -#[test] -fn test_crypto_secretbox_primitive() { - unsafe { - let s = crypto_secretbox_primitive(); - let s = CStr::from_ptr(s); - let p = CStr::from_bytes_with_nul(crypto_secretbox_PRIMITIVE).unwrap(); - assert_eq!(s, p); - } -} diff --git a/libsodium-sys/tests/crypto/crypto_secretbox_xsalsa20poly1305.rs b/libsodium-sys/tests/crypto/crypto_secretbox_xsalsa20poly1305.rs deleted file mode 100644 index 8ed529b..0000000 --- a/libsodium-sys/tests/crypto/crypto_secretbox_xsalsa20poly1305.rs +++ /dev/null @@ -1,43 +0,0 @@ -// crypto_secretbox_xsalsa20poly1305.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_secretbox_xsalsa20poly1305_keybytes() { - assert!( - unsafe { crypto_secretbox_xsalsa20poly1305_keybytes() } - == crypto_secretbox_xsalsa20poly1305_KEYBYTES as usize - ) -} - -#[test] -fn test_crypto_secretbox_xsalsa20poly1305_noncebytes() { - assert!( - unsafe { crypto_secretbox_xsalsa20poly1305_noncebytes() } - == crypto_secretbox_xsalsa20poly1305_NONCEBYTES as usize - ) -} - -#[test] -fn test_crypto_secretbox_xsalsa20poly1305_zerobytes() { - assert!( - unsafe { crypto_secretbox_xsalsa20poly1305_zerobytes() } - == crypto_secretbox_xsalsa20poly1305_ZEROBYTES as usize - ) -} - -#[test] -fn test_crypto_secretbox_xsalsa20poly1305_boxzerobytes() { - assert!( - unsafe { crypto_secretbox_xsalsa20poly1305_boxzerobytes() } - == crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES as usize - ) -} - -#[test] -fn test_crypto_secretbox_xsalsa20poly1305_macbytes() { - assert!( - unsafe { crypto_secretbox_xsalsa20poly1305_macbytes() } - == crypto_secretbox_xsalsa20poly1305_MACBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_shorthash_siphash24.rs b/libsodium-sys/tests/crypto/crypto_shorthash_siphash24.rs deleted file mode 100644 index 9473faa..0000000 --- a/libsodium-sys/tests/crypto/crypto_shorthash_siphash24.rs +++ /dev/null @@ -1,18 +0,0 @@ -// crypto_shorthash_siphash24.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_shorthash_siphash24_bytes() { - assert!( - unsafe { crypto_shorthash_siphash24_bytes() } == crypto_shorthash_siphash24_BYTES as usize - ) -} - -#[test] -fn test_crypto_shorthash_siphash24_keybytes() { - assert!( - unsafe { crypto_shorthash_siphash24_keybytes() } - == crypto_shorthash_siphash24_KEYBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_sign_ed25519.rs b/libsodium-sys/tests/crypto/crypto_sign_ed25519.rs deleted file mode 100644 index 497221c..0000000 --- a/libsodium-sys/tests/crypto/crypto_sign_ed25519.rs +++ /dev/null @@ -1,29 +0,0 @@ -// crypto_sign_ed25519.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_sign_ed25519_bytes() { - assert!(unsafe { crypto_sign_ed25519_bytes() } == crypto_sign_ed25519_BYTES as usize) -} - -#[test] -fn test_crypto_sign_ed25519_seedbytes() { - assert!(unsafe { crypto_sign_ed25519_seedbytes() } == crypto_sign_ed25519_SEEDBYTES as usize) -} - -#[test] -fn test_crypto_sign_ed25519_publickeybytes() { - assert!( - unsafe { crypto_sign_ed25519_publickeybytes() } - == crypto_sign_ed25519_PUBLICKEYBYTES as usize - ) -} - -#[test] -fn test_crypto_sign_ed25519_secretkeybytes() { - assert!( - unsafe { crypto_sign_ed25519_secretkeybytes() } - == crypto_sign_ed25519_SECRETKEYBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_stream.rs b/libsodium-sys/tests/crypto/crypto_stream.rs deleted file mode 100644 index df74e1c..0000000 --- a/libsodium-sys/tests/crypto/crypto_stream.rs +++ /dev/null @@ -1,24 +0,0 @@ -// crypto_stream.h - -use libsodium_sys::*; -use std::ffi::CStr; - -#[test] -fn test_crypto_stream_keybytes() { - assert!(unsafe { crypto_stream_keybytes() } == crypto_stream_KEYBYTES as usize) -} - -#[test] -fn test_crypto_stream_noncebytes() { - assert!(unsafe { crypto_stream_noncebytes() } == crypto_stream_NONCEBYTES as usize) -} - -#[test] -fn test_crypto_stream_primitive() { - unsafe { - let s = crypto_stream_primitive(); - let s = CStr::from_ptr(s); - let p = CStr::from_bytes_with_nul(crypto_stream_PRIMITIVE).unwrap(); - assert_eq!(s, p); - } -} diff --git a/libsodium-sys/tests/crypto/crypto_stream_chacha20.rs b/libsodium-sys/tests/crypto/crypto_stream_chacha20.rs deleted file mode 100644 index 9a5b650..0000000 --- a/libsodium-sys/tests/crypto/crypto_stream_chacha20.rs +++ /dev/null @@ -1,18 +0,0 @@ -// crypto_stream_chacha20.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_stream_chacha20_keybytes() { - assert!( - unsafe { crypto_stream_chacha20_keybytes() } == crypto_stream_chacha20_KEYBYTES as usize - ) -} - -#[test] -fn test_crypto_stream_chacha20_noncebytes() { - assert!( - unsafe { crypto_stream_chacha20_noncebytes() } - == crypto_stream_chacha20_NONCEBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_stream_salsa20.rs b/libsodium-sys/tests/crypto/crypto_stream_salsa20.rs deleted file mode 100644 index c9f562f..0000000 --- a/libsodium-sys/tests/crypto/crypto_stream_salsa20.rs +++ /dev/null @@ -1,15 +0,0 @@ -// crypto_stream_salsa20.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_stream_salsa20_keybytes() { - assert!(unsafe { crypto_stream_salsa20_keybytes() } == crypto_stream_salsa20_KEYBYTES as usize) -} - -#[test] -fn test_crypto_stream_salsa20_noncebytes() { - assert!( - unsafe { crypto_stream_salsa20_noncebytes() } == crypto_stream_salsa20_NONCEBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_stream_salsa2012.rs b/libsodium-sys/tests/crypto/crypto_stream_salsa2012.rs deleted file mode 100644 index da5cc42..0000000 --- a/libsodium-sys/tests/crypto/crypto_stream_salsa2012.rs +++ /dev/null @@ -1,18 +0,0 @@ -// crypto_stream_salsa2012.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_stream_salsa2012_keybytes() { - assert!( - unsafe { crypto_stream_salsa2012_keybytes() } == crypto_stream_salsa2012_KEYBYTES as usize - ) -} - -#[test] -fn test_crypto_stream_salsa2012_noncebytes() { - assert!( - unsafe { crypto_stream_salsa2012_noncebytes() } - == crypto_stream_salsa2012_NONCEBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_stream_salsa208.rs b/libsodium-sys/tests/crypto/crypto_stream_salsa208.rs deleted file mode 100644 index 53e7597..0000000 --- a/libsodium-sys/tests/crypto/crypto_stream_salsa208.rs +++ /dev/null @@ -1,17 +0,0 @@ -// crypto_stream_salsa208.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_stream_salsa208_keybytes() { - assert!( - unsafe { crypto_stream_salsa208_keybytes() } == crypto_stream_salsa208_KEYBYTES as usize - ) -} -#[test] -fn test_crypto_stream_salsa208_noncebytes() { - assert!( - unsafe { crypto_stream_salsa208_noncebytes() } - == crypto_stream_salsa208_NONCEBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_stream_xchacha20.rs b/libsodium-sys/tests/crypto/crypto_stream_xchacha20.rs deleted file mode 100644 index 62d715b..0000000 --- a/libsodium-sys/tests/crypto/crypto_stream_xchacha20.rs +++ /dev/null @@ -1,18 +0,0 @@ -// crypto_stream_xchacha20.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_stream_xchacha20_keybytes() { - assert!( - unsafe { crypto_stream_xchacha20_keybytes() } == crypto_stream_xchacha20_KEYBYTES as usize - ) -} - -#[test] -fn test_crypto_stream_xchacha20_noncebytes() { - assert!( - unsafe { crypto_stream_xchacha20_noncebytes() } - == crypto_stream_xchacha20_NONCEBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_stream_xsalsa20.rs b/libsodium-sys/tests/crypto/crypto_stream_xsalsa20.rs deleted file mode 100644 index 6097e15..0000000 --- a/libsodium-sys/tests/crypto/crypto_stream_xsalsa20.rs +++ /dev/null @@ -1,18 +0,0 @@ -// crypto_stream_xsalsa20.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_stream_xsalsa20_keybytes() { - assert!( - unsafe { crypto_stream_xsalsa20_keybytes() } == crypto_stream_xsalsa20_KEYBYTES as usize - ) -} - -#[test] -fn test_crypto_stream_xsalsa20_noncebytes() { - assert!( - unsafe { crypto_stream_xsalsa20_noncebytes() } - == crypto_stream_xsalsa20_NONCEBYTES as usize - ) -} diff --git a/libsodium-sys/tests/crypto/crypto_verify_16.rs b/libsodium-sys/tests/crypto/crypto_verify_16.rs deleted file mode 100644 index f818305..0000000 --- a/libsodium-sys/tests/crypto/crypto_verify_16.rs +++ /dev/null @@ -1,11 +0,0 @@ -// crypto_verify_16.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_verify_16_bytes() { - assert_eq!( - unsafe { crypto_verify_16_bytes() }, - crypto_verify_16_BYTES as usize - ); -} diff --git a/libsodium-sys/tests/crypto/crypto_verify_32.rs b/libsodium-sys/tests/crypto/crypto_verify_32.rs deleted file mode 100644 index 77d4ebd..0000000 --- a/libsodium-sys/tests/crypto/crypto_verify_32.rs +++ /dev/null @@ -1,11 +0,0 @@ -// crypto_verify_32.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_verify_32_bytes() { - assert_eq!( - unsafe { crypto_verify_32_bytes() }, - crypto_verify_32_BYTES as usize - ); -} diff --git a/libsodium-sys/tests/crypto/crypto_verify_64.rs b/libsodium-sys/tests/crypto/crypto_verify_64.rs deleted file mode 100644 index 8064748..0000000 --- a/libsodium-sys/tests/crypto/crypto_verify_64.rs +++ /dev/null @@ -1,11 +0,0 @@ -// crypto_verify_64.h - -use libsodium_sys::*; - -#[test] -fn test_crypto_verify_64_bytes() { - assert_eq!( - unsafe { crypto_verify_64_bytes() }, - crypto_verify_64_BYTES as usize - ); -} diff --git a/libsodium-sys/tests/crypto/mod.rs b/libsodium-sys/tests/crypto/mod.rs deleted file mode 100644 index 13d75b7..0000000 --- a/libsodium-sys/tests/crypto/mod.rs +++ /dev/null @@ -1,36 +0,0 @@ -mod crypto_aead_chacha20poly1305; -mod crypto_auth; -mod crypto_auth_hmacsha256; -mod crypto_auth_hmacsha512; -mod crypto_auth_hmacsha512256; -mod crypto_box; -mod crypto_box_curve25519xsalsa20poly1305; -mod crypto_core_hsalsa20; -mod crypto_core_salsa20; -mod crypto_core_salsa2012; -mod crypto_core_salsa208; -mod crypto_generichash; -mod crypto_generichash_blake2b; -mod crypto_hash; -mod crypto_hash_sha256; -mod crypto_hash_sha512; -mod crypto_kx; -mod crypto_onetimeauth; -mod crypto_onetimeauth_poly1305; -mod crypto_pwhash_scryptsalsa208sha256; -mod crypto_scalarmult; -mod crypto_scalarmult_curve25519; -mod crypto_secretbox; -mod crypto_secretbox_xsalsa20poly1305; -mod crypto_shorthash_siphash24; -mod crypto_sign_ed25519; -mod crypto_stream; -mod crypto_stream_chacha20; -mod crypto_stream_salsa20; -mod crypto_stream_salsa2012; -mod crypto_stream_salsa208; -mod crypto_stream_xchacha20; -mod crypto_stream_xsalsa20; -mod crypto_verify_16; -mod crypto_verify_32; -mod crypto_verify_64; diff --git a/libsodium-sys/tests/test.rs b/libsodium-sys/tests/test.rs deleted file mode 100644 index 0c595fe..0000000 --- a/libsodium-sys/tests/test.rs +++ /dev/null @@ -1,4 +0,0 @@ -extern crate libc; -extern crate libsodium_sys; - -mod crypto; diff --git a/src/newtype_macros.rs b/src/newtype_macros.rs index 9482d99..44f5ac5 100644 --- a/src/newtype_macros.rs +++ b/src/newtype_macros.rs @@ -82,58 +82,6 @@ macro_rules! newtype_traits (($newtype:ident, $len:expr) => ( } } - /// Allows a user to access the byte contents of an object as a slice. - /// - /// WARNING: it might be tempting to do comparisons on objects - /// by using `x[a..b] == y[a..b]`. This will open up for timing attacks - /// when comparing for example authenticator tags. Because of this only - /// use the comparison functions exposed by the sodiumoxide API. - #[deprecated(since="0.2.2", note="Use the `AsRef` or `AsMut` implementation instead")] - impl ::std::ops::Index<::std::ops::Range> for $newtype { - type Output = [u8]; - fn index(&self, _index: ::std::ops::Range) -> &[u8] { - self.0.index(_index) - } - } - /// Allows a user to access the byte contents of an object as a slice. - /// - /// WARNING: it might be tempting to do comparisons on objects - /// by using `x[..b] == y[..b]`. This will open up for timing attacks - /// when comparing for example authenticator tags. Because of this only - /// use the comparison functions exposed by the sodiumoxide API. - #[deprecated(since="0.2.2", note="Use the `AsRef` or `AsMut` implementation instead")] - impl ::std::ops::Index<::std::ops::RangeTo> for $newtype { - type Output = [u8]; - fn index(&self, _index: ::std::ops::RangeTo) -> &[u8] { - self.0.index(_index) - } - } - /// Allows a user to access the byte contents of an object as a slice. - /// - /// WARNING: it might be tempting to do comparisons on objects - /// by using `x[a..] == y[a..]`. This will open up for timing attacks - /// when comparing for example authenticator tags. Because of this only - /// use the comparison functions exposed by the sodiumoxide API. - #[deprecated(since="0.2.2", note="Use the `AsRef` or `AsMut` implementation instead")] - impl ::std::ops::Index<::std::ops::RangeFrom> for $newtype { - type Output = [u8]; - fn index(&self, _index: ::std::ops::RangeFrom) -> &[u8] { - self.0.index(_index) - } - } - /// Allows a user to access the byte contents of an object as a slice. - /// - /// WARNING: it might be tempting to do comparisons on objects - /// by using `x[] == y[]`. This will open up for timing attacks - /// when comparing for example authenticator tags. Because of this only - /// use the comparison functions exposed by the sodiumoxide API. - #[deprecated(since="0.2.2", note="Use the `AsRef` or `AsMut` implementation instead")] - impl ::std::ops::Index<::std::ops::RangeFull> for $newtype { - type Output = [u8]; - fn index(&self, _index: ::std::ops::RangeFull) -> &[u8] { - self.0.index(_index) - } - } )); macro_rules! public_newtype_traits (($newtype:ident) => ( diff --git a/testcrate/.gitignore b/testcrate/.gitignore deleted file mode 100644 index 46d6bed..0000000 --- a/testcrate/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -#### IDEs #### -### CLion ### -# CMake -cmake-build-debug/ - -### IntelliJ ### -.idea -*.iws -*.iml -*.ipr - -### Vim ### -.sw[a-p] -.*.sw[a-p] -Session.vim -.netrwhist -*~ - -### Visual Studio Code ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -.history - -#### Languages #### -### Rust ### -/target/ -Cargo.lock diff --git a/testcrate/Cargo.toml b/testcrate/Cargo.toml deleted file mode 100644 index ef1466b..0000000 --- a/testcrate/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "testcrate" -build = "build.rs" -version = "0.0.1" - -[dependencies] -libsodium-sys = { path = "../libsodium-sys" } diff --git a/testcrate/build.rs b/testcrate/build.rs deleted file mode 100644 index af7dd85..0000000 --- a/testcrate/build.rs +++ /dev/null @@ -1,42 +0,0 @@ -use std::{env, fs}; - -fn main() { - println!("cargo:rerun-if-changed=build.rs"); - - let target = env::var("TARGET").unwrap(); - - // Skip the test when `SODIUM_LIB_DIR` is set since there is no - // build metadata. - if let Ok(_) = env::var("SODIUM_LIB_DIR") { - return; - } - - let include = env::var("DEP_SODIUM_INCLUDE").unwrap(); - - let header = fs::read_dir(include) - .unwrap() - .filter_map(Result::ok) - .find(|entry| entry.file_name() == "sodium.h"); - assert!( - header.is_some(), - "sodium.h not found in DEP_SODIUM_INCLUDE dir" - ); - - let lib = env::var("DEP_SODIUM_LIB").unwrap(); - - let file_name = if target.contains("msvc") { - "libsodium.lib" - } else { - "libsodium.a" - }; - - let compiled_lib = fs::read_dir(lib) - .unwrap() - .filter_map(Result::ok) - .find(|e| e.file_name() == file_name); - - assert!( - compiled_lib.is_some(), - "compiled lib not found in DEP_SODIUM_LIB dir" - ); -} diff --git a/testcrate/src/lib.rs b/testcrate/src/lib.rs deleted file mode 100644 index ceef472..0000000 --- a/testcrate/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[test] -fn testcrate_builds() {}