Skip to content

Commit

Permalink
hkdf: fix Debug impls (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov authored Dec 13, 2023
1 parent 3023203 commit 1ac16e8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion hkdf/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hkdf"
version = "0.12.3" # Also update html_root_url in lib.rs when bumping this
version = "0.12.4"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
homepage = "https://github.com/RustCrypto/KDFs/"
Expand Down
13 changes: 7 additions & 6 deletions hkdf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@
#![no_std]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
html_root_url = "https://docs.rs/hkdf/0.12.3"
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg"
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![forbid(unsafe_code)]
Expand Down Expand Up @@ -173,12 +172,13 @@ where

impl<H, I> fmt::Debug for HkdfExtract<H, I>
where
H: OutputSizeUser + AlgorithmName,
H: OutputSizeUser,
I: HmacImpl<H>,
I::Core: AlgorithmName,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("HkdfExtract<")?;
<H as AlgorithmName>::write_alg_name(f)?;
<I::Core as AlgorithmName>::write_alg_name(f)?;
f.write_str("> { ... }")
}
}
Expand Down Expand Up @@ -273,12 +273,13 @@ impl<H: OutputSizeUser, I: HmacImpl<H>> Hkdf<H, I> {

impl<H, I> fmt::Debug for Hkdf<H, I>
where
H: OutputSizeUser + AlgorithmName,
H: OutputSizeUser,
I: HmacImpl<H>,
I::Core: AlgorithmName,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("Hkdf<")?;
<H as AlgorithmName>::write_alg_name(f)?;
<I::Core as AlgorithmName>::write_alg_name(f)?;
f.write_str("> { ... }")
}
}
Expand Down
7 changes: 7 additions & 0 deletions hkdf/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,3 +446,10 @@ new_test!(
"wycheproof-sha512",
SimpleHkdf::<Sha512>
);

#[test]
fn test_debug_impls() {
fn needs_debug<T: std::fmt::Debug>() {}
needs_debug::<Hkdf<Sha256>>();
needs_debug::<HkdfExtract<Sha256>>();
}

0 comments on commit 1ac16e8

Please sign in to comment.