Skip to content

Commit

Permalink
verify_cert: take references in verify_chain helper
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cpu committed Sep 7, 2023
1 parent 932ad95 commit 910b9ca
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/verify_cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,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]
Expand Down Expand Up @@ -933,7 +933,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]
Expand Down Expand Up @@ -1053,16 +1053,16 @@ mod tests {

#[cfg(feature = "alloc")]
fn verify_chain(
trust_anchor: CertificateDer<'_>,
intermediates_der: Vec<Vec<u8>>,
ee_cert: CertificateDer<'_>,
trust_anchor: &CertificateDer<'_>,
intermediates_der: &[Vec<u8>],
ee_cert: &CertificateDer<'_>,
) -> Result<(), Error> {
use crate::{extract_trust_anchor, ECDSA_P256_SHA256};
use crate::{EndEntityCert, Time};

let anchors = &[extract_trust_anchor(&trust_anchor).unwrap()];
let anchors = &[extract_trust_anchor(trust_anchor).unwrap()];
let time = Time::from_seconds_since_unix_epoch(0x1fed_f00d);
let cert = EndEntityCert::try_from(&ee_cert).unwrap();
let cert = EndEntityCert::try_from(ee_cert).unwrap();
let intermediates_der = intermediates_der
.iter()
.map(|x| CertificateDer::from(x.as_ref()))
Expand Down

0 comments on commit 910b9ca

Please sign in to comment.