Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ x509-cert = { path = "./x509-cert" }
x509-ocsp = { path = "./x509-ocsp" }

rsa = { git = "https://github.com/RustCrypto/RSA" }
universal-hash = { git = "https://github.com/RustCrypto/traits" }

[workspace.lints.clippy]
borrow_as_ptr = "warn"
Expand Down
2 changes: 1 addition & 1 deletion phc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ storing password hashes

[dependencies]
base64ct = "1.7"
subtle = { version = "2", default-features = false }
ctutils = "0.4"

# optional dependencies
getrandom = { version = "0.4", optional = true, default-features = false }
Expand Down
12 changes: 6 additions & 6 deletions phc/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use crate::{B64, Error, Result};
use base64ct::Encoding;
use core::{cmp::Ordering, fmt, str::FromStr};
use subtle::{Choice, ConstantTimeEq};
use ctutils::{Choice, CtEq};

/// Output from password hashing functions, i.e. the "hash" or "digest"
/// as raw bytes.
Expand Down Expand Up @@ -39,11 +39,11 @@ use subtle::{Choice, ConstantTimeEq};
/// as a reasonable maximum, and recommends using 32-bytes.
///
/// # Constant-time comparisons
/// The [`Output`] type impls the [`ConstantTimeEq`] trait from the [`subtle`]
/// crate and uses it to perform constant-time comparisons.
/// The [`Output`] type impls the [`CtEq`] trait from the [`ctutils`] crate and uses it to perform
/// constant-time comparisons.
///
/// Additionally the [`PartialEq`] and [`Eq`] trait impls for [`Output`] use
/// [`ConstantTimeEq`] when performing comparisons.
/// Additionally, the [`PartialEq`] and [`Eq`] trait impls for [`Output`] use [`CtEq`] when
/// performing comparisons.
///
/// ## Attacks on non-constant-time password hash comparisons
/// Comparing password hashes in constant-time is known to mitigate at least
Expand Down Expand Up @@ -222,7 +222,7 @@ impl AsRef<[u8]> for Output {
}
}

impl ConstantTimeEq for Output {
impl CtEq for Output {
fn ct_eq(&self, other: &Self) -> Choice {
self.as_ref().ct_eq(other.as_ref())
}
Expand Down