From c991342aa1fb77d05e7df35680e5d550238c5bd8 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Sat, 28 Feb 2026 12:14:37 -0700 Subject: [PATCH] poly1305: rename `poly1305_force_soft` => `poly1305_backend="soft"` Changes the `cfg`-based override to force usage of the soft backend to use `poly1305_backend` following a similar change in `polyval` (#259) --- .github/workflows/poly1305.yml | 2 +- poly1305/Cargo.toml | 5 ++++- poly1305/src/backend.rs | 4 ++-- poly1305/src/lib.rs | 8 ++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/poly1305.yml b/.github/workflows/poly1305.yml index b537e8b..c68f920 100644 --- a/.github/workflows/poly1305.yml +++ b/.github/workflows/poly1305.yml @@ -108,7 +108,7 @@ jobs: # Tests for the portable software backend soft: env: - RUSTFLAGS: "-Dwarnings --cfg poly1305_force_soft" + RUSTFLAGS: '-Dwarnings --cfg poly1305_backend="soft"' runs-on: ubuntu-latest strategy: matrix: diff --git a/poly1305/Cargo.toml b/poly1305/Cargo.toml index ee2656b..84ec37c 100644 --- a/poly1305/Cargo.toml +++ b/poly1305/Cargo.toml @@ -24,4 +24,7 @@ hex-literal = "1" [lints.rust.unexpected_cfgs] level = "warn" -check-cfg = ["cfg(fuzzing)", "cfg(poly1305_force_soft)"] +check-cfg = [ + 'cfg(fuzzing)', + 'cfg(poly1305_backend, values("soft"))' +] diff --git a/poly1305/src/backend.rs b/poly1305/src/backend.rs index 7193b19..81ab855 100644 --- a/poly1305/src/backend.rs +++ b/poly1305/src/backend.rs @@ -2,13 +2,13 @@ #[cfg(all( any(target_arch = "x86", target_arch = "x86_64"), - not(poly1305_force_soft) + not(poly1305_backend = "soft") ))] pub(crate) mod avx2; #[cfg(all( any(target_arch = "x86", target_arch = "x86_64"), - not(poly1305_force_soft) + not(poly1305_backend = "soft") ))] pub(crate) mod autodetect; diff --git a/poly1305/src/lib.rs b/poly1305/src/lib.rs index 02af551..25956fd 100644 --- a/poly1305/src/lib.rs +++ b/poly1305/src/lib.rs @@ -19,7 +19,7 @@ mod backend; #[cfg(all( any(target_arch = "x86", target_arch = "x86_64"), - not(poly1305_force_soft), + not(poly1305_backend = "soft"), target_feature = "avx2", // Fuzz tests bypass AVX2 autodetection code any(fuzzing, test) ))] @@ -27,13 +27,13 @@ mod fuzz; #[cfg(all( any(target_arch = "x86", target_arch = "x86_64"), - not(poly1305_force_soft) + not(poly1305_backend = "soft") ))] use crate::backend::autodetect::State; #[cfg(not(all( any(target_arch = "x86", target_arch = "x86_64"), - not(poly1305_force_soft) + not(poly1305_backend = "soft") )))] use crate::backend::soft::State; @@ -121,7 +121,7 @@ impl Debug for Poly1305 { #[cfg(all( any(target_arch = "x86", target_arch = "x86_64"), - not(poly1305_force_soft), + not(poly1305_backend = "soft"), target_feature = "avx2", // Fuzz tests bypass AVX2 autodetection code any(fuzzing, test) ))]