diff --git a/.github/workflows/ghash.yml b/.github/workflows/ghash.yml index cfdec17..dcee8a8 100644 --- a/.github/workflows/ghash.yml +++ b/.github/workflows/ghash.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: rust: - - 1.81.0 # MSRV + - 1.85.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -53,7 +53,7 @@ jobs: strategy: matrix: rust: - - 1.81.0 # MSRV + - 1.85.0 # MSRV - stable steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/poly1305.yml b/.github/workflows/poly1305.yml index cce5d53..e3f0e68 100644 --- a/.github/workflows/poly1305.yml +++ b/.github/workflows/poly1305.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: rust: - - 1.81.0 # MSRV + - 1.85.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -39,6 +39,7 @@ jobs: targets: ${{ matrix.target }} - run: cargo build --target ${{ matrix.target }} --release - run: cargo build --target ${{ matrix.target }} --release --features zeroize + - run: cargo build --target ${{ matrix.target }} --release --all-features # Tests for runtime AVX2 detection autodetect: @@ -48,7 +49,7 @@ jobs: include: # 32-bit Linux - target: i686-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV deps: sudo apt update && sudo apt install gcc-multilib - target: i686-unknown-linux-gnu rust: stable @@ -56,7 +57,7 @@ jobs: # 64-bit Linux - target: x86_64-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV - target: x86_64-unknown-linux-gnu rust: stable steps: @@ -68,9 +69,8 @@ jobs: - run: ${{ matrix.deps }} - run: cargo check --target ${{ matrix.target }} --all-features - run: cargo test --target ${{ matrix.target }} --release - - run: cargo test --target ${{ matrix.target }} --release --features std - run: cargo test --target ${{ matrix.target }} --release --features zeroize - - run: cargo test --target ${{ matrix.target }} --release --features std,zeroize + - run: cargo test --target ${{ matrix.target }} --release --all-features # Tests for the AVX2 backend avx2: @@ -82,7 +82,7 @@ jobs: include: # 32-bit Linux - target: i686-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV deps: sudo apt update && sudo apt install gcc-multilib - target: i686-unknown-linux-gnu rust: stable @@ -90,7 +90,7 @@ jobs: # 64-bit Linux - target: x86_64-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV - target: x86_64-unknown-linux-gnu rust: stable steps: @@ -102,7 +102,6 @@ jobs: - run: ${{ matrix.deps }} - run: cargo check --target ${{ matrix.target }} --all-features - run: cargo test --target ${{ matrix.target }} --release - - run: cargo test --target ${{ matrix.target }} --release --features std - run: cargo test --target ${{ matrix.target }} --release --features zeroize - run: cargo test --target ${{ matrix.target }} --release --all-features @@ -116,7 +115,7 @@ jobs: include: # 32-bit Linux - target: i686-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV deps: sudo apt update && sudo apt install gcc-multilib - target: i686-unknown-linux-gnu rust: stable @@ -124,7 +123,7 @@ jobs: # 64-bit Linux - target: x86_64-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV - target: x86_64-unknown-linux-gnu rust: stable steps: @@ -136,7 +135,6 @@ jobs: - run: ${{ matrix.deps }} - run: cargo check --target ${{ matrix.target }} --all-features - run: cargo test --target ${{ matrix.target }} --release - - run: cargo test --target ${{ matrix.target }} --release --features std - run: cargo test --target ${{ matrix.target }} --release --features zeroize - run: cargo test --target ${{ matrix.target }} --release --all-features @@ -158,5 +156,5 @@ jobs: targets: ${{ matrix.target }} - run: cargo install cross - run: cross test --target ${{ matrix.target }} --release - - run: cross test --target ${{ matrix.target }} --release --features std + - run: cross test --target ${{ matrix.target }} --release --features zeroize - run: cross test --target ${{ matrix.target }} --release --all-features diff --git a/.github/workflows/polyval.yml b/.github/workflows/polyval.yml index f0b8795..27866f3 100644 --- a/.github/workflows/polyval.yml +++ b/.github/workflows/polyval.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: rust: - - 1.81.0 # MSRV + - 1.85.0 # MSRV - stable target: - thumbv7em-none-eabi @@ -48,7 +48,7 @@ jobs: include: # 32-bit Linux - target: i686-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV deps: sudo apt update && sudo apt install gcc-multilib - target: i686-unknown-linux-gnu rust: stable @@ -56,7 +56,7 @@ jobs: # 64-bit Linux - target: x86_64-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV - target: x86_64-unknown-linux-gnu rust: stable steps: @@ -68,9 +68,8 @@ jobs: - run: ${{ matrix.deps }} - run: cargo check --target ${{ matrix.target }} --all-features - run: cargo test --target ${{ matrix.target }} --release - - run: cargo test --target ${{ matrix.target }} --release --features std - run: cargo test --target ${{ matrix.target }} --release --features zeroize - - run: cargo test --target ${{ matrix.target }} --release --features std,zeroize + - run: cargo test --target ${{ matrix.target }} --release --all-features # Tests for the CLMUL backend (forced) clmul: @@ -82,7 +81,7 @@ jobs: include: # 32-bit Linux - target: i686-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV deps: sudo apt update && sudo apt install gcc-multilib - target: i686-unknown-linux-gnu rust: stable @@ -90,7 +89,7 @@ jobs: # 64-bit Linux - target: x86_64-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV - target: x86_64-unknown-linux-gnu rust: stable steps: @@ -102,7 +101,6 @@ jobs: - run: ${{ matrix.deps }} - run: cargo check --target ${{ matrix.target }} --all-features - run: cargo test --target ${{ matrix.target }} --release - - run: cargo test --target ${{ matrix.target }} --release --features std - run: cargo test --target ${{ matrix.target }} --release --features zeroize - run: cargo test --target ${{ matrix.target }} --release --all-features @@ -116,7 +114,7 @@ jobs: include: # 32-bit Linux - target: i686-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV deps: sudo apt update && sudo apt install gcc-multilib - target: i686-unknown-linux-gnu rust: stable @@ -124,7 +122,7 @@ jobs: # 64-bit Linux - target: x86_64-unknown-linux-gnu - rust: 1.81.0 # MSRV + rust: 1.85.0 # MSRV - target: x86_64-unknown-linux-gnu rust: stable steps: @@ -136,7 +134,6 @@ jobs: - run: ${{ matrix.deps }} - run: cargo check --target ${{ matrix.target }} --all-features - run: cargo test --target ${{ matrix.target }} --release - - run: cargo test --target ${{ matrix.target }} --release --features std - run: cargo test --target ${{ matrix.target }} --release --features zeroize - run: cargo test --target ${{ matrix.target }} --release --all-features @@ -158,7 +155,6 @@ jobs: targets: ${{ matrix.target }} - run: cargo install cross - run: cross test --target ${{ matrix.target }} --release - - run: cross test --target ${{ matrix.target }} --release --features std - run: cross test --target ${{ matrix.target }} --release --features zeroize - run: cross test --target ${{ matrix.target }} --release --all-features @@ -180,7 +176,6 @@ jobs: toolchain: ${{ matrix.rust }} targets: ${{ matrix.target }} - run: cargo install cross - - run: cross test --target ${{ matrix.target }} --release - - run: cross test --target ${{ matrix.target }} --release --features std + - run: cross test --target ${{ matrix.target }} --release - run: cross test --target ${{ matrix.target }} --release --features zeroize - run: cross test --target ${{ matrix.target }} --release --all-features diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index 3f51325..d51da33 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.82.0 + toolchain: 1.85.0 components: clippy - run: cargo clippy --all --all-features -- -D warnings diff --git a/Cargo.lock b/Cargo.lock index 4e4c6b6..7febd6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "cfg-if" @@ -10,33 +10,19 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cpufeatures" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] [[package]] name = "crypto-common" -version = "0.2.0-rc.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0b8ce8218c97789f16356e7896b3714f26c2ee1079b79c0b7ae7064bb9089fa" +version = "0.2.0-rc.2" +source = "git+https://github.com/RustCrypto/traits#f8aa068be3e64ba8970107042f21605b237754ac" dependencies = [ - "getrandom", "hybrid-array", - "rand_core", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi", ] [[package]] @@ -51,24 +37,24 @@ dependencies = [ [[package]] name = "hex-literal" -version = "0.4.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +checksum = "bcaaec4551594c969335c98c903c1397853d4198408ea609190f420500f6be71" [[package]] name = "hybrid-array" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a9a965bb102c1c891fb017c09a05c965186b1265a207640f323ddd009f9deb" +checksum = "4dab50e193aebe510fe0e40230145820e02f48dae0cf339ea4204e6e708ff7bd" dependencies = [ "typenum", ] [[package]] name = "libc" -version = "0.2.164" +version = "0.2.170" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" +checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" [[package]] name = "opaque-debug" @@ -99,15 +85,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - [[package]] name = "subtle" version = "2.6.1" @@ -116,26 +93,19 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "universal-hash" version = "0.6.0-rc.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3517d72c5ca6d60f9f2e85d2c772e2652830062a685105a528d19dd823cf87d5" +source = "git+https://github.com/RustCrypto/traits#f8aa068be3e64ba8970107042f21605b237754ac" dependencies = [ "crypto-common", "subtle", ] -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - [[package]] name = "zeroize" version = "1.8.1" diff --git a/Cargo.toml b/Cargo.toml index 3464997..ec40d8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,3 +5,6 @@ members = [ "polyval" ] resolver = "2" + +[patch.crates-io] +universal-hash = { git = "https://github.com/RustCrypto/traits" } diff --git a/README.md b/README.md index cf952e2..08790aa 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@ Collection of [Universal Hash Functions][1] written in pure Rust. ## Crates -| Name | Crates.io | Documentation | Build Status | -|--------------|-----------|---------------|--------------| -| [`ghash`] | [![crates.io](https://img.shields.io/crates/v/ghash.svg)](https://crates.io/crates/ghash) | [![Documentation](https://docs.rs/ghash/badge.svg)](https://docs.rs/ghash) | ![build](https://github.com/RustCrypto/universal-hashes/workflows/ghash/badge.svg?branch=master&event=push) | -| [`poly1305`] | [![crates.io](https://img.shields.io/crates/v/poly1305.svg)](https://crates.io/crates/poly1305) | [![Documentation](https://docs.rs/poly1305/badge.svg)](https://docs.rs/poly1305) | ![build](https://github.com/RustCrypto/universal-hashes/workflows/poly1305/badge.svg?branch=master&event=push) | -| [`polyval`] | [![crates.io](https://img.shields.io/crates/v/polyval.svg)](https://crates.io/crates/polyval) | [![Documentation](https://docs.rs/polyval/badge.svg)](https://docs.rs/polyval) | ![build](https://github.com/RustCrypto/universal-hashes/workflows/polyval/badge.svg?branch=master&event=push) | +| Name | Crates.io | Documentation | MSRV | +|--------------|:---------:|:-------------:|:----:| +| [`ghash`] | [![crates.io](https://img.shields.io/crates/v/ghash.svg)](https://crates.io/crates/ghash) | [![Documentation](https://docs.rs/ghash/badge.svg)](https://docs.rs/ghash) | ![MSRV 1.85][msrv-1.85] | +| [`poly1305`] | [![crates.io](https://img.shields.io/crates/v/poly1305.svg)](https://crates.io/crates/poly1305) | [![Documentation](https://docs.rs/poly1305/badge.svg)](https://docs.rs/poly1305) | ![MSRV 1.85][msrv-1.85] | +| [`polyval`] | [![crates.io](https://img.shields.io/crates/v/polyval.svg)](https://crates.io/crates/polyval) | [![Documentation](https://docs.rs/polyval/badge.svg)](https://docs.rs/polyval) | ![MSRV 1.85][msrv-1.85] | ## ⚠️ Security Warning: [Hazmat!][hazmat-link] @@ -23,15 +23,7 @@ USE AT YOUR OWN RISK! ## Usage -Crates functionality is expressed in terms of traits defined in the [`universal-hash`][2] -crate. - -### Minimum Supported Rust Version - -All crates in this repository support **Rust 1.56** or higher. - -In the future, we reserve the right to change the Minimum Supported Rust -Version, but it will be done with the minor version bump. +Crates functionality is expressed in terms of traits defined in the [`universal-hash`][2] crate. ## License @@ -56,6 +48,8 @@ dual licensed as above, without any additional terms or conditions. [hazmat-image]: https://img.shields.io/badge/crypto-hazmat%E2%9A%A0-red.svg [hazmat-link]: https://github.com/RustCrypto/meta/blob/master/HAZMAT.md +[msrv-1.85]: https://img.shields.io/badge/rustc-1.85.0+-blue.svg + [//]: # (crates) [`ghash`]: https://github.com/RustCrypto/universal-hashes/tree/master/ghash diff --git a/ghash/CHANGELOG.md b/ghash/CHANGELOG.md index a26559a..a91638e 100644 --- a/ghash/CHANGELOG.md +++ b/ghash/CHANGELOG.md @@ -5,9 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.6.0 (UNRELEASED) +### Changed +- Edition changed to 2024 and MSRV bumped to 1.85 ([#228]) +- Relax MSRV policy and allow MSRV bumps in patch releases +- Update to `universal-hash` v0.6 ([#213]) + +[#213]: https://github.com/RustCrypto/universal-hashes/pull/213 +[#228]: https://github.com/RustCrypto/universal-hashes/pull/228 + ## 0.5.1 (2024-03-03) ### Added -- add `new_with_init_block` ([#195]) +- `new_with_init_block` method ([#195]) [#195]: https://github.com/RustCrypto/universal-hashes/pull/195 diff --git a/ghash/Cargo.toml b/ghash/Cargo.toml index 9dba577..8e3cc0c 100644 --- a/ghash/Cargo.toml +++ b/ghash/Cargo.toml @@ -12,8 +12,8 @@ repository = "https://github.com/RustCrypto/universal-hashes" readme = "README.md" keywords = ["aes-gcm", "crypto", "universal-hashing"] categories = ["cryptography", "no-std"] -rust-version = "1.81" -edition = "2021" +rust-version = "1.85" +edition = "2024" [dependencies] opaque-debug = "0.3" @@ -23,7 +23,4 @@ polyval = { version = "0.7.0-rc.0", path = "../polyval" } zeroize = { version = "1", optional = true, default-features = false } [dev-dependencies] -hex-literal = "0.4" - -[features] -std = ["polyval/std"] +hex-literal = "1" diff --git a/ghash/LICENSE-MIT b/ghash/LICENSE-MIT index bb7ff7c..4aa53fb 100644 --- a/ghash/LICENSE-MIT +++ b/ghash/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2019-2025 RustCrypto Developers +Copyright (c) 2019-2025 The RustCrypto Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/ghash/README.md b/ghash/README.md index 66762db..d6d2434 100644 --- a/ghash/README.md +++ b/ghash/README.md @@ -16,9 +16,8 @@ Its primary intended use is for implementing [AES-GCM][4]. ### ⚠️ Warning: [Hazmat!][hazmat-link] -Universal hash functions have subtle security properties and using them -correctly is difficult. See the [toplevel README.md](../README.md) for more -information. +Universal hash functions have subtle security properties and are primarily intended as a +building block for constructions like AEAD algorithms. USE AT YOUR OWN RISK! @@ -58,7 +57,7 @@ dual licensed as above, without any additional terms or conditions. [docs-image]: https://docs.rs/ghash/badge.svg [docs-link]: https://docs.rs/ghash/ [license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg -[rustc-image]: https://img.shields.io/badge/rustc-1.81+-blue.svg +[rustc-image]: https://img.shields.io/badge/rustc-1.85+-blue.svg [build-image]: https://github.com/RustCrypto/universal-hashes/workflows/ghash/badge.svg?branch=master&event=push [build-link]: https://github.com/RustCrypto/universal-hashes/actions?query=workflow%3Aghash [hazmat-image]: https://img.shields.io/badge/crypto-hazmat%E2%9A%A0-red.svg diff --git a/ghash/benches/ghash.rs b/ghash/benches/ghash.rs index f1a2ee5..e24a799 100644 --- a/ghash/benches/ghash.rs +++ b/ghash/benches/ghash.rs @@ -3,8 +3,8 @@ extern crate test; use ghash::{ - universal_hash::{KeyInit, UniversalHash}, GHash, + universal_hash::{KeyInit, UniversalHash}, }; use test::Bencher; diff --git a/ghash/src/lib.rs b/ghash/src/lib.rs index de24162..7054e5d 100644 --- a/ghash/src/lib.rs +++ b/ghash/src/lib.rs @@ -27,15 +27,15 @@ html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg", html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg" )] -#![warn(missing_docs, rust_2018_idioms)] +#![warn(missing_docs)] pub use polyval::universal_hash; use polyval::Polyval; use universal_hash::{ + KeyInit, UhfBackend, UhfClosure, UniversalHash, consts::U16, crypto_common::{BlockSizeUser, KeySizeUser, ParBlocksSizeUser}, - KeyInit, UhfBackend, UhfClosure, UniversalHash, }; #[cfg(feature = "zeroize")] diff --git a/ghash/tests/lib.rs b/ghash/tests/lib.rs index 6490028..c95d5b4 100644 --- a/ghash/tests/lib.rs +++ b/ghash/tests/lib.rs @@ -1,6 +1,6 @@ use ghash::{ - universal_hash::{KeyInit, UniversalHash}, GHash, + universal_hash::{KeyInit, UniversalHash}, }; use hex_literal::hex; diff --git a/poly1305/CHANGELOG.md b/poly1305/CHANGELOG.md index 53aeeb8..8ff5ef1 100644 --- a/poly1305/CHANGELOG.md +++ b/poly1305/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.9.0 (UNRELEASED) +### Changed +- Edition changed to 2024 and MSRV bumped to 1.85 ([#228]) +- Relax MSRV policy and allow MSRV bumps in patch releases +- Update to `universal-hash` v0.6 ([#213]) + +[#213]: https://github.com/RustCrypto/universal-hashes/pull/213 +[#228]: https://github.com/RustCrypto/universal-hashes/pull/228 + ## 0.8.0 (2022-07-31) ### Changed - Relax `zeroize` constraints ([#147]) diff --git a/poly1305/Cargo.toml b/poly1305/Cargo.toml index 93d1776..803a96f 100644 --- a/poly1305/Cargo.toml +++ b/poly1305/Cargo.toml @@ -9,8 +9,8 @@ repository = "https://github.com/RustCrypto/universal-hashes" keywords = ["crypto", "chacha20", "mac", "salsa20", "universal-hashing"] categories = ["cryptography", "no-std"] readme = "README.md" -rust-version = "1.81" -edition = "2021" +rust-version = "1.85" +edition = "2024" [dependencies] opaque-debug = "0.3" @@ -21,10 +21,7 @@ zeroize = { version = "1", optional = true, default-features = false } cpufeatures = "0.2" [dev-dependencies] -hex-literal = "0.4" - -[features] -std = ["universal-hash/std"] +hex-literal = "1" [lints.rust.unexpected_cfgs] level = "warn" diff --git a/poly1305/LICENSE-MIT b/poly1305/LICENSE-MIT index dde3038..c2e25d1 100644 --- a/poly1305/LICENSE-MIT +++ b/poly1305/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2015-2025 RustCrypto Developers +Copyright (c) 2015-2025 The RustCrypto Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/poly1305/README.md b/poly1305/README.md index 61fff5e..db70761 100644 --- a/poly1305/README.md +++ b/poly1305/README.md @@ -18,9 +18,8 @@ In practice, Poly1305 is primarily combined with ciphers from the ### ⚠️ Warning: [Hazmat!][hazmat-link] -Universal hash functions have subtle security properties and using them -correctly is difficult. See the [toplevel README.md](../README.md) for more -information. +Universal hash functions have subtle security properties and are primarily intended as a +building block for constructions like AEAD algorithms. USE AT YOUR OWN RISK! @@ -62,7 +61,7 @@ dual licensed as above, without any additional terms or conditions. [docs-image]: https://docs.rs/poly1305/badge.svg [docs-link]: https://docs.rs/poly1305/ [license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg -[rustc-image]: https://img.shields.io/badge/rustc-1.81+-blue.svg +[rustc-image]: https://img.shields.io/badge/rustc-1.85+-blue.svg [build-image]: https://github.com/RustCrypto/universal-hashes/workflows/poly1305/badge.svg?branch=master&event=push [build-link]: https://github.com/RustCrypto/universal-hashes/actions?query=workflow%3Apoly1305 [hazmat-image]: https://img.shields.io/badge/crypto-hazmat%E2%9A%A0-red.svg diff --git a/poly1305/benches/poly1305.rs b/poly1305/benches/poly1305.rs index f7981e7..22c2b99 100644 --- a/poly1305/benches/poly1305.rs +++ b/poly1305/benches/poly1305.rs @@ -3,8 +3,8 @@ extern crate test; use poly1305::{ - universal_hash::{KeyInit, UniversalHash}, Poly1305, + universal_hash::{KeyInit, UniversalHash}, }; use test::Bencher; diff --git a/poly1305/src/backend/autodetect.rs b/poly1305/src/backend/autodetect.rs index 29c6074..3e58fd9 100644 --- a/poly1305/src/backend/autodetect.rs +++ b/poly1305/src/backend/autodetect.rs @@ -1,9 +1,9 @@ //! Autodetection support for AVX2 CPU intrinsics on x86 CPUs, with fallback //! to the "soft" backend when it's unavailable. -use universal_hash::{consts::U16, crypto_common::BlockSizeUser, UhfClosure, UniversalHash}; +use universal_hash::{UhfClosure, UniversalHash, consts::U16, crypto_common::BlockSizeUser}; -use crate::{backend, Block, Key, Tag}; +use crate::{Block, Key, Tag, backend}; use core::mem::ManuallyDrop; cpufeatures::new!(avx2_cpuid, "avx2"); diff --git a/poly1305/src/backend/avx2.rs b/poly1305/src/backend/avx2.rs index 726714c..0a5c407 100644 --- a/poly1305/src/backend/avx2.rs +++ b/poly1305/src/backend/avx2.rs @@ -14,12 +14,13 @@ // Note that State only implements the original Goll-Gueron algorithm, not the // optimisations provided by Bhattacharyya and Sarkar. The latter require the message // length to be known, which is incompatible with the streaming API of UniversalHash. +#![allow(unsafe_op_in_unsafe_fn)] use universal_hash::{ + UhfBackend, array::Array, - consts::{U16, U4}, + consts::{U4, U16}, crypto_common::{BlockSizeUser, ParBlocksSizeUser}, - UhfBackend, }; use crate::{Block, Key, Tag}; diff --git a/poly1305/src/backend/avx2/helpers.rs b/poly1305/src/backend/avx2/helpers.rs index dc92bcf..8b3b7c3 100644 --- a/poly1305/src/backend/avx2/helpers.rs +++ b/poly1305/src/backend/avx2/helpers.rs @@ -1,4 +1,5 @@ //! AVX2 helpers for implementing Poly1305 using 26-bit limbs. +#![allow(unsafe_op_in_unsafe_fn)] use core::fmt; use core::ops::{Add, Mul}; diff --git a/poly1305/src/backend/soft.rs b/poly1305/src/backend/soft.rs index d42e3b5..c3d0d51 100644 --- a/poly1305/src/backend/soft.rs +++ b/poly1305/src/backend/soft.rs @@ -13,9 +13,9 @@ // https://github.com/floodyberry/poly1305-donna use universal_hash::{ + UhfBackend, UhfClosure, UniversalHash, consts::{U1, U16}, crypto_common::{BlockSizeUser, ParBlocksSizeUser}, - UhfBackend, UhfClosure, UniversalHash, }; use crate::{Block, Key, Tag}; diff --git a/poly1305/src/fuzz.rs b/poly1305/src/fuzz.rs index a4d9fc1..eb20683 100644 --- a/poly1305/src/fuzz.rs +++ b/poly1305/src/fuzz.rs @@ -1,6 +1,6 @@ use universal_hash::UniversalHash; -use crate::{backend, Block, Key}; +use crate::{Block, Key, backend}; /// Helper function for fuzzing the AVX2 backend. pub fn fuzz_avx2(key: &Key, data: &[u8]) { diff --git a/poly1305/src/lib.rs b/poly1305/src/lib.rs index 6e24c28..117501c 100644 --- a/poly1305/src/lib.rs +++ b/poly1305/src/lib.rs @@ -46,17 +46,14 @@ html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg", html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg" )] -#![warn(missing_docs, rust_2018_idioms)] - -#[cfg(feature = "std")] -extern crate std; +#![warn(missing_docs)] pub use universal_hash; use universal_hash::{ + KeyInit, UhfClosure, UniversalHash, consts::{U16, U32}, crypto_common::{BlockSizeUser, KeySizeUser}, - KeyInit, UhfClosure, UniversalHash, }; mod backend; diff --git a/poly1305/tests/lib.rs b/poly1305/tests/lib.rs index 95980ac..437491d 100644 --- a/poly1305/tests/lib.rs +++ b/poly1305/tests/lib.rs @@ -1,9 +1,9 @@ use hex_literal::hex; use poly1305::{ + Block, KEY_SIZE, Poly1305, universal_hash::{KeyInit, UniversalHash}, - Block, Poly1305, KEY_SIZE, }; -use std::iter::repeat; +use std::iter::repeat_n; #[test] fn test_nacl_vector() { @@ -56,9 +56,9 @@ fn donna_self_test2() { for i in 0..256 { let mut key = [0u8; KEY_SIZE]; - key.copy_from_slice(&repeat(i as u8).take(KEY_SIZE).collect::>()); + key.copy_from_slice(&repeat_n(i as u8, KEY_SIZE).collect::>()); - let msg: Vec = repeat(i as u8).take(256).collect(); + let msg: Vec = repeat_n(i as u8, 256).collect(); let tag = Poly1305::new(key.as_ref()).compute_unpadded(&msg[..i]); tpoly.update(&[tag]); } diff --git a/polyval/CHANGELOG.md b/polyval/CHANGELOG.md index a25691e..19de59c 100644 --- a/polyval/CHANGELOG.md +++ b/polyval/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.7.0 (UNRELEASED) +### Changed +- Edition changed to 2024 and MSRV bumped to 1.85 ([#228]) +- Relax MSRV policy and allow MSRV bumps in patch releases +- Update to `universal-hash` v0.6 ([#213]) + +[#213]: https://github.com/RustCrypto/universal-hashes/pull/213 +[#228]: https://github.com/RustCrypto/universal-hashes/pull/228 + ## 0.6.2 (2022-03-03) ### Added - add `new_with_init_block` ([#195]) diff --git a/polyval/Cargo.toml b/polyval/Cargo.toml index 85f6043..0fd985a 100644 --- a/polyval/Cargo.toml +++ b/polyval/Cargo.toml @@ -12,8 +12,8 @@ repository = "https://github.com/RustCrypto/universal-hashes" readme = "README.md" keywords = ["aes-gcm", "aes-gcm-siv", "crypto", "ghash", "universal-hashing"] categories = ["cryptography", "no-std"] -rust-version = "1.81" -edition = "2021" +rust-version = "1.85" +edition = "2024" [dependencies] cfg-if = "1" @@ -25,10 +25,7 @@ zeroize = { version = "1", optional = true, default-features = false } cpufeatures = "0.2" [dev-dependencies] -hex-literal = "0.4" - -[features] -std = ["universal-hash/std"] +hex-literal = "1" [lints.rust.unexpected_cfgs] level = "warn" diff --git a/polyval/LICENSE-MIT b/polyval/LICENSE-MIT index bb7ff7c..4aa53fb 100644 --- a/polyval/LICENSE-MIT +++ b/polyval/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2019-2025 RustCrypto Developers +Copyright (c) 2019-2025 The RustCrypto Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/polyval/README.md b/polyval/README.md index 0080f0b..e1c3796 100644 --- a/polyval/README.md +++ b/polyval/README.md @@ -19,9 +19,8 @@ closely related to [GHASH][6] and therefore can also be used to implement ### ⚠️ Warning: [Hazmat!][hazmat-link] -Universal hash functions have subtle security properties and using them -correctly is difficult. See the [toplevel README.md](../README.md) for more -information. +Universal hash functions have subtle security properties and are primarily intended as a +building block for constructions like AEAD algorithms. USE AT YOUR OWN RISK! @@ -63,7 +62,7 @@ dual licensed as above, without any additional terms or conditions. [build-image]: https://github.com/RustCrypto/universal-hashes/workflows/polyval/badge.svg?branch=master&event=push [build-link]: https://github.com/RustCrypto/universal-hashes/actions?query=workflow%3Apolyval [license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg -[rustc-image]: https://img.shields.io/badge/rustc-1.81+-blue.svg +[rustc-image]: https://img.shields.io/badge/rustc-1.85+-blue.svg [hazmat-image]: https://img.shields.io/badge/crypto-hazmat%E2%9A%A0-red.svg [hazmat-link]: https://github.com/RustCrypto/meta/blob/master/HAZMAT.md diff --git a/polyval/benches/polyval.rs b/polyval/benches/polyval.rs index 11b2c58..258c024 100644 --- a/polyval/benches/polyval.rs +++ b/polyval/benches/polyval.rs @@ -3,8 +3,8 @@ extern crate test; use polyval::{ - universal_hash::{KeyInit, UniversalHash}, Polyval, + universal_hash::{KeyInit, UniversalHash}, }; use test::Bencher; diff --git a/polyval/src/backend/autodetect.rs b/polyval/src/backend/autodetect.rs index c084086..4d3f165 100644 --- a/polyval/src/backend/autodetect.rs +++ b/polyval/src/backend/autodetect.rs @@ -1,12 +1,12 @@ //! Autodetection for CPU intrinsics, with fallback to the "soft" backend when //! they are unavailable. -use crate::{backend::soft, Key, Tag}; +use crate::{Key, Tag, backend::soft}; use core::mem::ManuallyDrop; use universal_hash::{ + KeyInit, Reset, UhfClosure, UniversalHash, consts::U16, crypto_common::{BlockSizeUser, KeySizeUser}, - KeyInit, Reset, UhfClosure, UniversalHash, }; #[cfg(target_arch = "aarch64")] diff --git a/polyval/src/backend/clmul.rs b/polyval/src/backend/clmul.rs index 1e891c2..c94a645 100644 --- a/polyval/src/backend/clmul.rs +++ b/polyval/src/backend/clmul.rs @@ -7,9 +7,9 @@ use core::arch::x86::*; use core::arch::x86_64::*; use universal_hash::{ + KeyInit, Reset, UhfBackend, consts::{U1, U16}, crypto_common::{BlockSizeUser, KeySizeUser, ParBlocksSizeUser}, - KeyInit, Reset, UhfBackend, }; use crate::{Block, Key, Tag}; @@ -72,7 +72,21 @@ impl Polyval { impl Polyval { #[inline] #[target_feature(enable = "pclmulqdq")] + #[allow(unsafe_op_in_unsafe_fn)] unsafe fn mul(&mut self, x: &Block) { + #[inline(always)] + unsafe fn xor4(e1: __m128i, e2: __m128i, e3: __m128i, e4: __m128i) -> __m128i { + _mm_xor_si128(_mm_xor_si128(e1, e2), _mm_xor_si128(e3, e4)) + } + + #[inline(always)] + unsafe fn xor5(e1: __m128i, e2: __m128i, e3: __m128i, e4: __m128i, e5: __m128i) -> __m128i { + _mm_xor_si128( + e1, + _mm_xor_si128(_mm_xor_si128(e2, e3), _mm_xor_si128(e4, e5)), + ) + } + let h = self.h; // `_mm_loadu_si128` performs an unaligned load @@ -148,16 +162,3 @@ impl Drop for Polyval { self.y.zeroize(); } } - -#[inline(always)] -unsafe fn xor4(e1: __m128i, e2: __m128i, e3: __m128i, e4: __m128i) -> __m128i { - _mm_xor_si128(_mm_xor_si128(e1, e2), _mm_xor_si128(e3, e4)) -} - -#[inline(always)] -unsafe fn xor5(e1: __m128i, e2: __m128i, e3: __m128i, e4: __m128i, e5: __m128i) -> __m128i { - _mm_xor_si128( - e1, - _mm_xor_si128(_mm_xor_si128(e2, e3), _mm_xor_si128(e4, e5)), - ) -} diff --git a/polyval/src/backend/pmull.rs b/polyval/src/backend/pmull.rs index ff43314..6d70837 100644 --- a/polyval/src/backend/pmull.rs +++ b/polyval/src/backend/pmull.rs @@ -10,13 +10,14 @@ //! For more information about PMULL, see: //! - //! - +#![allow(unsafe_op_in_unsafe_fn)] use core::{arch::aarch64::*, mem}; use universal_hash::{ + KeyInit, Reset, UhfBackend, consts::{U1, U16}, crypto_common::{BlockSizeUser, KeySizeUser, ParBlocksSizeUser}, - KeyInit, Reset, UhfBackend, }; use crate::{Block, Key, Tag}; diff --git a/polyval/src/backend/soft32.rs b/polyval/src/backend/soft32.rs index 78b9568..63d0b75 100644 --- a/polyval/src/backend/soft32.rs +++ b/polyval/src/backend/soft32.rs @@ -31,9 +31,9 @@ use core::{ ops::{Add, Mul}, }; use universal_hash::{ + KeyInit, Reset, UhfBackend, UhfClosure, UniversalHash, consts::{U1, U16}, crypto_common::{BlockSizeUser, KeySizeUser, ParBlocksSizeUser}, - KeyInit, Reset, UhfBackend, UhfClosure, UniversalHash, }; #[cfg(feature = "zeroize")] diff --git a/polyval/src/backend/soft64.rs b/polyval/src/backend/soft64.rs index 9208fc8..2876093 100644 --- a/polyval/src/backend/soft64.rs +++ b/polyval/src/backend/soft64.rs @@ -11,9 +11,9 @@ use core::{ }; use universal_hash::{ + KeyInit, Reset, UhfBackend, UhfClosure, UniversalHash, consts::{U1, U16}, crypto_common::{BlockSizeUser, KeySizeUser, ParBlocksSizeUser}, - KeyInit, Reset, UhfBackend, UhfClosure, UniversalHash, }; #[cfg(feature = "zeroize")] diff --git a/polyval/src/lib.rs b/polyval/src/lib.rs index b054aff..dd9e3a7 100644 --- a/polyval/src/lib.rs +++ b/polyval/src/lib.rs @@ -76,7 +76,7 @@ html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg", html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/8f1a9894/logo.svg" )] -#![warn(missing_docs, rust_2018_idioms)] +#![warn(missing_docs)] mod backend; mod mulx; diff --git a/polyval/src/mulx.rs b/polyval/src/mulx.rs index bec3033..0db47d1 100644 --- a/polyval/src/mulx.rs +++ b/polyval/src/mulx.rs @@ -19,7 +19,7 @@ pub fn mulx(block: &Block) -> Block { #[cfg(test)] mod tests { - use super::{mulx, Block}; + use super::{Block, mulx}; use hex_literal::hex; /// Test vector given in RFC 8452 Appendix A. diff --git a/polyval/tests/lib.rs b/polyval/tests/lib.rs index adfadb5..02e6ad1 100644 --- a/polyval/tests/lib.rs +++ b/polyval/tests/lib.rs @@ -1,7 +1,7 @@ use hex_literal::hex; use polyval::{ + BLOCK_SIZE, Polyval, universal_hash::{KeyInit, UniversalHash}, - Polyval, BLOCK_SIZE, }; //