From ccad3fc04a3e896bfcd6a3f0a2713d8cdf0fb436 Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Mon, 29 Sep 2025 19:22:45 -0700 Subject: [PATCH] fixup support for `subtle` feature in `hybrid-array` When a downstream crate enables the `subtle` feature in `hybrid-array`, the crate would fail to compile: ``` src/algorithms/pss.rs:375:31 | 375 | if (salt_valid & h0.ct_eq(h)).into() { | ----- ^ expected `&Array`, found `&mut [u8]` | | | arguments to this method are incorrect | = note: expected reference `&Array::OutputSize>` found mutable reference `&mut [u8]` ``` This is because the `hybrid_array::Array` was automatically deref'ed to a slice. Now `Array` implements `subtle::ConstantTimeEq` that automatic deref no longer happens. This commit fixes that by converting one of the arguments of the conversion that brings back the auto-deref. --- src/algorithms/pss.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/pss.rs b/src/algorithms/pss.rs index 99c6199b..61780c6d 100644 --- a/src/algorithms/pss.rs +++ b/src/algorithms/pss.rs @@ -372,7 +372,7 @@ where let h0 = hash.finalize_reset(); // 14. If H = H', output "consistent." Otherwise, output "inconsistent." - if (salt_valid & h0.ct_eq(h)).into() { + if (salt_valid & h0.as_slice().ct_eq(h)).into() { Ok(()) } else { Err(Error::Verification)