From 277fb4be2bb4af71ff8ef814936aeeb6079e777f Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Thu, 7 Sep 2023 12:49:16 -0400 Subject: [PATCH] verify_cert: take references in verify_chain helper This commit adjusts the arguments to the `verify_chain` test helper to take references instead of moving the arguments. This makes it easier to use the same inputs for multiple `verify_chain` invocations. --- src/verify_cert.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/verify_cert.rs b/src/verify_cert.rs index 433c6e36..690e72ff 100644 --- a/src/verify_cert.rs +++ b/src/verify_cert.rs @@ -505,7 +505,7 @@ mod tests { intermediates.pop(); } - verify_chain(ca_cert_der, intermediates, make_end_entity(&issuer)).unwrap_err() + verify_chain(&ca_cert_der, &intermediates, &make_end_entity(&issuer)).unwrap_err() } #[test] @@ -540,7 +540,7 @@ mod tests { issuer = intermediate; } - verify_chain(ca_cert_der, intermediates, make_end_entity(&issuer)) + verify_chain(&ca_cert_der, &intermediates, &make_end_entity(&issuer)) } #[test] @@ -656,16 +656,16 @@ mod tests { #[cfg(feature = "alloc")] fn verify_chain( - trust_anchor_der: Vec, - intermediates_der: Vec>, - ee_cert_der: Vec, + trust_anchor_der: &[u8], + intermediates_der: &[Vec], + ee_cert_der: &[u8], ) -> Result<(), Error> { use crate::ECDSA_P256_SHA256; use crate::{EndEntityCert, Time}; - let anchors = &[TrustAnchor::try_from_cert_der(&trust_anchor_der).unwrap()]; + let anchors = &[TrustAnchor::try_from_cert_der(trust_anchor_der).unwrap()]; let time = Time::from_seconds_since_unix_epoch(0x1fed_f00d); - let cert = EndEntityCert::try_from(&ee_cert_der[..]).unwrap(); + let cert = EndEntityCert::try_from(ee_cert_der).unwrap(); let intermediates_der = intermediates_der .iter() .map(|x| x.as_ref())