Skip to content

Commit

Permalink
avoid Debug on agreement::Algorithm
Browse files Browse the repository at this point in the history
- Remove derived Debug implementation on ` agreement::Algorithm`.
- Update unit test.
  • Loading branch information
Taowyoo committed Apr 15, 2024
1 parent a2da09c commit 55592de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion rustls-mbedcrypto-provider/src/agreement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use mbedtls::pk::{EcGroupId, ECDSA_MAX_LEN};

/// An ECDH key agreement algorithm.
#[derive(Debug)]
pub(crate) struct Algorithm {
pub(crate) group_id: EcGroupId,
pub(crate) public_key_len: usize,
Expand Down
7 changes: 5 additions & 2 deletions rustls-mbedcrypto-provider/src/kx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<T: RngCallback> fmt::Debug for KxGroup<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("KxGroup")
.field("name", &self.name)
.field("agreement_algorithm", &self.agreement_algorithm)
.field("agreement_algorithm", &self.agreement_algorithm.group_id)
.field("rng_provider", &self.rng_provider)
.finish()
}
Expand Down Expand Up @@ -420,7 +420,10 @@ mod tests {
#[test]
fn test_kx_group_fmt_debug() {
let debug_str = format!("{:?}", X25519_KX_GROUP);
assert!(debug_str.contains("KxGroup { name: X25519, agreement_algorithm: Algorithm { group_id: Curve25519, public_key_len: 32, max_signature_len: 64 }, rng_provider: 0x"), "debug_str: {debug_str}")
assert!(debug_str.contains("KxGroup"), "debug_str: {debug_str}");
assert!(debug_str.contains("name: X25519"), "debug_str: {debug_str}");
assert!(debug_str.contains("agreement_algorithm: Curve25519"), "debug_str: {debug_str}");
assert!(debug_str.contains("rng_provider: 0x"), "debug_str: {debug_str}");
}

#[test]
Expand Down

0 comments on commit 55592de

Please sign in to comment.