Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crl: rm Budget from verify_signature fn #190

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/crl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ impl<'a> RevocationOptions<'a> {
// TODO(XXX): consider whether we can refactor so this happens once up-front, instead
// of per-lookup.
// https://github.com/rustls/webpki/issues/81
crl.verify_signature(supported_sig_algs, issuer_spki.as_slice_less_safe(), budget)
// Note: The `verify_signature` method is part of a public trait in the exported API.
// We can't add a budget argument to that fn in a semver compatible way and so must
// consume signature budget here before calling verify_signature.
budget.consume_signature()?;
crl.verify_signature(supported_sig_algs, issuer_spki.as_slice_less_safe())
.map_err(crl_signature_err)?;

// Verify that if the issuer has a KeyUsage bitstring it asserts cRLSign.
Expand Down
7 changes: 2 additions & 5 deletions src/crl/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub trait CertRevocationList: Sealed + Debug {
&self,
supported_sig_algs: &[&dyn SignatureVerificationAlgorithm],
issuer_spki: &[u8],
budget: &mut Budget,
) -> Result<(), Error>;
}

Expand Down Expand Up @@ -86,13 +85,12 @@ impl CertRevocationList for OwnedCertRevocationList {
&self,
supported_sig_algs: &[&dyn SignatureVerificationAlgorithm],
issuer_spki: &[u8],
budget: &mut Budget,
) -> Result<(), Error> {
signed_data::verify_signed_data(
supported_sig_algs,
untrusted::Input::from(issuer_spki),
&self.signed_data.borrow(),
budget,
&mut Budget::default(),
)
}
}
Expand Down Expand Up @@ -230,13 +228,12 @@ impl CertRevocationList for BorrowedCertRevocationList<'_> {
&self,
supported_sig_algs: &[&dyn SignatureVerificationAlgorithm],
issuer_spki: &[u8],
budget: &mut Budget,
) -> Result<(), Error> {
signed_data::verify_signed_data(
supported_sig_algs,
untrusted::Input::from(issuer_spki),
&self.signed_data,
budget,
&mut Budget::default(),
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/verify_cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ fn check_signed_chain_name_constraints(
Ok(())
}

pub struct Budget {
pub(crate) struct Budget {
signatures: usize,
build_chain_calls: usize,
name_constraint_comparisons: usize,
Expand Down