diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2023-03-21 17:57:34 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2023-03-21 17:57:34 +0100 |
commit | c7b40bcd1a66419e737718c6ccebb09826b26cc4 (patch) | |
tree | 01666c475c67be8174daba7b0e3e423a210ae58b /openpgp/src/policy.rs | |
parent | 289f87d10454005140ba2125402301b305060e94 (diff) |
openpgp: Delay non-trivial context computations.
- Fixes #892.
Diffstat (limited to 'openpgp/src/policy.rs')
-rw-r--r-- | openpgp/src/policy.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/openpgp/src/policy.rs b/openpgp/src/policy.rs index 92b08a47..a75ed74d 100644 --- a/openpgp/src/policy.rs +++ b/openpgp/src/policy.rs @@ -1455,14 +1455,14 @@ impl<'a> Policy for StandardPolicy<'a> { .collision_resistant_hash_algos .check(sig.hash_algo(), time, Some(self.hash_revocation_tolerance)) - .context(format!( + .with_context(|| format!( "Policy rejected revocation signature ({}) requiring \ collision resistance", sig.typ()))? } else { self .collision_resistant_hash_algos .check(sig.hash_algo(), time, None) - .context(format!( + .with_context(|| format!( "Policy rejected non-revocation signature ({}) requiring \ collision resistance", sig.typ()))? } @@ -1473,14 +1473,14 @@ impl<'a> Policy for StandardPolicy<'a> { .second_pre_image_resistant_hash_algos .check(sig.hash_algo(), time, Some(self.hash_revocation_tolerance)) - .context(format!( + .with_context(|| format!( "Policy rejected revocation signature ({}) requiring \ second pre-image resistance", sig.typ()))? } else { self .second_pre_image_resistant_hash_algos .check(sig.hash_algo(), time, None) - .context(format!( + .with_context(|| format!( "Policy rejected non-revocation signature ({}) requiring \ second pre-image resistance", sig.typ()))? } |