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 12, 2023
1 parent 63f78e0 commit 277fb4b
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 @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -656,16 +656,16 @@ mod tests {

#[cfg(feature = "alloc")]
fn verify_chain(
trust_anchor_der: Vec<u8>,
intermediates_der: Vec<Vec<u8>>,
ee_cert_der: Vec<u8>,
trust_anchor_der: &[u8],
intermediates_der: &[Vec<u8>],
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())
Expand Down

0 comments on commit 277fb4b

Please sign in to comment.