diff --git a/Cargo.lock b/Cargo.lock index 4fade8d98..0d975f2d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -847,10 +847,11 @@ dependencies = [ [[package]] name = "hybrid-array" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b229d73f5803b562cc26e4da0396c8610a4ee209f4fac8fa4f8d709166dc45" +checksum = "8655f91cd07f2b9d0c24137bd650fe69617773435ee5ec83022377777ce65ef1" dependencies = [ + "ctutils", "subtle", "typenum", "zeroize", @@ -1727,7 +1728,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.1", "once_cell", "rustix", "windows-sys", diff --git a/sec1/Cargo.toml b/sec1/Cargo.toml index 5e820d411..57bb32244 100644 --- a/sec1/Cargo.toml +++ b/sec1/Cargo.toml @@ -20,7 +20,7 @@ rust-version = "1.85" base16ct = { version = "1", optional = true, default-features = false } ctutils = { version = "0.4", optional = true } der = { version = "0.8", optional = true, features = ["oid"] } -hybrid-array = { version = "0.4.6", optional = true, default-features = false } +hybrid-array = { version = "0.4.8", optional = true, default-features = false } serdect = { version = "0.4", optional = true, default-features = false, features = ["alloc"] } subtle = { version = "2", optional = true, default-features = false } zeroize = { version = "1", optional = true, default-features = false } @@ -34,6 +34,7 @@ default = ["der", "point"] alloc = ["der?/alloc", "zeroize?/alloc"] std = ["alloc", "der?/std"] +ctutils = ["dep:ctutils", "hybrid-array?/ctutils"] der = ["dep:der", "zeroize"] pem = ["alloc", "der/pem"] point = ["dep:base16ct", "dep:hybrid-array"] diff --git a/sec1/src/point.rs b/sec1/src/point.rs index 5bbad06be..4913d7a6c 100644 --- a/sec1/src/point.rs +++ b/sec1/src/point.rs @@ -355,20 +355,16 @@ where } } -// TODO(tarcieri): add `ctutils` support to `hybrid-array` #[cfg(feature = "ctutils")] impl CtSelect for EncodedPoint where Size: ModulusSize, + ::ArrayType: CtSelect, { fn ct_select(&self, other: &Self, choice: Choice) -> Self { - let mut bytes = Array::default(); - - for (i, byte) in bytes.iter_mut().enumerate() { - *byte = self.bytes[i].ct_select(&other.bytes[i], choice); + Self { + bytes: self.bytes.ct_select(&other.bytes, choice), } - - Self { bytes } } }