Skip to content

Commit 6e3e33e

Browse files
authored
fixup support for subtle feature in hybrid-array (#586)
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<u8, ...>`, found `&mut [u8]` | | | arguments to this method are incorrect | = note: expected reference `&Array<u8, <D as OutputSizeUser>::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. Thanks to @tarcieri for the help debugging: RustCrypto/formats#2049 (comment)
1 parent bb0468e commit 6e3e33e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/algorithms/pss.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ where
372372
let h0 = hash.finalize_reset();
373373

374374
// 14. If H = H', output "consistent." Otherwise, output "inconsistent."
375-
if (salt_valid & h0.ct_eq(h)).into() {
375+
if (salt_valid & h0.as_slice().ct_eq(h)).into() {
376376
Ok(())
377377
} else {
378378
Err(Error::Verification)

0 commit comments

Comments
 (0)