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 authored and djc committed Sep 12, 2023
1 parent c9914e4 commit 08fd439
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/verify_cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,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 @@ -655,7 +655,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 @@ -775,14 +775,14 @@ 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 intermediates_der = intermediates_der
Expand Down

0 comments on commit 08fd439

Please sign in to comment.